/* =====================================================================
   Aptenix Ledger — design system
   Two skins, one set of tokens:
     data-theme="bank"  warm paper, ink, mint  (the customer's app)
     data-theme="ops"   graphite, mint, coral  (the bank's console)
   ===================================================================== */

:root {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --paper: #fbf9f5;
  --paper-2: #f4f0e8;
  --card: #ffffff;
  --ink: #14181f;
  --ink-2: #46505f;
  --mut: #7c8797;
  --line: #e8e2d6;
  --line-2: #d8d1c2;
  --mint: #0e7c5a;
  --mint-2: #0a6146;
  --mint-soft: #e7f4ef;
  --coral: #c2492f;
  --coral-soft: #fbeae5;
  --gold: #a9762a;
  --gold-soft: #f8efdc;
  --blue: #2b5b9e;
  --blue-soft: #e8effa;
  --shadow: 0 1px 2px rgba(20, 24, 31, .05), 0 12px 28px -18px rgba(20, 24, 31, .35);
  --shadow-lg: 0 24px 60px -30px rgba(20, 24, 31, .5);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --topbar: 62px;
  --rail: 236px;
}

body[data-theme="ops"] {
  --paper: #0e1116;
  --paper-2: #131820;
  --card: #161c25;
  --ink: #f2f5f8;
  --ink-2: #b8c2ce;
  --mut: #7b8798;
  --line: #232b36;
  --line-2: #2e3947;
  --mint: #3fe0b0;
  --mint-2: #24c496;
  --mint-soft: rgba(63, 224, 176, .12);
  --coral: #ff6b57;
  --coral-soft: rgba(255, 107, 87, .13);
  --gold: #f0b45a;
  --gold-soft: rgba(240, 180, 90, .13);
  --blue: #6fa8ff;
  --blue-soft: rgba(111, 168, 255, .13);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 34px -22px rgba(0, 0, 0, .8);
  --shadow-lg: 0 30px 70px -34px #000;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(720px 420px at 88% -8%, var(--mint-soft), transparent 62%),
    radial-gradient(600px 380px at 2% 4%, var(--gold-soft), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}
body[data-theme="ops"] {
  background-image:
    radial-gradient(760px 420px at 92% -6%, rgba(63, 224, 176, .10), transparent 60%),
    radial-gradient(680px 400px at 0% 0%, rgba(111, 168, 255, .08), transparent 60%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--mint-soft); }

/* ─────────── top bar ─────────── */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--mint), var(--mint-2));
  color: #fff;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  box-shadow: 0 6px 16px -8px var(--mint);
}
body[data-theme="ops"] .brand-mark { color: #06110d; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.18; min-width: 0; }
.brand-txt b { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.brand-txt small { font-size: 10.5px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-gap { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  padding: 5px 9px; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--line);
  color: var(--ink-2);
  cursor: pointer;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.chip.live { color: var(--mint); border-color: color-mix(in srgb, var(--mint) 35%, var(--line)); background: var(--mint-soft); }
.chip.warn { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); background: var(--gold-soft); }

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  transition: .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); transform: translateY(-1px); }
.only-mobile { display: none; }

.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--mint-soft);
  color: var(--mint);
  font-weight: 600; font-size: 12.5px; letter-spacing: .04em;
  cursor: pointer;
}

/* ─────────── rail ─────────── */
.rail {
  position: fixed;
  top: var(--topbar); left: 0; bottom: 0;
  width: var(--rail);
  display: flex; flex-direction: column;
  padding: 16px 12px 12px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  z-index: 30;
}
.rail-scroll { flex: 1; overflow-y: auto; }
.rail-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mut); font-weight: 600;
  margin: 6px 0 8px 12px;
}
.rail nav { display: flex; flex-direction: column; gap: 1px; margin-bottom: 14px; }
.rail nav a, .tabbar a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 11px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  transition: .14s;
}
.rail nav a:hover { background: var(--paper-2); color: var(--ink); }
.rail nav a.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.rail nav a.on i { color: var(--mint); }
.rail nav a i { display: grid; place-items: center; color: var(--mut); }
.rail nav.ops-only, .rail p.ops-only { display: none; }
body[data-theme="ops"] .rail nav.ops-only { display: flex; }
body[data-theme="ops"] .rail p.ops-only { display: block; }
body[data-theme="ops"] .rail-label#railLabel { display: none; }
body[data-theme="ops"] .rail nav#navBank { display: none; }

