:root {
  --bg: #F4F7F5; --card: #FFFFFF; --line: #E1E8E4; --line2: #EEF2F0; --fg: #0E1C17; --muted: #52625C;
  --brand: #0B6B4E; --brand-ink: #FFFFFF; --hero: #0B3D2E; --hero-2: #072B20; --hero-fg: #FFFFFF; --hero-sub: #CFE6DC; --chip: #1E6B50;
  --neg: #B54708; --pos: #0B6B4E; --warn-bg: #FEF0E6; --warn-fg: #7A2E05; --mask: #D5DFDA; --input: #C9D4CF; --soft: #E3ECE7;
  --g-prop: #8A5A2B; --g-inv: #0B6B4E; --g-bank: #2563EB; --g-ret: #7C3AED; --g-gold: #C38A12; --g-other: #64748B; --g-liab: #B54708;
  --area: #E3F1EB; --shadow: 0 1px 2px rgba(14, 28, 23, .04);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1310; --card: #121E19; --line: #23332C; --line2: #1B2A23; --fg: #E6EFEA; --muted: #9DB2A9;
    --brand: #3CC58F; --brand-ink: #062118; --hero: #0F3B2D; --hero-2: #0A2B21; --hero-sub: #BFDCCF; --chip: #1F6A4F;
    --neg: #F49A55; --pos: #4FD19C; --warn-bg: #3A2416; --warn-fg: #FBCB9F; --mask: #2C3D35; --input: #34463E; --soft: #1C2B25;
    --g-prop: #C48A55; --g-inv: #3CC58F; --g-bank: #6C9BFF; --g-ret: #A98BFA; --g-gold: #E2B33E; --g-other: #94A3B8; --g-liab: #F49A55;
    --area: rgba(60, 197, 143, .14); --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.4;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; letter-spacing: -.2px; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 16px; font-weight: 800; }
