/* app/static/css/style.css
   صامت تک آزما — Lab command center
   Design system: red glass over a warm void (dark) / warm paper (light),
   sharing the same accent as login.css so the whole app reads as one brand.
   Signature element: the "bead" — a glowing indicator that slides beneath
   the active nav item, used both in the mobile dock and the desktop sidebar.
*/

/* ---------------------------------------------------------------------------
   SELF-HOSTED FONT (2026-08-18)
   App-wide UI font is now Yekan Bakh (variable), replacing Vazirmatn as the
   --font-ui default below. It's a single variable-font file covering the
   whole 100–950 weight range and 62.5%–150% width range in one @font-face —
   no separate regular/bold/500/600/800 files to keep in sync the way
   Vazirmatn needed, the browser interpolates whatever weight is requested.
   font-display:swap so text paints immediately with the fallback and
   re-renders once the font arrives — same reasoning as Vazirmatn below.

   Vazirmatn's @font-face stays registered (and its TTFs stay in
   static/fonts/) purely as a CSS fallback in --font-ui — it's NOT used for
   the UI anymore, but app/services/certificate_service.py still loads those
   same TTFs directly for fpdf2 to render the certificate PDF, and fpdf2
   can't consume a WOFF/variable font, so that path is unaffected.

   'Yekan Bakh FaNum' (same glyphs, but 0-9 draw as Persian-style numerals
   while remaining plain ASCII digit codepoints underneath — no data or
   validation impact) is also registered but deliberately not wired into
   --font-ui: on request, the app defaults to Western digit shapes. Opt a
   specific element in with `font-family: 'Yekan Bakh FaNum', var(--font-ui);`
   if that's ever wanted somewhere.
   --------------------------------------------------------------------------- */
@font-face {
  font-family: 'Yekan Bakh';
  src: url('/static/fonts/YekanBakh-VF.woff') format('woff');
  font-weight: 100 950;
  font-stretch: 62.5% 150%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Yekan Bakh FaNum';
  src: url('/static/fonts/YekanBakhFaNum-VF.woff') format('woff');
  font-weight: 100 950;
  font-stretch: 62.5% 150%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* 500/600 are requested by several components but only 400 and 700 files
   exist; map them onto the bold face so the browser doesn't synthesise a
   smeared faux-bold. */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

:root {
  --bg: #111217;
  --bg-glow-1: rgba(236, 72, 94, 0.20);
  --bg-glow-2: rgba(99, 102, 241, 0.12);

  --surface: rgba(30, 32, 40, 0.82);
  --surface-strong: rgba(42, 45, 56, 0.94);
  --surface-hover: rgba(57, 61, 74, 0.96);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --sheen: rgba(255, 255, 255, 0.07);

  --text: #f8fafc;
  --text-dim: #c4c8d2;
  --text-faint: #9198a8;

  --accent: #e11d48;
  --accent-2: #fb7185;
  --accent-soft: rgba(225, 29, 72, 0.20);
  --accent-contrast: #fff;

  --success: #4ade80;   --success-soft: rgba(74, 222, 128, 0.16);
  --warn: #fbbf24;      --warn-soft: rgba(251, 191, 36, 0.16);
  --danger: #fca5a5;    --danger-soft: rgba(252, 165, 165, 0.16);
  --info: #93c5fd;      --info-soft: rgba(147, 197, 253, 0.16);
  --violet: #c084fc;    --violet-soft: rgba(192, 132, 252, 0.14);

  --shadow-ambient: 0 24px 60px -24px rgba(0, 0, 0, 0.65);
  --shadow-lift: 0 16px 40px -18px rgba(225, 29, 46, 0.35);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --font-ui: 'Yekan Bakh', 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --sidebar-w: 264px;
}

html[data-theme="light"] {
  --bg: #f7f8fc;
  --bg-glow-1: rgba(225, 29, 72, 0.11);
  --bg-glow-2: rgba(99, 102, 241, 0.08);

  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-hover: rgba(255, 255, 255, 1);
  --border: rgba(30, 41, 59, 0.12);
  --border-strong: rgba(30, 41, 59, 0.20);
  --sheen: rgba(255, 255, 255, 0.55);

  --text: #172033;
  --text-dim: #4b5568;
  --text-faint: #718096;

  --accent: #be123c;
  --accent-2: #e11d48;
  --accent-soft: rgba(190, 18, 60, 0.12);
  --success: #15803d;   --success-soft: rgba(21, 128, 61, 0.12);
  --warn: #a16207;      --warn-soft: rgba(161, 98, 7, 0.12);
  --danger: #b91c1c;    --danger-soft: rgba(185, 28, 28, 0.11);
  --info: #1d4ed8;      --info-soft: rgba(29, 78, 216, 0.11);

  --accent-contrast: #fff;

  --shadow-ambient: 0 20px 48px -26px rgba(120, 30, 40, 0.28);
  --shadow-lift: 0 14px 34px -18px rgba(225, 29, 46, 0.28);
}

body {
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 700px 500px at 88% 8%, var(--bg-glow-1) 0%, transparent 60%),
    radial-gradient(ellipse 600px 500px at 8% 92%, var(--bg-glow-2) 0%, transparent 55%);
  background-attachment: fixed;
  font-family: var(--font-ui);
  color: var(--text);
  transition: background-color .3s ease, color .3s ease;
  direction: rtl;
}

