/* ============ tokens ============ */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --surface-3: #e6e5df;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --income: #2a78d6;
  --expense: #eb6834;
  --cih: #6250d6;
  --cashplus: #1baf7a;
  --good-text: #006300;
  --critical: #d03b3b;
  --primary: #0b0b0b;
  --on-primary: #ffffff;
  --focus: #2a78d6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --surface-3: #2f2f2c;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #898781;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --grid: #2c2c2a;
    --axis: #383835;
    --income: #3987e5;
    --expense: #d95926;
    --cih: #9085e9;
    --cashplus: #199e70;
    --good-text: #0ca30c;
    --critical: #e66767;
    --primary: #f0efec;
    --on-primary: #0b0b0b;
    --focus: #3987e5;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --surface-3: #2f2f2c;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #898781;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --grid: #2c2c2a;
  --axis: #383835;
  --income: #3987e5;
  --expense: #d95926;
  --cih: #9085e9;
  --cashplus: #199e70;
  --good-text: #0ca30c;
  --critical: #e66767;
  --primary: #f0efec;
  --on-primary: #0b0b0b;
  --focus: #3987e5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
}

/* ============ base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.pos { color: var(--good-text); }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; flex: none; }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--text); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ buttons & controls ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; white-space: nowrap; background: none;
  transition: background-color .15s, opacity .15s, transform .08s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-ghost { background: var(--surface-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--critical); padding: 0 12px; }
.btn-danger:hover { background: color-mix(in srgb, var(--critical) 10%, transparent); }
.btn-danger.armed { background: var(--critical); color: #fff; }
.btn-block { width: 100%; height: 46px; }

.seg {
  display: inline-flex; gap: 2px; padding: 3px; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 9px;
  color: var(--text-2); font-weight: 550; font-size: 14px; white-space: nowrap; cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--border); }
.seg-lg { display: flex; width: 100%; }
.seg-lg button { flex: 1; padding: 10px; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg-sm button { padding: 6px 10px; font-size: 13px; }

/* ============ shell ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-in { position: relative; max-width: 1160px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; letter-spacing: -.01em; font-size: 16px; }
.brand em { font-style: normal; font-weight: 500; color: var(--text-2); }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 750; font-size: 15px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tabs a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 550; }
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a.active { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-weight: 650; cursor: pointer; }
.menu {
  position: absolute; right: 16px; top: calc(100% + 6px); z-index: 30; width: 250px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px;
}
.menu-who { font-size: 13px; color: var(--text-2); padding: 2px 4px 10px; border-bottom: 1px solid var(--border); }
.menu-who b { color: var(--text); }
.menu-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 12px 4px 6px; }
.menu .seg { display: flex; }
.menu .seg button { flex: 1; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 10px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-weight: 550; text-align: left; }
.menu-item:hover { background: var(--surface-2); }

.page { max-width: 1160px; margin: 0 auto; padding: 22px 16px 64px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pagehead h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.pagehead p { margin: 2px 0 0; }

.bottombar { display: none; }

/* ============ cards & dashboard ============ */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-head .link { font-size: 14px; font-weight: 600; color: var(--text-2); text-decoration: none; }
.card-head .link:hover { color: var(--text); }
.label { font-size: 13px; font-weight: 550; color: var(--text-2); }