h3 { font-size: 18px; font-weight: 800; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
:focus-visible { outline: 3px solid var(--g-bank); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small, small { font-size: 12px; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
.r { float: right; }

/* ---------- Layout ---------- */
.layout { min-height: 100vh; }
.main { padding: calc(20px + env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom)); max-width: 1440px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border-radius: 12px;
  color: var(--muted); font-size: 11px; font-weight: 600; }
.nav a.on { color: var(--brand); font-weight: 800; }
.nav .nav-settings, .nav-brand, .nav-foot { display: none; }

@media (max-width: 599px) { .tablet-up { display: none !important; } }
@media (max-width: 1099px) { .desk-only { display: none !important; } }

@media (min-width: 600px) {
  .only-phone { display: none !important; }
  .layout { display: flex; }
  .nav { position: sticky; top: 0; height: 100vh; width: 88px; flex: none; border: 0; background: var(--hero); display: flex; flex-direction: column;
    align-items: center; gap: 6px; padding: calc(22px + env(safe-area-inset-top)) 8px 20px; }
  .nav a { width: 70px; min-height: 62px; color: var(--hero-sub); }
  .nav a.on { background: var(--chip); color: #FFFFFF; }
  .nav .nav-settings { display: flex; }
  .nav-brand { display: flex; width: 44px; height: 44px; border-radius: 12px; background: #FFFFFF; color: #0B3D2E; align-items: center; justify-content: center; margin-bottom: 14px; }
  .nav-brand span { display: none; }
  .main { flex: 1; min-width: 0; padding: calc(26px + env(safe-area-inset-top)) 28px 32px; gap: 16px; }
}
@media (min-width: 1100px) {
  .not-desk { display: none !important; }
  .nav { width: 236px; align-items: stretch; padding: 28px 16px 20px; }
  .nav a { width: auto; min-height: 46px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; font-size: 14px; }
  .nav-brand { width: auto; height: auto; background: none; color: #FFFFFF; justify-content: flex-start; gap: 10px; padding: 0 6px; margin-bottom: 22px; }
  .nav-brand svg { background: #FFFFFF; color: #0B3D2E; border-radius: 11px; padding: 9px; width: 40px; height: 40px; }
  .nav-brand span { display: inline; font-size: 17px; font-weight: 800; }
  .nav-foot { display: flex; flex-direction: column; gap: 12px; margin-top: auto; border-top: 1px solid var(--chip); padding: 16px 6px 0; color: #FFFFFF; font-size: 13px; font-weight: 700; }
  .nav-foot small { color: var(--hero-sub); font-weight: 500; }
  .main { padding: 30px 32px; gap: 20px; }
}

/* ---------- Header ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.top .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; color: var(--fg); padding: 0; }
.icon-btn:disabled { opacity: .45; cursor: default; }
.syncing .spin-when-busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons ---------- */
.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--input); background: var(--card); font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.dark { background: var(--hero); color: #FFFFFF; border-color: var(--hero); }
.btn.outline { background: transparent; border-color: var(--brand); color: var(--brand); }
.btn.white { background: #FFFFFF; color: #0B3D2E; border: 0; }
.btn.danger { color: var(--neg); border-color: var(--neg); background: transparent; }
.btn.ghost-light { background: transparent; color: #FFFFFF; border-color: var(--chip); }
.btn.big { width: 100%; min-height: 56px; font-size: 16px; border-radius: 16px; }
.btn.wide { width: 100%; min-height: 48px; }
.btn.grow { flex: 1; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--brand); font-weight: 700; padding: 8px 0; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }
.link.light { color: var(--hero-sub); }
.link-row { background: none; border: 0; padding: 0; color: inherit; font-weight: 700; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

/* ---------- Cards and tiles ---------- */
.card, .tile { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.card { padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.list-card { padding: 4px 0; gap: 0; }
.card h2.pad, .pad { padding: 12px 16px 4px; }
.tile { padding: 14px; display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--fg); min-width: 0; }
.tile .lbl, .lbl { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tile .tv { font-size: 22px; font-weight: 800; }
.tile .ts { font-size: 12px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.g-prop-bg { background: var(--g-prop); } .g-inv-bg { background: var(--g-inv); } .g-bank-bg { background: var(--g-bank); }
.g-ret-bg { background: var(--g-ret); } .g-gold-bg { background: var(--g-gold); } .g-other-bg { background: var(--g-other); } .g-liab-bg { background: var(--g-liab); }
.g-prop-stroke { stroke: var(--g-prop); } .g-inv-stroke { stroke: var(--g-inv); } .g-bank-stroke { stroke: var(--g-bank); }
.g-ret-stroke { stroke: var(--g-ret); } .g-gold-stroke { stroke: var(--g-gold); } .g-other-stroke { stroke: var(--g-other); }

.grid5 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid5 .span2 { grid-column: 1 / -1; }
.grid5 .tile:last-child { grid-column: 1 / -1; }
@media (min-width: 600px) { .grid5 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } .grid5 .tile:last-child { grid-column: auto; } }
@media (min-width: 1000px) { .grid5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .grid5 .span2 { grid-column: span 2; } }

.hero { background: var(--hero); color: var(--hero-fg); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hero .lbl { color: var(--hero-sub); font-size: 13px; }
.hero .big { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.hero-sub { font-size: 12px; color: var(--hero-sub); }
.row-sb { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-sb.wrap, .row-gap.wrap { flex-wrap: wrap; }
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chip { background: var(--chip); color: #FFFFFF; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }
.chip.down { background: #7A3A12; }
.chip.sm { font-size: 11px; padding: 2px 8px; background: var(--soft); color: var(--fg); }
.card .chip:not(.sm) { background: var(--soft); color: var(--fg); }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--soft); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { min-height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--fg); font-weight: 800; }
.seg.dark { background: var(--hero-2); }
.seg.dark button { color: var(--hero-sub); }
.seg.dark button.on { background: #FFFFFF; color: #0B3D2E; }
@media (max-width: 380px) { .hero .row-sb { flex-direction: column; align-items: flex-start; } .hero .big { font-size: 38px; } }

.alert { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border-radius: 16px; border: 0; background: var(--warn-bg); color: var(--warn-fg); font-weight: 600; font-size: 13px; text-align: left; }
.alert span { flex: 1; }
.banner { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600; }

.spark-card { text-align: left; color: var(--fg); }
.chart { display: block; width: 100%; min-width: 0; }
.chart svg { display: block; max-width: 100%; }
.spark .stroke, .line .stroke { stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .end, .line .end { fill: var(--card); stroke: var(--brand); stroke-width: 2.5; }
.line .area { fill: var(--area); }
.line .grid { stroke: var(--line2); stroke-width: 1; }
.line .dot { fill: var(--brand); }
.line .ax { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.line .hline { stroke: var(--brand); stroke-dasharray: 3 3; }
.line .tip { fill: var(--fg); }
.line .tip-d { fill: var(--bg); font-size: 11px; font-family: var(--font); }
.line .tip-v { fill: var(--bg); font-size: 13px; font-weight: 800; font-family: var(--font); }
.line { touch-action: pan-y; }
.donut .donut-l { fill: var(--muted); font-weight: 600; font-family: var(--font); }
.donut .donut-v { fill: var(--fg); font-weight: 800; font-family: var(--font); }
.donut-empty { stroke: var(--line); }

.cols2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 900px) { .cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols2.wide-first { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.cols-desk { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.stack-lg { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { min-height: 100%; }

.donut-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut-row .chart { width: 176px; flex: none; }
.donut-row.big .chart { width: 220px; }
@media (max-width: 420px) { .donut-row .chart { width: 140px; } .donut-row.big .chart { width: 150px; } .donut-row { gap: 12px; } }
.legend { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; }
.leg, .grp-h { display: flex; align-items: center; gap: 8px; min-height: 34px; font-size: 13px; }
.lg-n { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-p { color: var(--muted); width: 46px; text-align: right; }
.lg-v { font-weight: 800; width: 78px; text-align: right; }
.kv { display: grid; grid-template-columns: auto; gap: 2px 0; font-size: 13px; }
.kv b { font-size: 18px; margin-bottom: 6px; }
.kv2 { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv2 span { color: var(--muted); }
.sublist { border-top: 1px solid var(--line2); padding-top: 6px; }
.li { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 42px; border-top: 1px solid var(--line2); font-size: 13px; }
.sublist .li:first-child, .card > .li:first-of-type { border-top: 0; }
.li.strong { font-weight: 800; }
.r2 { display: flex; gap: 14px; align-items: center; }
.r2 b { min-width: 72px; text-align: right; }

.grp { border-top: 1px solid var(--line2); }
.grp:first-child { border-top: 0; }
.grp-h { width: 100%; background: none; border: 0; padding: 8px 16px; min-height: 52px; font-size: 14px; text-align: left; color: var(--fg); }
.grp-b { padding: 0 0 6px 18px; }
.irow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; border-top: 1px solid var(--line2); background: none; text-align: left; color: var(--fg); min-height: 56px; }
.list-card > .irow:first-child, .grp-b .irow:first-child { border-top: 0; }
.irow.tap:hover { background: var(--soft); }
.irow .in { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.irow .it { font-size: 14px; font-weight: 700; }
.irow .isub { font-size: 12px; color: var(--muted); }
.irow .iv { font-size: 15px; font-weight: 800; flex: none; }
.miss, .stale { font-size: 12px; font-weight: 700; color: var(--warn-fg); background: var(--warn-bg); border-radius: 6px; padding: 1px 6px; align-self: flex-start; }
h2.sec { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; margin: 6px 2px -4px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats div { background: var(--bg); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stats > div > span { font-size: 11px; font-weight: 600; color: var(--muted); }
.stats b { font-size: 16px; }
.stats small { color: var(--muted); }

input.search { min-height: 38px; width: 220px; max-width: 100%; border: 1px solid var(--input); border-radius: 10px; padding: 0 12px; background: var(--card); font-size: 14px; }
.tscroll { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl td:first-child { font-weight: 600; }
.tbl td .sw { margin-right: 8px; }
.tcell { display: flex; align-items: center; gap: 8px; }
.tcell .sw { margin: 0 !important; }
.tbl td:nth-child(4) { white-space: nowrap; }
.tile .ts { margin-top: auto; }
.tbl .num { text-align: right; font-weight: 800; white-space: nowrap; }
.tbl tr.flag td { background: var(--warn-bg); }
@media (max-width: 599px) { .tbl th:nth-child(2), .tbl td:nth-child(2), .tbl th:nth-child(3), .tbl td:nth-child(3) { display: none; } }

.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 80px 20px; color: var(--muted); text-align: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin 1s linear infinite; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.code { font-size: 34px; font-weight: 800; letter-spacing: 4px; text-align: center; background: var(--soft); border-radius: 14px; padding: 14px; font-family: ui-monospace, Menlo, monospace; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label { font-size: 13px; font-weight: 700; }
input:not([type=checkbox]), select { min-height: 48px; border: 1px solid var(--input); border-radius: 12px; padding: 0 14px; background: var(--card); font-size: 16px; width: 100%; }
input:focus, select:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: 0; }
.hint { font-size: 12px; color: var(--muted); }
.msg { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--soft); }
.msg.err { background: var(--warn-bg); color: var(--warn-fg); font-weight: 600; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 420px) { .two { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(5, 15, 11, .5); z-index: 40; }
.modal { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 600px) { .modal { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); border-radius: 22px; padding: 24px; }
  .modal.tall { width: min(680px, 94vw); } }
.mhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mhead .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.mfoot { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; }
.mfoot .btn { min-width: 120px; }
.prog-h { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.prog { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.prog .bar { display: block; height: 8px; background: var(--brand); width: 0; transition: width .3s; }
.me-cur { background: var(--bg); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.lastbox { background: var(--card); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.lastbox b { font-size: 20px; }
.steps { display: flex; flex-direction: column; }
.step { display: flex; align-items: center; gap: 12px; min-height: 50px; border: 0; border-top: 1px solid var(--line2); background: none; text-align: left; color: var(--fg); padding: 0 4px; }
.step .num { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--input); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: var(--muted); flex: none; }
.step.done .num { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.step.now { background: var(--soft); border-radius: 10px; }
.step.now .num { border-color: var(--brand); color: var(--brand); }
.step .in { flex: 1; font-weight: 600; font-size: 14px; }

/* ---------- Gate (setup, PIN) ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: calc(32px + env(safe-area-inset-top)) 20px 32px; }
.gate.dark { background: var(--hero); color: #FFFFFF; }
.gate-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.gate-card h1 { text-align: center; }
.gate-card .lead { text-align: center; color: var(--muted); }
.gate.dark .lead, .hint.light, .fine { color: var(--hero-sub); }
.brand { width: 72px; height: 72px; border-radius: 20px; background: var(--hero); color: #FFFFFF; display: flex; align-items: center; justify-content: center; align-self: center; }
.brand.light { background: #FFFFFF; color: #0B3D2E; }
.lockcard { align-items: center; text-align: center; }
.fine { font-size: 12px; line-height: 1.5; text-align: center; }
.dots { display: flex; gap: 14px; justify-content: center; margin: 4px 0; }
.dot { width: 14px; height: 14px; border-radius: 7px; border: 2px solid var(--hero-sub); }
.dot.on { background: #FFFFFF; border-color: #FFFFFF; }
.dot.dk { border-color: var(--input); }
.dot.dk.on { background: var(--brand); border-color: var(--brand); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 26px; justify-content: center; }
.key { width: 72px; height: 72px; border-radius: 36px; border: 0; background: #1E5A45; color: #FFFFFF; font-size: 26px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.key.ghost { background: transparent; }
.keypad.light .key { background: var(--soft); color: var(--fg); }
.gsi { min-height: 44px; display: flex; justify-content: center; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; max-width: min(92vw, 460px); z-index: 60; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--neg); color: #FFFFFF; }
@media (min-width: 600px) { .toast { bottom: 28px; } }

/* ---------- Hide amounts ---------- */
.masked .amt { color: transparent !important; background: var(--mask); border-radius: 6px; user-select: none; -webkit-user-select: none; }
.masked .hero .amt { background: rgba(255, 255, 255, .22); }
.masked .chip .amt { background: rgba(255, 255, 255, .3); }
.masked .line .ay, .masked .line .tip-v { visibility: hidden; }
.masked .seg .amt { background: rgba(255, 255, 255, .25); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ================================================================== */
/* Gift Cards additions (same tokens as Net Worth)                     */
/* ================================================================== */
:root { --c0: #0B6B4E; --c1: #2563EB; --c2: #C38A12; --c3: #7C3AED; --c4: #8A5A2B; --c5: #B5476B; --c6: #0E7490; --c7: #64748B; }
@media (prefers-color-scheme: dark) {
  :root { --c0: #2FA57A; --c1: #4F7FE0; --c2: #C9971F; --c3: #8E6CE8; --c4: #A87644; --c5: #C9607F; --c6: #2A93AD; --c7: #7B8A9E; }
}
.c0 { background: var(--c0); } .c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); }
.c4 { background: var(--c4); } .c5 { background: var(--c5); } .c6 { background: var(--c6); } .c7 { background: var(--c7); }
.warn-bg { background: var(--neg); }

.logo { width: 38px; height: 38px; border-radius: 11px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  color: #FFFFFF; font-style: normal; font-size: 13px; font-weight: 800; letter-spacing: .3px; }
.irow .iv { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.irow .iv small { font-size: 11px; font-weight: 600; }
.irow .isub.note { color: var(--warn-fg); }
.days { flex: none; min-width: 42px; text-align: center; font-size: 12px; font-weight: 800; padding: 3px 6px; border-radius: 8px; background: var(--soft); color: var(--muted); }
.days.soon { background: var(--warn-bg); color: var(--warn-fg); }
.pill { font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 7px; align-self: flex-start; background: var(--soft); color: var(--fg); }
.pill.st-soon, .pill.st-check { background: var(--warn-bg); color: var(--warn-fg); }
.pill.st-partly { background: rgba(37, 99, 235, .12); color: var(--g-bank); }
.pill.st-used { background: var(--line2); color: var(--muted); }
.pill.st-ok { background: var(--area); color: var(--pos); }
.hero .chip { border: 0; display: inline-flex; align-items: center; gap: 6px; }
.hero button.chip { cursor: pointer; }

.grid3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 .tile:first-child { grid-column: 1 / -1; }
@media (min-width: 600px) { .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } .grid3 .tile:first-child { grid-column: auto; } }

.bars { display: flex; flex-direction: column; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 46px;
  background: none; border: 0; border-top: 1px solid var(--line2); padding: 4px 0; text-align: left; color: var(--fg); font-size: 13px; }
.bar-row:first-child { border-top: 0; }
div.bar-row, .bar-row:not([data-act]) { cursor: default; }
.bar-row .bn { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.bar-row .bn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bn .logo { width: 26px; height: 26px; border-radius: 8px; font-size: 10px; }
.bar-row .bt { height: 8px; border-radius: 4px; background: var(--line2); overflow: hidden; }
.bar-row .bt i { display: block; height: 8px; border-radius: 4px; width: 0; transition: width .4s; }
.bar-row .bv { font-weight: 800; min-width: 70px; text-align: right; }
@media (max-width: 420px) { .bar-row { grid-template-columns: minmax(0, 1fr) auto; } .bar-row .bt { grid-column: 1 / -1; grid-row: 2; } }

.months .mbar { fill: var(--brand); opacity: .85; }
.months .mbar.now { fill: var(--neg); opacity: 1; }
.months .mval { font-size: 10px; font-weight: 700; fill: var(--fg); font-family: var(--font); }
.months .ax { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.months .grid { stroke: var(--line); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.searchbox { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--input); border-radius: 12px; padding: 0 12px; background: var(--card); color: var(--muted); }
.searchbox input.search { border: 0; outline: 0; min-height: 44px; padding: 0; width: 100%; background: transparent; font-size: 16px; color: var(--fg); }
.searchbox:focus-within { border-color: var(--brand); outline: 2px solid var(--brand); }
select.sortsel { width: auto; min-height: 46px; font-size: 14px; }
.seg.scroll { display: flex; overflow-x: auto; scrollbar-width: none; max-width: 100%; justify-content: flex-start; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll button { flex: none; }
.seg button small { opacity: .7; font-weight: 600; margin-left: 2px; }
.brandchip { display: inline-flex; align-items: center; gap: 6px; border: 0; min-height: 30px; padding: 0 12px; font-weight: 700; }
@media (min-width: 1100px) {
  .cards-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 0; }
  .cards-list > .irow:nth-child(2) { border-top: 0; }
  .cards-list > .irow:nth-child(odd) { border-right: 1px solid var(--line2); }
}

.tick { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--input);
  background: var(--card); color: var(--muted); font-size: 12px; font-weight: 700; }
.tick.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tick:not(.on) svg { opacity: .35; }

/* ---------- Card detail ---------- */
.gcard { position: relative; overflow: hidden; color: #FFFFFF; border-radius: 20px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 14px; min-height: 170px; }
.gcard::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(0, 0, 0, .22)); pointer-events: none; }
.gcard > * { position: relative; z-index: 1; }
.gc-brand { font-size: 17px; font-weight: 800; }
.gc-bal { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.gc-bal small { font-size: 12px; font-weight: 600; opacity: .85; }
.gc-bal .amt { font-size: 34px; font-weight: 800; letter-spacing: -.6px; line-height: 1.05; }
.gc-foot { font-size: 12px; font-weight: 600; opacity: .9; flex-wrap: wrap; }
.masked .gcard .amt { background: rgba(255, 255, 255, .25); }
.fld { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l b" "v b"; align-items: center; gap: 2px 10px;
  background: var(--bg); border-radius: 14px; padding: 10px 12px; }
.fld .fl { grid-area: l; font-size: 12px; font-weight: 700; color: var(--muted); }
.fld .fv { grid-area: v; font-size: 19px; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.fld > .btn, .fld > .row-gap { grid-area: b; }
.fld.slim { display: flex; gap: 12px; }
.fld.slim .fv { font-size: 14px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: .5px; }
.nowrap { flex-wrap: nowrap; gap: 6px; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions .btn { min-height: 48px; }
.info { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
h3.sec { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; margin-top: 6px; }
.info .kv2 { font-size: 13px; gap: 8px 14px; }
.info .kv2 b { font-weight: 600; overflow-wrap: anywhere; }
.info .kv2 a { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.list-plain .irow { padding-left: 0; padding-right: 0; }
.preview { white-space: pre-wrap; font-family: var(--font); font-size: 14px; line-height: 1.5; background: var(--bg); border-radius: 14px; padding: 12px 14px; margin: 0; overflow-wrap: anywhere; }
textarea { font: inherit; font-size: 16px; color: inherit; border: 1px solid var(--input); border-radius: 12px; padding: 10px 14px; background: var(--card); width: 100%; resize: vertical; }
textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: 0; }
a.btn { color: var(--fg); }
a.btn.primary { color: var(--brand-ink); }
