/*
 * NHMSV design system.
 * RTL-first: layout uses CSS logical properties (inline-start/end) so the same
 * stylesheet renders Arabic (dir=rtl) and English (dir=ltr) without overrides.
 * Brand colors are CSS variables; the layout injects configured values.
 */
:root {
  --brand: #1e3a5f;
  --brand-strong: #142a46;
  --brand-soft: #e6edf5;
  --accent: #e0b84a;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #0f172a;
  --text-muted: #5b6577;
  --text-subtle: #8a94a6;

  --ok: #15803d;      --ok-soft: #e7f6ec;
  --warn: #b45309;    --warn-soft: #fdf3e2;
  --danger: #b91c1c;  --danger-soft: #fdecec;
  --info: #1d4ed8;    --info-soft: #e8efff;
  --neutral: #475569; --neutral-soft: #eef1f5;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --tabbar-h: 68px;

  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --brand-ink: var(--brand);
  --nav-ink: #3a4556;
  --overlay: rgba(15, 23, 42, .42);
  color-scheme: light;
}

/* Dark mode (docs/ADMIN_NAV.md 1ج): automatic by default, or chosen with the theme button. */
:root[data-theme="dark"] {
  --bg: #0d121a; --surface: #151c27; --surface-2: #1b2431; --border: #273243;
  --text: #e6ebf2; --text-muted: #a3aec0; --text-subtle: #7c889c; --nav-ink: #b8c2d2;
  --ok: #4ade80; --ok-soft: #12291c; --warn: #fbbf24; --warn-soft: #2e2410;
  --danger: #f87171; --danger-soft: #331618; --info: #93b4ff; --info-soft: #172240;
  --neutral: #a3aec0; --neutral-soft: #1f2836;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --overlay: rgba(0, 0, 0, .55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d121a; --surface: #151c27; --surface-2: #1b2431; --border: #273243;
    --text: #e6ebf2; --text-muted: #a3aec0; --text-subtle: #7c889c; --nav-ink: #b8c2d2;
    --ok: #4ade80; --ok-soft: #12291c; --warn: #fbbf24; --warn-soft: #2e2410;
    --danger: #f87171; --danger-soft: #331618; --info: #93b4ff; --info-soft: #172240;
    --neutral: #a3aec0; --neutral-soft: #1f2836;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --overlay: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.3; font-weight: 700; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .85em; direction: ltr; unicode-bidi: embed; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

/* ---------- App shell ----------
 * One pattern for every admin panel (approved 2026-10-15): from 900px a light sidebar that
 * collapses to an icon rail (body.nav-collapsed, remembered in the nav_collapsed cookie) plus
 * a top bar; below 900px a top title and a fixed bottom bar (4 pages + "More"). */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
body.nav-collapsed { --sidebar-w: 76px; }
.sidebar {
  background: var(--surface); color: var(--text); border-inline-end: 1px solid var(--border);
  padding: 0 .75rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: .75rem; height: var(--topbar-h); padding: 0 .4rem; border-bottom: 1px solid var(--border); margin-bottom: .75rem; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand); font-weight: 800; color: var(--accent); }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: .3px; }