.hero { container-type: inline-size; display: flex; align-items: center; }
.hero-in { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 330px); gap: 22px 28px; align-items: end; }
@container (max-width: 700px) { .hero-in { grid-template-columns: 1fr; } }
.hero-value { font-size: clamp(44px, 6.5vw, 60px); font-weight: 650; letter-spacing: -.035em; line-height: 1.05; margin: 8px 0 14px; white-space: nowrap; }
.hero-value .cur { font-size: .45em; font-weight: 600; letter-spacing: 0; color: var(--text-2); margin-left: .25em; }
.hero-sub { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; color: var(--text-2); }
.hero-sub span { display: flex; align-items: center; }
.hero-sub b { color: var(--text); font-weight: 650; margin-left: 6px; }
.quick-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; min-width: 0;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; text-align: left;
  transition: background-color .15s, transform .08s;
}
.quick-btn:hover { background: var(--surface-3); }
.quick-btn:active { transform: scale(.97); }
.quick-btn small { font-size: 12px; font-weight: 550; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.quick-btn b { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.quick-btn .ico { width: 14px; height: 14px; }

.bal-row { display: flex; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); }
.bal-row span { color: var(--text-2); font-weight: 550; }
.bal-row b { margin-left: auto; font-size: 21px; font-weight: 650; letter-spacing: -.015em; }
.bal-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 13px; font-weight: 650; }
.bal-total b { font-size: 16px; }
.bal-note { margin: 10px 0 0; font-size: 12px; color: var(--text-2); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.legend span { display: flex; align-items: center; }

.chart { position: relative; height: 240px; touch-action: pan-y; }
.chart-svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar.income { fill: var(--income); }
.chart .bar.expense { fill: var(--expense); }
.chart .hover-band { fill: var(--text); opacity: .05; }
.chart .hit { fill: transparent; outline: none; cursor: crosshair; }
.chart-empty { position: absolute; inset: 0 0 26px 44px; display: grid; place-items: center; color: var(--text-2); font-size: 14px; pointer-events: none; }
.tip {
  position: absolute; z-index: 3; pointer-events: none; min-width: 178px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 10px 12px; font-size: 13px;
}
.tip-t { font-weight: 650; margin-bottom: 6px; }
.tip-r { display: flex; align-items: center; padding: 2px 0; color: var(--text-2); }
.tip-r b { margin-left: auto; padding-left: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.tip-net { border-top: 1px solid var(--border); margin-top: 5px; padding-top: 6px; }

details.table-view { margin-top: 8px; }
details.table-view summary { cursor: pointer; font-size: 13px; color: var(--text-2); font-weight: 550; width: max-content; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.data-table th { text-align: left; font-weight: 600; color: var(--text-2); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.hbar-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 12px; padding: 9px 0; }
.hbar-label { font-size: 14px; font-weight: 550; color: var(--text-2); }
.hbar-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hbar { height: 12px; border-radius: 0 4px 4px 0; background: var(--income); flex: none; }
.hbar-val { font-size: 14px; font-weight: 650; white-space: nowrap; }
.hbar-val small { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 4px; }
.sub-stats { display: flex; gap: 22px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.sub-stats b { display: block; font-size: 19px; color: var(--text); font-weight: 650; letter-spacing: -.01em; }

.splitbar { display: flex; gap: 2px; height: 28px; margin: 2px 0 14px; }
.splitbar .part { height: 100%; border-radius: 4px; background: var(--c); display: flex; align-items: center; padding-left: 8px; min-width: 0; color: #fff; font-size: 12px; font-weight: 650; white-space: nowrap; }
.split-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.split-table th { font-size: 12px; font-weight: 600; color: var(--text-2); text-align: right; padding: 0 0 6px; }
.split-table th:first-child { text-align: left; }
.split-table td { padding: 7px 0; border-top: 1px solid var(--border); text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.split-table td:first-child { text-align: left; font-weight: 550; color: var(--text-2); }
.split-table td:first-child span { display: flex; align-items: center; }

/* ============ transactions ============ */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.search:focus-within { border-color: var(--focus); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; color: var(--text); font-size: 15px; }
.list-summary { font-size: 13px; color: var(--text-2); margin: 6px 4px 4px; }
.day-head { display: flex; justify-content: space-between; padding: 14px 8px 4px; font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.day-head span:last-child { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.tx {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 8px;
  border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer;
}
.tx:hover { background: var(--surface-2); }
.tx-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tx-icon.income { background: color-mix(in srgb, var(--income) 14%, transparent); color: var(--income); }
.tx-icon.expense { background: color-mix(in srgb, var(--expense) 14%, transparent); color: var(--expense); }
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tx-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); min-width: 0; }
.tx-note { min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.tx-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-amt small { font-size: 12px; font-weight: 500; color: var(--text-2); }
.empty { text-align: center; padding: 40px 16px; color: var(--text-2); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ============ sheet (add / edit) ============ */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0); transition: background-color .2s; }
.overlay.open { background: rgba(0, 0, 0, .45); }
.sheet {
  width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 20px;
  opacity: 0; transform: translateY(16px) scale(.98); transition: opacity .2s, transform .2s;
}
.overlay.open .sheet { opacity: 1; transform: none; }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.field { display: block; margin-top: 14px; min-width: 0; }
.flabel { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.flabel .opt { font-weight: 500; color: var(--muted); }
.field input {
  width: 100%; height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); outline: none; font-size: 16px;
}
.field input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.amount-input { position: relative; }
.amount-input input { padding-right: 46px; font-size: 18px; font-weight: 600; }
.amount-input i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 600; color: var(--text-2); pointer-events: none; }
.pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; min-width: 0;
  border-radius: 14px; border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; text-align: left;
}
.pick b { font-size: 16px; font-weight: 650; }
.pick span { font-size: 13px; color: var(--text-2); }
.pick.method { flex-direction: row; align-items: center; padding: 14px 12px; font-weight: 600; }
.pick:hover { background: var(--surface-2); }
.pick[aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); background: var(--surface); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cat-chips button { cursor: pointer; padding: 4px 10px; }
.cat-chips button:hover { color: var(--text); background: var(--surface-3); }
.form-error {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, var(--critical) 12%, transparent); border: 1px solid color-mix(in srgb, var(--critical) 40%, transparent);
}
.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.sheet-actions .spacer { flex: 1; }
.sheet-meta { margin: 14px 0 0; font-size: 12px; color: var(--text-2); }

.sheet .only-income, .sheet .only-expense, .sheet .amount-row { display: none; }
.sheet[data-type="income"] .only-income, .sheet[data-type="expense"] .only-expense { display: block; }
.sheet[data-type="expense"] .amount-row, .sheet[data-type="income"][data-pkg="custom"] .amount-row { display: grid; }
.sheet[data-type="expense"] .amount-row { grid-template-columns: 1fr; }
.sheet[data-type="expense"] .games-field { display: none; }

/* ============ toast ============ */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: 14px; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 550; animation: toast-in .2s ease; }
.toast button { padding: 0; border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ============ login ============ */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(900px 500px at 50% -10%, color-mix(in srgb, var(--income) 12%, transparent), transparent 70%), var(--bg);
}
.login-card { width: 100%; max-width: 380px; padding: 28px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); }
.login-card .brand { font-size: 19px; }
.login-card .logo { width: 36px; height: 36px; font-size: 18px; border-radius: 11px; }
.login-sub { margin: 14px 0 4px; color: var(--text-2); }
.login-card .btn-block { margin-top: 20px; }

/* ============ responsive ============ */
@media (max-width: 900px) {
  .dash > * { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .tabs, .hide-sm { display: none !important; }
  .page { padding: 16px 16px calc(110px + env(safe-area-inset-bottom)); }
  .pagehead h1 { font-size: 22px; }
  .pagehead .seg { width: 100%; }
  .pagehead .seg button { flex: 1; padding: 7px 8px; }
  .bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    padding: 6px 24px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }
  .bottombar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
  .bottombar a.active { color: var(--text); }
  .bottombar .ico { width: 22px; height: 22px; }
  .fab { width: 58px; height: 58px; margin-top: -26px; border: 0; border-radius: 19px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; box-shadow: var(--shadow-lg); cursor: pointer; }
  .fab .ico { width: 26px; height: 26px; }
  .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tx-note { display: none; }
}
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; max-height: 94dvh; border-radius: 22px 22px 0 0; border-bottom: 0; transform: translateY(100%); padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .sheet-grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--surface-3); margin: -8px auto 12px; }
  .card { padding: 16px; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
