/* ==========================================================================
   VIGIL PORTAL (affiliate + admin + join)
   Unified with redesign.css: Abyssal Marine (#052E2B), Mineral Alabaster
   (#F6F9F8), Sea Mist (#EAF2F0), Vigil Teal (#0B7A70 / #2DD4BF).
   Typography: Plus Jakarta Sans (display & headings) + Inter (body, tabular-nums).
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

:root {
  --night: #052E2B;
  --night-2: #0A3F3B;
  --teal: #0B7A70;
  --teal-hover: #08635B;
  --teal-soft: #E0F2EE;
  --teal-bright: #2DD4BF;
  --teal-bright-hover: #5EEAD4;

  --ink: #071E22;
  --ink-2: #3D5B61;
  --ink-3: #57747B;

  --ground: #F6F9F8;
  --panel: #FFFFFF;
  --panel-2: #EAF2F0;
  --line: #D4E2DF;
  --line-strong: #B0C7C2;

  --amber: #D97706;
  --amber-ink: #7A4700;
  --amber-bg: #FFF3DD;
  --good: #0F7B4F;
  --good-bg: #E0F4E9;
  --bad: #B42318;
  --bad-bg: #FCE6E3;
  --info-bg: #E5F2F0;

  --focus: #0B7A70;
  --on-night: #F2FAF8;
  --on-night-2: #B1D4CE;
  --night-line: rgba(231, 244, 241, 0.16);

  --r-slab: 20px;
  --r-panel: 14px;
  --r-control: 8px;

  --font-display: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --night: #031D1B;
    --night-2: #082E2B;
    --teal: #2DD4BF;
    --teal-hover: #5EEAD4;
    --teal-soft: #0C3330;
    --ink: #E8F3F1;
    --ink-2: #B3CCC8;
    --ink-3: #8BA8A3;
    --ground: #071619;
    --panel: #0D2125;
    --panel-2: #122A2F;
    --line: #1E393E;
    --line-strong: #2E5258;
    --amber: #F0B357;
    --amber-ink: #FFD08A;
    --amber-bg: #33260C;
    --good: #5BE3A2;
    --good-bg: #0D3324;
    --bad: #FF9A8F;
    --bad-bg: #3D1512;
    --info-bg: #0F2C33;
    --focus: #5EEAD4;
    color-scheme: dark;
  }
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.18; letter-spacing: -0.025em; font-weight: 800; }
a { color: var(--teal); text-underline-offset: 3px; transition: color 160ms var(--ease); }
a:hover { color: var(--teal-hover); }
strong { font-weight: 600; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--night); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 12px; color: #fff; }

/* ── top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 clamp(16px, 3.5vw, 36px);
  background: color-mix(in srgb, var(--ground) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand img { width: 30px; height: 30px; }
.brand small {
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  color: var(--ink-3);
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
}
.topbar-spacer { flex: 1; }
.topbar-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.topbar-link:hover { color: var(--teal); }
.topbar-user {
  font-size: 14px;
  color: var(--ink-3);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .topbar-user { display: none; }
  .topbar-link { display: none; }
}

/* ── admin shell ─────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidebar { padding: 24px 12px; border-right: 1px solid var(--line); }
.nav { display: flex; flex-direction: column; gap: 2px; list-style: none; padding: 0; position: sticky; top: 88px; }
.nav a {
  display: block;
  padding: 9px 14px;
  border-radius: var(--r-control);
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 15px;
  border-left: 3px solid transparent;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.nav a:hover { color: var(--ink); background: var(--panel-2); }
.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--panel);
  border-left-color: var(--teal);
  border-radius: 4px var(--r-control) var(--r-control) 4px;
  box-shadow: 0 1px 0 var(--line);
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; overflow-x: auto; }
  .nav { flex-direction: row; position: static; }
  .nav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; border-radius: 0; }
  .nav a[aria-current="page"] { border-bottom-color: var(--teal); background: none; box-shadow: none; border-radius: 0; }
}

/* ── page layout ─────────────────────────────────────────────────────────── */
.main { padding: clamp(28px, 4vw, 44px) clamp(16px, 4vw, 44px) 84px; max-width: 1120px; width: 100%; }
#app > .main { margin-inline: auto; max-width: 980px; }
.main-narrow { max-width: 720px; margin-inline: auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.page-title { font-size: clamp(28px, 3.4vw, 36px); }
.page-sub { color: var(--ink-2); margin-top: 6px; max-width: 60ch; }
.page-jumps { display: flex; flex-wrap: wrap; gap: 18px; }
.page-jumps a { font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.page-jumps a:hover { color: var(--teal); }
.stack { display: grid; gap: 28px; }
.stack .stack { gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-between { justify-content: space-between; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 28px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.mt-20 { margin-top: 20px; }
.footnote { color: var(--ink-3); font-size: 14px; }

/* ── panels (working surfaces only) ──────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); }
.section { padding: clamp(20px, 2.8vw, 28px); }
.section-plain { padding: 28px 0 0; border-top: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-title { font-size: 20px; }
.section-desc { color: var(--ink-2); font-size: 15px; margin-top: 4px; max-width: 64ch; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-body > * + * { margin-top: 16px; }
.section-body > ul { padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }

.stat { padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); }
.stat-label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.stat-value { font-family: var(--font-display); font-size: clamp(22px, 2.6vw, 28px); font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.stat-hint { font-size: 14px; color: var(--ink-3); }
.stat-good { border-left-color: var(--teal); }
.stat-warn { border-left-color: var(--amber); }
.stat-bad { border-left-color: var(--bad); }

/* ── referral code slab (bright branded teal anchor) ─────────────────────── */
.code-card {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 22px 32px;
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--r-slab);
  background:
    radial-gradient(640px 260px at 88% -10%, rgba(94, 234, 212, 0.24), transparent 70%),
    linear-gradient(135deg, #0D9488 0%, #0B7A70 100%);
  color: #FFFFFF;
  border: 1px solid rgba(11, 122, 112, 0.28);
}
.code-card > div:first-child { display: contents; }
.code-card .code-label { grid-column: 1 / -1; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.84); margin-bottom: -14px; }
.code-card .code {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(38px, 8.6cqi, 88px);
  line-height: 1;
  letter-spacing: 0.04em;
  color: #FFFFFF;
  white-space: nowrap;
}
.code-card .code-meta { grid-column: 1; align-self: end; }
.code-card .code-link { font-size: 15px; color: rgba(255, 255, 255, 0.88); overflow-wrap: anywhere; }
.code-card .code-count { margin-top: 4px; font-size: 15px; color: #FFFFFF; }
.code-card .code-count strong { color: #FFFFFF; font-weight: 800; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.45); text-underline-offset: 3px; }
.code-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 280px; }
.code-actions > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.code-card .btn { background: rgba(255, 255, 255, 0.14); color: #FFFFFF; border-color: rgba(255, 255, 255, 0.30); }
.code-card .btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.24); }
.code-card .btn-copy-code { background: #FFFFFF; color: #0B7A70; border-color: transparent; }
.code-card .btn-copy-code:hover:not(:disabled) { background: #F0FAF8; color: #08635B; }
@media (max-width: 720px) {
  .code-card { grid-template-columns: 1fr; }
  .code-actions { min-width: 0; }
}

/* ── earnings track (signature element) ──────────────────────────────────── */
.track {
  container-type: inline-size;
  display: grid;
  gap: 20px;
  padding: clamp(20px, 2.8vw, 28px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
}
.track-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; }
.track-title { font-size: 20px; }
.track-total { font-size: 15px; color: var(--ink-2); }
.track-total strong { color: var(--ink); font-family: var(--font-display); font-size: 18px; font-weight: 800; }
.track-bar {
  display: flex;
  gap: 3px;
  width: 100%;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.track-bar.is-empty { background: repeating-linear-gradient(135deg, var(--panel-2) 0 8px, var(--line) 8px 9px); }
.track-seg { flex: 1 1 0; min-width: 10px; height: 100%; }
@keyframes track-grow { from { transform: scaleX(0); } }

.tone-pending { background: repeating-linear-gradient(135deg, var(--amber) 0 5px, color-mix(in srgb, var(--amber) 55%, var(--panel)) 5px 9px); }
.tone-available { background: var(--teal); }
.tone-moving { background: repeating-linear-gradient(90deg, var(--teal) 0 6px, color-mix(in srgb, var(--teal) 45%, var(--panel)) 6px 9px); }
.tone-paid { background: var(--night-2); }
.tone-hold { background: repeating-linear-gradient(135deg, var(--bad) 0 4px, color-mix(in srgb, var(--bad) 40%, var(--panel)) 4px 8px); }
@media (prefers-color-scheme: dark) { .tone-paid { background: #3E6E68; } }

.track-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; list-style: none; padding: 0; }
@container (min-width: 560px) {
  .track-legend[data-stages="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .track-legend[data-stages="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .track-legend[data-stages="5"] .track-value { font-size: clamp(18px, 3.2cqi, 24px); }
}
.track-legend li { display: grid; grid-template-columns: 14px 1fr; column-gap: 10px; align-items: baseline; align-content: start; }
.track-key { width: 14px; height: 14px; border-radius: 4px; align-self: center; }
.track-label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.track-value { grid-column: 2; font-family: var(--font-display); font-size: clamp(20px, 3.8cqi, 26px); font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; line-height: 1.25; }
.track-hint { grid-column: 2; font-size: 14px; color: var(--ink-3); margin-top: 2px; }
.track-empty { font-size: 15px; color: var(--ink-2); }

/* ── admin overview ──────────────────────────────────────────────────────── */
.owed { display: grid; gap: 22px; }
.owed-figure { font-family: var(--font-display); font-size: clamp(44px, 7vw, 64px); font-weight: 800; letter-spacing: -0.035em; line-height: 1; }
.owed-caption { color: var(--ink-2); margin-top: 8px; }
.attention { display: grid; gap: 8px; }
.attention-title { font-size: 17px; }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: var(--r-control);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--teal-hover); color: #FFFFFF; }
.btn-ghost { background: var(--panel); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); border-color: var(--ink-3); color: var(--ink); }
.btn-danger { background: var(--bad); color: #FFFFFF; }
.btn-danger:hover:not(:disabled) { opacity: 0.92; }
.btn-link { background: none; border: 0; color: var(--teal); min-height: 0; padding: 4px 0; font-family: var(--font); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-color-scheme: dark) {
  .btn-primary, .btn-primary:hover:not(:disabled) { color: var(--night); }
}

/* ── forms ───────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-weight: 600; font-size: 14px; color: var(--ink); }
.field input:not([type=checkbox]), .field select, .field textarea {
  font-family: var(--font);
  font-size: 16px;
  color: inherit;
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-control);
  padding: 11px 14px;
  min-height: 46px;
  width: 100%;
  transition: border-color 160ms var(--ease);
}
.field input:hover, .field select:hover { border-color: var(--ink-3); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); outline: 3px solid color-mix(in srgb, var(--focus) 24%, transparent); outline-offset: 0; }
.field-help { font-size: 14px; color: var(--ink-3); }
.field-check { display: flex; align-items: flex-start; gap: 10px; }
.field-check input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--teal); }
.field-check label { font-weight: 500; font-size: 15px; }
.form-grid { display: grid; align-items: start; gap: 18px 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-error { color: var(--bad); font-size: 14px; font-weight: 600; }
.row > .field { flex: 1 1 220px; }
.row:has(> .field) { align-items: flex-end; }

/* Searchable bank picker (ARIA combobox). */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; max-height: 240px; overflow-y: auto;
  margin: 0; padding: 6px; list-style: none; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--r-control); box-shadow: 0 16px 40px rgba(3, 22, 24, 0.16);
}
.modal-card .combo-list { position: static; margin-top: 2px; max-height: 210px; box-shadow: none; }
.combo-option { padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: 15px; }
.combo-option:hover { background: var(--panel-2); }
.combo-option[aria-selected="true"] { background: var(--teal-soft); color: var(--ink); font-weight: 600; }
.combo-empty { padding: 9px 12px; color: var(--ink-3); font-size: 15px; }

/* Bank account check result inside the dialog. */
.verify { padding: 14px 16px; border-radius: var(--r-control); font-size: 15px; min-height: 52px; }
.verify-idle, .verify-checking { background: var(--panel-2); color: var(--ink-2); }
.verify-checking p::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite;
}
.verify-bad { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.verify-ok { background: var(--good-bg); border-left: 4px solid var(--good); border-radius: 4px var(--r-control) var(--r-control) 4px; }
.verify-label { font-size: 14px; font-weight: 700; color: var(--good); }
.verify-name { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); margin-top: 2px; overflow-wrap: anywhere; }
.verify-meta { color: var(--ink-2); }
.verify-ask { margin-top: 8px; color: var(--ink); font-weight: 600; }
.modal-card .modal-fields + .modal-error { margin-top: 14px; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
.filters .field { width: min(100%, 240px); }
.filters form { flex: 1 1 320px; max-width: 460px; flex-wrap: nowrap; }
.filters form .field { width: auto; flex: 1; }

/* ── tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--panel); }
.section .table-wrap { border-radius: var(--r-control); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 14px; font-weight: 600; color: var(--ink-3); padding: 12px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table .num { text-align: right; font-weight: 600; }
.table tbody tr:hover td { background: var(--panel-2); }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
@media (max-width: 640px) {
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-top: 1px solid var(--line); padding: 8px 0; }
  .table tr:first-child { border-top: 0; }
  .table td { border: 0; display: flex; justify-content: space-between; gap: 12px; padding: 5px 16px; text-align: right; }
  .table td::before { content: attr(data-label); font-weight: 600; color: var(--ink-3); text-align: left; }
  .table td:empty, .table td[data-label=""]::before { display: none; }
}

/* Status dot in tables and headers */
.badge { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.badge-good { color: var(--good); }
.badge-good::before { background: var(--good); }
.badge-warn { color: var(--amber-ink); }
.badge-warn::before { background: var(--amber); }
.badge-bad { color: var(--bad); }
.badge-bad::before { background: var(--bad); }
.badge-muted::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }

/* ── notices ─────────────────────────────────────────────────────────────── */
.notice {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-radius: 4px var(--r-control) var(--r-control) 4px; border-left: 4px solid var(--teal);
  background: var(--info-bg); color: var(--ink); font-size: 15px;
}
.notice > p { flex: 1 1 280px; }
.notice-warn { background: var(--amber-bg); border-left-color: var(--amber); }
.notice-bad { background: var(--bad-bg); border-left-color: var(--bad); }
.notice-good { background: var(--good-bg); border-left-color: var(--good); }
.notice-actions { display: flex; gap: 8px; }
.notice .btn-ghost { background: transparent; }

.empty { padding: 32px 20px; text-align: center; color: var(--ink-2); border: 1.5px dashed var(--line-strong); border-radius: var(--r-control); }
.load-more { display: flex; justify-content: center; margin-top: 14px; }
.skeleton-block { display: grid; gap: 12px; max-width: 720px; }
.skeleton-line { height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--line), var(--panel-2), var(--line)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton-line:first-child { height: 34px; width: 45%; margin-bottom: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Genuine numbered sequence */
.steps { display: grid; gap: 16px; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start; color: var(--ink-2); }
.steps li strong { color: var(--ink); }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--teal);
  color: var(--teal);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
}

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 20px; font-size: 15px; }
.kv dt { color: var(--ink-3); }
.kv dd { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.modal-card .kv, .section-body > .kv { padding: 14px 16px; background: var(--panel-2); border-radius: var(--r-control); }
.kv + .btn { margin-top: 18px; }

/* ── sign in & onboarding ────────────────────────────────────────────────── */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: clamp(20px, 4vw, 48px) 16px; }
.auth-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  width: 100%;
  max-width: 960px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-slab);
  overflow: hidden;
}
.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: clamp(28px, 4vw, 44px);
  background:
    radial-gradient(520px 300px at 90% 10%, rgba(20, 184, 166, 0.16), transparent 68%),
    var(--panel-2);
  color: var(--ink);
  border-right: 1px solid var(--line);
}
.auth-mark { width: 56px; height: 56px; }
.auth-aside-body { display: grid; gap: 14px; }
.auth-aside-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--ink);
  max-width: 16ch;
}
.auth-aside-copy { color: var(--ink-2); font-size: 15px; max-width: 36ch; }
.auth-points {
  list-style: none;
  padding: 0;
  margin-top: 8px;
  border-top: 1px solid var(--line-strong);
}
.auth-points li {
  padding: 11px 0;
  border-bottom: 1px solid var(--line-strong);
  font-size: 14px;
  color: var(--ink);
}
.auth-card { padding: clamp(28px, 4vw, 48px); }
.auth-card h1 { font-size: 30px; }
.auth-card .lead { color: var(--ink-2); margin: 8px 0 26px; }
.auth-card form { display: grid; gap: 16px; }
.auth-card form .btn { margin-top: 4px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 20px; font-size: 15px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 14px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 780px) {
  .auth-frame { grid-template-columns: 1fr; max-width: 500px; }
  .auth-aside { gap: 20px; padding: 28px; }
  .auth-aside-title { max-width: none; }
}

