/* روزنة هجر — admin panel. Same palette and typeface as the site, quieter: this is a work surface. */
@font-face { font-family: "Handicrafts"; src: url("../assets/fonts/handicrafts-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Handicrafts"; src: url("../assets/fonts/handicrafts-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Handicrafts"; src: url("../assets/fonts/handicrafts-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Handicrafts"; src: url("../assets/fonts/handicrafts-black.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  --bg: #efe3cf; --bg-2: #e6d5ba; --card: #f7eee1; --ink: #3a2a1b; --ink-2: #67523d; --ink-3: #8f7a62;
  --brown: #8b6542; --brown-2: #6c4a2e; --clay: #a8683c; --deep: #2e2116; --cream: #f5ead8;
  --line: rgba(58, 42, 27, .13); --ok: #4f6b33; --bad: #9a3a25;
  --font: "Handicrafts", "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.7; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; border-radius: 6px; }
.muted { color: var(--ink-3); font-size: .88rem; }
.sr { position: absolute; top: 0; right: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- buttons & fields ---- */
.abtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 10px;
  background: var(--brown); color: var(--cream); border: 1px solid var(--brown); font-weight: 500; white-space: nowrap; transition: background-color .2s, border-color .2s; }
.abtn:hover { background: var(--brown-2); border-color: var(--brown-2); }
.abtn:disabled { opacity: .6; pointer-events: none; }
.abtn--line { background: transparent; color: var(--brown-2); border-color: rgba(108, 74, 46, .35); }
.abtn--line:hover { background: rgba(139, 101, 66, .08); }
.abtn--wide { width: 100%; min-height: 50px; font-size: 1.02rem; margin-top: 6px; }
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; margin-bottom: 5px; font-size: .88rem; font-weight: 500; }
.fld small { color: var(--ink-3); font-weight: 400; }
.fld input, select, .search input { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(58, 42, 27, .22); background: #fbf5ec; font-size: 15px; }
.fld input:focus, select:focus, .search input:focus { outline: none; border-color: var(--clay); box-shadow: 0 0 0 3px rgba(168, 104, 60, .16); }
.aform__err { color: var(--bad); font-size: .88rem; min-height: 0; margin-bottom: 8px; }
.aform__err:empty { display: none; }

/* ---- sign-in ---- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 80% at 50% 0%, #f5ead8 0%, var(--bg) 55%, var(--bg-2) 100%); }
.auth__card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 34px 30px 26px; box-shadow: 0 30px 70px -40px rgba(46, 33, 22, .55); }
.auth__logo img { height: 56px; width: auto; margin-bottom: 18px; }
.auth__eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--clay); font-size: .86rem; font-weight: 500; }
.auth__eyebrow .ic { width: 16px; height: 16px; }
.auth h1 { font-weight: 900; font-size: 1.7rem; line-height: 1.3; margin: 4px 0 4px; color: var(--deep); }
.auth .muted { margin-bottom: 20px; }
.auth__back { display: inline-block; margin-top: 18px; font-size: .86rem; color: var(--ink-3); }
.auth__back:hover { color: var(--clay); }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 22px 16px 18px; background: var(--deep); color: var(--cream); }
.side__logo img { height: 50px; width: auto; margin: 0 8px 26px; }
.side__nav { display: flex; flex-direction: column; gap: 3px; }
.side__nav a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: rgba(245, 234, 216, .72); transition: background-color .2s, color .2s; }
.side__nav a:hover { background: rgba(245, 234, 216, .07); color: var(--cream); }
.side__nav a[aria-current="page"] { background: rgba(245, 234, 216, .12); color: var(--cream); }
.side__nav a[aria-current="page"] .ic { color: #e2c48f; }
.side__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(245, 234, 216, .14); display: flex; flex-direction: column; gap: 2px; }
.side__me { padding: 0 12px 10px; line-height: 1.4; }
.side__me b { display: block; font-weight: 500; }
.side__me span { font-size: .8rem; color: rgba(245, 234, 216, .55); }
.side__link { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: .9rem; color: rgba(245, 234, 216, .72); text-align: start; }
.side__link:hover { background: rgba(245, 234, 216, .07); color: var(--cream); }

.main { padding: 0 clamp(16px, 3vw, 36px) 48px; min-width: 0; }
.top { display: flex; align-items: center; gap: 10px; min-height: 76px; }
.top__menu { display: none; width: 42px; height: 42px; border-radius: 10px; place-items: center; }
.top__menu .ic { width: 22px; height: 22px; }
.top__title { font-weight: 900; font-size: 1.6rem; color: var(--deep); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin-bottom: 18px; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel h2 { font-size: 1.08rem; font-weight: 700; color: var(--deep); }
.panel--note { background: transparent; border-style: dashed; }
.panel--note p { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }

/* ---- overview ---- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px 14px; }
.stat span { display: block; font-size: .86rem; color: var(--ink-3); }
.stat b { display: block; font-size: 2.1rem; font-weight: 900; line-height: 1.25; color: var(--deep); font-variant-numeric: tabular-nums; }
.stat:first-child { background: var(--deep); border-color: var(--deep); }
.stat:first-child span { color: rgba(245, 234, 216, .65); }
.stat:first-child b { color: var(--cream); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; direction: ltr; border-bottom: 1px solid var(--line); }
.bars i { flex: 1; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--brown); opacity: .85; position: relative; }
.bars i.z { background: var(--line); opacity: 1; }
.bars i:hover { opacity: 1; background: var(--clay); }
.bars__axis { display: flex; justify-content: space-between; font-size: .78rem; color: var(--ink-3); margin-top: 6px; direction: ltr; }
.hbars li { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) 2.5em; align-items: center; gap: 10px; min-height: 32px; font-size: .9rem; }
.hbars .t { height: 10px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.hbars .t i { display: block; height: 100%; border-radius: 99px; background: var(--brown); }
.hbars b { font-weight: 500; text-align: left; font-variant-numeric: tabular-nums; }

/* ---- subscribers ---- */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.search { position: relative; flex: 1 1 260px; }
.search .ic { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-right: 40px; }
.tools select { width: auto; flex: 0 1 170px; }
.tools__end { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.count { margin: 4px 2px 10px; }
.tablewrap { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th { position: relative; }
.table th { text-align: start; font-size: .8rem; font-weight: 500; color: var(--ink-3); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .92rem; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(230, 213, 186, .35); }
.table td.ltr { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.table td.name { font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: .75rem; padding: 1px 8px; border-radius: 99px; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.st--off { color: var(--ink-3); }
.st--off::before { background: var(--ink-3); }
.acts { display: flex; gap: 4px; justify-content: flex-end; }
.acts button { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); }
.acts button:hover { background: var(--bg-2); color: var(--ink); }
.acts button.del:hover { color: var(--bad); }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-2); }
.empty .ic { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--ink-3); stroke-width: 1.3; }
.empty b { display: block; font-size: 1.05rem; color: var(--deep); }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.pager button { min-width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); }
.pager button[aria-current="page"] { background: var(--deep); color: var(--cream); border-color: var(--deep); }

/* ---- admins ---- */
.admins li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.admins li:last-child { border-bottom: 0; }
.admins .av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); font-weight: 700; color: var(--brown-2); flex: none; }
.admins .who { flex: 1; min-width: 0; line-height: 1.45; }
.admins .who b { font-weight: 500; }
.admins .who span { display: block; font-size: .84rem; color: var(--ink-3); direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.admins .role { font-size: .78rem; padding: 2px 10px; border-radius: 99px; background: var(--bg-2); }
.admins .role--owner { background: var(--deep); color: var(--cream); }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.aform--narrow { max-width: 460px; }

.toast { position: fixed; z-index: 50; bottom: 22px; left: 50%; transform: translate(-50%, 20px); padding: 11px 20px; border-radius: 12px; background: var(--deep); color: var(--cream);
  font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease); max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 0 0 auto; z-index: 40; width: 260px; transform: translateX(100%); transition: transform .3s var(--ease); box-shadow: -20px 0 60px rgba(0, 0, 0, .25); }
  .side { visibility: hidden; transition: transform .3s var(--ease), visibility .3s; }
  .side.is-open { transform: none; visibility: visible; }
  .top__menu { display: grid; }
  .row3 { grid-template-columns: 1fr; }
  .tools__end { margin-inline-start: 0; width: 100%; }
  .tools__end > * { flex: 1; }
}
@media (max-width: 480px) { .stat b { font-size: 1.7rem; } .tools select { flex: 1 1 140px; } }
