/* styles.css — RCCC Network prototype design system (Agent 1).
   Type: Archivo (semi-condensed, heavy) for headings — the voice of yard signs and slate cards;
         Public Sans for body — designed for U.S. government services, very legible at small sizes.
   Layers (z-index): topbar 50 · drawer backdrop 55 · sidebar drawer 60 · modal 900 · toasts 1000.
   Tour overlays should sit at 2000+ (above everything, including modals).
   Header height: --topbar-h (64px desktop, 108px under 900px: two rows, wordmark/tour then switchers). */

:root {
  --brand: #0B2A4A;
  --brand-ink: #FFFFFF;
  --accent: #C8102E;
  --master: #5B3FA0;
  --master-soft: #EFEAFA;

  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --line: #DCE1E8;
  --line-strong: #C3CAD4;
  --ink: #15202E;
  --ink-2: #3C4858;
  --ink-3: #5A6676;

  --ok: #1B7A43;   --ok-soft: #E3F4EA;
  --warn: #9A5B00; --warn-soft: #FDF1DC;
  --danger: #B42318; --danger-soft: #FDE7E5;
  --info: #1F5E9E; --info-soft: #E5EFFA;

  --font-head: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(21, 32, 46, .06);
  --shadow-2: 0 10px 30px -12px rgba(21, 32, 46, .28);
  --topbar-h: 64px;
  --sidebar-w: 260px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-stretch: 85%;
  line-height: 1.15;
  margin: 0 0 .4em;
  color: var(--ink);
  letter-spacing: -0.005em;
}
h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 750; }
h3 { font-size: 1.2rem; font-weight: 700; }
h4 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .8em; }
p:last-child { margin-bottom: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 3000; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }

/* ================= Shell ================= */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: var(--brand);
  color: var(--brand-ink);
  border-bottom: 4px solid var(--accent);
  transition: background-color .35s ease, border-color .35s ease;
}
.menu-btn {
  display: none;
  background: transparent; border: 0; color: inherit; cursor: pointer;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  align-items: center; justify-content: center;
}
.menu-btn:hover { background: rgba(255,255,255,.12); }
.wordmark { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.wordmark:hover { color: inherit; }
.wordmark-star { flex: none; }
.wordmark-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.wordmark-name { font-family: var(--font-head); font-stretch: 80%; font-weight: 800; font-size: 1.35rem; letter-spacing: .01em; white-space: nowrap; }
.wordmark-sub { font-size: 13px; opacity: .82; white-space: nowrap; }
.topbar-controls { display: flex; align-items: center; gap: 10px; }
.switcher {
  display: flex; flex-direction: column; gap: 0;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--r-sm);
  padding: 3px 8px 4px;
}
.switcher-label { font-size: 11.5px; opacity: .8; line-height: 1.2; font-weight: 600; }
/* note: 11.5px label is decorative chrome next to a 15px control; real content min is 13px */
.switcher-select {
  appearance: none; -webkit-appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 0 center;
  border: 0; color: inherit; font: 600 15px/1.3 var(--font-body);
  padding: 0 18px 0 0; cursor: pointer; max-width: 260px;
}
.switcher-select option { color: var(--ink); background: #fff; }
.switcher:focus-within { box-shadow: 0 0 0 3px rgba(255,255,255,.45); }
/* .btn.btn-tour outranks .btn defined later */
.btn.btn-tour {
  background: color-mix(in srgb, var(--accent) 82%, black); color: #fff; border-color: transparent;
  box-shadow: 0 2px 0 rgba(0,0,0,.18);
}
.btn.btn-tour:hover { color: #fff; background: color-mix(in srgb, var(--accent) 70%, black); }

/* The sidebar column stretches to the full page height (white to the bottom on long pages);
   its inner nav stays sticky under the topbar and scrolls on its own. */
.shell { display: flex; align-items: stretch; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  position: relative;
  width: var(--sidebar-w); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.sidebar-inner {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 12px 24px;
  display: flex; flex-direction: column;
}
#nav-list { flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-group-label {
  font-family: var(--font-head); font-stretch: 85%; font-weight: 700;
  font-size: 13px; color: var(--ink-3);
  padding: 4px 10px; letter-spacing: .02em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: color-mix(in srgb, var(--brand) 9%, white);
  color: var(--brand); font-weight: 700;
  border-left-color: var(--accent);
}
.nav-icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.nav-icon svg { width: 20px; height: 20px; }
.nav-text { flex: 1; min-width: 0; }
.nav-item .lock { margin-left: auto; }
.nav-item.is-locked .nav-text { color: var(--ink-3); }
.nav-item.is-locked.active .nav-text { color: var(--brand); }
.sidebar-foot { color: var(--ink-3); padding: 12px 10px 0; border-top: 1px solid var(--line); margin-top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.sample-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 12.5px/1.2 var(--font-body); color: var(--ink-2);
  padding: 3px 9px; border-radius: 999px; border: 1px dashed var(--line-strong); background: var(--surface-2);
}
.sample-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.drawer-backdrop { display: none; }

.main { flex: 1; min-width: 0; outline: none; }
.screen { min-height: 60vh; }

/* ================= Layout ================= */
.page { max-width: 1180px; margin: 0 auto; padding: 32px 32px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin-bottom: 24px; }
.page-head > :first-child { flex: 1 1 340px; min-width: 0; }
.page-head h1 { margin-bottom: .15em; }
.page-head p { color: var(--ink-2); font-size: 1.05rem; max-width: 68ch; margin: 0; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 20px; }
.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)); }
@media (max-width: 1000px) {
  .ov-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack > * { margin-top: 0; margin-bottom: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* ================= Surfaces ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3, .card-head h4 { margin: 0; font-size: 1.15rem; }
.card-body { padding: 20px; }
.card > .card-body + .card-body { border-top: 1px solid var(--line); }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; line-height: 1.45; }

.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px 16px; position: relative; overflow: hidden; min-width: 0;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.kpi-value {
  font-family: var(--font-head); font-stretch: 80%; font-weight: 800;
  font-size: 2.1rem; line-height: 1.05; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kpi-label { font-size: 14px; color: var(--ink-2); margin-top: 4px; font-weight: 500; }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13.5px; font-weight: 700; margin-top: 6px; }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.up::before { content: '▲'; font-size: 10px; }
.kpi-delta.down { color: var(--danger); }
.kpi-delta.down::before { content: '▼'; font-size: 10px; }

/* ================= Controls ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 16px;
  font: 600 15px/1.2 var(--font-body);
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, black); border-color: color-mix(in srgb, var(--brand) 86%, black); color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-ghost:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); border-color: transparent; color: var(--brand); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 14px; }

.input, .select, .textarea {
  width: 100%; max-width: 100%;
  font: 400 16px/1.4 var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 10px 12px; min-height: 44px;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%233C4858' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: #7A8594; }

/* .toggle: wrap a checkbox -> <label class="toggle"><input type="checkbox"> Label</label>
   or use it directly on the input: <input type="checkbox" class="toggle"> */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
input[type="checkbox"].toggle, .toggle input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 44px; height: 26px; border-radius: 999px;
  background: var(--line-strong); position: relative; cursor: pointer;
  transition: background-color .18s ease;
}
input[type="checkbox"].toggle::after, .toggle input[type="checkbox"]::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .18s ease;
}
input[type="checkbox"].toggle:checked, .toggle input[type="checkbox"]:checked { background: var(--brand); }
input[type="checkbox"].toggle:checked::after, .toggle input[type="checkbox"]:checked::after { transform: translateX(18px); }
input[type="checkbox"].toggle:focus-visible, .toggle input[type="checkbox"]:focus-visible { box-shadow: var(--focus); }

.tabs {
  display: flex; gap: 4px; overflow-x: auto; max-width: 100%;
  border-bottom: 1px solid var(--line); margin-bottom: 20px;
  scrollbar-width: thin;
}
.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  font: 600 15px/1.2 var(--font-body); color: var(--ink-3);
  padding: 12px 14px 11px; border-bottom: 3px solid transparent; margin-bottom: -1px;
  white-space: nowrap; text-decoration: none;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 5px 13px;
  font: 500 14px/1.2 var(--font-body); color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
  cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ================= Status ================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 13px/1.2 var(--font-body);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge-master { background: var(--master-soft); color: var(--master); border-color: color-mix(in srgb, var(--master) 30%, white); }
