/* ======================================================================
   Ledgerly — design system
   Direction: premium fintech. Ink navy shell + airy light workspace,
   single emerald accent, Space Grotesk display / Plus Jakarta Sans text.
   ====================================================================== */
:root {
  --ink-900: #0b1120;
  --ink-800: #111a2e;
  --ink-700: #1b2740;
  --ink-600: #24324f;

  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f2f5f9;
  --border: #e5eaf1;
  --border-strong: #d5dde8;

  --text: #101828;
  --text-2: #475467;
  --text-3: #8a97a8;
  --text-onink: #e7edf6;
  --text-onink-2: #93a2bd;

  --accent: #10b981;
  --accent-600: #059669;
  --accent-700: #047857;
  --accent-soft: #e7f8f1;

  --pos: #059669;
  --neg: #e11d48;
  --pos-soft: #e7f8f1;
  --neg-soft: #fdeaef;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px -4px rgba(16, 24, 40, .10), 0 2px 6px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22);
  --sidebar-w: 250px;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: "Space Grotesk", var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
::selection { background: var(--accent-soft); color: var(--accent-700); }

/* number columns */
.tabnum { font-variant-numeric: tabular-nums; }

/* ===================== AUTH ===================== */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--ink-900);
}
.auth__aside {
  position: relative;
  color: var(--text-onink);
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    radial-gradient(1000px 600px at 12% -10%, rgba(16,185,129,.28), transparent 60%),
    radial-gradient(900px 700px at 100% 110%, rgba(59,130,246,.18), transparent 55%),
    var(--ink-900);
}
.auth__aside::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(700px 500px at 30% 30%, #000, transparent 75%);
  pointer-events: none;
}
.auth__aside > * { position: relative; z-index: 1; }
.auth__pitch h2 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.12;
  color: #fff;
  max-width: 15ch;
  margin-bottom: 16px;
}
.auth__pitch p { color: var(--text-onink-2); max-width: 40ch; font-size: 16px; }
.auth__stats { display: flex; gap: 34px; margin-top: 30px; }
.auth__stat .n { font-family: var(--display); font-size: 26px; color: #fff; }
.auth__stat .l { color: var(--text-onink-2); font-size: 13px; }

.auth__panel {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth__card {
  width: 100%;
  max-width: 400px;
}
.auth__card h1 { font-size: 26px; margin-bottom: 6px; }
.auth__card .sub { color: var(--text-2); margin-bottom: 26px; }

.brand {
  display: inline-flex; align-items: center; gap: 11px;
  font-family: var(--display); font-weight: 700; font-size: 19px;
}
.brand__logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(150deg, var(--accent), var(--accent-700));
  display: grid; place-items: center; color: #fff; font-weight: 800;
  box-shadow: 0 6px 16px -4px rgba(16,185,129,.6);
  font-family: var(--display);
}
.brand--onink { color: #fff; }
.brand__mark { display: block; flex: none; filter: drop-shadow(0 6px 16px rgba(16,185,129,.28)); }

/* forms */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--text-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14.5px;
  transition: transform .06s ease, background .15s, box-shadow .15s, border-color .15s, color .15s;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-600));
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(5,150,105,.7);
}
.btn--primary:hover { box-shadow: 0 8px 20px -6px rgba(5,150,105,.85); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--neg-soft); color: var(--neg); }
.btn--danger:hover { background: #fbdbe3; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 11px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.auth__switch { text-align: center; margin-top: 20px; color: var(--text-2); font-size: 14px; }
.auth__switch a { color: var(--accent-700); font-weight: 600; cursor: pointer; }

.alert {
  padding: 11px 13px; border-radius: var(--radius-sm);
  font-size: 13.5px; margin-bottom: 16px; display: none;
}
.alert--err { display: block; background: var(--neg-soft); color: #a3122f; border: 1px solid #f6c6cf; }

/* ===================== APP SHELL ===================== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--ink-900);
  color: var(--text-onink);
  display: flex; flex-direction: column;
  padding: 20px 16px;
  position: fixed; inset: 0 auto 0 0; height: 100vh;
  z-index: 40;
}
.sidebar__brand { padding: 6px 8px 22px; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav__label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-onink-2); padding: 14px 12px 6px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-onink-2); font-weight: 500; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: rgba(16,185,129,.16); color: #fff; }
.nav a.active svg { color: var(--accent); }

.sidebar__user {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 14px; margin-top: 10px;
  display: flex; align-items: center; gap: 11px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(150deg, var(--accent), var(--accent-700));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}
.sidebar__user .meta { overflow: hidden; }
.sidebar__user .nm { color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.sidebar__user .em { color: var(--text-onink-2); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.logout { margin-left: auto; color: var(--text-onink-2); background: none; border: none; padding: 6px; border-radius: 8px; }
.logout:hover { color: #fff; background: rgba(255,255,255,.07); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  height: 66px; background: rgba(246,248,251,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px; position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 20px; }
.topbar .spacer { flex: 1; }
.hamburger { display: none; background: none; border: 1px solid var(--border-strong); border-radius: 9px; padding: 8px; }
.page { padding: 26px 28px 60px; max-width: 1180px; }

/* ===================== CARDS / GRID ===================== */
.grid { display: grid; gap: 18px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.col-3-2 { grid-template-columns: 1.4fr 1fr; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__pad { padding: 20px; }
.card__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card__head h3 { font-size: 15.5px; }
.card__head .hint { color: var(--text-3); font-size: 13px; }

/* stat cards */
.stat { position: relative; overflow: hidden; }
.stat .lab { color: var(--text-2); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.stat .ico svg { width: 18px; height: 18px; }
.stat .val { font-family: var(--display); font-size: 27px; font-weight: 700; margin-top: 12px; letter-spacing: -.02em; }
.stat .val.pos { color: var(--pos); }
.stat .val.neg { color: var(--neg); }
.stat .meta { color: var(--text-3); font-size: 12.5px; margin-top: 4px; }
.stat--accent { background: linear-gradient(155deg, var(--ink-800), var(--ink-900)); border-color: var(--ink-700); color: #fff; }
.stat--accent .lab { color: var(--text-onink-2); }
.stat--accent .ico { background: rgba(16,185,129,.18); color: var(--accent); }
.stat--accent .val { color: #fff; }
.stat--accent .meta { color: var(--text-onink-2); }

/* ===================== TABLE ===================== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.amt-pos { color: var(--pos); }
.amt-neg { color: var(--neg); }
.desc-main { font-weight: 600; color: var(--text); }
.desc-sub { color: var(--text-3); font-size: 12.5px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill--in { background: var(--pos-soft); color: var(--pos); }
.pill--ex { background: var(--neg-soft); color: var(--neg); }
.pill--muted { background: var(--surface-2); color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--text-3); padding: 6px; border-radius: 8px; display: grid; place-items: center; transition: .12s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.del:hover { background: var(--neg-soft); color: var(--neg); }
.icon-btn svg { width: 16px; height: 16px; }

/* ===================== FILTERS / TOOLBAR ===================== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar .grow { flex: 1; }
.select-sm, .input-sm { padding: 9px 11px; font-size: 13.5px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); outline: none; }
.select-sm:focus, .input-sm:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ===================== EMPTY STATE ===================== */
.empty { text-align: center; padding: 52px 20px; color: var(--text-2); }
.empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-700); display: grid; place-items: center; margin: 0 auto 16px; }
.empty .ico svg { width: 26px; height: 26px; }
.empty h3 { font-size: 17px; color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 34ch; margin: 0 auto 18px; font-size: 14px; }

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,17,32,.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; z-index: 100; opacity: 0; animation: fade .18s forwards;
  overflow-y: auto;
}
@keyframes fade { to { opacity: 1; } }
.modal {
  background: var(--surface); width: 100%; max-width: 480px;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.99); animation: pop .2s forwards;
}
@keyframes pop { to { transform: translateY(0) scale(1); } }
.modal__head { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal__head h3 { font-size: 17px; }
.modal__body { padding: 20px 22px; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; width: 100%; }
.seg button { flex: 1; border: none; background: transparent; padding: 9px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--text-2); transition: .15s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button.on[data-t="income"] { color: var(--pos); }
.seg button.on[data-t="expense"] { color: var(--neg); }

/* ===================== REPORTS ===================== */
.pl-line { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--border); font-size: 14.5px; }
.pl-line:last-child { border-bottom: none; }
.pl-line .cat { color: var(--text-2); }
.pl-total { display: flex; justify-content: space-between; padding: 14px 0 2px; font-family: var(--display); font-weight: 700; font-size: 16px; }
.pl-net { margin-top: 16px; padding: 16px 18px; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; font-family: var(--display); }
.pl-net.pos { background: var(--pos-soft); color: var(--pos); }
.pl-net.neg { background: var(--neg-soft); color: var(--neg); }
.pl-net .big { font-size: 22px; font-weight: 700; }

.legend { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.legend .item { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.legend .item .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend .item .nm { color: var(--text-2); }
.legend .item .vl { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

.chart-box { position: relative; height: 300px; }
.chart-box--sm { height: 240px; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; margin: 4px 0 12px; }

/* toast */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink-800); color: #fff; padding: 12px 16px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-size: 14px; display: flex; align-items: center; gap: 10px;
  animation: toastin .2s ease; max-width: 340px;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.toast.err .dot { background: var(--neg); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

.skeleton { background: linear-gradient(90deg, var(--surface-2), #e9eef4, var(--surface-2)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; }
@keyframes sh { to { background-position: -200% 0; } }

.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.mini-item:last-child { border-bottom: none; }
.mini-item .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.mini-item .ic.in { background: var(--pos-soft); color: var(--pos); }
.mini-item .ic.ex { background: var(--neg-soft); color: var(--neg); }
.mini-item .ic svg { width: 17px; height: 17px; }
.mini-item .txt { min-width: 0; flex: 1; }
.mini-item .txt .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-item .txt .s { color: var(--text-3); font-size: 12.5px; }
.mini-item .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.acct-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.acct-item:last-child { border-bottom: none; }
.acct-item .ab { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.acct-item .ab svg { width: 19px; }
.acct-item .an { font-weight: 600; }
.acct-item .as { color: var(--text-3); font-size: 12.5px; }
.acct-item .abal { margin-left: auto; text-align: right; font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }

.scrim { display: none; }

/* ===================== BRAND BYLINE ===================== */
.brand__tt { display: inline-flex; flex-direction: column; line-height: 1.05; }
.brand__nm { font-family: var(--display); font-weight: 700; }
.brand__by { font-size: 10px; font-weight: 500; letter-spacing: .02em; color: var(--text-3); font-family: var(--font); margin-top: 1px; }
.brand--onink .brand__by { color: var(--text-onink-2); }

/* ===================== STATUS BADGES ===================== */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.st-draft { background: var(--surface-2); color: var(--text-2); }
.badge.st-sent { background: #eef4ff; color: #2563eb; }
.badge.st-ok { background: var(--accent-soft); color: var(--accent-700); }
.badge.st-bad { background: var(--neg-soft); color: #a3122f; }

/* ===================== DOC EDITOR ===================== */
.modal.modal--wide { max-width: 720px; }
.items-head { display: grid; grid-template-columns: 1fr 74px 110px 100px 34px; gap: 8px; padding: 0 2px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 700; }
.items-head span:nth-child(2), .items-head span:nth-child(3), .items-head span:nth-child(4) { text-align: right; }
.item-row { display: grid; grid-template-columns: 1fr 74px 110px 100px 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.item-row .input { padding: 9px 10px; font-size: 14px; }
.item-row [data-f="qty"], .item-row [data-f="unit_price"] { text-align: right; }
.item-amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; color: var(--text-2); }
.doc-tot { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; color: var(--text-2); }
.doc-tot span:last-child { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.doc-tot.grand { border-top: 2px solid var(--border-strong); margin-top: 6px; padding-top: 10px; font-family: var(--display); font-size: 17px; font-weight: 700; color: var(--text); }
.doc-tot.grand span:last-child { font-size: 17px; }

/* doc detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.detail-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; margin-bottom: 4px; }
.detail-val { font-weight: 600; }
.detail-sub { color: var(--text-3); font-size: 12.5px; }
.doc-tbl td { padding: 10px 14px; }
.doc-tbl td.d { font-weight: 600; }
.doc-tbl td.n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ===================== SETTINGS ===================== */
.settings-wrap { display: flex; flex-direction: column; gap: 18px; max-width: 720px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch-row input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); position: relative; flex: none; transition: background .18s; cursor: pointer; }
.switch-row input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .18s; }
.switch-row input[type="checkbox"]:checked { background: var(--accent); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(18px); }

/* ===================== RESPONSIVE ===================== */
/* hamburger icon must be visible & correctly sized on mobile */
.hamburger { color: var(--text); }
.hamburger svg { width: 22px; height: 22px; display: block; }
/* keep large stat numbers from overflowing on small screens */
.stat .val { overflow-wrap: anywhere; }
@media (max-width: 1080px) {
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .col-3-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
}
@media (max-width: 780px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; width: 258px; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(11,17,32,.45); z-index: 35; }
  .main { margin-left: 0; }
  .hamburger { display: inline-grid; place-items: center; }
  .cards-4 { grid-template-columns: 1fr 1fr; }
  .cards-2 { grid-template-columns: 1fr; }
  .page { padding: 18px 16px 60px; }
  .topbar { padding: 0 16px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .cards-4 { grid-template-columns: 1fr; }
}

/* mobile: shrink large stat numbers so long currency values sit comfortably */
@media (max-width: 780px) {
  .stat .val { font-size: 22px; }
  .stat--accent .val { font-size: 23px; }
}
@media (max-width: 460px) {
  .stat .val { font-size: 21px; }
  .stat--accent .val { font-size: 22px; }
}
