/* ───────────────────────────────────────────────────────────────────────────
   شب شب — لوحة الإدارة بنفس شكل التطبيق: نفس الألوان (بنفسجي غامق + كهرماني)، نفس الاستدارات،
   ونفس خط الأيقونات (fonts/MaterialIcons.otf). هذا الملف يُحمَّل أخيرًا فيغلب ما قبله.
   ─────────────────────────────────────────────────────────────────────────── */
@font-face { font-family: "PanelIcons"; src: url("fonts/MaterialIcons.otf") format("opentype"); font-display: block; }

:root {
  --bg: #0E0A1F;            /* night950 */
  --surface: #16102C;       /* night900 */
  --panel: #1F173D;         /* night800: cards */
  --panel-2: #2A2050;       /* night700: inputs, elevated */
  --line: rgba(255,255,255,.12);
  --line-strong: #3A2E68;   /* night600 */
  --text: #F5F3FF;
  --muted: #A49CC4;         /* night400 */
  --brand: #7C3AED;         /* purple600 */
  --brand-soft: #A78BFA;    /* purple400: purple text on dark */
  --brand-ink: #FFFFFF;
  --amber: #FBBF24;
  --amber-ink: #0E0A1F;
  --ok: #22C55E;
  --warn: #FBBF24;
  --err: #EF4444;
  --info: #38BDF8;
  --radius: 20px;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --shadow: 0 1px 2px rgba(0,0,0,.25), 0 10px 30px rgba(0,0,0,.22);
  --glow: rgba(124,58,237,.4);
  --font: Cairo, "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
}
:root[data-theme="light"] {
  --bg: #F5F3FF; --surface: #FFFFFF; --panel: #FFFFFF; --panel-2: #F3F0FC; --line: #E9E3FB; --line-strong: #D5CBF5;
  --text: #1B1433; --muted: #6B6385; --brand: #7C3AED; --brand-soft: #6D28D9; --ok: #15803D; --err: #DC2626; --warn: #B45309; --info: #0369A1;
  --shadow: 0 1px 2px rgba(40,30,70,.06), 0 10px 30px rgba(40,30,70,.08); --glow: rgba(124,58,237,.25);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg: #F5F3FF; --surface: #FFFFFF; --panel: #FFFFFF; --panel-2: #F3F0FC; --line: #E9E3FB; --line-strong: #D5CBF5;
    --text: #1B1433; --muted: #6B6385; --brand-soft: #6D28D9; --ok: #15803D; --err: #DC2626; --warn: #B45309; --info: #0369A1;
    --shadow: 0 1px 2px rgba(40,30,70,.06), 0 10px 30px rgba(40,30,70,.08); --glow: rgba(124,58,237,.25);
  }
}

html, body { font-family: var(--font); background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.6; }
h1, h2, h3 { font-family: var(--font); letter-spacing: 0; }

/* ── icons (the app's own font) ── */
.mi { font-family: "PanelIcons"; font-style: normal; font-weight: normal; line-height: 1; display: inline-block; font-size: 22px; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; -webkit-font-feature-settings: "liga"; font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; flex: none; user-select: none; }
.mi.s16 { font-size: 16px; } .mi.s18 { font-size: 18px; } .mi.s20 { font-size: 20px; } .mi.s28 { font-size: 28px; } .mi.s40 { font-size: 40px; } .mi.s56 { font-size: 56px; }