.rail-foot { border-top: 1px solid var(--line); padding-top: 10px; }
.mini { display: flex; justify-content: space-between; align-items: baseline; padding: 3px 12px; }
.mini span { font-size: 11.5px; color: var(--mut); }
.mini b { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.fine { font-size: 9.5px; line-height: 1.5; color: var(--mut); margin: 10px 12px 0; opacity: .8; }

/* ─────────── stage ─────────── */
#view {
  margin: var(--topbar) 0 0 var(--rail);
  padding: 24px 26px 80px;
  max-width: 1220px;
  outline: none;
}
.tabbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 {
  margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.02em;
  font-family: var(--serif); font-weight: 600;
}
.page-head p { margin: 5px 0 0; color: var(--mut); font-size: 13.5px; max-width: 72ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─────────── buttons ─────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary {
  background: linear-gradient(160deg, var(--mint), var(--mint-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 10px 24px -14px var(--mint);
}
body[data-theme="ops"] .btn.primary { color: #06110d; }
.btn.soft { background: var(--mint-soft); color: var(--mint); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--coral-soft); color: var(--coral); border-color: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─────────── cards / grids ─────────── */
.grid { display: grid; gap: 14px; }
.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)); }
.g23 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.g32 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card.flat { box-shadow: none; }
.card.tight { padding: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-h h2, .card-h h3 {
  margin: 0; font-size: 13px; font-weight: 600;
  letter-spacing: .02em; color: var(--ink);
}
.card-h .sub { font-size: 11.5px; color: var(--mut); font-weight: 500; }
.card-h a { font-size: 12.5px; color: var(--mint); font-weight: 600; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.hstack { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ─────────── money ─────────── */
.money { font-family: var(--serif); font-weight: 600; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.balance-hero { font-size: 42px; line-height: 1.05; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); font-weight: 600; }
.kpi .val { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.kpi .val.sm { font-size: 20px; }
.kpi .delta { font-size: 12px; color: var(--mut); margin-top: 2px; }
.pos { color: var(--mint); }
.neg { color: var(--coral); }
.warnc { color: var(--gold); }
.mono { font-family: var(--mono); font-size: 12px; }
.mut { color: var(--mut); }
.nowrap { white-space: nowrap; }
.num { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ─────────── account hero ─────────── */
.account-card {
  position: relative;
  border-radius: var(--r-xl);
  padding: 20px;
  color: #fff;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, .18), transparent 55%),
    linear-gradient(150deg, #0f3d31, #0e7c5a 55%, #0a5a44);
  overflow: hidden;
  box-shadow: 0 24px 48px -30px rgba(14, 124, 90, .9);
}
.account-card .acc-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.account-card .acc-no { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; opacity: .85; }
.account-card .acc-bal { font-family: var(--serif); font-size: 36px; font-weight: 600; margin: 10px 0 2px; }
.account-card.fd { background: linear-gradient(150deg, #4a3212, #a9762a 60%, #7a531b); box-shadow: 0 24px 48px -30px rgba(169, 118, 42, .9); }
.account-card.loan { background: linear-gradient(150deg, #1e2f4d, #2b5b9e 60%, #1d3f70); box-shadow: 0 24px 48px -30px rgba(43, 91, 158, .9); }

/* ─────────── rows / lists ─────────── */
.row-list { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: .12s;
}
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: var(--paper-2); border-radius: 10px; }
.row-item .ic {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--paper-2); color: var(--ink-2);
}
.row-item .ic.in { background: var(--mint-soft); color: var(--mint); }
.row-item .ic.out { background: var(--coral-soft); color: var(--coral); }
.row-item .ic.gold { background: var(--gold-soft); color: var(--gold); }
.row-item .txt { flex: 1; min-width: 0; }
.row-item .txt b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .txt small { display: block; font-size: 11.5px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .amt { text-align: right; font-family: var(--mono); font-size: 13px; font-weight: 500; white-space: nowrap; }
.row-item .amt small { display: block; font-size: 10.5px; color: var(--mut); font-family: var(--sans); }

/* ─────────── badges ─────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  background: var(--paper-2); color: var(--ink-2);
  white-space: nowrap;
}
.badge.ok { background: var(--mint-soft); color: var(--mint); }
.badge.warn { background: var(--gold-soft); color: var(--gold); }
.badge.bad { background: var(--coral-soft); color: var(--coral); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.plain { background: transparent; border: 1px solid var(--line-2); }

.tag { font-family: var(--mono); font-size: 10.5px; padding: 2px 6px; border-radius: 6px; background: var(--paper-2); color: var(--ink-2); }

/* ─────────── forms ─────────── */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--mut); font-weight: 500; }
input, select, textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line-2);
  color: var(--ink);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
input.amount {
  font-family: var(--serif); font-size: 32px; font-weight: 600;
  padding: 12px 14px; text-align: center; letter-spacing: -.02em;
}
textarea { min-height: 74px; resize: vertical; }
.hint { font-size: 11.5px; color: var(--mut); }
.err { font-size: 12px; color: var(--coral); }

.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--paper-2); border-radius: 11px; border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; color: var(--mut);
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 9px; cursor: pointer;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: .18s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .18s; }
.switch input:checked + span { background: var(--mint); }
.switch input:checked + span::after { left: 21px; }

/* ─────────── tables ─────────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--mut); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.tbl td.wrap { white-space: normal; min-width: 180px; }
table.tbl tr.click { cursor: pointer; }
table.tbl tr.click:hover { background: var(--paper-2); }
table.tbl tr.total td { font-weight: 700; border-top: 2px solid var(--line-2); border-bottom: 0; }

/* ─────────── charts ─────────── */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 74px; }
.bars i { flex: 1; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--mint), color-mix(in srgb, var(--mint) 30%, transparent)); min-height: 3px; }
.bars i.bad { background: linear-gradient(180deg, var(--coral), color-mix(in srgb, var(--coral) 25%, transparent)); }
.spark { display: block; width: 100%; height: 52px; }
.hbar { display: flex; flex-direction: column; gap: 10px; }
.hbar .row { display: grid; grid-template-columns: 132px 1fr 72px; align-items: center; gap: 10px; font-size: 12.5px; }
.hbar .track { height: 8px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--blue)); }
.hbar .row b { font-family: var(--mono); font-size: 11.5px; text-align: right; }
.ring-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.legend span { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.legend b { margin-left: auto; font-family: var(--mono); font-size: 11.5px; }

/* ─────────── risk / explainability ─────────── */
.risk-banner {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: var(--r);
  padding: 13px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.risk-banner.bad { background: var(--coral-soft); border-color: color-mix(in srgb, var(--coral) 30%, var(--line)); }
.risk-banner.warn { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 30%, var(--line)); }
.risk-banner.ok { background: var(--mint-soft); border-color: color-mix(in srgb, var(--mint) 25%, var(--line)); }
.risk-banner b { display: block; font-size: 13px; margin-bottom: 2px; }
.risk-banner p { margin: 0; font-size: 12.5px; color: var(--ink-2); }

.reason { display: grid; grid-template-columns: 1fr 110px 46px; gap: 10px; align-items: center; font-size: 12.5px; }
.reason .track { height: 6px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.reason .fill { height: 100%; border-radius: 999px; background: var(--coral); }
.reason .fill.mid { background: var(--gold); }
.reason b { font-family: var(--mono); font-size: 11.5px; text-align: right; }
.reason small { display: block; color: var(--mut); font-size: 11px; }

.score-pill { font-family: var(--mono); font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; }
.score-pill.low { background: var(--mint-soft); color: var(--mint); }
.score-pill.mid { background: var(--gold-soft); color: var(--gold); }
.score-pill.high { background: var(--coral-soft); color: var(--coral); }

/* ─────────── quick actions ─────────── */
.quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.quick a {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 8px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  transition: .15s;
}
.quick a:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.quick a i { color: var(--mint); }

/* ─────────── sheets / modal ─────────── */
.scrim { position: fixed; inset: 0; background: rgba(12, 16, 22, .5); backdrop-filter: blur(3px); z-index: 60; animation: fade .16s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; z-index: 61;
  left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100vw);
  max-height: 88vh; overflow-y: auto;
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translate(-50%, 14px); opacity: .6; } to { transform: translate(-50%, 0); opacity: 1; } }
.sheet h3 { margin: 0 0 4px; font-size: 17px; font-family: var(--serif); font-weight: 600; }
.sheet p.sub { margin: 0 0 16px; color: var(--mut); font-size: 13px; }
.sheet-foot { display: flex; gap: 8px; margin-top: 18px; }
.sheet-foot .btn { flex: 1; }
.grab { width: 42px; height: 4px; border-radius: 999px; background: var(--line-2); margin: -8px auto 14px; }