.brand-tag { font-size: .75rem; color: var(--text-muted); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: .75rem; min-height: 44px;
  color: var(--nav-ink); padding: 0 .75rem; border-radius: 10px; font-weight: 500; font-size: .93rem; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.nav svg { width: 20px; height: 20px; flex: none; }
.nav .badge-count { margin-inline-start: auto; }
body.nav-collapsed .brand { justify-content: center; }
body.nav-collapsed .brand-text, body.nav-collapsed .nav-label { display: none; }
body.nav-collapsed .nav a { justify-content: center; padding: 0; }
body.nav-collapsed .nav .badge-count { position: absolute; top: 6px; inset-inline-end: 8px; width: 9px; height: 9px; padding: 0; font-size: 0; background: #c2410c; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 1rem; justify-content: space-between; min-height: var(--topbar-h);
  padding: .5rem 1.75rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title strong, .topbar-heading { font-size: 1.1rem; margin: 0; font-weight: 700; }
.topbar .actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.icon-btn { width: 40px; height: 38px; padding: 0; }
.icon-btn svg { width: 19px; height: 19px; }
.logout-btn { color: var(--danger); }
.topbar-mark { display: none; width: 30px; height: 30px; border-radius: 8px; overflow: hidden; flex: none; }
.topbar-mark img { width: 100%; height: 100%; display: block; }
.tabbar { display: none; }
.content { padding: 1.75rem; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { color: var(--text-muted); margin: 0; }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 1rem; }
.mt { margin-top: 1rem; } .mt-2 { margin-top: 1.5rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); font-size: .85rem; }

.stat { padding: 1.1rem 1.25rem; }
.stat .label { color: var(--text-muted); font-size: .85rem; font-weight: 500; }
.stat .value { font-size: 1.6rem; font-weight: 800; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .8rem; color: var(--text-subtle); margin-top: .15rem; }
.stat.accent { border-top: 3px solid var(--brand); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.mock { background: #fff1f8; color: #a21caf; border: 1px dashed #d946ef; }
.badge-count { background: var(--accent); color: #1b1300; border-radius: 999px; padding: 0 .5rem; font-size: .75rem; font-weight: 700; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

.form { display: grid; gap: 1rem; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: .88rem; }
.field .help { font-size: .8rem; color: var(--text-subtle); }
.input, select.input, textarea.input {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: .92rem;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input[dir="ltr"] { text-align: start; }
textarea.input { min-height: 96px; resize: vertical; }
.input.is-invalid { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: .8rem; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .4rem 1rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem 1rem 1rem; margin: 0; }
legend { font-weight: 700; padding: 0 .4rem; font-size: .9rem; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filters .field { min-width: 150px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .7rem 1rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--surface-2); color: var(--text-muted); font-weight: 600; font-size: .8rem; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; white-space: nowrap; }
.table td.num, .table th.num { text-align: end; }

/* ---------- Alerts, empty states ---------- */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent; margin-bottom: 1rem; font-size: .92rem; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert ul { margin: .25rem 0 0; padding-inline-start: 1.25rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty .icon { width: 44px; height: 44px; margin: 0 auto .75rem; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; }
.empty .icon svg { width: 22px; height: 22px; }
.secret-box { background: #0f172a; color: #e2e8f0; padding: .9rem 1rem; border-radius: var(--radius-sm); font-family: var(--mono); font-size: .85rem; word-break: break-all; direction: ltr; text-align: left; }

/* ---------- Project cards ---------- */
.project-card { display: flex; flex-direction: column; }
.project-card .card-body { display: grid; gap: .75rem; flex: 1; }
.project-card .title { display: flex; align-items: center; gap: .75rem; }
.avatar { width: 42px; height: 42px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; flex: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; font-size: .85rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }
.project-card .card-foot { display: flex; gap: .5rem; flex-wrap: wrap; padding: .9rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Utilities (no inline styles: CSP forbids them) ---------- */
.avatar-sm { width: 24px; height: 24px; font-size: .7rem; border-radius: 6px; }
.center { justify-content: center; }
.req { color: var(--danger); }
.mt-xs { margin-top: .35rem; }
.mb-0 { margin-bottom: 0; }
.text-end { text-align: end; }
.wrap-anywhere { overflow-wrap: anywhere; }
.w-full { width: 100%; }
.input.w-auto { width: auto; min-width: 140px; }
@media (max-width: 899px) { .hide-sm { display: none; } }

/* ---------- Bars (simple CSS charts) ---------- */
.bars { display: grid; gap: .6rem; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: .75rem; align-items: center; font-size: .87rem; }
.bar-track { display: block; width: 100%; height: 10px; background: var(--neutral-soft); border-radius: 999px; overflow: hidden; }
.bar-track rect { fill: var(--brand); }
.bar-track.neg rect { fill: var(--danger); }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(1200px 600px at 100% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent),
  radial-gradient(800px 500px at 0% 100%, color-mix(in srgb, var(--accent) 18%, transparent), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { color: var(--text); border-color: var(--border); justify-content: center; }
.auth-card .brand-mark { background: var(--brand); color: #fff; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--text-subtle); font-size: .8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.pagination { display: flex; gap: .35rem; flex-wrap: wrap; padding: 1rem 1.25rem; }
.pagination a, .pagination span { padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; background: var(--surface); }
.pagination .active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled { opacity: .5; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar, .nav-collapse, .topbar .actions { display: none; }
  .topbar-mark { display: block; }
  .topbar { padding: .5rem 1rem; min-height: 56px; }
  .content { padding: 1rem 1rem calc(var(--tabbar-h) + 1.25rem + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
    min-height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 44px; color: var(--text-muted); font-size: .72rem; font-weight: 500; text-decoration: none;
  }
  .tabbar a.active { color: var(--brand-ink); font-weight: 700; }
  .tabbar svg { width: 23px; height: 23px; }
  .tab-dot { position: absolute; top: 9px; inset-inline-start: calc(50% + 6px); width: 9px; height: 9px; border-radius: 50%; background: #c2410c; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 90px 1fr auto; }
}

/* ---------- "More" page (the phone menu) ---------- */
.more-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.more-list li + li { border-top: 1px solid var(--border); }
.more-list a, .more-list button {
  display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 56px; padding: 0 1rem;
  color: var(--text); background: none; border: 0; font: inherit; font-size: .95rem; text-align: start; cursor: pointer;
}
.more-list a:hover, .more-list button:hover { background: var(--surface-2); text-decoration: none; }
.more-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); flex: none; }
.more-icon svg { width: 18px; height: 18px; }
.more-chevron { width: 18px; height: 18px; color: var(--text-subtle); }
[dir="rtl"] .more-chevron { transform: scaleX(-1); }
.logout-wide { min-height: 50px; color: var(--danger); }

@media print {
  .sidebar, .topbar, .tabbar, .btn { display: none !important; }
  .shell { display: block; }
}

/* ---------- Platform switcher (owner / general admins) ----------
 * From 900px: a menu of rows beside the page title. Below 900px the button moves to the end of
 * the top bar and shows icon tiles: a popover on tablets, a bottom sheet over a scrim on phones
 * (the scrim is the summary's ::before, so tapping it closes the <details> without JavaScript). */
.platforms { position: relative; }
.platforms > summary { list-style: none; cursor: pointer; }
.platforms > summary::-webkit-details-marker { display: none; }
.platforms[open] > summary.btn { background: var(--brand-soft); color: var(--brand-ink); }
.platforms-menu { position: absolute; top: calc(100% + 8px); inset-inline-start: 0; z-index: 30; width: 290px; padding: .4rem; max-height: 80vh; overflow-y: auto; }
.platforms-group { font-size: .72rem; font-weight: 700; color: var(--text-subtle); padding: .55rem .6rem .25rem; text-transform: uppercase; letter-spacing: .3px; }
.platforms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.platforms-list a { display: flex; align-items: center; gap: .65rem; min-height: 44px; padding: .25rem .6rem; border-radius: 10px; color: var(--text); }
.platforms-list a:hover { background: var(--surface-2); text-decoration: none; }
.platforms-list a.current { background: var(--brand-soft); }
.platforms-list img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.platforms-text { display: grid; line-height: 1.25; font-size: .88rem; font-weight: 600; }
.platforms-text small { font-size: .72rem; font-weight: 400; color: var(--text-muted); text-align: start; }
.platforms-head, .platforms-tiles { display: none; }

@media (max-width: 899px) {
  .topbar-title { flex: 1; flex-wrap: nowrap; min-width: 0; }
  .topbar-title strong, .topbar-heading { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .platforms { order: 9; margin-inline-start: auto; }
  .topbar:has(.platforms[open]) { z-index: 40; }
  .platforms-list { display: none; }
  .platforms-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
  .platforms-head strong { font-size: 1.05rem; }
  .platforms-close {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; padding: 0; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
  }
  .platforms-close svg { width: 17px; height: 17px; }
  .platforms-group { padding: .7rem .25rem .4rem; }
  .platforms-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
  .platforms-tiles a {
    display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .6rem .2rem .5rem;
    border: 1.5px solid transparent; border-radius: 12px; color: var(--text); font-size: .78rem; font-weight: 500; line-height: 1.3; text-align: center;
  }
  .platforms-tiles a:hover { background: var(--surface-2); text-decoration: none; }
  .platforms-tiles a.current { background: var(--brand-soft); border-color: var(--brand-ink); color: var(--brand-ink); font-weight: 700; }
  .platforms-tiles img { width: 46px; height: 46px; border-radius: 12px; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
  .platforms[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 1; background: rgba(15, 23, 42, .12); cursor: default; }
  .platforms-menu { inset-inline-start: auto; inset-inline-end: 0; z-index: 2; width: 420px; max-width: calc(100vw - 2rem); padding: 1rem; border-radius: 16px; box-shadow: 0 12px 40px rgba(15, 23, 42, .18); }
}
@media (max-width: 599px) {
  .platforms[open] > summary::before { background: var(--overlay); }
  .platforms-menu {
    position: fixed; top: auto; bottom: 0; inset-inline: 0; width: auto; max-width: none; max-height: 85vh;
    padding: .5rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(15, 23, 42, .18);
  }
  .platforms-menu::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto .6rem; }
}

/* Colour field: native picker + hex code + platform swatches (settings page) */
.color-row { display: flex; gap: .5rem; align-items: stretch; }
.color-picker { inline-size: 3rem; block-size: auto; min-block-size: 2.5rem; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: 0; border-radius: 6px; }
.color-picker::-moz-color-swatch { border: 0; border-radius: 6px; }
.color-code { flex: 1; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: lowercase; }
.color-presets { display: flex; flex-wrap: wrap; gap: .4rem; }
.color-swatch { inline-size: 1.6rem; block-size: 1.6rem; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.color-swatch:hover, .color-swatch:focus-visible { box-shadow: 0 0 0 2px var(--brand); outline: none; }
.color-swatch.is-current { box-shadow: 0 0 0 2px var(--text); }
.swatch-1e3a5f { background: #1e3a5f; }
.swatch-e0b84a { background: #e0b84a; }
.swatch-0b1635 { background: #0b1635; }
.swatch-2563eb { background: #2563eb; }
.swatch-047857 { background: #047857; }
.swatch-6d28d9 { background: #6d28d9; }
.swatch-ea580c { background: #ea580c; }
.swatch-0891b2 { background: #0891b2; }
.swatch-db2777 { background: #db2777; }
.swatch-111111 { background: #111111; }

/* Unified menu (docs/ADMIN_NAV.md): divider before the fixed "System" section */
.nav-section { display: flex; align-items: center; gap: .5rem; margin: .7rem .25rem .2rem; font-size: .72rem; font-weight: 700; letter-spacing: .4px; color: var(--text-muted); }
.nav-section::before, .nav-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
body.nav-collapsed .nav-section span { display: none; }
body.nav-collapsed .nav-section::before { display: none; }
.more-section { margin: .25rem .25rem -.25rem; font-size: .8rem; font-weight: 700; color: var(--text-muted); letter-spacing: .4px; }

/* Version at the bottom of the menu (docs/ADMIN_NAV.md) */
.app-version { margin-top: auto; padding: 1rem .5rem 0; display: flex; gap: .5rem; align-items: baseline; justify-content: center; font-size: .75rem; color: var(--text-muted); }
.app-commit { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; opacity: .85; }
.app-version-more { margin-top: 0; padding-top: .25rem; }
body.nav-collapsed .app-version { display: none; }

/* Unified shell (docs/ADMIN_NAV.md 1ج) */
a.brand { color: var(--text); }
a.brand:hover { text-decoration: none; }
a.brand:hover .brand-name { color: var(--brand-ink); }
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: inline; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-sun { display: inline; }
  :root:not([data-theme="light"]) .theme-icon-moon { display: none; }
}
.theme-toggle svg { width: 18px; height: 18px; }
.more-section.nav-section { margin: .5rem .25rem 0; font-size: .8rem; }
.more-list .subtle { color: var(--text-muted); font-size: .88rem; }
.plain-list { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.soon-divider { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.text-center { text-align: center; }
