:root {
  --brand: #0f3d3e;
  --brand-2: #155e5f;
  --accent: #e8b04a;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f9f8f5;
  --text: #1b2321;
  --muted: #5f6b68;
  --line: #e2dfd7;
  --good: #1d7a4c;
  --bad: #b3261e;
  --warn: #9a6400;
  --radius: 16px;
  --tap: 52px;
  --shadow: 0 1px 2px rgba(15, 61, 62, .06), 0 4px 16px rgba(15, 61, 62, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1514; --surface: #162120; --surface-2: #1b2826; --text: #e7ecea; --muted: #9aa8a4;
    --line: #2a3a37; --brand-2: #2f8a8b; --good: #4cc38a; --bad: #f2867c; --warn: #f0b85a;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

.splash { height: 100vh; display: grid; place-items: center; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons & inputs ---------- */
.btn {
  min-height: var(--tap); padding: 0 22px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 10px; text-decoration: none; color: var(--text); touch-action: manipulation;
  transition: transform .06s ease, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.accent { background: var(--accent); color: #23180a; border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; }
.btn.lg { min-height: 60px; font-size: 1.1rem; }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 160px; }

.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field label { font-weight: 600; font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 1.05rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 18%, transparent); }
.input.money { font-variant-numeric: tabular-nums; font-size: 1.25rem; font-weight: 600; text-align: right; }
.money-wrap { position: relative; }
.money-wrap span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap);
  padding: 8px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 54px; height: 32px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked { background: var(--brand-2); }
.switch input:checked::after { transform: translateX(22px); }

/* ---------- auth screens ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(1200px 600px at 10% -10%, #1d6667 0%, transparent 60%), var(--brand);
}
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 28px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.auth-card.wide { max-width: 560px; }
.brandmark { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brandmark img { width: 44px; height: 44px; }
.brandmark b { display: block; font-size: 1.15rem; letter-spacing: .01em; }
.brandmark small { color: var(--muted); }
.auth h1 { font-size: 1.4rem; margin: 0 0 4px; }
.user-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 16px 0; }
.user-tile { min-height: 96px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer;
  display: grid; place-items: center; gap: 6px; padding: 12px 6px; font-weight: 600; text-align: center; }
.user-tile:active { transform: scale(.97); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-2); color: #fff; display: grid; place-items: center; font-weight: 700; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 22px 0 8px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand-2); transition: background .1s, transform .1s; }
.pin-dots i.on { background: var(--brand-2); transform: scale(1.1); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.pin-msg { min-height: 1.4em; text-align: center; font-size: .9rem; color: var(--bad); margin-bottom: 8px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.key { height: 68px; border-radius: 50%/42%; border: 1.5px solid var(--line); background: var(--surface-2); font-size: 1.6rem; font-weight: 600;
  cursor: pointer; touch-action: manipulation; user-select: none; display: grid; place-items: center; }
.key:active { background: var(--line); transform: scale(.95); }
.key.fn { font-size: .95rem; font-weight: 600; color: var(--muted); background: transparent; border-color: transparent; }
.key svg { width: 26px; height: 26px; }
.bio-btn { margin-top: 18px; }
.link-btn { background: none; border: 0; color: var(--brand-2); font-weight: 600; cursor: pointer; padding: 12px; min-height: 44px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: #dfeceb; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brandmark b { color: #fff; }
.sidebar .brandmark small { color: #9cc3c2; }
.nav-item { display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 14px; border-radius: 12px; color: inherit; text-decoration: none; font-weight: 600; }
.nav-item svg { width: 22px; height: 22px; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: rgba(255,255,255,.14); color: #fff; }
.nav-sep { margin: 14px 14px 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #8fb5b4; }
.sidebar .spacer { flex: 1; }
.sidebar .me { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar .me .avatar { background: var(--accent); color: #23180a; }
.main { min-width: 0; }
.topbar { display: none; }
.page { padding: 28px 32px 48px; max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.tabbar { display: none; }

@media (max-width: 899px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 10;
    background: var(--brand); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  .topbar b { font-size: 1.05rem; }
  .topbar .btn { min-height: 44px; padding: 0 12px; background: rgba(255,255,255,.12); color: #fff; border: 0; }
  .page { padding: 18px 16px calc(100px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 1.35rem; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px; font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none; min-height: 60px; }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--brand-2); }
  .tabbar a.fab svg { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--accent); color: #23180a; box-sizing: content-box; margin-top: -14px; box-shadow: var(--shadow); }
}

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 16px; }
.card h2 { margin: 0 0 14px; font-size: 1.1rem; }
.hero { background: linear-gradient(135deg, var(--brand) 0%, #1a5c5d 100%); color: #fff; border: 0; padding: 26px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(232,176,74,.13); }
.hero .label { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: #a8cfcd; }
.hero .big { font-size: clamp(2.2rem, 7vw, 3.2rem); font-weight: 750; letter-spacing: -.02em; line-height: 1.1; margin: 6px 0 10px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: #cfe3e2; font-size: .92rem; }
.hero .meta b { color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat span { display: block; font-size: .8rem; color: var(--muted); }
.stat b { font-size: 1.2rem; }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr 1fr; } .stats .stat:last-child { grid-column: span 2; } }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.alert { padding: 14px 16px; border-radius: 12px; font-weight: 500; margin-bottom: 16px; border: 1px solid; }
.alert.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.alert.bad { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.alert.info { background: var(--surface-2); border-color: var(--line); color: var(--text); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 64px; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .sub { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .amt { font-weight: 700; text-align: right; white-space: nowrap; }
.list-item .amt small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }
.icon-dot { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.icon-dot svg { width: 20px; height: 20px; }
.icon-dot.out { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.icon-dot.in { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); border: 1px solid var(--line); }
.badge.open { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); border-color: transparent; }
.badge.void { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); border-color: transparent; }
.badge.admin { background: color-mix(in srgb, var(--accent) 25%, transparent); border-color: transparent; }
.voided .title, .voided .amt { text-decoration: line-through; opacity: .6; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- voucher form ---------- */
.voucher-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 899px) { .voucher-layout { grid-template-columns: 1fr; } }
.calc { position: sticky; top: 20px; }
.calc-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.calc-row:last-of-type { border-bottom: 0; }
.calc-row.total { font-size: 1.35rem; font-weight: 750; border-top: 2px solid var(--text); border-bottom: 0; margin-top: 4px; padding-top: 14px; }
.calc-balance { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.calc-balance .calc-row { padding: 6px 0; }
.calc-balance .after { font-size: 1.15rem; font-weight: 750; }

/* ---------- voucher document ---------- */
.voucher-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; position: relative; max-width: 760px; }
.voucher-doc header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 3px double var(--text); padding-bottom: 14px; margin-bottom: 18px; }
.voucher-doc header h2 { margin: 0; font-size: 1.25rem; letter-spacing: .06em; }
.voucher-doc .vno { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; color: var(--bad); text-align: right; }
.vd-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin-bottom: 18px; }
.vd-grid dt { color: var(--muted); font-weight: 600; }
.vd-grid dd { margin: 0; font-weight: 600; }
.vd-amounts { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.vd-amounts td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.vd-amounts td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.vd-amounts tr.total td { font-size: 1.2rem; font-weight: 800; border-bottom: 3px double var(--text); }
.words { font-style: italic; color: var(--muted); margin-bottom: 18px; }
.signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.signs div { border-top: 1px solid var(--text); padding-top: 6px; font-size: .85rem; color: var(--muted); }
.stamp { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg); font-size: 4rem; font-weight: 900; color: var(--bad);
  border: 6px solid var(--bad); padding: 0 24px; border-radius: 12px; opacity: .25; pointer-events: none; letter-spacing: .1em; }