a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
input, select, textarea {
  border: 1px solid var(--border); background: var(--surface-strong);
  color: var(--text); border-radius: 10px;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .55; }

/* ---------- glass primitive ---------- */
.glass {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: var(--shadow-ambient), inset 0 1px 0 var(--sheen);
  overflow: hidden;
}
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sheen), transparent 45%);
  pointer-events: none;
}

/* =====================================================================
   SIDEBAR (desktop) — docked right, RTL
   ===================================================================== */
.sidebar {
  position: fixed;
  inset-inline-end: 0;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-inline-start: 1px solid var(--border);
  backdrop-filter: blur(22px);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
}
.logo .mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #a10f1c);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
  box-shadow: 0 6px 16px rgba(225, 29, 46, .4);
}

/* theme toggle — sun/moon swap */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  transition: color .2s, transform .3s, border-color .2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.nav-section-label {
  font-size: .7rem;
  color: var(--text-faint);
  padding: 14px 12px 6px;
  letter-spacing: .04em;
}

.nav-list { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: .87rem;
  font-weight: 500;
  transition: background .2s, color .2s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-strong); color: var(--text); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
}
/* the "bead" glow, echoed at sidebar scale on the item's inner edge */
.nav-item.active::before {
  content: '';
  position: absolute;
  inset-inline-start: -16px;
  top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 12px 2px var(--accent);
}

.sidebar-footer { margin-top: auto; padding-top: 14px; }
.help-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid var(--accent-soft);
  font-size: .78rem;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 10px;
}
.help-card svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }

/* =====================================================================
   MAIN
   ===================================================================== */
.main {
  margin-inline-end: var(--sidebar-w);
  padding: 28px 32px 100px;
  min-height: 100vh;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
  gap: 16px; flex-wrap: wrap;
}
.topbar h1 { font-size: 1.35rem; font-weight: 700; }
.topbar .status-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .74rem; color: var(--text-faint); margin-top: 4px;
}
.topbar .status-dot i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px 1px var(--success);
}

.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 16px;
  border-radius: 30px;
  font-size: .82rem; color: var(--text-dim);
}
.user-pill .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a10f1c);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700;
}
.user-pill .role {
  font-size: .68rem; color: var(--accent-2);
  display: block;
}
.user-pill .logout-link { color: var(--danger); text-decoration: none; font-size: .78rem; }

/* ---------- hero banner ---------- */
.hero-banner {
  padding: 30px 32px;
  margin-bottom: 26px;
  background:
    radial-gradient(ellipse 420px 220px at 85% -10%, var(--accent-soft), transparent 60%),
    var(--surface);
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .74rem; font-weight: 700; color: var(--accent-2);
  margin-bottom: 10px;
}
.hero-banner h2 {
  font-size: 1.7rem; font-weight: 800; line-height: 1.5;
  max-width: 560px; margin-bottom: 8px;
}
.hero-banner p {
  color: var(--text-dim); font-size: .88rem; max-width: 520px; line-height: 1.8;
  margin-bottom: 18px;
}
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), #b8101f);
  color: #fff; font-size: .84rem; font-weight: 700;
  border: none; border-radius: 12px;
  box-shadow: var(--shadow-lift);
  transition: transform .15s;
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }

/* Was previously only defined in manageusers.css, which meant it
   silently rendered unstyled on any page that used the class without
   also loading that stylesheet (consultations_list.html and
   consultation_detail.html both did this). Promoted here since it's
   clearly a general-purpose secondary-action button, not something
   manageusers-specific — matches .btn-primary living here already. */
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}
.btn-secondary:hover { background: var(--surface-hover); }

/* ---------- stat cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px; margin-bottom: 26px;
}
.stat-card { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.stat-card .label {
  font-size: .76rem; color: var(--text-faint);
}
.stat-card .value {
  font-family: var(--font-mono);
  direction: ltr; text-align: right;
  font-size: 1.9rem; font-weight: 700; color: var(--text);
}
.stat-card .badge {
  font-size: .72rem; padding: 3px 9px; border-radius: 20px;
  width: fit-content;
}
.stat-card .badge.success { background: var(--success-soft); color: var(--success); }
.stat-card .badge.warn { background: var(--warn-soft); color: var(--warn); }
.stat-card .badge.danger { background: var(--danger-soft); color: var(--danger); }
.stat-card .badge.info { background: var(--info-soft); color: var(--info); }

/* ---------- module grid ---------- */
.section-label {
  font-size: .92rem; font-weight: 700; color: var(--text);
  margin-bottom: 14px;
}
.section-hint {
  font-size: .74rem; color: var(--text-faint);
  margin-bottom: 14px; margin-top: -10px;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}
.module-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.module-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-soft);
  background: var(--surface-hover);
}
.module-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.module-icon svg { width: 20px; height: 20px; }
.module-icon.c-red    { background: var(--accent-soft); color: var(--accent-2); }
.module-icon.c-green  { background: var(--success-soft); color: var(--success); }
.module-icon.c-amber  { background: var(--warn-soft); color: var(--warn); }
.module-icon.c-blue   { background: var(--info-soft); color: var(--info); }
.module-icon.c-violet { background: var(--violet-soft); color: var(--violet); }

.module-text { flex: 1; min-width: 0; }
.module-text .t { font-size: .87rem; font-weight: 700; color: var(--text); }
.module-text .d {
  font-size: .74rem; color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.module-arrow { color: var(--text-faint); flex-shrink: 0; }
.module-arrow svg { width: 16px; height: 16px; transform: scaleX(-1); }

/* ---------- settings form cards ---------- */
/* A single settings-form card with only `max-width` and no auto margin
   stays flush against its container's start edge (right, in this RTL
   app) — the block-box default when width is capped below the
   container's full width. That's what made every settings form (Bale
   integration, certificate approval mode, announcements) look pinned to
   one side with a large dead void beside it. Wrapping card(s) in this
   grid instead of giving each one its own inline max-width centers a
   single card, and lays two or more out side by side on wide screens
   (announcements.html) instead of stacking them full-width. */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 640px));
  justify-content: center;
  gap: 24px;
  align-items: start;
}

/* ---------- table ---------- */
.table-card { padding: 22px; }
/* Opt-in horizontal scroll for tables where every column carries meaning.
   The shared mobile treatment keeps data available instead of dropping
   columns; this class remains useful for dense, intentionally wide tables. */