.badge-local { background: color-mix(in srgb, var(--brand) 10%, white); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, white); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, white); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, white); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, white); }
.lock {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  color: var(--warn); background: var(--warn-soft);
}
.lock:empty::before {
  content: ''; width: 13px; height: 13px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='4' y='9' width='12' height='9' rx='2'/%3E%3Cpath d='M7 9V6.5a3 3 0 0 1 6 0V9'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='4' y='9' width='12' height='9' rx='2'/%3E%3Cpath d='M7 9V6.5a3 3 0 0 1 6 0V9'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ================= Ad slots / zones ================= */
.ad-slot {
  position: relative;
  border: 2px dashed var(--slot-color, var(--line-strong));
  border-radius: var(--r);
  background: color-mix(in srgb, var(--slot-color, #888) 5%, white);
  padding: 30px 16px 16px;
  min-height: 72px;
  min-width: 0;
}
.ad-slot::before {
  position: absolute; top: -2px; left: -2px;
  padding: 3px 10px 4px;
  font: 700 12.5px/1.2 var(--font-body); letter-spacing: .01em;
  color: #fff; background: var(--slot-color);
  border-radius: var(--r) 0 var(--r-sm) 0;
}
.ad-slot.master { --slot-color: var(--master); }
.ad-slot.master::before { content: 'Network slot'; }
.ad-slot.local { --slot-color: var(--brand); }
.ad-slot.local::before { content: 'Local slot'; color: var(--brand-ink); }

/* ================= Tables ================= */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th {
  font-family: var(--font-head); font-stretch: 85%; font-weight: 700; font-size: 14px;
  color: var(--ink-2); background: var(--surface-2); white-space: nowrap;
}
.table tbody tr:nth-child(even) td { background: #FAFBFC; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--brand) 5%, white); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ================= Explain callout ================= */
.explain {
  position: relative;
  display: block;
  background: #FFF8E6;
  border: 1px solid #F1DFAE;
  border-left: 4px solid #D9A21B;
  border-radius: var(--r);
  padding: 14px 18px 14px 54px;
  color: #3E3418;
  font-size: 15.5px; line-height: 1.55;
}
.explain::before {
  content: ''; position: absolute; left: 16px; top: 14px; width: 24px; height: 24px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A06E00' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4'/%3E%3Cpath d='M12 3a6 6 0 0 0-3.6 10.8c.6.5 1 1.2 1 2V16h5.2v-.2c0-.8.4-1.5 1-2A6 6 0 0 0 12 3z' fill='%23FFE08A'/%3E%3C/svg%3E") center/contain no-repeat;
}
.explain strong:first-child, .explain b:first-child { color: #2E2610; }
.explain h4, .explain .explain-title { font-family: var(--font-head); font-size: 1.02rem; margin: 0 0 3px; color: #2E2610; }

/* ================= Phone frame ================= */
.phone {
  width: 390px; height: 780px; max-width: 100%;
  margin: 0 auto;
  border: 12px solid #1B222C; border-radius: 46px;
  background: #fff;
  box-shadow: var(--shadow-2), inset 0 0 0 1px rgba(255,255,255,.06);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
.phone::before {
  content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 26px; border-radius: 16px; background: #1B222C; z-index: 3;
}
.phone > * { flex: none; }
.phone-screen, .phone .phone-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding-top: 42px; }
@media (max-width: 440px) {
  .phone { width: 100%; height: 680px; border-width: 9px; border-radius: 36px; }
}

/* ================= Toasts ================= */
#toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none; max-width: calc(100vw - 32px);
}
.toast {
  pointer-events: auto; cursor: pointer;
  display: flex; align-items: flex-start; gap: 10px;
  max-width: 420px; padding: 12px 16px;
  background: #18222F; color: #fff; border-radius: var(--r);
  box-shadow: var(--shadow-2); font-size: 15px; line-height: 1.4;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(4px); }
.toast-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: #7FB2E5; }
.toast-ok .toast-dot { background: #5BD08A; }
.toast-warn .toast-dot { background: #F5B941; }

/* ================= Modal ================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(15, 22, 32, .5);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; transition: opacity .18s ease;
}
.modal-backdrop.in { opacity: 1; }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  transform: translateY(8px); transition: transform .18s ease;
}
.modal-backdrop.in .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.35rem; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ================= States ================= */
.loading-card .card-body, .error-card .card-body { text-align: center; padding: 48px 24px; }
.error-card { border-color: color-mix(in srgb, var(--danger) 35%, white); }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 16px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.avatar { display: inline-block; vertical-align: middle; flex: none; }

/* ================= Overview screen (scoped) ================= */
.ov-hero {
  position: relative; overflow: hidden;
  background: var(--brand); color: var(--brand-ink);
  border-radius: var(--r-lg);
  padding: 44px 44px 40px;
  margin-bottom: 28px;
}
.ov-hero::after {
  /* bunting stripe: brand accent band at the base, like a campaign banner */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 8px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 48px, #fff 48px 56px);
  opacity: .95;
}
.ov-hero h1 {
  color: inherit; font-stretch: 75%; font-weight: 800;
  font-size: clamp(2.2rem, 1.4rem + 3vw, 3.6rem); line-height: 1.02;
  max-width: 17ch; margin-bottom: .35em; letter-spacing: -0.01em;
}
.ov-hero p { font-size: 1.15rem; max-width: 58ch; opacity: .92; margin-bottom: 24px; }
.ov-hero .btn-primary { background: var(--brand-ink); color: var(--brand); border-color: var(--brand-ink); }
.ov-hero .btn-primary:hover { background: color-mix(in srgb, var(--brand-ink) 88%, var(--brand)); color: var(--brand); }
.ov-hero .btn-outline { background: transparent; color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand-ink) 55%, transparent); }
.ov-hero .btn-outline:hover { background: rgba(255,255,255,.1); color: var(--brand-ink); }
.ov-hero-stars { position: absolute; right: -30px; top: -20px; width: 300px; opacity: .14; pointer-events: none; color: var(--brand-ink); }
.ov-hero-county { display: inline-block; font-weight: 600; font-size: 15px; margin-bottom: 14px; opacity: .9; }
.ov-section { margin-top: 40px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.ov-section > h2 { margin-bottom: 4px; }
.ov-section > .ov-lede { color: var(--ink-2); margin-bottom: 18px; max-width: 70ch; }
.ov-diagram { padding: 16px 12px 8px; color: var(--ink); }
.ov-diagram svg { display: block; width: 100%; height: auto; }
.ov-diagram .ov-diagram-m { display: none; }
.ov-group { margin-top: 26px; }
.ov-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ov-group-head h3 { margin: 0; font-size: 1.15rem; }
.ov-group-head .ov-rule { flex: 1; height: 1px; background: var(--line); }
.ov-mod { display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; height: 100%; }
.ov-mod-top { display: flex; align-items: center; gap: 12px; }
.ov-mod-icon {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 10%, white); color: var(--brand);
}
.ov-mod-icon.is-master { background: var(--master-soft); color: var(--master); }
.ov-mod-icon svg { width: 22px; height: 22px; }
.ov-mod h4 { margin: 0; font-size: 1.08rem; }
.ov-mod-titles { display: flex; flex-direction: column; min-width: 0; }
.ov-mod-group { font-size: 13px; font-weight: 600; color: var(--ink-3); line-height: 1.3; }
.ov-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 24px; margin: 0 0 20px; color: var(--ink-2); }
.ov-legend-item strong { color: var(--ink); }
.ov-mod p { color: var(--ink-2); font-size: 15px; flex: 1; margin: 0; }
.ov-mod .row { margin-top: 4px; }
.ov-mod.is-placeholder { background: var(--surface-2); border-style: dashed; }

@media (max-width: 720px) {
  .ov-hero { padding: 28px 22px 32px; }
  .ov-hero-stars { width: 180px; }
  .ov-diagram .ov-diagram-d { display: none; }
  .ov-diagram .ov-diagram-m { display: block; }
  .ov-legend { grid-template-columns: minmax(0, 1fr); }
}

/* ================= Responsive shell ================= */
@media (max-width: 1180px) {
  .switcher-select { max-width: 200px; }
  .acct-first { display: none; }
  .acct-btn { padding-right: 8px; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 108px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .menu-btn { display: inline-flex; flex: none; }
  .wordmark-sub { display: none; }
  .wordmark-name { font-size: 1.15rem; }
  .wordmark-star { width: 26px; height: 26px; }
  /* phone: two-row header. Row 1 = menu, wordmark, tour, account. Row 2 = committee switcher. */
  .topbar { height: var(--topbar-h); flex-wrap: wrap; align-content: center; padding: 6px 10px 8px; row-gap: 6px; }
  .topbar-controls { display: contents; }
  .switcher { order: 2; flex: 1 1 100%; min-width: 0; padding: 2px 8px 3px; }
  .switcher-label { font-size: 11.5px; }
  .switcher-select { font-size: 14px; max-width: none; width: 100%; padding-right: 16px; text-overflow: ellipsis; }
  .btn.btn-tour { min-height: 38px; padding: 6px 10px; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto;
    z-index: 60; width: min(300px, 86vw); overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(-105%); transition: transform .22s ease;
    box-shadow: var(--shadow-2);
  }
  body.drawer-open .sidebar { transform: none; }
  .sidebar-inner { position: static; height: auto; min-height: 100%; overflow: visible; }
  .drawer-backdrop {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 55;
    background: rgba(15,22,32,.4); opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
  .page { padding: 22px 16px 48px; }
}
@media (max-width: 560px) {
  .btn-tour span { display: none; }
  .btn.btn-tour { width: 40px; padding: 0; }
  .topbar { column-gap: 6px; }
  .wordmark { gap: 6px; }
  .wordmark-star { width: 24px; height: 24px; }
  .wordmark-name { max-width: 72px; overflow: hidden; text-overflow: ellipsis; font-size: 1.1rem; }
  .wordmark-name { max-width: 120px; }
  .acct-signin svg { display: none; }
  .acct-signin { padding: 0 14px; font-size: 14.5px; }
  #toasts { left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); align-items: stretch; max-width: none; gap: 8px; }
  .toast { max-width: none; }
}

/* =====================================================================
   Touch targets: on phones and any coarse pointer, every shared control gets a 44×44 hit area.
   Full-size controls grow with min-height; compact ones (.btn-sm, .chip, checkboxes, radios)
   keep their look and get an invisible ::after hit area instead. Desktop with a mouse is unchanged.
   ===================================================================== */
@media (max-width: 640px), (pointer: coarse) {
  .btn { min-height: 44px; }
  .menu-btn { width: 44px; height: 44px; }
  .btn.btn-tour { min-height: 44px; }
  .nav-item { min-height: 44px; }
  .tab { min-height: 44px; display: inline-flex; align-items: center; }
  .input, .select { min-height: 44px; }
  .link-btn { padding: 12px 2px; margin: -12px 0; }

  /* compact controls: same look, 44px tap area centered on them */
  :where(.btn-sm, .chip) { position: relative; }
  .btn-sm::after, .chip::after {
    content: ''; position: absolute; left: 50%; top: 50%;
    width: max(100%, 44px); height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }

  /* checkboxes and radios: a label around them becomes the 44px target; bare ones get bigger boxes */
  input[type="checkbox"]:not(.toggle), input[type="radio"] { width: 22px; height: 22px; margin: 11px; flex: none; }
  label:has(> input[type="checkbox"]), label:has(> input[type="radio"]), .toggle { min-height: 44px; }
  label:has(> input[type="checkbox"]) > input[type="checkbox"]:not(.toggle),
  label:has(> input[type="radio"]) > input[type="radio"] { margin: 0 4px 0 0; }
  /* unstyled labels become flex rows so the 44px min-height applies; classed labels keep their own display */
  label:not([class]):has(> input[type="checkbox"]), label:not([class]):has(> input[type="radio"]) { display: inline-flex; align-items: center; gap: 8px; }
  input[type="checkbox"].toggle { margin: 9px 0; }
}

/* Phone topbar with 44px controls: two 44px rows inside the 108px header. */
@media (max-width: 900px) and (max-width: 640px), (max-width: 900px) and (pointer: coarse) {
  .topbar { padding: 4px 10px 6px; row-gap: 4px; }
  .btn.btn-tour { min-height: 44px; }
  .switcher { position: relative; padding: 0; min-height: 44px; display: block; }
  .switcher-label { position: absolute; left: 9px; top: 4px; pointer-events: none; }
  .switcher-select { display: block; width: 100%; min-height: 42px; padding: 18px 28px 4px 8px; background-position: right 10px center; }
}
@media (max-width: 560px) {
  .btn.btn-tour { width: 44px; }
}
@media (max-width: 380px) {
  .wordmark-name { max-width: 96px; }
}

/* Tab strips that overflow on phones scroll sideways with a soft fade at the right edge. */
@media (max-width: 720px) {
  .tabs {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    padding-right: 24px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs > .tab { flex: none; scroll-snap-align: start; }
}

/* =====================================================================
   Accounts: topbar account control, account sheet, OTP, gate card.
   Layers: account menu 70 · sheet 950 (under toasts 1000, so codes stay visible).
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn { transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .08s ease, box-shadow .15s ease; }
.btn-block { width: 100%; min-height: 48px; }
.btn.is-busy { opacity: .75; cursor: progress; }
.link-btn {
  appearance: none; background: none; border: 0; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: inherit; line-height: inherit; color: var(--brand);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  padding: 10px 2px; margin: -10px 0;
}
.link-btn:hover { color: var(--accent); }

/* page transition: opacity only, so fixed-position children inside screens are never offset */
.screen { animation: screen-in .26s ease both; }
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- topbar account control ---------- */
.acct { position: relative; flex: none; display: flex; }
.acct-signin {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  font: 700 15px/1 var(--font-body);
  background: var(--brand-ink); color: var(--brand); border: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.15);
  transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease;
}
.acct-signin:hover { background: color-mix(in srgb, var(--brand-ink) 90%, var(--brand)); box-shadow: 0 4px 14px -6px rgba(0,0,0,.45); }
.acct-signin:active { transform: translateY(1px); }
.acct-signin:focus-visible, .acct-btn:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,.6); border-radius: 999px; }
.acct-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.1); color: inherit; border: 1px solid rgba(255,255,255,.24);
  font: 600 15px/1 var(--font-body);
  transition: background-color .15s ease, border-color .15s ease;
}
.acct-btn:hover, .acct-btn[aria-expanded="true"] { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.4); }
.acct-btn .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.85); border-radius: 50%; }
.acct-chev { display: inline-flex; opacity: .8; transition: transform .2s ease; }
.acct-btn[aria-expanded="true"] .acct-chev { transform: rotate(180deg); }
.acct-first { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.acct-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 70;
  width: 316px; max-width: calc(100vw - 20px);
  max-height: calc(100vh - var(--topbar-h) - 24px); overflow-y: auto;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 22px 50px -18px rgba(21,32,46,.45), var(--shadow-1);
  padding: 6px;
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity .16s ease, transform .18s cubic-bezier(.2,.8,.2,1);
}
.acct-menu.in { opacity: 1; transform: none; }
.acct-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.acct-head-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.acct-head-txt strong { font-family: var(--font-head); font-stretch: 85%; font-size: 1.12rem; overflow-wrap: anywhere; }
.acct-head-txt span { color: var(--ink-3); font-size: 13.5px; }
.acct-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 44px; padding: 8px 12px; border-radius: var(--r-sm);
  background: none; border: 0; cursor: pointer; text-align: left;
  font: 500 15px/1.25 var(--font-body); color: var(--ink-2);
}
.acct-item svg { flex: none; color: var(--ink-3); }
.acct-item:hover, .acct-item:focus-visible { background: var(--surface-2); color: var(--ink); box-shadow: none; outline: none; }
.acct-item:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 45%, transparent); }
.acct-sample span { display: flex; flex-direction: column; min-width: 0; }
.acct-s-name { font-weight: 600; color: var(--ink); }
.acct-s-role { font-size: 13px; color: var(--ink-3); }
.acct-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.acct-group { margin: 6px 12px 2px; font: 700 12.5px/1.3 var(--font-body); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- account sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(13, 20, 30, .46);
  opacity: 0; transition: opacity .28s ease;
}
.sheet-backdrop.in { opacity: 1; }
.sheet {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(460px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  box-shadow: -24px 0 60px -30px rgba(13,20,30,.55);
  transform: translateX(104%);
  transition: transform .34s cubic-bezier(.2,.8,.2,1);
  outline: none;
}
.sheet-backdrop.in .sheet { transform: none; }
.sheet-backdrop.out .sheet { transition-duration: .24s; transition-timing-function: cubic-bezier(.4,0,1,1); }
.sheet::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--accent); }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; gap: 6px; padding: 18px 14px 6px 24px; }
.sheet-head .sheet-back:not([hidden]) + .sheet-title { padding-left: 0; }
.sheet-head:has(.sheet-back:not([hidden])) { padding-left: 10px; }
.sheet-title { flex: 1; min-width: 0; margin: 0; font-size: 1.55rem; font-weight: 800; font-stretch: 80%; }
.sheet-icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--ink-2); cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.sheet-icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px calc(28px + env(safe-area-inset-bottom, 0px)); }
.sheet-stage { position: relative; overflow-x: clip; padding: 3px; margin: -3px; }
.sheet-step { transition: opacity .24s ease, transform .26s cubic-bezier(.2,.8,.2,1); }
.sheet-step.is-entering { opacity: 0; }
.sheet-step.from-right { transform: translateX(32px); }
.sheet-step.from-left { transform: translateX(-32px); }
.sheet-step.is-leaving { position: absolute; top: 3px; left: 3px; right: 3px; opacity: 0; pointer-events: none; }
.sheet-step.to-left { transform: translateX(-32px); }
.sheet-step.to-right { transform: translateX(32px); }
.sheet-lead { color: var(--ink-2); margin: 2px 0 18px; }
.sheet-progress {
  display: inline-block; margin: 0 0 12px; padding: 3px 10px; border-radius: 999px;
  font: 700 12.5px/1.3 var(--font-body); color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, white);
}
.sheet-reason {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 2px 0 18px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: var(--r-sm); color: var(--ink-2); font-size: 15px;
}
.sheet-reason svg { flex: none; margin-top: 2px; color: var(--brand); }
.sheet-reason p { margin: 0; }
.sheet-form { display: flex; flex-direction: column; }
.sheet-form .btn-block { margin-top: 6px; }
.sheet-note { margin: 14px 0 0; padding: 10px 12px; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); background: var(--info-soft); border-radius: var(--r-sm); }
.sheet-form .sheet-note { margin: 2px 0 12px; }
.sheet-switch { margin: 18px 0 0; text-align: center; font-size: 15px; color: var(--ink-2); }

