/* ==========================================================
   RANK CULTURE — Design System v1.0
   One logo. Three fonts. Seven text sizes. Nothing else.
   ========================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Colour */
  --ink: #0B0B0C;
  --paper: #FAFAF8;
  --surface: #FFFFFF;
  --muted: #5C5F6B;
  --line-soft: #E3E3E0;
  --blue: #2D50CD;
  --blue-ink: #1E3AA8;
  --blue-soft: #EAEEFF;
  --green: #12805C;
  --green-soft: #E3F5EC;
  --amber: #A86200;
  --amber-soft: #FFF2DB;
  --red: #BA1A1A;
  --red-soft: #FFE5E2;

  /* Type families — the ONLY three allowed */
  --f-display: "Space Grotesk", system-ui, sans-serif;  /* headings, labels, buttons */
  --f-body: "Inter", system-ui, sans-serif;             /* paragraphs, inputs */
  --f-mono: "JetBrains Mono", ui-monospace, monospace;  /* scores, ranks, timers only */

  /* Type scale — the ONLY seven sizes allowed */
  --t-display: 64px;  --lh-display: 68px;
  --t-h1: 40px;       --lh-h1: 46px;
  --t-h2: 28px;       --lh-h2: 34px;
  --t-h3: 20px;       --lh-h3: 26px;
  --t-body: 16px;     --lh-body: 24px;
  --t-sm: 14px;       --lh-sm: 20px;
  --t-xs: 12px;       --lh-xs: 16px;

  /* Spacing (8pt) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  --border: 2px solid var(--ink);
  --border-thin: 1px solid var(--line-soft);
  --shadow: 4px 4px 0 var(--ink);
  --max: 1200px;
  --header-h: 64px;
}

@media (max-width: 768px) {
  :root {
    --t-display: 40px; --lh-display: 46px;
    --t-h1: 28px; --lh-h1: 34px;
    --t-h2: 20px; --lh-h2: 26px;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--f-body); font-size: var(--t-body); line-height: var(--lh-body);
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- Typography (use these, never raw sizes) ---------- */
.t-display { font-family: var(--f-display); font-size: var(--t-display); line-height: var(--lh-display); font-weight: 700; letter-spacing: -0.03em; text-transform: uppercase; }
.t-h1 { font-family: var(--f-display); font-size: var(--t-h1); line-height: var(--lh-h1); font-weight: 700; letter-spacing: -0.02em; text-transform: uppercase; }
.t-h2 { font-family: var(--f-display); font-size: var(--t-h2); line-height: var(--lh-h2); font-weight: 700; letter-spacing: -0.01em; text-transform: uppercase; }
.t-h3 { font-family: var(--f-display); font-size: var(--t-h3); line-height: var(--lh-h3); font-weight: 700; text-transform: uppercase; }
.t-body { font-size: var(--t-body); line-height: var(--lh-body); }
.t-sm { font-size: var(--t-sm); line-height: var(--lh-sm); }
.t-xs { font-size: var(--t-xs); line-height: var(--lh-xs); }
.label { font-family: var(--f-display); font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.mono { font-family: var(--f-mono); font-weight: 700; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.blue { color: var(--blue); }
.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }
.accent { color: var(--blue); }
.lead { font-size: var(--t-body); line-height: var(--lh-body); color: var(--muted); max-width: 60ch; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--s5); }
.section { padding: var(--s9) 0; border-bottom: var(--border); }
.section-sm { padding-top: var(--s7); padding-bottom: var(--s7); }
.stack > * + * { margin-top: var(--s4); }
.stack-lg > * + * { margin-top: var(--s6); }
.row { display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; gap: var(--s5); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.step-row { grid-template-columns: 120px 1fr; border-bottom: var(--border-thin); padding-bottom: var(--s6); }
@media (max-width: 960px) { .g3, .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span2 { grid-column: span 2; } }
@media (max-width: 640px) { .step-row { grid-template-columns: 1fr; gap: var(--s2); } .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } .section { padding: var(--s8) 0; } }

.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); padding-bottom: var(--s4); margin-bottom: var(--s6); border-bottom: var(--border); flex-wrap: wrap; }