/* ---------- sheet table ---------- */
.table-wrap { overflow-x: auto; }
table.sheet { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.sheet th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.sheet td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.sheet td.r, table.sheet th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.sheet tr.bf td, table.sheet tr.tot td { font-weight: 700; background: var(--surface-2); }
table.sheet tr.clickable { cursor: pointer; }
table.sheet tr.clickable:hover td { background: var(--surface-2); }
table.sheet tr.voided td { text-decoration: line-through; opacity: .5; }
@media (max-width: 720px) {
  table.sheet thead { display: none; }
  table.sheet, table.sheet tbody, table.sheet tr, table.sheet td { display: block; width: 100%; }
  table.sheet tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 8px 12px; background: var(--surface); }
  table.sheet td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.sheet td::before { content: attr(data-l); color: var(--muted); font-weight: 600; text-align: left; flex: none; }
  table.sheet td.r { text-align: right; }
  table.sheet td:empty { display: none; }
}

/* ---------- dialog & toasts ---------- */
dialog { border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10, 25, 25, .55); backdrop-filter: blur(2px); }
dialog .dlg-body { padding: 24px; }
dialog h3 { margin: 0 0 8px; font-size: 1.2rem; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 0 24px 22px; flex-wrap: wrap; }
dialog .dlg-actions .btn { flex: 1 1 140px; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.toast { background: #1b2321; color: #fff; padding: 14px 18px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 500; animation: toastIn .2s ease; }
.toast.bad { background: var(--bad); }
.toast.good { background: #1d7a4c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- print ---------- */
@media print {
  @page { margin: 14mm; }
  :root { --text: #000; --muted: #444; --line: #bbb; --surface: #fff; --surface-2: #f3f3f3; }
  body { background: #fff; }
  .sidebar, .topbar, .tabbar, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .card, .voucher-doc { box-shadow: none; border: 0; padding: 0; }
  table.sheet { font-size: 10pt; }
  table.sheet thead { display: table-header-group !important; }
  table.sheet, table.sheet tbody { display: table !important; }
  table.sheet tbody { display: table-row-group !important; }
  table.sheet tr { display: table-row !important; border: 0 !important; padding: 0 !important; }
  table.sheet td { display: table-cell !important; padding: 5px 6px !important; border-bottom: 1px solid #ccc !important; text-align: left; }
  table.sheet td.r { text-align: right !important; }
  table.sheet td::before { content: none !important; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---------- layout refinements ---------- */
.list-item .title, .list-item .sub { display: block; }
.brandmark { text-align: left; }
.page-head .btn-row > .btn { flex: 0 0 auto; }
.btn span { white-space: nowrap; }
table.sheet td:nth-child(1), table.sheet td:nth-child(2) { white-space: nowrap; }
@media (max-width: 899px) {
  .actions { grid-template-columns: 1fr 1fr; }
  .actions .btn.accent { grid-column: 1 / -1; }
  .actions .btn.lg { font-size: 1rem; padding: 0 12px; }
  .page-head .btn-row { width: 100%; }
  .page-head .btn-row > .btn { flex: 1 1 auto; }
}
@media (max-width: 720px) {
  table.sheet tr.bf td, table.sheet tr.tot td { justify-content: space-between; }
  table.sheet tr.bf td[data-l=""]::before, table.sheet tr.tot td[data-l=""]::before { content: none; }
  table.sheet tr.bf td[data-l=""], table.sheet tr.tot td[data-l=""] { justify-content: flex-start; text-align: left; }
}

/* ---------- v0.5: version footer, pull-to-refresh, months, import ---------- */
html, body { overscroll-behavior-y: contain; }
.built { font-size: .78rem; color: var(--muted); text-align: center; margin-top: 18px; letter-spacing: .01em; }
.built b { font-weight: 650; }
.built.side { color: #8fb5b4; text-align: left; padding: 4px 14px 10px; margin: 0; }
.built.side b { color: #cfe3e2; }
.built.page-foot { margin-top: 36px; }
@media (min-width: 900px) { .built.page-foot { display: none; } }
.nav-item.linkish { background: none; border: 0; width: 100%; cursor: pointer; font: inherit; font-weight: 600; text-align: left; color: #b9d6d5; min-height: 44px; }
#ptr { position: fixed; top: calc(-44px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, 0); z-index: 200; display: flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 99px; padding: 8px 16px; font-size: .88rem; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transition: opacity .15s; }
#ptr.show { opacity: 1; }
#ptr svg { width: 18px; height: 18px; color: var(--brand-2); }
#ptr.ready { background: var(--brand); color: #fff; border-color: var(--brand); }
#ptr.ready svg { color: var(--accent); }
#ptr.loading svg { animation: spin .8s linear infinite; }
#updBanner { position: fixed; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); z-index: 150; display: flex; align-items: center; gap: 12px;
  background: var(--accent); color: #23180a; padding: 8px 8px 8px 16px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); font-weight: 600; width: max-content; max-width: calc(100vw - 24px); }
#updBanner .btn { min-height: 40px; padding: 0 14px; }

.year { margin-bottom: 26px; }
.year-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.year-head h2 { margin: 0; font-size: 1.3rem; }
.month-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 1000px) { .month-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 560px) { .month-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
.month-tile { display: grid; gap: 2px; padding: 14px; min-height: 96px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: inherit; box-shadow: var(--shadow); align-content: start; }
.month-tile b { font-size: 1.05rem; }
.month-tile span { font-weight: 700; font-size: .98rem; color: var(--bad); }
.month-tile small { color: var(--muted); font-size: .76rem; }
.month-tile:active { transform: scale(.97); }
.month-tile.current { border-color: var(--brand-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-2) 30%, transparent); }
.month-tile.empty { background: transparent; box-shadow: none; border-style: dashed; color: var(--muted); }
.month-tile.future { opacity: .45; }
@media (max-width: 560px) { .month-tile { padding: 10px; min-height: 84px; } .month-tile span { font-size: .85rem; } }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav .btn { min-height: 48px; padding: 0 10px; }
.filters { display: grid; grid-template-columns: 1fr 240px auto; gap: 12px; align-items: center; }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr; } }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; cursor: pointer; color: var(--muted); flex: 1; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button.on.danger { background: var(--bad); color: #fff; }

.dropzone { display: grid; justify-items: center; gap: 6px; padding: 44px 20px; border: 2px dashed var(--line); border-radius: 20px; background: var(--surface);
  cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.dropzone svg { width: 40px; height: 40px; color: var(--brand-2); }
.dropzone b { font-size: 1.15rem; }
.dropzone.over, .dropzone:hover { border-color: var(--brand-2); background: var(--surface-2); }
.tips { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 8px; }
.imp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.imp-item.off { opacity: .6; }
.imp-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.imp-row .grow { flex: 1; min-width: 160px; }
.month-input { width: auto; min-height: 46px; padding: 8px 12px; font-size: .95rem; }
.switch.compact { border: 0; padding: 0; min-height: 0; background: none; }
.imp-bal { margin-top: 10px; font-size: .92rem; }
.dupe { margin-top: 12px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.dupe .seg { min-width: 220px; }
.badge.warnb { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); border-color: transparent; }
details { margin-top: 12px; }
details summary { cursor: pointer; font-weight: 600; color: var(--brand-2); min-height: 40px; display: flex; align-items: center; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; margin-top: 8px; }
.map-grid .field { margin-bottom: 10px; }
.map-grid .input { min-height: 44px; font-size: .92rem; padding: 8px 10px; }
.import-bar { position: sticky; bottom: 12px; z-index: 5; }
@media (max-width: 899px) { .import-bar { position: static; } }
.progress { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress i { display: block; height: 100%; width: 0; background: var(--brand-2); transition: width .2s; }

/* ---------- v0.5.1: notes + QuickBooks ---------- */
.note { display: block; font-size: .8rem; color: var(--muted); font-style: italic; margin-top: 2px; }
.badge.qb { background: color-mix(in srgb, #2ca01c 16%, transparent); color: #1f7a12; border-color: transparent; font-size: .68rem; padding: 1px 7px; }
@media (prefers-color-scheme: dark) { .badge.qb { color: #6fd35c; } }
.qb-card { max-width: 760px; margin-top: 16px; }
.qb-card .switch { border: 0; padding: 0; }
@media (max-width: 720px) { table.sheet td .note { text-align: right; } }

/* ---------- v0.5.2: categories ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: .9rem;
  cursor: pointer; color: var(--text); touch-action: manipulation; }
.chip:active { transform: scale(.97); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.cat-tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .02em; padding: 1px 8px; margin: 0 6px 3px 0; border-radius: 6px;
  background: color-mix(in srgb, var(--brand-2) 12%, transparent); color: var(--brand-2); vertical-align: 1px; white-space: nowrap; }
.cat-card { margin-top: 16px; }
.cat-card summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--text); min-height: 32px; }
.cat-list { display: grid; gap: 4px; margin-top: 10px; }
.cat-row { display: grid; grid-template-columns: minmax(130px, 220px) 1fr auto; gap: 12px; align-items: center; padding: 6px 4px; border: 0; background: none;
  text-align: left; font: inherit; color: inherit; border-radius: 8px; width: 100%; }
button.cat-row { cursor: pointer; min-height: 44px; }
button.cat-row:hover { background: var(--surface-2); }
.cat-name { font-weight: 600; font-size: .9rem; }
.cat-bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.cat-bar i { display: block; height: 100%; background: var(--brand-2); border-radius: 99px; }
.cat-amt { font-weight: 700; text-align: right; font-size: .9rem; white-space: nowrap; }
.cat-amt small { color: var(--muted); font-weight: 500; margin-left: 6px; }
@media (max-width: 560px) { .cat-row { grid-template-columns: 1fr auto; } .cat-bar { grid-column: 1 / -1; grid-row: 2; } }
.filters { grid-template-columns: 1fr 200px 200px auto; }
@media (max-width: 1100px) { .filters { grid-template-columns: 1fr 1fr; } .filters .seg { grid-column: 1 / -1; } }
@media (max-width: 560px) { .filters { grid-template-columns: 1fr; } }
.filters { grid-template-columns: 220px 220px 1fr; }
.filters #q { grid-column: 1 / -1; }
@media (max-width: 1100px) { .filters { grid-template-columns: 1fr 1fr; } .filters .seg { grid-column: 1 / -1; } }
@media (max-width: 560px) { .filters { grid-template-columns: 1fr; } }
