/* ===================================================================
   Platfòm Sivik Ayisyen — style.css
   Mobile-first · Dark default + Light theme · i18n-agnostic
   =================================================================== */

/* ----- Theme variables ----- */
:root,
[data-theme="dark"] {
  --bg:         #111418;
  --surface:    #1a1f26;
  --surface-2:  #242b33;
  --fg:         #e8ecef;
  --muted:      #9aa4ad;
  --accent:     #c9a227;
  --accent-2:   #a5372a;
  --success:    #4a8;
  --info:       #5b8def;
  --border:     #2f3843;
  --shadow:     0 4px 16px rgba(0,0,0,0.4);
  --radius:     8px;
  --radius-lg:  12px;

  /* Menu refactor 2026-04-29 — new neutral surfaces + bright accent so
     the rust/brown header and the purple-brown card borders no longer
     dominate. The old --accent-2 (oxblood) is preserved for badges,
     status pills, exhibit borders — it just stops being the header
     gradient. */
  --surface-deep:   #0f1115;       /* mobile drawer, deepest layer */
  --surface-elev:   #1a1d23;       /* header bg — neutral, no rust gradient */
  --surface-pop:    #22262d;       /* dropdown panels, hover rows */
  --text-1:         #f0f3f6;       /* high-contrast nav text on dark */
  --text-2:         #c0c6cf;       /* secondary nav labels, sub-titles */
  --accent-bright:  #ffd966;       /* brighter gold for active pastilles */
}

[data-theme="light"] {
  --bg:         #f7f2e6;
  --surface:    #ffffff;
  --surface-2:  #eee7d4;
  --fg:         #1a1410;
  --muted:      #6b5f52;
  --accent:     #8a6a14;
  --accent-2:   #a5372a;
  --success:    #2f7d4f;
  --info:       #2e5ba8;
  --border:     #dfd4bb;
  --shadow:     0 2px 10px rgba(60,40,10,0.12);

  --surface-deep:   #ffffff;
  --surface-elev:   #fbf6e8;
  --surface-pop:    #f3ecd8;
  --text-1:         var(--fg);
  --text-2:         #5a5247;
  --accent-bright:  #c9a227;
}

/* ----- Base / Reset ----- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ----- Layout — header + navigation =====================================
   Refactored 2026-04-29: header was a rust gradient (--accent-2 → #6b1a12)
   which read as "brown everywhere" on mobile and made the nav low-contrast.
   New design: neutral dark surface (--surface-elev) with a thin gold
   accent line above the bottom border. The rust accent is preserved for
   badges/pills/exhibit borders elsewhere.
   ====================================================================== */