.table-card.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-card h3 { margin-bottom: 14px; font-size: .95rem; color: var(--text); font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th {
  text-align: right; padding: 10px 14px; color: var(--text-faint);
  font-weight: 500; border-bottom: 1px solid var(--border);
  font-size: .74rem;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }

.status-badge { padding: 3px 11px; border-radius: 20px; font-size: .72rem; }
.status-badge.pending  { background: var(--warn-soft); color: var(--warn); }
.status-badge.approved { background: var(--success-soft); color: var(--success); }
.status-badge.rejected { background: var(--danger-soft); color: var(--danger); }

.empty-row td {
  text-align: center; color: var(--text-faint); padding: 30px 14px;
}

/* =====================================================================
   MOBILE THEME TOGGLE — top-left sliding pill switch, mobile only.
   Same action-icon convention as .theme-toggle (sun = "switch to
   light" affordance, shown in dark mode; moon = "switch to dark",
   shown in light mode) — see the rule pair below and compare to
   .theme-toggle above.
   ===================================================================== */
.mobile-theme-toggle {
  display: none;
  position: fixed;
  left: 14px; top: 14px;
  z-index: 200;
  width: 54px; height: 30px;
  padding: 0;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-ambient), inset 0 1px 0 var(--sheen);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}
/* Absolutely positioned from the pill's physical left edge, deliberately
   NOT flex-centered — this page is dir="rtl", and a lone flex child sits
   at the RTL inline-start (the right edge) by default. That put the knob
   at x:24 in dark mode already, so light mode's translateX(24) pushed it
   to x:48 — clean off the far side of the 48px-wide inner track instead
   of sliding across it. `left: 3px` + translateX() is unambiguous in
   either direction. */
.mobile-theme-toggle .knob {
  position: absolute;
  left: 3px; top: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent) 75%);
  box-shadow: 0 0 10px var(--accent-soft);
  transform: translateX(0);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1), background .25s ease;
}
.mobile-theme-toggle .knob svg { width: 14px; height: 14px; }
.mobile-theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .mobile-theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .mobile-theme-toggle .icon-moon { display: block; }
html[data-theme="light"] .mobile-theme-toggle .knob { transform: translateX(24px); }

/* =====================================================================
   SPATIAL DOCK — mobile nav. A horizontal scroll-snap strip (every
   nav_items entry is reachable, not just the first 6) whose centered
   item magnifies RocketDock-style, driven by initDock() in nav.js.
   The magnify transform lands on .dock-icon (not .dock-item) so it
   never fights fx.css's `.dock-item { transition: transform ... }`
   press/hover rule; opacity for the edge fade-out lands on .dock-item,
   which fx.css does not touch.
   ===================================================================== */
.dock {
  display: none;
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(94vw, 460px);
  /* Taller than the visible pill (see .dock-window) purely to give the
     magnified/lifted active icon headroom — see .dock-track. The extra
     22px on top is otherwise empty, so clicks must fall through it to
     whatever's underneath rather than being eaten by a dead zone. */
  height: 100px;
  pointer-events: none;
}

/* The label bubble is positioned via nav.js against the item nearest
   the dock's center. top is relative to .dock's (taller) box, not the
   pill — see the -12 vs -34 note below. */
.dock-label {
  position: absolute;
  left: 0; top: -31px;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 9px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-ambient);
  font-size: .7rem;
  font-weight: 600;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity .1s ease;
}

/* Pure visual background — the glass pill. Bottom-anchored inside the
   taller .dock, fixed at its "real" 78px height so it doesn't grow with
   the extra headroom above it. */
.dock-window {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 78px;
  border-radius: 999px;
  z-index: 0;
}
/* The actual scroll/clip container — also bottom-anchored, but as tall
   as .dock itself. overflow-x:auto forces overflow-y to clip too (the
   CSS overflow spec ties the two axes together the moment either one
   isn't `visible`), so the only way to stop that from cutting off the
   active icon's magnify+lift is to make the clipped box taller than
   anything ever reaches — not to fight the clipping itself.
   align-items:flex-end keeps items flush with the pill's bottom (and
   therefore its top) at rest, so the extra height is headroom ABOVE
   the icons, not empty space around them. */