/* ─────────── toast ─────────── */
.toast-wrap { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--mint);
  color: var(--ink); font-size: 13px;
  padding: 11px 14px; border-radius: 12px;
  box-shadow: var(--shadow-lg); max-width: 340px;
  animation: slide .2s ease-out;
}
.toast.bad { border-left-color: var(--coral); }
.toast.warn { border-left-color: var(--gold); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─────────── misc ─────────── */
.empty { text-align: center; padding: 34px 18px; color: var(--mut); font-size: 13px; }
.empty b { display: block; color: var(--ink); font-size: 14.5px; margin-bottom: 4px; font-family: var(--serif); }
.note { font-size: 12px; color: var(--mut); border: 1px dashed var(--line-2); border-radius: 12px; padding: 11px 13px; }
.kv { display: grid; grid-template-columns: 132px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--mut); font-size: 12.5px; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-word; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline .step { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline .step::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline .step:last-child::before { display: none; }
.timeline .dotm { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--card); flex: none; margin-top: 3px; }
.timeline .step.done .dotm { background: var(--mint); border-color: var(--mint); }
.timeline .step.now .dotm { background: var(--card); border-color: var(--mint); box-shadow: 0 0 0 4px var(--mint-soft); }
.timeline b { font-size: 13px; display: block; }
.timeline small { color: var(--mut); font-size: 11.5px; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: var(--r); overflow: hidden; }
.stat-strip > div { background: var(--card); padding: 13px 14px; }
.scroll-y { max-height: 460px; overflow-y: auto; }
.hl { color: var(--mint); font-weight: 600; }
.sep { height: 8px; }
.pill-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; }
.pill-row .pill { white-space: nowrap; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.pill-row .pill.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ─────────── auth screen (no seat chosen yet) ─────────── */
body.is-auth .rail, body.is-auth .tabbar { display: none; }
body.is-auth #view { margin-left: 0; padding: 28px 24px 60px; max-width: 1080px; margin-right: auto; }
body.is-auth .topbar { position: static; background: transparent; border-bottom: 0; backdrop-filter: none; }
body.is-auth #view { margin-top: 0; }
@media (max-width: 960px) {
  body.is-auth #view { padding: 16px 14px 40px; }
}

/* ─────────── responsive ─────────── */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g23, .g32 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  :root { --rail: 0px; }
  .only-mobile { display: grid; }
  .rail {
    width: 250px; transform: translateX(-104%);
    transition: transform .22s ease-out;
    background: var(--paper); box-shadow: var(--shadow-lg);
    z-index: 45;
  }
  .rail.open { transform: none; }
  #view { margin-left: 0; padding: 16px 14px 96px; }
  .tabbar {
    display: flex; position: fixed; inset: auto 0 0 0;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 35;
  }
  .tabbar a { flex: 1; flex-direction: column; gap: 3px; font-size: 10px; padding: 6px 2px; border-radius: 10px; }
  .tabbar a.on { color: var(--mint); }
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .balance-hero { font-size: 34px; }
  .quick { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast-wrap { left: 14px; right: 14px; bottom: 78px; }
  .toast { max-width: none; }
  .brand-txt small { display: none; }
}
@media (max-width: 560px) {
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 22px; }
  .card { padding: 15px; border-radius: var(--r); }
  .account-card { padding: 16px; }
  .account-card .acc-bal { font-size: 30px; }
  .quick { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .quick a { padding: 10px 2px; font-size: 9.5px; }
  .reason { grid-template-columns: 1fr 60px 40px; }
  .kv { grid-template-columns: 106px 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── connection panel (sign-in screen and sheets) ───────────────────── */
.conn-key { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.conn-key input {
  flex: 1 1 230px; min-width: 0; padding: 8px 10px; font-size: 11.5px;
  font-family: var(--mono); border-radius: 9px;
}
.conn-diag { margin-top: 8px; font-size: 11.5px; color: var(--mut); }
.conn-diag summary { cursor: pointer; font-weight: 500; }
.conn-diag pre {
  white-space: pre-wrap; word-break: break-all; margin: 6px 0 0;
  padding: 8px 10px; border-radius: 9px; font-family: var(--mono); font-size: 11px;
  background: rgba(0, 0, 0, .045); color: var(--ink-2);
}