header.site-header {
  background: var(--surface-elev);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 -1px 0 rgba(255,217,102,0.18) inset, var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
[data-theme="light"] header.site-header {
  background: var(--surface-elev);
  box-shadow: 0 -1px 0 rgba(201,162,39,0.45) inset, var(--shadow);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: nowrap;
}
.brand {
  display: flex; flex-direction: column;
  text-decoration: none; color: var(--text-1);
  flex-shrink: 0;
  /* Cap the brand block so a long hero_tagline subtitle doesn't push
     the rest of the header (nav + prefs + Konekte button) off the
     right edge. Reginald 2026-05-03: Lycée Sainte-Marie's tagline
     "Lycée privé · 350 élèves · primaire & secondaire · Pétion-Ville"
     was cropping the Konekte button. */
  max-width: 320px;
  min-width: 0;
}
.brand strong {
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--accent-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Apex BVN wordmark — V-anchor pattern per the locked brand system
   (PR #27, 2026-05-04). The B and N use the primary text color
   (navy in light theme, off-white in dark theme), and the V wears
   the institutional gold. Slightly tighter letter-spacing + heavier
   weight to read as a designed wordmark, not just three letters.
   This rule is scoped to .brand-bvn so tenant-side branding (which
   shows the tenant slug in --accent-bright) is unaffected. */
.brand strong.brand-bvn {
  color: var(--text-1);
  letter-spacing: 0.02em;
  font-weight: 800;
  font-feature-settings: "ss01", "cv01";   /* prefer alt forms when available */
}
.brand strong.brand-bvn .brand-v {
  color: var(--accent);
  /* Subtle structural anchor — slightly heavier weight than the
     surrounding letters so the V remains identifiable even in
     monochrome printouts where the gold is lost. */
  font-weight: 900;
}
.brand .sub {
  font-size: 0.72rem;
  color: var(--text-2);
  margin-top: 1px;
  /* Single-line truncation. The full tagline is still visible in the
     hero band below — this is just the header-strip echo of it. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ----- Primary navigation (desktop + tablet) ------------------------- */
nav.primary {
  display: flex;
  gap: 0.1rem;
  flex-wrap: nowrap;
  align-items: stretch;
  flex: 1;
  justify-content: center;
  margin: 0 0.4rem;
}
/* Top-level link (apex flat nav OR Accueil within tenant nav) */
nav.primary > a {
  color: var(--text-1);
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
nav.primary > a:hover {
  color: var(--accent-bright);
  background: rgba(255,217,102,0.06);
}
nav.primary > a.active {
  background: var(--accent-bright);
  color: #1a1410;
  font-weight: 700;
}

/* ----- Category dropdowns (the new 5-group structure) ---------------- */
.nav-group {
  position: relative;
}
/* Strip the default <details> disclosure triangle */
.nav-group > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  color: var(--text-1);
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
  content: "▾";
  font-size: 0.7em;
  margin-left: 0.25rem;
  opacity: 0.7;
}
.nav-group > summary:hover {
  color: var(--accent-bright);
  background: rgba(255,217,102,0.06);
}
.nav-group.is-active > summary {
  background: var(--accent-bright);
  color: #1a1410;
  font-weight: 700;
}
.nav-group.is-active > summary::after {
  opacity: 1;
}

/* Submenu — desktop: floating panel; mobile: inline accordion */
.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.nav-submenu a {
  color: var(--text-1);
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  border-radius: 5px;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.nav-submenu a:hover {
  background: rgba(255,217,102,0.08);
  color: var(--accent-bright);
}
.nav-submenu a.active {
  background: rgba(255,217,102,0.18);
  color: var(--accent-bright);
  font-weight: 600;
}

/* Desktop dropdown — floating panel on hover/click. The hover trigger is
   not enough alone (won't work on touch). On desktop we use both: <details>
   open by user click AND :hover-reveal as a fallback. */
@media (min-width: 768px) {
  .nav-group {
    /* The <details> visible state still controls open via summary click;
       but on desktop we also reveal on hover. */
  }
  .nav-group > .nav-submenu,
  .nav-group[open] > .nav-submenu {
    position: absolute;
    top: 100%; left: 0;
    background: var(--surface-pop);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem;
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    z-index: 110;
    display: none;
  }
  .nav-group:hover > .nav-submenu,
  .nav-group[open] > .nav-submenu,
  .nav-group:focus-within > .nav-submenu {
    display: flex;
  }
  /* Sub-link active state on desktop fits the floating panel style */
  .nav-submenu a.active {
    background: rgba(255,217,102,0.22);
  }
}

/* ----- Prefs (right-side controls) ----------------------------------- */
.prefs {
  display: flex; gap: 0.3rem; align-items: center;
  flex-shrink: 0;
}
.prefs button,
.prefs a {
  background: var(--surface-pop);
  color: var(--text-1);
  /* Brighter border than --border so the buttons read as
     buttons on dark mode mobile. Reginald's feedback 2026-05-03:
     the previous --border was too close to the surface color and
     the prefs buttons looked "blurry" in the drawer. */
  border: 1px solid rgba(255,217,102,0.35);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.prefs button:hover,
.prefs a:hover {
  background: rgba(255,217,102,0.16);
  border-color: var(--accent-bright);
  color: var(--accent-bright);
}
.prefs button.active,
.prefs a.active {
  background: var(--accent-bright);
  color: #1a1410;
  border-color: var(--accent-bright);
}
/* Login (Konekte) button — promote to PRIMARY action.
   Filled accent background, dark text. High contrast on mobile dark
   drawer so users can immediately spot how to log in. */
.prefs a[href*="/login"] {
  background: var(--accent-bright);
  color: #1a1410;
  border-color: var(--accent-bright);
  font-weight: 700;
}
.prefs a[href*="/login"]:hover {
  background: #ffe28a;
  border-color: #ffe28a;
  color: #1a1410;
}
[data-theme="light"] .prefs a[href*="/login"] {
  background: var(--accent-bright);
  color: #1a1410;
}
.prefs form { display: inline; }

/* Drawer-only chrome — hidden until the mobile breakpoint switches them on.
   !important deliberately used because some layouts may have inline display
   rules that would otherwise win at desktop sizes. */
.nav-drawer-head { display: none !important; }
.prefs-mobile-zone { display: none !important; }
@media (max-width: 767px) {
  /* Restored at the mobile breakpoint via the @media block below.
     The !important here matches the desktop hide so the order of the
     rules is consistent. */
  .nav-drawer-head { display: flex !important; }
  .prefs-mobile-zone { display: flex !important; }
}

/* ----- Connexion CTA (.nav-cta-login) -------------------------------- */
/* Promoted login control living inside nav.primary (NOT inside .prefs).
   On apex it renders after S'inscrire; on tenant subdomains it renders
   at the bottom of the category list when no leader is logged in.

   Implementation note (2026-05-10, third iteration): this is a
   <form action method="get"><button type="submit"></button></form>,
   NOT an <a href>. Reginald confirmed Android Chrome on his S23+ AND
   his Samsung tablet (in vertical/mobile-drawer mode) absorbs both
   <a> click navigation AND window.location.href = href inside the
   drawer's transformed/fixed stacking context. Form GET submission
   goes through a different, lower-level browser navigation primitive
   that isn't subject to the absorption. Visually identical to the
   previous gold pill — only the underlying browser code path changed. */
.nav-cta-login-form {
  margin: 0;
  padding: 0;
  display: flex;
}
nav.primary > .nav-cta-login-form > button.nav-cta-login {
  background: var(--accent-bright);
  color: #1a1410;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  padding: 0.5rem 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--accent-bright);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  /* Defeat the default browser button styling that would otherwise
     leak in (text-shadow, line-height, etc.) */
  line-height: 1.2;
}
nav.primary > .nav-cta-login-form > button.nav-cta-login:hover {
  background: #ffe28a;
  border-color: #ffe28a;
  color: #1a1410;
}
nav.primary > .nav-cta-login-form.active > button.nav-cta-login {
  background: #1a1410;
  color: var(--accent-bright);
  border-color: var(--accent-bright);
}
@media (max-width: 767px) {
  /* On mobile drawer the CTA goes full-width and tall, matching the
     other top-level nav rows so the tap target is identical. */
  nav.primary > .nav-cta-login-form {
    width: 100%;
    margin: 0.5rem 0 0.2rem;
  }
  nav.primary > .nav-cta-login-form > button.nav-cta-login {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    min-height: 56px;
    font-size: 1.05rem;
    padding: 0.95rem 1rem;
  }
}

/* ----- "Bientôt" badge for upcoming features (Agents category) ------ */
.nav-soon-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1a1410;
  background: var(--accent-bright, #ffd966);
  border-radius: 100px;
  vertical-align: 1px;
}
.nav-submenu a.nav-soon {
  opacity: 0.65;
  pointer-events: auto;             /* click still routes to /agents */
}
.nav-submenu a.nav-soon:hover {
  opacity: 0.95;
}
.nav-submenu a.nav-soon .nav-soon-badge {
  font-size: 0.58rem;
}

/* ----- Admin header overrides ----- */
/* Admin keeps its distinct visual identity (deep purple-blue gradient,
   crown, "Top Admin" role badge) so operators always know they're in
   command-center mode vs tenant-mode. The nav.primary architecture is
   shared with the tenant nav — same dropdowns, same drawer, same active
   states — only the surrounding chrome differs. */
header.admin-header {
  background: linear-gradient(to right, #2a1a3e, #1a2a3e);
  border-bottom: 1px solid #3a2a5e;
  box-shadow: 0 -1px 0 rgba(255,217,102,0.2) inset, var(--shadow);
}
header.admin-header .brand strong {
  color: #f0e6d8;
  font-weight: 900;
  letter-spacing: 0.06em;
}
header.admin-header .brand .crown {
  color: #ffd966;
}
header.admin-header .brand .sub {
  color: rgba(240,230,216,0.7);
}
/* Admin nav text on the purple-blue gradient: lighter cream */
header.admin-header nav.primary > a,
header.admin-header .nav-group > summary {
  color: #f0e6d8;
}
header.admin-header nav.primary > a:hover,
header.admin-header .nav-group > summary:hover {
  color: #ffd966;
  background: rgba(255,255,255,0.08);
}
header.admin-header nav.primary > a.active,
header.admin-header .nav-group.is-active > summary {
  background: #ffd966;
  color: #1a1410;
  font-weight: 700;
}
header.admin-header .nav-group > .nav-submenu {
  background: #1a1226;             /* admin-themed dropdown panel */
  border-color: #3a2a5e;
}
header.admin-header .nav-submenu a {
  color: #f0e6d8;
}
header.admin-header .nav-submenu a:hover {
  background: rgba(255,217,102,0.12);
  color: #ffd966;
}
header.admin-header .nav-submenu a.active {
  background: rgba(255,217,102,0.22);
  color: #ffd966;
  font-weight: 600;
}
/* Admin prefs zone */
header.admin-header .admin-who {
  font-size: 0.85rem;
  color: rgba(240,230,216,0.85);
  padding: 0 0.4rem;
}
header.admin-header .admin-who .role-top {
  color: #ffd966;
  font-weight: 700;
}
header.admin-header .admin-prefs button,
header.admin-header .admin-prefs a {
  background: rgba(0,0,0,0.25);
  color: #f0e6d8;
  border: 1px solid rgba(255,255,255,0.15);
}
header.admin-header .admin-prefs button:hover {
  border-color: #ffd966;
  color: #ffd966;
  background: rgba(255,217,102,0.08);
}
header.admin-header .nav-toggle {
  background: rgba(0,0,0,0.25);
  color: #f0e6d8;
  border: 1px solid rgba(255,255,255,0.18);
}
header.admin-header .nav-toggle:hover {
  border-color: #ffd966;
  color: #ffd966;
}
/* Admin mobile drawer — match the deep-purple identity */
@media (max-width: 767px) {
  header.admin-header nav.primary {
    background: #150f24;
    border-left: 1px solid #3a2a5e;
  }
  header.admin-header .nav-drawer-close {
    color: #f0e6d8;
    border-color: rgba(255,255,255,0.2);
  }
  header.admin-header .nav-drawer-title {
    color: rgba(240,230,216,0.7);
  }
}

/* ----- Mobile hamburger toggle --------------------------------------- */
.nav-toggle {
  display: none;
  background: var(--surface-pop);
  color: var(--text-1);
  border: 1px solid var(--border);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 1.2rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}
.nav-toggle:hover {
  border-color: var(--accent-bright);
  color: var(--accent-bright);
}

main {
  max-width: 1180px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}
footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  font-size: 0.85rem;
}

/* ----- Typography ----- */
h1, h2, h3 { color: var(--fg); line-height: 1.25; }
h1 { color: var(--accent); font-weight: 600; margin: 0 0 0.8rem; font-size: 1.7rem; }
h2 {
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin-top: 2rem;
  font-size: 1.3rem;
}
h3 { font-size: 1.1rem; margin: 0.8rem 0 0.4rem; }
.lead { color: var(--muted); font-size: 1.02rem; }
code {
  background: var(--surface-2);
  color: var(--accent);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
  word-break: break-all;
}

/* ----- Hero ----- */
.hero h1 { font-size: 1.9rem; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
  margin: 1.3rem 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.1rem;
  border-radius: var(--radius);
  text-align: center;
}
.stat .value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.stat .label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ----- Tables ----- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 600;
  /* Sticky table headers offset by the page header height so they don't
     conflict with the sticky site/admin header at viewport top:0.
     Page header is ~60px tall + 4px buffer = 64px. z-index stays below 100
     (page header) so the page header always renders on top in case of overlap. */
  position: sticky;
  top: 64px;
  z-index: 50;
}
tr:hover td { background: rgba(201, 162, 39, 0.06); }
.summary { max-width: 540px; }
.meta { color: var(--muted); font-size: 0.85rem; }

/* ----- Coverage table + progress ----- */
.coverage { margin-top: 1rem; }
.coverage td.filled { color: var(--accent); font-weight: 600; }
.coverage .total-row td {
  background: var(--surface-2);
  font-weight: 700;
  border-top: 2px solid var(--accent);
}
.progress {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 22px;
  min-width: 110px;
  overflow: hidden;
}
.progress-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.4s;
}
.progress span {
  position: relative;
  display: block;
  text-align: center;
  font-size: 0.75rem;
  line-height: 22px;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}

/* ----- Card grid ----- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.7rem;
  margin: 1rem 0 2rem;
}
.card {
  display: block;
  text-decoration: none;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
  min-height: 96px;
}
.card:hover, .card:active {
  transform: translateY(-1px);
  background: var(--surface-2);
  border-left-color: var(--accent-2);
}
.card.diaspora { border-left-color: #3a7bd5; }
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.72rem; color: var(--muted); margin-bottom: 0.4rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.card-head .code { color: var(--accent); font-weight: 700; }
.card-name { font-size: 1rem; font-weight: 600; }
.card-alt { font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; }
.card-foot {
  margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.76rem; color: var(--muted);
}

/* ----- Breadcrumb ----- */
.crumbs {
  display: flex; gap: 0.35rem; align-items: center;
  font-size: 0.88rem; color: var(--muted);
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .current { color: var(--fg); font-weight: 500; }
.crumbs span { opacity: 0.5; }

/* ----- Node detail header ----- */
.node-head { margin-bottom: 1.2rem; }
.node-head h1 { margin-bottom: 0.5rem; }
.node-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pill {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}
a.pill:hover { background: var(--accent); color: #1a1410; }
.name-alt { color: var(--muted); font-style: italic; margin-top: 0.5rem; }

/* ----- Metrics strip ----- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.55rem;
  margin: 1.2rem 0;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.9rem;
  border-radius: var(--radius);
  text-align: center;
}
.metric .value {
  display: block; font-size: 1.5rem; font-weight: 700; color: var(--accent);
}
.metric .label {
  display: block; font-size: 0.75rem; color: var(--muted);
  margin-top: 0.2rem; text-transform: uppercase; letter-spacing: 0.04em;
}

/* ----- Forms ----- */
.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.form label {
  display: flex; flex-direction: column; gap: 0.25rem;
  font-size: 0.85rem; color: var(--muted);
}
.form label.full { grid-column: 1 / -1; }
.form input, .form select, .form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  color: var(--fg);
  font: inherit;
  min-height: 44px;   /* mobile tap target */
}
.form textarea { min-height: 80px; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--accent);
}

button, .form button, .btn-row button, .toolbar button, .inline button {
  background: var(--accent);
  color: #1a1410;
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
  min-height: 44px;
}
button:hover { filter: brightness(1.08); }
button.secondary, .form button.secondary, .btn-row button.secondary {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border);
}
button.danger {
  background: var(--accent-2);
  color: #fff;
}
.btn-row { grid-column: 1 / -1; display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }

.inline { display: inline-flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; }
.inline select, .inline input {
  padding: 0.4rem 0.6rem;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-height: 38px;
  font-size: 0.9rem;
}
.inline button {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  min-height: 38px;
}

.filled { color: var(--accent); font-weight: 600; }
.vacant { color: var(--muted); font-style: italic; }

/* ----- Empty state ----- */
.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  padding: 1.5rem;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* ----- Toolbar + filter pills ----- */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin: 1rem 0; flex-wrap: wrap; gap: 0.5rem;
}
.filters { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
.filters .pill { cursor: pointer; }
.filters .pill.active { background: var(--accent); color: #1a1410; border-color: var(--accent); }

/* ----- Row-inline actions (details/summary) ----- */
.row-actions { display: inline-block; }
.row-actions summary {
  cursor: pointer;
  color: var(--accent);
  list-style: none;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: inline-block;
  min-height: 36px;
  font-size: 0.88rem;
}
.row-actions summary::-webkit-details-marker { display: none; }
.row-actions[open] summary { background: var(--surface-2); }
.row-actions form + form { margin-top: 0.3rem; }
.secondary-btn {
  cursor: pointer;
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.55rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  display: inline-block;
  min-height: 40px;
}

/* ----- Inbox (mesaj) ----- */
.inbox { display: flex; flex-direction: column; gap: 0.7rem; }
.msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.msg.status-new { border-left-color: var(--accent-2); }
.msg.status-triaged { border-left-color: var(--accent); }
.msg.status-replied { border-left-color: var(--success); }
.msg.status-archived { border-left-color: var(--border); opacity: 0.75; }
.msg header {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 0.4rem;
  font-size: 0.82rem; color: var(--muted);
}
.msg h3 { margin: 0.3rem 0; font-size: 1rem; }
.msg .body {
  margin: 0.4rem 0;
  color: var(--fg);
  white-space: pre-wrap;
  font-size: 0.93rem;
}
.msg footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.6rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem; color: var(--muted);
  flex-wrap: wrap; gap: 0.4rem;
}
.channel-tag {
  padding: 0.12rem 0.45rem; border-radius: 4px;
  font-weight: 600; text-transform: uppercase;
  font-size: 0.68rem; letter-spacing: 0.06em;
}
.ch-whatsapp { background: #25d366; color: #0e2b1a; }
.ch-sms      { background: #5b8def; color: #0a1a3a; }
.ch-email    { background: #c97; color: #1a1410; }
.ch-web      { background: var(--accent); color: #1a1410; }
.from .ident { color: var(--muted); margin-left: 0.4rem; font-size: 0.78rem; }
.scope { color: var(--accent); font-size: 0.78rem; }
.status-pill {
  padding: 0.08rem 0.5rem; border-radius: 999px; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--surface-2); color: var(--muted);
}
.status-pill.st-new { background: rgba(165, 55, 42, 0.25); color: var(--accent-2); }
.status-pill.st-triaged { background: rgba(201, 162, 39, 0.25); color: var(--accent); }
.status-pill.st-replied { background: rgba(74, 160, 120, 0.25); color: var(--success); }

/* ----- Publications ----- */
.pubs { display: flex; flex-direction: column; gap: 0.7rem; }
.pub {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.pub.status-draft { border-left-color: var(--muted); opacity: 0.88; }
.pub.status-published { border-left-color: var(--accent); }
.pub header {
  display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center;
  font-size: 0.78rem; margin-bottom: 0.4rem;
}
.pub h3 { margin: 0.3rem 0 0.4rem; }
.pub .body { white-space: pre-wrap; margin: 0.4rem 0; font-size: 0.93rem; }
.pub footer {
  display: flex; justify-content: space-between; gap: 0.5rem; align-items: center;
  margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem; color: var(--muted);
  flex-wrap: wrap;
}
.kind-pill, .lang-pill {
  padding: 0.1rem 0.5rem; border-radius: 4px;
  background: var(--surface-2); color: var(--accent);
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.lang-pill { background: var(--accent-2); color: #fff; }
.time { font-variant-numeric: tabular-nums; }

/* ----- Search bar ----- */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
  max-width: 720px;
}
.search-bar input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--fg);
  font: inherit;
  min-height: 44px;
}
.search-bar input:focus { outline: none; border-color: var(--accent); }
.search-bar button {
  padding: 0 1.2rem;
  border-radius: 8px;
  min-height: 44px;
}

/* ----- Nanm (soul) cards ----- */
.nanm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 0.8rem 0;
}
.nanm-card.ai {
  border-left-color: var(--accent-2);
  background: linear-gradient(180deg, var(--surface), rgba(165, 55, 42, 0.08));
}
.nanm-card h3 { color: var(--accent); margin: 0 0 0.5rem; }
.nanm-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--fg);
  max-height: 520px;
  overflow-y: auto;
  margin: 0;
}
.document-body { max-height: none; }

/* AI panel */
.ai-panel {
  background: linear-gradient(180deg, var(--surface), rgba(165, 55, 42, 0.08));
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin: 1rem 0 2rem;
}
.ai-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.ai-header h2 {
  border-bottom: none;
  margin: 0;
  color: var(--accent);
}
.ai-status {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
}
.ai-status.ok { background: rgba(74, 160, 120, 0.2); color: var(--success); }
.ai-status.off { background: rgba(165, 55, 42, 0.2); color: var(--accent-2); }
.ai-status code { background: transparent; color: inherit; padding: 0; }

.ai-btn {
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  color: #fff;
  font-size: 1rem;
}

/* =====================================================================
   SALON D'EXPOSITION — public billboard / saloon-style showcase
   ===================================================================== */

.salon-hero {
  margin: -1.5rem -1rem 1.5rem;
  padding: 3rem 1.5rem 2.5rem;
  background:
    radial-gradient(circle at 85% 20%, rgba(201, 162, 39, 0.14), transparent 55%),
    radial-gradient(circle at 15% 90%, rgba(165, 55, 42, 0.18), transparent 55%),
    linear-gradient(160deg, var(--surface), var(--bg));
  border-bottom: 2px solid var(--accent);
  position: relative;
  overflow: hidden;
}
.salon-hero::before,
.salon-hero::after {
  content: "";
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  opacity: 0.05;
  pointer-events: none;
}
.salon-hero::before {
  background: var(--accent); top: -120px; right: -80px;
}
.salon-hero::after {
  background: var(--accent-2); bottom: -140px; left: -80px;
}
.salon-hero-inner {
  max-width: 900px; margin: 0 auto; text-align: center;
  position: relative; z-index: 1;
}
.salon-eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.25em;
  margin-bottom: 0.6rem;
  font-weight: 700;
}
.salon-title {
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.05;
  margin: 0 0 0.6rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.salon-tagline {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto 0.5rem;
  line-height: 1.5;
}
.salon-mission {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  display: inline-block;
}

/* Filter chips */
.salon-filters {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  justify-content: center;
  margin: 0 0 2rem;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  transition: all 0.15s;
  min-height: 40px;
}
.filter-chip:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}
.filter-chip.active {
  background: var(--accent);
  color: #1a1410;
  border-color: var(--accent);
  font-weight: 600;
}
.chip-count {
  background: rgba(0,0,0,0.18);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.filter-chip.active .chip-count { background: rgba(0,0,0,0.3); }

/* Featured (hero) exhibits */
.salon-featured {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.exhibit-hero {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--fg);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.exhibit-hero::before {
  content: "★";
  position: absolute;
  top: 0.8rem; right: 1rem;
  color: var(--accent);
  font-size: 1.1rem;
}
.exhibit-hero:hover {
  transform: translateY(-2px);
  border-left-color: var(--accent-2);
}
.exhibit-hero-icon {
  font-size: 2.6rem;
  line-height: 1;
  flex-shrink: 0;
}
.exhibit-hero-body { flex: 1; min-width: 0; }
.exhibit-hero-body h2 {
  margin: 0.3rem 0 0.5rem;
  font-size: 1.35rem;
  line-height: 1.25;
  border-bottom: none;
  padding-bottom: 0;
}
.exhibit-hero-body p { margin: 0.3rem 0; color: var(--muted); line-height: 1.5; }

/* Grid of secondary exhibits */
.salon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.exhibit-card {
  display: flex; flex-direction: column; gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.2rem 1.1rem;
  text-decoration: none;
  color: var(--fg);
  transition: all 0.2s;
  min-height: 190px;
}
.exhibit-card:hover {
  transform: translateY(-2px);
  border-top-color: var(--accent-2);
  background: var(--surface-2);
}
.exhibit-card-icon { font-size: 2rem; line-height: 1; }
.exhibit-card h3 {
  margin: 0.2rem 0 0.3rem;
  font-size: 1.05rem;
  line-height: 1.25;
}
.exhibit-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* Kind tag */
.exhibit-kind-tag {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

/* Kind-colored accents (subtle per-type theming) */
.exhibit-kind-evenman  { border-top-color: #d97706; }  /* event — amber */
.exhibit-kind-lakou    { border-top-color: var(--accent-2); }  /* sacred site — oxblood */
.exhibit-kind-rechèch  { border-top-color: #3a7bd5; }  /* research — blue */
.exhibit-kind-anons    { border-top-color: var(--accent); }  /* announcement — gold */
.exhibit-kind-pwodwi   { border-top-color: #2f7d4f; }  /* product — green */
.exhibit-kind-medya    { border-top-color: #9c4dcc; }  /* media — purple */
.exhibit-kind-evenman.exhibit-hero { border-left-color: #d97706; }
.exhibit-kind-lakou.exhibit-hero   { border-left-color: var(--accent-2); }
.exhibit-kind-rechèch.exhibit-hero { border-left-color: #3a7bd5; }
.exhibit-kind-anons.exhibit-hero   { border-left-color: var(--accent); }
.exhibit-kind-pwodwi.exhibit-hero  { border-left-color: #2f7d4f; }
.exhibit-kind-medya.exhibit-hero   { border-left-color: #9c4dcc; }

.exhibit-date {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem !important;
}
.exhibit-cta {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* Detail page */
.exhibit-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 1rem 0;
}
.exhibit-detail-head {
  display: flex; gap: 1.5rem; align-items: flex-start;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.2rem;
}
.exhibit-detail-icon { font-size: 4rem; line-height: 1; flex-shrink: 0; }
.exhibit-detail-head h1 { margin: 0.3rem 0 0.5rem; color: var(--fg); }
.exhibit-detail.exhibit-kind-lakou   { border-top-color: var(--accent-2); }
.exhibit-detail.exhibit-kind-rechèch { border-top-color: #3a7bd5; }
.exhibit-detail.exhibit-kind-evenman { border-top-color: #d97706; }
.exhibit-detail.exhibit-kind-pwodwi  { border-top-color: #2f7d4f; }
.exhibit-detail.exhibit-kind-medya   { border-top-color: #9c4dcc; }

.exhibit-cta-block {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
}
.exhibit-cta-button {
  display: inline-block;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  color: #fff;
  padding: 0.8rem 2rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.exhibit-cta-button:hover { transform: translateY(-1px); }

.salon-admin-link {
  margin: 2rem 0 1rem;
  text-align: center;
}

/* Territory-jump widget on /salon */
.salon-territory-jump {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
.salon-territory-jump .search-bar {
  max-width: 100%;
  margin: 0;
}

/* Tenant attribution inside exhibit cards on /salon/teritwa/... */
.exhibit-tenant,
.exhibit-tenant-card {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.exhibit-tenant strong,
.exhibit-tenant-card strong { color: var(--accent); }

/* ---- Login ---- */
.login-wrap {
  max-width: 440px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.login-wrap h1 { text-align: center; }
.login-wrap .lead { text-align: center; font-size: 0.95rem; }

/* Quota meters on /ai-usage */
.quota-stack {
  display: flex; flex-direction: column; gap: 0.6rem;
  margin: 0.8rem 0;
}
.quota-row {
  display: grid;
  grid-template-columns: 180px 1fr 160px;
  gap: 0.8rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
}
.quota-label {
  font-weight: 600;
  color: var(--fg);
}
.quota-bar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 18px;
  overflow: hidden;
  position: relative;
}
.quota-fill {
  height: 100%;
  transition: width 0.4s;
  border-radius: 999px;
}
.quota-text {
  text-align: right;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 767px) {
  .quota-row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
    padding: 0.8rem;
  }
  .quota-text { text-align: left; }
}

/* Logged-in leader badge in nav */
.prefs-leader {
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.25);
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .salon-hero { padding: 2rem 1rem 1.8rem; margin: -1rem -0.7rem 1.2rem; }
  .salon-title { font-size: 1.7rem; }
  .salon-tagline { font-size: 0.98rem; }
  .salon-featured { grid-template-columns: 1fr; }
  .exhibit-hero { flex-direction: column; padding: 1.2rem; }
  .exhibit-hero-icon { font-size: 2.2rem; }
  .salon-grid { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .exhibit-card { padding: 0.9rem 0.85rem; min-height: 160px; }
  .exhibit-detail { padding: 1.2rem; }
  .exhibit-detail-head { flex-direction: column; gap: 0.6rem; }
  .exhibit-detail-icon { font-size: 3rem; }
}

/* =====================================================================
   MOBILE (< 768px) — mobile-first but we adjust a few desktop patterns
   ===================================================================== */
@media (max-width: 767px) {
  body { font-size: 15px; }
  .header-inner { padding: 0.6rem 0.8rem; gap: 0.4rem; }
  .brand strong { font-size: 1rem; }
  .brand .sub { font-size: 0.66rem; }

  /* ----- Mobile drawer (slides in from the right) ---------------------- */
  /* The hamburger ☰ becomes the only visible nav control.
     Tapping it sets nav.primary.open, which translates the drawer onto
     the screen. body.nav-open paints a backdrop. ESC + outside-tap close
     the drawer (wired in base.html inline JS). */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  nav.primary {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 360px);
    max-width: 100vw;
    background: var(--surface-deep);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0,0,0,0.55);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.15rem;
    padding: 1rem 0.7rem 1.4rem;
    margin: 0;
    z-index: 200;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    /* Make the drawer scroll independently of the page */
    overscroll-behavior: contain;
    /* Isolate the drawer into its own stacking context so the backdrop's
       backdrop-filter doesn't bleed through to the menu text on mobile
       Chrome/Safari (well-known compositor bug). Also forces a GPU layer. */
    isolation: isolate;
  }
  nav.primary.open {
    transform: translateX(0);
  }
  /* Drawer header (close X + brand recap) */
  .nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.4rem 0.8rem;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
  }
  .nav-drawer-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-1);
    border-radius: 6px;
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
  }
  .nav-drawer-close:hover {
    border-color: var(--accent-bright);
    color: var(--accent-bright);
  }
  .nav-drawer-title {
    font-size: 0.85rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  /* Top-level entries fill the drawer width.
     Reginald 2026-05-03: drawer items were "blurry" — text-only with
     low background contrast. Adding a subtle bottom border between
     items makes each label clearly distinct in the dark drawer. */
  nav.primary > a,
  .nav-group > summary {
    padding: 0.85rem 0.9rem;
    font-size: 1.02rem;          /* nudged up from 1rem for legibility */
    border-radius: 6px;
    min-height: 48px;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    color: var(--text-1);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  nav.primary > a:hover,
  .nav-group > summary:hover {
    background: rgba(255,217,102,0.10);
  }
  /* Active item — solid yellow band so the user sees their location */
  nav.primary > a.active {
    background: var(--accent-bright);
    color: #1a1410;
    font-weight: 700;
    border-bottom-color: var(--accent-bright);
  }

  /* Mobile accordion: submenu is inline-expanded under its summary,
     not a floating panel. */
  .nav-group {
    position: static;
  }
  .nav-group > .nav-submenu {
    display: none;
    flex-direction: column;
    gap: 0.05rem;
    padding: 0.2rem 0 0.4rem 1.6rem;
    border-left: 2px solid var(--border);
    margin: 0.2rem 0 0.4rem 0.6rem;
  }
  .nav-group[open] > .nav-submenu {
    display: flex;
  }
  .nav-submenu a {
    padding: 0.7rem 0.8rem;
    font-size: 0.95rem;
    min-height: 44px;
  }
  /* Open-state visual: gold left-border on the summary */
  .nav-group[open] > summary {
    color: var(--accent-bright);
  }
  .nav-group[open] > summary::after {
    content: "▴";
  }

  /* Backdrop when drawer is open. NOTE: backdrop-filter was removed because
     it caused the drawer text to render blurry on Android Chrome (compositor
     leakage even with z-index: 200 on the drawer). The 0.55 black overlay is
     sufficient visual separation; the GPU blur was decorative and broken. */
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 150;
  }
  /* Lock body scroll while drawer is open */
  body.nav-open {
    overflow: hidden;
  }

  /* The display toggle for .nav-drawer-head + .prefs-mobile-zone is handled
     near the top of this file (with !important to defeat any layout
     surprises). Here we only set their inner layout properties on mobile. */
  .prefs-mobile-zone {
    flex-direction: column;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    gap: 0.4rem;
  }
  .prefs-mobile-zone .prefs {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  /* Hide the desktop prefs in the header on mobile */
  .header-inner > .prefs {
    display: none;
  }

  main { padding: 0 0.7rem; margin: 1rem auto; }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.15rem; margin-top: 1.4rem; }
  .hero h1 { font-size: 1.6rem; }
  .lead { font-size: 0.98rem; }

  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat .value { font-size: 1.55rem; }

  .grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .card { min-height: 88px; padding: 0.7rem 0.8rem; }
  .card-name { font-size: 0.95rem; }

  .metrics { grid-template-columns: repeat(2, 1fr); }

  /* Tables: wrap for horizontal scroll on mobile */
  table { font-size: 0.85rem; }
  th, td { padding: 0.45rem 0.55rem; }
  /* If a table is inside .table-wrap it scrolls horizontally. */

  .form { padding: 0.8rem; }
  .form input, .form select, .form textarea { font-size: 16px; } /* prevents iOS zoom */

  .coverage table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .prefs { flex-wrap: nowrap; order: 3; }
  .prefs button, .prefs a { padding: 0.3rem 0.5rem; font-size: 0.78rem; }

  .msg, .pub { padding: 0.7rem 0.85rem; }

  .search-bar { flex-direction: row; }

  footer { padding: 1.5rem 0.8rem; margin-top: 2rem; font-size: 0.78rem; }
}

/* ----- Tablet (768–1023px) ----- */
@media (min-width: 768px) and (max-width: 1023px) {
  .stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

/* ----- Small desktop up (>= 1024px) ----- */
@media (min-width: 1024px) {
  body { font-size: 16px; }
  h1 { font-size: 1.85rem; }
  .hero h1 { font-size: 2.1rem; }
}

/* ----- Accessibility: focus rings ----- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