.dock-track {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 100%;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* The headroom above the pill (see .dock's comment) shouldn't be a
     dead zone that eats taps meant for the page behind it, but it also
     shouldn't stop the pill itself from being drag-scrollable anywhere
     — not just on an icon. ::before below is a same-height stand-in for
     the old (pointer-events:auto, 78px-tall) .dock-track: a descendant
     of the real scroll container, sized to match .dock-window exactly,
     so dragging it scrolls .dock-track natively, while .dock-track's
     own box (now 100px, headroom included) stays pass-through. */
  pointer-events: none;
}
.dock-track::-webkit-scrollbar { display: none; }
.dock-track::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 78px;
  pointer-events: auto;
}
.dock-spacer { flex: 0 0 auto; width: calc(50% - 27px); }
.dock-item {
  position: relative;
  flex: 0 0 auto;
  width: 54px; height: 78px;
  margin: 0 4px;
  display: flex; align-items: center; justify-content: center;
  scroll-snap-align: center;
  text-decoration: none;
  pointer-events: auto;
  will-change: opacity;
}
.dock .dock-item { transition: opacity .12s ease; }
.dock-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  will-change: transform;
  transition: width .12s ease, height .12s ease, border-radius .12s ease,
              background .12s ease, box-shadow .12s ease, color .12s ease;
}
.dock-icon svg { width: 19px; height: 19px; }
.dock-item.is-centered .dock-icon {
  width: 66px; height: 66px;
  border-radius: 20px;
}
.dock-item.active .dock-icon {
  color: var(--accent-contrast);
  background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent) 75%);
  border: 1px solid rgba(255, 255, 255, .4);
  box-shadow: 0 0 0 7px var(--accent-soft), 0 10px 24px rgba(225, 29, 46, .5);
}
.dock-item.is-centered .dock-icon svg { width: 25px; height: 25px; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-inline-end: 0; padding: 20px 16px 120px; }
  .dock { display: block; }
  .mobile-theme-toggle { display: block; }
  .hero-banner h2 { font-size: 1.35rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  table { font-size: .78rem; }
  .topbar { align-items: stretch; }
  .user-pill { justify-content: space-between; }
  .hero-banner { padding: 22px 20px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .module-card, .btn-primary, .theme-toggle, .mobile-theme-toggle .knob { transition: none !important; }
}

/* visible keyboard focus */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Shared mobile chooser for every public/admin map link. Desktop anchors
   point directly to Balad's web map; this surface is opened by
   static/js/map-chooser.js only when a phone-sized/touch context selects a
   `data-map-link` anchor. */
body.map-chooser-open { overflow: hidden; }
.map-chooser-backdrop {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  background: rgba(7, 24, 13, .46);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.map-chooser-backdrop[hidden] { display: none; }
.map-chooser-panel {
  position: relative;
  width: min(100%, 430px);
  padding: 22px 16px 16px;
  border: 1px solid rgba(255,255,255,.46);
  border-radius: 22px;
  color: var(--text);
  background: var(--surface, #fff);
  box-shadow: 0 24px 60px rgba(0,0,0,.30);
  direction: rtl;
  animation: map-chooser-in .18s ease-out;
}
.map-chooser-header { padding-inline: 5px 42px; margin-bottom: 15px; }
.map-chooser-header h2 { margin: 0; font-size: 1rem; }
.map-chooser-header p { margin: 4px 0 0; color: var(--text-faint); font-size: .75rem; }
.map-chooser-close {
  position: absolute;
  top: 13px;
  inset-inline-end: 13px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  background: var(--surface-strong);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.map-chooser-options { display: grid; gap: 8px; }
.map-chooser-option {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: inherit;
  background: var(--surface-strong);
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.map-chooser-option:hover,
.map-chooser-option:focus-visible { transform: translateY(-1px); border-color: var(--accent); background: var(--surface-hover); }
.map-chooser-mark {
  display: grid;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: #168344;
  font-size: .9rem;
  font-weight: 800;
}
.map-chooser-option--neshan .map-chooser-mark { background: #0a86ae; }
.map-chooser-option--google .map-chooser-mark { background: linear-gradient(135deg, #4285f4, #34a853 52%, #fbbc05); }
.map-chooser-copy { display: grid; gap: 2px; min-width: 0; }
.map-chooser-copy strong { font-size: .84rem; }
.map-chooser-copy small { color: var(--text-faint); font-size: .69rem; }
.map-chooser-arrow { margin-inline-start: auto; color: var(--text-faint); font-weight: 700; }
@keyframes map-chooser-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .map-chooser-panel { animation: none; }
}