/* ---------- Logo (the one lockup) ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: var(--t-h3); line-height: 1; letter-spacing: -0.02em; text-transform: uppercase; white-space: nowrap; }
.logo svg { width: 28px; height: 28px; flex: none; }
.logo.on-dark { color: #fff; }

/* ---------- Header ---------- */
.header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: var(--surface); border-bottom: var(--border); }
.header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s5); }
.nav { display: flex; gap: var(--s5); }
.nav a { font-family: var(--f-display); font-size: var(--t-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.active { color: var(--ink); border-bottom-color: var(--blue); }
.header-actions { display: flex; align-items: center; gap: var(--s3); }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.icon-btn:hover { background: var(--paper); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--blue); border: 2px solid var(--surface); border-radius: 50%; }
.avatar { width: 36px; height: 36px; border: var(--border); background: var(--blue-soft); display: inline-flex; align-items: center; justify-content: center; font-family: var(--f-display); font-weight: 700; font-size: var(--t-xs); flex: none; }
.avatar.lg { width: 72px; height: 72px; font-size: var(--t-h3); }
.menu-btn { display: none; }
@media (max-width: 960px) {
  .header .nav, .header .hide-m { display: none; }
  .menu-btn { display: inline-flex; }
}

/* Mobile drawer */
.drawer { position: fixed; inset: 0; z-index: 100; display: none; }
.drawer.open { display: block; }
.drawer-bg { position: absolute; inset: 0; background: rgba(11,11,12,.5); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); background: var(--surface); border-left: var(--border); padding: var(--s5); display: flex; flex-direction: column; gap: var(--s2); overflow-y: auto; }
.drawer-panel a.dl { font-family: var(--f-display); font-weight: 700; text-transform: uppercase; font-size: var(--t-body); padding: var(--s3) 0; border-bottom: var(--border-thin); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s5); font-family: var(--f-display); font-size: var(--t-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border: var(--border); background: var(--surface); color: var(--ink); transition: transform .08s, box-shadow .08s, background .15s; white-space: nowrap; }
.btn:hover { box-shadow: var(--shadow); transform: translate(-2px, -2px); }
.btn:active { box-shadow: none; transform: none; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { box-shadow: none; transform: none; text-decoration: underline; }
.btn-lg { min-height: 56px; padding: 0 var(--s6); font-size: var(--t-body); }
.btn-sm { min-height: 36px; padding: 0 var(--s4); font-size: var(--t-xs); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.link { font-family: var(--f-display); font-size: var(--t-sm); font-weight: 700; text-transform: uppercase; color: var(--blue); }
.link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: var(--border); padding: var(--s5); }
.card-lg { padding: var(--s6); }
.card.dark { background: var(--ink); color: #fff; }
.card.dark .muted { color: #A9ABB5; }
.card.blue { background: var(--blue); color: #fff; }
.card.blue .muted { color: #D5DDFF; }
.card.soft { background: var(--blue-soft); }
.card.hover:hover { box-shadow: var(--shadow); transform: translate(-2px, -2px); transition: .08s; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); margin-bottom: var(--s4); }

/* ---------- Chips, badges, tiers ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--s3); border: var(--border); font-family: var(--f-display); font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface); }
.chip.on, .chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
button.chip:hover { background: var(--paper); }
button.chip.on:hover { background: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-family: var(--f-display); font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; background: var(--paper); border: 1px solid var(--ink); }
.badge.blue { background: var(--blue); color: #fff; border-color: var(--blue); }
.badge.green { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.badge.dark { background: var(--ink); color: #fff; }
.badge.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .2; } }

/* ---------- Progress ---------- */
.bar { height: 10px; border: 1.5px solid var(--ink); background: var(--surface); }
.bar > i { display: block; height: 100%; background: var(--ink); }
.bar.blue > i { background: var(--blue); }
.bar.thin { height: 6px; border-width: 1px; }
.on-dark .bar, .card.dark .bar { border-color: #fff; background: transparent; }
.card.dark .bar > i { background: #fff; }
.card.dark .bar.blue > i { background: var(--blue); }

/* ---------- Score block ---------- */
.score { display: flex; align-items: baseline; gap: 6px; }
.score .num { font-family: var(--f-mono); font-weight: 700; font-size: var(--t-display); line-height: 1; letter-spacing: -0.04em; }
.score .of { font-family: var(--f-mono); font-size: var(--t-h3); color: var(--muted); }
.kpi .v { font-family: var(--f-mono); font-weight: 700; font-size: var(--t-h2); line-height: var(--lh-h2); }

/* ---------- Lists / tables ---------- */
.list > * { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s4) 0; border-bottom: var(--border-thin); }
.list > *:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: var(--border); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th { text-align: left; font-family: var(--f-display); font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: var(--s3) var(--s4); border-bottom: var(--border); background: var(--paper); white-space: nowrap; }
td { padding: var(--s3) var(--s4); border-bottom: var(--border-thin); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.me td { background: var(--blue-soft); }
.rank-pos { font-family: var(--f-mono); font-weight: 700; font-size: var(--t-body); width: 48px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--f-display); font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: var(--s3) var(--s4); border: var(--border); background: var(--surface); font-size: var(--t-body); border-radius: 0; }
textarea.input { min-height: 120px; resize: vertical; }
.input:focus { outline: none; box-shadow: var(--shadow); }
.input.error { border-color: var(--red); }
.hint { font-size: var(--t-xs); color: var(--muted); }
.check { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--t-sm); }
.check input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; margin-top: 2px; }
.toggle { position: relative; width: 48px; height: 28px; border: var(--border); background: var(--surface); flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--ink); transition: .15s; }
.toggle[aria-checked="true"] { background: var(--blue); }
.toggle[aria-checked="true"]::after { left: 23px; background: #fff; }
.divider { display: flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: var(--t-xs); text-transform: uppercase; font-family: var(--f-display); font-weight: 700; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

/* ---------- Option tiles (onboarding, quiz) ---------- */
.option { display: block; width: 100%; text-align: left; padding: var(--s5); border: var(--border); background: var(--surface); }
.option:hover { box-shadow: var(--shadow); transform: translate(-2px,-2px); }
.option.selected { background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--blue); border-color: var(--blue); }
.option .key { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border: var(--border); font-family: var(--f-mono); font-weight: 700; font-size: var(--t-sm); margin-right: var(--s3); }
.option.selected .key { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0; border-bottom: var(--border); overflow-x: auto; }
.tabs button, .tabs a { padding: var(--s3) var(--s5); font-family: var(--f-display); font-size: var(--t-sm); font-weight: 700; text-transform: uppercase; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs .on { color: var(--ink); border-bottom-color: var(--blue); }

/* ---------- App shell (logged in) ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.sidebar { border-right: var(--border); background: var(--surface); padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s5); position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; }
.rank-pill { border: var(--border); padding: var(--s3); display: flex; gap: var(--s3); align-items: center; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s3); font-family: var(--f-display); font-size: var(--t-sm); font-weight: 700; text-transform: uppercase; }
.side-nav a:hover { background: var(--paper); }
.side-nav a.active { background: var(--ink); color: #fff; }
.side-nav svg { width: 18px; height: 18px; flex: none; }
.side-nav .count { margin-left: auto; font-family: var(--f-mono); font-size: var(--t-xs); background: var(--blue); color: #fff; padding: 0 6px; }
.main { padding: var(--s6) var(--s6) var(--s8); min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.page-head .t-h1 { margin-top: var(--s2); }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: var(--s5) var(--s4) 104px; }
}

/* Bottom nav — mobile only */
.bottom-nav { display: none; }
@media (max-width: 960px) {
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 68px; background: var(--surface); border-top: var(--border); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-family: var(--f-display); font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; color: var(--muted); }
  .bottom-nav a.active { color: var(--blue); }
  .bottom-nav svg { width: 22px; height: 22px; }
}

/* ---------- Auth split ---------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - var(--header-h)); }
.auth-side { background: var(--ink); color: #fff; padding: var(--s8) var(--s7); display: flex; flex-direction: column; justify-content: space-between; gap: var(--s7); }
.auth-side .muted { color: #A9ABB5; }
.auth-form { padding: var(--s8) var(--s7); display: flex; align-items: center; justify-content: center; }
.auth-form > div { width: 100%; max-width: 420px; }
@media (max-width: 960px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-form { padding: var(--s7) var(--s5); } }

/* ---------- Steps ---------- */
.steps { display: flex; gap: var(--s2); }
.steps > div { flex: 1; }
.steps .seg { height: 6px; background: var(--line-soft); margin-bottom: var(--s2); }
.steps .done .seg, .steps .now .seg { background: var(--blue); }
.steps .now .label { color: var(--blue); }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #fff; padding: var(--s8) 0 var(--s6); }
.footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s6); }
.footer h4 { font-family: var(--f-display); font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #A9ABB5; margin-bottom: var(--s3); }
.footer ul { list-style: none; display: grid; gap: var(--s2); font-size: var(--t-sm); }
.footer a:hover { color: #9DB1FF; }
.footer .base { margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid #2A2B30; font-size: var(--t-xs); color: #A9ABB5; display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
@media (max-width: 768px) { .footer .cols { grid-template-columns: 1fr 1fr; } .footer .cols > :first-child { grid-column: span 2; } }

/* ---------- States ---------- */
.empty { border: 2px dashed var(--ink); padding: var(--s8) var(--s5); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s4); background: var(--surface); }
.empty .icon { width: 56px; height: 56px; border: var(--border); display: flex; align-items: center; justify-content: center; }
.skel { background: linear-gradient(90deg, #EEEEEB 0%, #F7F7F5 50%, #EEEEEB 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.banner { border: var(--border); padding: var(--s4) var(--s5); display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.banner.red { background: var(--red-soft); border-color: var(--red); }
.banner.blue { background: var(--blue-soft); }
.banner.amber { background: var(--amber-soft); border-color: var(--amber); }

/* ---------- Hero ---------- */
.hero { padding: var(--s9) 0 var(--s8); border-bottom: var(--border); }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--s8); align-items: center; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; gap: var(--s7); } .hero { padding: var(--s8) 0 var(--s7); } }
.eyebrow { display: inline-flex; align-items: center; gap: var(--s2); }
.marquee { overflow: hidden; border-bottom: var(--border); background: var(--blue); color: #fff; white-space: nowrap; }
.marquee div { display: inline-block; padding: var(--s3) 0; animation: scroll 40s linear infinite; }
.marquee span { margin: 0 var(--s6); font-family: var(--f-display); font-weight: 700; text-transform: uppercase; font-size: var(--t-sm); }
@keyframes scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee div, .badge.live::before, .skel { animation: none; } }

/* ---------- Comparison ---------- */
.vs { display: grid; grid-template-columns: 1fr 1fr; border: var(--border); }
.vs > div { padding: var(--s6); }
.vs > div:first-child { border-right: var(--border); background: var(--paper); }
.vs > div:last-child { background: var(--ink); color: #fff; }
.vs li { list-style: none; padding: var(--s3) 0; border-bottom: 1px solid currentColor; border-color: rgba(127,127,127,.25); font-size: var(--t-sm); display: flex; gap: var(--s3); }
@media (max-width: 640px) { .vs { grid-template-columns: 1fr; } .vs > div:first-child { border-right: 0; border-bottom: var(--border); } }

/* ---------- Arena ---------- */
.arena-top { background: var(--ink); color: #fff; border-bottom: var(--border); position: sticky; top: var(--header-h); z-index: 30; }
.arena-top .container { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 64px; flex-wrap: wrap; padding-top: var(--s2); padding-bottom: var(--s2); }
.timer { font-family: var(--f-mono); font-weight: 700; font-size: var(--t-h2); }
.timer.low { color: #FF8A80; }
.q-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.q-dots span { width: 28px; height: 28px; border: 1.5px solid #fff; display: flex; align-items: center; justify-content: center; font-family: var(--f-mono); font-size: var(--t-xs); }
.q-dots .done { background: #fff; color: var(--ink); }
.q-dots .cur { background: var(--blue); border-color: var(--blue); }
.code { background: var(--ink); color: #E6E8F0; font-family: var(--f-mono); font-size: var(--t-sm); line-height: var(--lh-sm); padding: var(--s5); overflow-x: auto; white-space: pre; border: var(--border); font-weight: 400; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 120; display: none; align-items: center; justify-content: center; padding: var(--s5); background: rgba(11,11,12,.6); }
.modal.open { display: flex; }
.modal > .card { width: 100%; max-width: 520px; box-shadow: 8px 8px 0 var(--ink); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 130; background: var(--ink); color: #fff; padding: var(--s3) var(--s5); font-family: var(--f-display); font-size: var(--t-sm); font-weight: 700; text-transform: uppercase; transition: .2s; pointer-events: none; border: 2px solid var(--ink); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Messages ---------- */
.inbox { display: grid; grid-template-columns: 320px 1fr; border: var(--border); background: var(--surface); height: calc(100vh - 220px); min-height: 520px; }
.inbox-list { border-right: var(--border); overflow-y: auto; }
.inbox-list button { width: 100%; text-align: left; padding: var(--s4); border-bottom: var(--border-thin); display: flex; gap: var(--s3); }
.inbox-list button.on { background: var(--blue-soft); box-shadow: inset 4px 0 0 var(--blue); }
.thread { display: flex; flex-direction: column; min-width: 0; }
.thread-body { flex: 1; overflow-y: auto; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.msg { max-width: 72%; padding: var(--s3) var(--s4); border: var(--border); font-size: var(--t-sm); background: var(--surface); }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; }
.thread-input { border-top: var(--border); padding: var(--s3); display: flex; gap: var(--s3); }
@media (max-width: 768px) { .inbox { grid-template-columns: 1fr; height: auto; } .inbox-list { max-height: 260px; border-right: 0; border-bottom: var(--border); } .thread-body { min-height: 360px; } }

/* ---------- Utilities ---------- */
.mt1{margin-top:var(--s2)} .mt2{margin-top:var(--s4)} .mt3{margin-top:var(--s5)} .mt4{margin-top:var(--s6)} .mt5{margin-top:var(--s7)}
.mb2{margin-bottom:var(--s4)} .mb3{margin-bottom:var(--s5)}
.center { text-align: center; }
.w-full { width: 100%; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }
.bg-white { background: var(--surface); }
.bt { border-top: var(--border); }
.icon { width: 20px; height: 20px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.proto-flag { position: fixed; right: 12px; bottom: 12px; z-index: 60; background: var(--amber-soft); border: 1.5px solid var(--amber); color: var(--amber); padding: 4px 10px; font-family: var(--f-display); font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; }
.proto-flag:hover { background: var(--amber); color: #fff; }
@media (max-width: 960px) { .proto-flag { display: none; } }