.fld { margin-bottom: 14px; }
.fld-label { display: block; margin-bottom: 6px; font: 600 14.5px/1.3 var(--font-body); color: var(--ink); }
.fld-hint { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-3); }
.fld-error { margin: 6px 0 0; font-size: 13.5px; font-weight: 600; color: var(--danger); }
.fld-error:empty { display: none; }
.fld.has-error .input, .input[aria-invalid="true"] { border-color: var(--danger); }
.fld.has-error .input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.fld.has-error .fld-hint { display: none; }

.code-lead { display: flex; align-items: center; gap: 14px; margin: 2px 0 18px; }
.code-lead p { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.code-lead strong { color: var(--ink); }
.code-icon {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, white);
}
.otp { display: flex; gap: 10px; margin-bottom: 4px; }
.otp-box {
  width: 50px; height: 58px; min-width: 0; flex: 0 1 50px; padding: 0;
  text-align: center; font: 700 1.6rem/1 var(--font-head); font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: 12px;
  caret-color: var(--accent);
  transition: border-color .15s ease, background-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.otp-box:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); transform: translateY(-1px); }
.otp-box.is-filled { border-color: color-mix(in srgb, var(--brand) 60%, white); background: color-mix(in srgb, var(--brand) 4%, white); }
.otp-box:disabled { opacity: .55; }
.otp.shake { animation: otp-shake .36s ease; }
.otp-error { margin-bottom: 4px; }
@keyframes otp-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.resend-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 44px; margin-top: 10px; font-size: 14.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.sample-accts { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.sample-h { margin: 0; font: 700 12.5px/1.3 var(--font-body); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.sample-sub { margin: 4px 0 12px; font-size: 13.5px; color: var(--ink-3); }
.sample-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sample-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px;
  padding: 10px 12px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  font: inherit; color: inherit;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.sample-btn:hover { border-color: var(--line-strong); background: var(--surface-2); box-shadow: var(--shadow-1); }
.sample-btn:active { transform: scale(.99); }
.sample-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sample-name { font-weight: 700; color: var(--ink); }
.sample-role { font-size: 13.5px; color: var(--ink-3); }
.sample-go { display: inline-flex; color: var(--ink-3); transform: rotate(180deg); transition: transform .18s ease, color .15s ease; }
.sample-btn:hover .sample-go { transform: rotate(180deg) translateX(-3px); color: var(--brand); }

html.sheet-open, html.sheet-open body { overflow: hidden; }
@media (min-width: 641px) {
  html.sheet-open #toasts { right: calc(min(460px, 100vw) + 20px); }
}
@media (max-width: 640px) {
  .sheet {
    top: auto; left: 0; width: 100%;
    max-height: calc(100dvh - 40px); max-height: calc(100vh - 40px);
    border-radius: 20px 20px 0 0; overflow: hidden;
    transform: translateY(104%);
    box-shadow: 0 -20px 50px -24px rgba(13,20,30,.5);
  }
  @supports (height: 100dvh) { .sheet { max-height: calc(100dvh - 40px); } }
  .sheet::before { display: none; }
  .sheet-grab { display: block; width: 40px; height: 5px; border-radius: 999px; background: var(--line-strong); margin: 10px auto 0; flex: none; }
  .sheet-head { padding: 8px 8px 4px 18px; }
  .sheet-head:has(.sheet-back:not([hidden])) { padding-left: 6px; }
  .sheet-title { font-size: 1.4rem; }
  .sheet-body { padding: 6px 18px calc(22px + env(safe-area-inset-bottom, 0px)); }
  /* codes arrive at the top while the bottom sheet is open, so they never cover the code boxes */
  html.sheet-open #toasts { top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; flex-direction: column-reverse; }
}
@media (max-width: 380px) {
  .otp { gap: 7px; }
  .otp-box { height: 54px; font-size: 1.45rem; }
}

/* ---------- gate card (role-gated screens) ---------- */
.gate-page { position: relative; min-height: calc(100vh - var(--topbar-h) - 40px); display: grid; place-items: center; overflow: hidden; }
.gate-ghost {
  position: absolute; inset: 32px; display: flex; flex-direction: column; gap: 18px;
  filter: blur(3px); opacity: .55; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%); mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}
.gate-ghost i { display: block; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-radius: var(--r); }
.gate-ghost .g-h { width: 42%; height: 40px; }
.gate-ghost .g-p { width: 64%; height: 16px; }
.gate-ghost .g-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.gate-ghost .g-row i { height: 110px; border: 1px solid var(--line); background: var(--surface); }
.gate-ghost .g-b { height: 260px; border: 1px solid var(--line); background: var(--surface); }
.gate-card {
  position: relative; width: min(540px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 70px -36px rgba(13,20,30,.5), var(--shadow-1);
  padding: 38px 36px 32px; text-align: center;
  animation: gate-in .36s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes gate-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.gate-icon {
  width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 18%, white);
}
.gate-eyebrow { margin: 0 0 4px; font: 700 12.5px/1.3 var(--font-body); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.gate-card h1 { font-size: clamp(1.7rem, 1.3rem + 1.2vw, 2.2rem); margin: 0 0 10px; }
.gate-text { color: var(--ink-2); font-size: 1.05rem; max-width: 44ch; margin: 0 auto 22px; }
.gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
@media (max-width: 560px) {
  .gate-page { place-items: start center; min-height: 0; padding-top: 28px; }
  .gate-ghost { inset: 16px; }
  .gate-ghost .g-row { grid-template-columns: minmax(0, 1fr); }
  .gate-card { padding: 30px 20px 22px; }
  .gate-actions .btn { width: 100%; min-height: 48px; }
}

/* ---------- toast polish ---------- */
.toast { align-items: flex-start; border: 1px solid rgba(255,255,255,.06); }
.toast-msg { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.toast-error .toast-dot { background: #F28B82; }
.toast-code { background: #101823; box-shadow: 0 18px 40px -18px rgba(0,0,0,.6); }
.toast-code .toast-dot { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.toast-code-line { font-weight: 600; }
.toast b.toast-code {
  display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 6px;
  font: 800 1.15rem/1.3 var(--font-head); letter-spacing: .08em; font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,.12); color: #fff;
}
.toast-sub { font-size: 13.5px; opacity: .78; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important; animation-duration: .01ms !important;
    animation-iteration-count: 1 !important; scroll-behavior: auto !important;
  }
}

/* ================= Invite toast and claim page ================= */
.toast-msg { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.toast-link { display: block; font: 500 13px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; color: #cfe0f2; overflow-wrap: anywhere; word-break: break-all; }
.toast-copy {
  align-self: flex-start; margin-top: 4px; min-height: 36px; padding: 6px 14px; cursor: pointer;
  font: 700 14px/1 var(--font-body); color: #fff; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px; transition: background .15s ease, transform .1s ease;
}
.toast-copy:hover { background: rgba(255,255,255,.24); }
.toast-copy:active { transform: translateY(1px); }
.toast-copy:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.claim-page { display: grid; place-items: start center; padding-top: 48px; }
.claim-card {
  width: min(520px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 70px -36px rgba(13,20,30,.5), var(--shadow-1); padding: 34px 32px 30px;
  animation: gate-in .36s cubic-bezier(.2,.8,.2,1) both;
}
.claim-eyebrow { margin: 0 0 4px; font: 700 12.5px/1.3 var(--font-body); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.claim-card h1 { font-size: clamp(1.6rem, 1.3rem + 1vw, 2rem); margin: 0 0 10px; }
.claim-lead { color: var(--ink-2); font-size: 1.02rem; margin: 0 0 22px; }
.claim-mark { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: 14px; margin-bottom: 14px; background: color-mix(in srgb, var(--brand) 10%, white); color: var(--brand); }
.claim-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.claim-form { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 560px) {
  .claim-page { padding-top: 20px; }
  .claim-card { padding: 26px 18px 22px; }
  .claim-actions .btn { width: 100%; min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) { .claim-card { animation: none; } }

/* Touch targets on phones and coarse pointers */
@media (max-width: 640px), (pointer: coarse) {
  .wordmark { min-height: 44px; }
  .switcher-select { min-height: 44px; }
}