/* ── buttons: like the app's FilledButton / OutlinedButton ── */
.btn { background: transparent; border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 0 18px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; cursor: pointer; color: var(--text); }
.btn:hover { border-color: var(--brand-soft); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 800; box-shadow: 0 6px 18px var(--glow); }
.btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.danger { border-color: color-mix(in srgb, var(--err) 60%, transparent); color: var(--err); }
.btn.danger:hover { background: color-mix(in srgb, var(--err) 12%, transparent); border-color: var(--err); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.btn.icon { min-height: 40px; width: 40px; padding: 0; border-radius: 12px; }
.btn.icon.small { min-height: 34px; width: 34px; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 800; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }

/* ── inputs: filled, rounded 14 ── */
input[type=text], input[type=password], input[type=search], input[type=email], input[type=number], input[type=url], input[type=date], input[type=time], textarea, select {
  background: var(--panel-2); border: 1px solid transparent; border-radius: var(--r-md); padding: 12px 14px; color: var(--text); width: 100%; min-height: 48px; font-family: var(--font);
}
:root[data-theme="light"] input[type=text], :root[data-theme="light"] textarea, :root[data-theme="light"] select { border-color: var(--line); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
label { color: var(--muted); font-size: 13px; font-weight: 600; margin: 14px 2px 6px; display: block; }
.field-hint { color: var(--muted); font-size: 12px; margin: 5px 4px 0; }
.field.row { display: flex; gap: 10px; }
.field.row > * { flex: 1; min-width: 0; }

/* ── switch (like Material 3) ── */
.switch { position: relative; width: 52px; height: 32px; flex: none; border-radius: 999px; border: 2px solid var(--line-strong); background: var(--panel-2); cursor: pointer; padding: 0; transition: background .15s, border-color .15s; }
.switch::after { content: ""; position: absolute; top: 4px; inset-inline-start: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: all .15s; }
.switch[aria-checked="true"] { background: var(--brand); border-color: var(--brand); }
.switch[aria-checked="true"]::after { inset-inline-start: 25px; width: 22px; height: 22px; top: 2px; background: #fff; }
.switch:focus-visible { outline: 2px solid var(--brand-soft); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 6px 2px; }
.switch-row .t { flex: 1; }

/* ── chips (ChoiceChip) ── */
.cchip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); font-size: 14px; cursor: pointer; font-family: var(--font); }
.cchip:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.cchip.on { background: color-mix(in srgb, var(--brand) 30%, transparent); border-color: var(--brand-soft); color: var(--text); font-weight: 700; }
.cchips { display: flex; flex-wrap: wrap; gap: 8px; }
.cchip .mi { font-size: 18px; }

/* ── status pill ── */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--err) 16%, transparent); color: var(--err); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.brand { background: color-mix(in srgb, var(--brand) 22%, transparent); color: var(--brand-soft); }

/* ── cards ── */
.card, .stat, .item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: none; }
.card { padding: 18px 20px; margin-bottom: 14px; }
.stat { padding: 16px 18px; }
.stat b { font-size: 26px; font-weight: 800; }
.item { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.item.on { border-color: color-mix(in srgb, var(--brand) 55%, transparent); }
.item .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item .title { font-weight: 800; font-size: 16px; }
.item .meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13px; }
.item .meta .m { display: inline-flex; align-items: center; gap: 5px; }
.item .actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.item .spacer { flex: 1; }
.list { display: grid; gap: 12px; }
.list.cols { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

/* ── page header ── */
.main { padding: 26px clamp(16px, 3vw, 40px) 90px; max-width: 1280px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.page-head h2 .mi { color: var(--brand-soft); }
.page-sub { color: var(--muted); margin: -8px 0 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.searchbox { position: relative; flex: 1 1 220px; min-width: 180px; }
.searchbox .mi { position: absolute; right: 14px; top: 14px; color: var(--muted); font-size: 20px; pointer-events: none; }
.searchbox input { padding-inline-start: 42px; }

/* ── empty state (the app's EmptyState) ── */
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty::before { display: none; }
.empty .mi { font-size: 56px; color: var(--brand-soft); opacity: .8; display: block; margin: 0 auto 10px; }
.empty b { display: block; color: var(--text); font-size: 18px; margin-bottom: 4px; }
.empty.loading { padding: 40px 20px; }
.skel { height: 110px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── shell: sidebar like the app's settings list ── */
.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 18px 14px 14px; gap: 2px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { font-size: 20px; font-weight: 900; padding: 4px 10px 14px; display: flex; align-items: center; gap: 10px; }
.side .brand .logo-sq { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #8B5CF6, #5B21B6); color: #fff; box-shadow: 0 6px 16px var(--glow); }
.side .brand span { color: var(--brand-soft); }
.side .group { color: var(--muted); font-size: 12px; font-weight: 700; padding: 14px 12px 6px; letter-spacing: .02em; }
.tab { border-radius: var(--r-md); padding: 8px 10px; gap: 12px; min-height: 46px; font-weight: 600; color: var(--text); display: flex; align-items: center; justify-content: flex-start; }
.tab:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.tab.active { background: color-mix(in srgb, var(--brand) 24%, transparent); box-shadow: none; }
.tab .ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand-soft); margin: 0; }
.tab.active .ico { background: var(--brand); color: #fff; }
.tab .ico .mi { font-size: 20px; }
.tab .grow-label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.tab .badge.count { margin-inline-start: auto; }
.side .who { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; }
.side .who b { font-size: 15px; }
.side .tools { display: flex; gap: 8px; margin-top: 8px; }

/* mobile top bar + drawer */
.topbar { display: none; }
.scrim { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 12; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 12px; min-height: 56px; }
  .topbar .t { font-weight: 800; font-size: 17px; flex: 1; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); height: 100vh; z-index: 30; transform: translateX(110%); transition: transform .22s ease; flex-direction: column; flex-wrap: nowrap; box-shadow: var(--shadow); }
  [dir=rtl] .side { transform: translateX(110%); }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(8,6,16,.6); z-index: 25; backdrop-filter: blur(2px); }
  .main { padding: 18px 14px 90px; }
  .page-head h2 { font-size: 21px; }
  .list.cols { grid-template-columns: 1fr; }
}

/* ── sheets (modal = the app's bottom sheet; on desktop it is centered) ── */
.modal-back { background: rgba(8,6,16,.62); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px 22px 20px; width: min(620px, 100%); max-height: 92vh; box-shadow: var(--shadow); }
.modal.wide { width: min(820px, 100%); }
.modal h3 { font-size: 20px; font-weight: 800; margin: 0 0 12px; text-align: center; }
.modal .actions { margin-top: 20px; gap: 10px; justify-content: stretch; }
.modal .actions .btn { flex: 1; }
.modal .handle { display: none; }
@media (max-width: 640px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 94vh; padding-top: 10px; animation: rise .22s ease; }
  .modal .handle { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 12px; }
}
@keyframes rise { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }

.toast { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px; box-shadow: var(--shadow); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.toast.err { border-color: color-mix(in srgb, var(--err) 60%, transparent); color: #fff; background: color-mix(in srgb, var(--err) 28%, var(--panel-2)); }

/* ── lists of rows like SettingsTile ── */
.tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); cursor: pointer; border: 1px solid transparent; }
.tile:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.tile .lead { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 20%, transparent); color: var(--brand-soft); flex: none; }
.tile .body { flex: 1; min-width: 0; }
.tile .body b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .body span { color: var(--muted); font-size: 13px; }
.picker-list { max-height: 52vh; overflow: auto; margin-top: 8px; }

/* ── the slide of the home carousel, exactly like the app's ── */
.slide { position: relative; overflow: hidden; border-radius: var(--r-lg); aspect-ratio: 2.2; min-height: 130px; background: linear-gradient(to bottom left, var(--s1), var(--s2)); color: #fff; display: flex; align-items: center; padding: 24px; }
.slide.c-purple { --s1: #6D28D9; --s2: #4C1D95; } .slide.c-blue { --s1: #1E40AF; --s2: #0B1B4D; } .slide.c-green { --s1: #166534; --s2: #052E16; }
.slide.c-wine { --s1: #9F1239; --s2: #4C0519; } .slide.c-teal { --s1: #0F766E; --s2: #042F2E; } .slide.c-slate { --s1: #334155; --s2: #0F172A; }
.slide .ring { position: absolute; border-radius: 50%; border: 18px solid rgba(255,255,255,.10); }
.slide .ring.a { width: 180px; height: 180px; inset-inline-end: -40px; top: -40px; }
.slide .ring.b { width: 140px; height: 140px; inset-inline-end: 20px; bottom: -60px; border-color: rgba(255,255,255,.07); }
.slide .glyph { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); font-size: 96px; color: var(--amber); opacity: .95; }
.slide .copy { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 62%; }
.slide .t1 { color: rgba(255,255,255,.72); font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide .t2 { font-size: 24px; font-weight: 900; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide .cta { margin-top: 10px; align-self: flex-start; background: var(--amber); color: var(--amber-ink); font-weight: 800; border-radius: 999px; padding: 6px 16px; font-size: 14px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide.sm { min-height: 0; }
.icongrid { display: flex; flex-wrap: wrap; gap: 8px; }
.icongrid button { width: 52px; height: 52px; border-radius: var(--r-md); border: 2px solid transparent; background: #4C1D95; color: var(--amber); cursor: pointer; display: grid; place-items: center; }
.icongrid button.on { border-color: var(--amber); }
.colorgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.colorgrid button { width: 56px; height: 38px; border-radius: var(--r-md); border: 2px solid transparent; cursor: pointer; }
.colorgrid button.on { border-color: var(--amber); }

/* ── bars (numbers) in the app palette ── */
.cbar .fill { background: var(--brand); }
.bars { color: var(--text); }

/* ── login ── */
.login { background: radial-gradient(900px 500px at 80% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%), radial-gradient(700px 400px at 0% 110%, color-mix(in srgb, var(--amber) 8%, transparent), transparent 60%), var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); }
.login-card .logo { background: linear-gradient(135deg, #8B5CF6, #5B21B6); box-shadow: 0 8px 20px var(--glow); }
.login-card .btn.primary { min-height: 50px; }
.error { border-radius: var(--r-md); }

/* ── tables inside cards ── */
th { color: var(--muted); }
tbody tr.click:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }

/* ── support chat and logs stay, in the new colours ── */
.msg.staff { background: color-mix(in srgb, var(--brand) 32%, var(--panel-2)); }
.convs, .thread, .cats { background: var(--panel); border-color: var(--line); box-shadow: none; }
.conv.active, .conv:hover { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.logrow:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }

.tile-lead { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 22%, transparent); color: var(--brand-soft); flex: none; }
.empty-action { margin-top: 14px; }
.row-wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.post-img { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--r-md); background: var(--panel-2); }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.section-title { margin: 22px 2px 10px; font-size: 16px; font-weight: 800; }
.tile .body span { display: block; }

/* ── stores ── */
.thumb { width: 64px; height: 64px; border-radius: var(--r-md); background: var(--panel-2); color: var(--muted); display: grid; place-items: center; overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grow { flex: 1; min-width: 0; }
.gal { position: relative; }
.gal .x { position: absolute; top: -6px; inset-inline-end: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--err); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.hours { display: grid; gap: 8px; margin: 10px 0; }
.hday { display: grid; grid-template-columns: 90px 1fr; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); align-items: start; }
.hday .dname { font-weight: 800; padding-top: 10px; }
.hbody { display: grid; gap: 8px; }
.hrange { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; }
.hrange input { min-height: 42px; text-align: center; }
input.bad { border-color: var(--err); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 25%, transparent); }
@media (max-width: 560px) { .hday { grid-template-columns: 1fr; } .hday .dname { padding-top: 0; } }

/* ── scrollbars: slim and dark, like the app ── */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ── support chat ── */
.chat { grid-template-columns: 350px 1fr; gap: 14px; }
.convs, .thread { border-radius: var(--r-lg); }
.convs .bar { padding: 12px; margin: 0; border-bottom: 1px solid var(--line); }
.conv { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; }
.conv .cbody { flex: 1; min-width: 0; display: grid; gap: 4px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, #8B5CF6, #5B21B6); color: #fff; }
.who-head { display: flex; align-items: center; gap: 12px; }
.thread .head { padding: 12px 16px; }
.thread .msgs { padding: 16px; gap: 10px; }
.msg { border-radius: 18px; padding: 10px 14px; max-width: 80%; }
.msg.customer { background: var(--panel-2); border-end-end-radius: 6px; }
.msg.staff { border-end-start-radius: 6px; }
.thread form { align-items: flex-end; padding: 12px; }
.thread form textarea { min-height: 48px; height: 48px; border-radius: 24px; padding: 12px 18px; }
.thread form .btn.primary { border-radius: 24px; min-height: 48px; }
.report .row { gap: 8px; }
@media (max-width: 960px) { .chat { grid-template-columns: 1fr; } }
.convs .list { display: block; gap: 0; }