/* ── modal ───────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(5, 30, 28, 0.58); backdrop-filter: blur(2px); animation: fade 0.16s ease-out; }
.modal-card { background: var(--panel); color: var(--ink); width: 100%; max-width: 500px; max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 18px; padding: 28px; box-shadow: 0 28px 72px rgba(0, 0, 0, 0.28); animation: pop 0.18s var(--ease); }
.modal-title { font-size: 22px; margin-bottom: 8px; }
.modal-message { color: var(--ink-2); margin-bottom: 16px; }
.modal-message p + p { margin-top: 8px; }
.modal-fields { display: grid; gap: 14px; margin-top: 4px; }
.modal-error { margin-top: 12px; padding: 10px 14px; border-radius: var(--r-control); background: var(--bad-bg); color: var(--bad); font-size: 14px; font-weight: 600; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ── toasts ──────────────────────────────────────────────────────────────── */
.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { padding: 13px 16px; border-radius: 12px; background: var(--night); color: #FFFFFF; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22); font-size: 15px; font-weight: 600; animation: pop 0.2s var(--ease); }
.toast-success { background: var(--good); color: #FFFFFF; }
.toast-error { background: var(--bad); color: #FFFFFF; }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity 220ms var(--ease), transform 220ms var(--ease); }

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

/* ── public /join page ───────────────────────────────────────────────────── */
.card.auth-card { width: 100%; max-width: 560px; border-radius: var(--r-slab); }
.card.auth-card .code-card { grid-template-columns: 1fr; margin-bottom: 8px; }
.card.auth-card .code-card .btn { justify-self: start; }

/* ── sandbox mode (?sandbox=1) ───────────────────────────────────────────── */
.mode-banner {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 16px; padding: 9px 16px;
  background: repeating-linear-gradient(135deg, var(--night) 0 14px, var(--night-2) 14px 28px); color: #FFD08A;
  font-size: 14px; font-weight: 700;
}
.mode-banner .btn-link { color: #FFFFFF; font-size: 14px; }
