/* CARTAGO Street Food — visual system (v1.1, bazaar colours)
   Deep red and burgundy, warm cream, gold accents. Gelasio for figures and
   headings, DM Sans for everything else. */

@font-face { font-family: 'Gelasio'; src: url('fonts/gelasio.woff') format('woff'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('fonts/dmsans.woff') format('woff'); font-weight: 300 800; font-display: swap; }

:root {
  color-scheme: light;
  --brand: #A51019;
  --brand-hover: #8A0D15;
  --burgundy: #681017;
  --burgundy-deep: #4A0B10;
  --pine: var(--brand);            /* legacy name used by older rules */
  --pine-deep: var(--burgundy);
  --pine-soft: var(--brand-hover);
  --cream: #FFF5DF;
  --paper: #FFFBF2;
  --paper-2: #F8EBD2;
  --gold: #D6A348;
  --gold-ink: #94681C;             /* gold dark enough for text on cream */
  --gold-light: #E9C77F;
  --ink: #2B1A17;
  --muted: #6B5850;
  --faint: #9A877D;
  --line: rgba(104, 16, 23, 0.11);
  --line-strong: rgba(104, 16, 23, 0.22);
  --kainan: #BC7A12;
  --palamig: #2C75BF;
  --combined: #1E7A50;
  --ok: #1E7A50;
  --warn: #8A5A00;
  --danger: #B3261E;
  --hero-ink: #FFF5DF;
  --hero-muted: rgba(255, 245, 223, 0.72);
  --hero-k: #E8B45A;
  --hero-p: #8EBCEB;
  --on-brand: #FFF8EA;
  --shadow: 0 1px 0 rgba(104, 16, 23, 0.04), 0 10px 26px -14px rgba(74, 11, 16, 0.22);
  --r-lg: 20px;
  --r-md: 15px;
  --r-sm: 11px;
  --serif: 'Gelasio', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', 'Gelasio', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --brand: #C0222B;
  --brand-hover: #D4343D;
  --burgundy: #5A0E14;
  --burgundy-deep: #3A080C;
  --cream: #170C0D;
  --paper: #231416;
  --paper-2: #2E1B1D;
  --ink: #F6EADB;
  --muted: #C2AEA4;
  --faint: #8F7B73;
  --line: rgba(246, 234, 219, 0.10);
  --line-strong: rgba(246, 234, 219, 0.2);
  --gold-ink: #E2B868;
  --kainan: #C98A1F;
  --palamig: #4A8FD0;
  --combined: #3E9A6C;
  --ok: #57B484;
  --warn: #D9A441;
  --danger: #F07A6E;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 12px 28px -14px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--cream); }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:root[data-theme='dark'] a { color: var(--gold-light); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.num { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.01em; }

/* ---------- shell ---------- */
.shell { max-width: 620px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) 18px calc(var(--nav-h) + var(--safe-b) + 28px); }
.shell.no-nav { padding-bottom: calc(var(--safe-b) + 28px); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; flex: none; box-shadow: 0 4px 10px -4px rgba(104, 16, 23, 0.5); }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.1; letter-spacing: 0.03em; color: var(--burgundy); }
:root[data-theme='dark'] .brand-name { color: var(--ink); }
.brand-name small { display: block; font-family: var(--sans); font-weight: 500; letter-spacing: 0; font-size: 13px; color: var(--muted); }

.sync-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 11px; white-space: nowrap; cursor: pointer; }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.sync-pill.is-pending .dot { background: var(--warn); }
.sync-pill.is-offline .dot { background: var(--faint); }
.sync-pill.is-error .dot { background: var(--danger); }
.sync-pill.is-syncing .dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: 30px; }
.page-title h1 { color: var(--burgundy); }
:root[data-theme='dark'] .page-title h1 { color: var(--ink); }
.page-title h1::after { content: ''; display: block; width: 36px; height: 2.5px; border-radius: 2px; background: var(--gold); margin-top: 10px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
.page-title { margin: 6px 2px 18px; }
.page-title p { margin: 6px 0 0; color: var(--muted); font-size: 16px; }
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }
.section-head a, .link-btn { font-size: 15px; font-weight: 600; color: var(--brand); background: none; border: 0; padding: 6px 0; cursor: pointer; text-decoration: none; }
:root[data-theme='dark'] .section-head a, :root[data-theme='dark'] .link-btn { color: var(--gold-light); }
.muted { color: var(--muted); }
.small { font-size: 14.5px; }
.explain { color: var(--muted); font-size: 15px; margin: 10px 2px 0; max-width: 62ch; }

/* ---------- cards ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card.flat { box-shadow: none; }

/* ---------- hero: today's combined sales ---------- */
.hero { position: relative; overflow: hidden; color: var(--hero-ink); border-radius: 24px; padding: 22px 22px 20px;
  background: radial-gradient(120% 140% at 0% 0%, #B51A23 0%, var(--brand) 38%, var(--burgundy) 100%);
  box-shadow: 0 20px 40px -22px rgba(74, 11, 16, 0.75); }
.hero::before { content: ''; position: absolute; inset: 0; border-radius: inherit; border: 1px solid rgba(214, 163, 72, 0.45); pointer-events: none; }
.hero::after { content: ''; position: absolute; left: 22px; right: 22px; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0.8; }
.hero-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; color: var(--hero-muted); }
.hero-label strong { color: var(--hero-ink); font-weight: 600; font-size: 16px; }
.hero-figure { font-family: var(--serif); font-weight: 600; font-size: clamp(46px, 13vw, 64px); line-height: 1.05; margin: 12px 0 4px; letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums; }
.hero-figure .peso { color: var(--gold-light); font-weight: 500; margin-right: 2px; }
.hero-figure.is-empty { color: var(--hero-muted); }
.hero-status { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--hero-ink); }
.hero-status svg { flex: none; }
.hero-status.is-incomplete { color: var(--gold-light); }

.split { margin-top: 18px; }
.split-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: rgba(255, 245, 223, 0.14); }
.split-bar span { display: block; height: 100%; min-width: 4px; }
.split-bar .k { background: var(--hero-k); }
.split-bar .p { background: var(--hero-p); }
.split-bar .pending { background: repeating-linear-gradient(135deg, rgba(255, 245, 223, 0.32) 0 4px, transparent 4px 8px); }
.split-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13.5px; color: var(--hero-muted); }
.split-legend span:first-child i { background: var(--hero-k) !important; }
.split-legend span:last-child i { background: var(--hero-p) !important; }
.split-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }

/* ---------- division cards ---------- */
.divisions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.div-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; position: relative; text-align: left; cursor: pointer; width: 100%; }
.div-card { box-shadow: var(--shadow); }
.div-card::after { content: ''; position: absolute; left: 16px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.div-card .div-name { font-family: var(--serif); font-weight: 700; font-size: 19px; }
.div-card .div-owner { font-size: 14.5px; color: var(--muted); }
.div-card .div-amount { font-family: var(--serif); font-size: 25px; font-weight: 600; margin: 12px 0 6px; font-variant-numeric: lining-nums tabular-nums; }
.div-card .div-amount.is-empty { color: var(--faint); font-size: 18px; font-family: var(--sans); font-weight: 500; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px; }
.status svg { flex: none; }
.status.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.status.pending { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.status.zero { color: var(--muted); background: var(--paper-2); }
.status.local { color: var(--palamig); background: color-mix(in srgb, var(--palamig) 12%, transparent); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px; border-radius: 15px; border: 1px solid transparent;
  font-weight: 600; font-size: 17px; cursor: pointer; text-decoration: none; transition: transform 0.12s ease, background-color 0.15s ease; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 8px 18px -10px rgba(165, 16, 25, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-block { width: 100%; }
.btn-xl { min-height: 64px; font-size: 19px; border-radius: 18px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }
.record-cta { margin-top: 16px; position: relative; }
.record-cta::after { content: ''; position: absolute; left: 18%; right: 18%; bottom: 0; height: 2px; border-radius: 2px; background: var(--gold); opacity: 0.85; }
.record-cta svg { margin-left: -4px; }

/* ---------- stats grid ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.stat { background: var(--paper); padding: 15px 16px 14px; }
.stat-label { font-size: 14.5px; color: var(--muted); }
.stat-value { font-family: var(--serif); font-weight: 600; font-size: 23px; margin: 4px 0 4px; font-variant-numeric: lining-nums tabular-nums; }
.delta { font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat, .delta.na { color: var(--faint); font-weight: 500; }
.stat-note { display: block; font-size: 12.5px; color: var(--faint); margin-top: 2px; }

/* ---------- insights ---------- */
.insights { list-style: none; margin: 0; padding: 0; }
.insight { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); font-size: 16.5px; line-height: 1.45; }
.insight:first-child { border-top: 0; padding-top: 2px; }
.insight .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.insight.positive .mark { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.insight.attention .mark { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.insight.neutral .mark { background: var(--paper-2); color: var(--muted); }
.insight.estimate .mark { background: color-mix(in srgb, var(--palamig) 14%, transparent); color: var(--palamig); }
.insight-tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--gold-ink); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); border-radius: 6px; padding: 0 6px; margin-left: 6px; vertical-align: 1px; }
.smart-head { display: flex; align-items: center; gap: 8px; }
.smart-head svg { color: var(--gold-ink); }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r-md); padding: 14px 16px; font-size: 15.5px; margin-bottom: 12px; border: 1px solid; }
.banner svg { flex: none; margin-top: 2px; }
.banner.info { background: color-mix(in srgb, var(--palamig) 8%, var(--paper)); border-color: color-mix(in srgb, var(--palamig) 25%, transparent); }
.banner.warn { background: color-mix(in srgb, var(--warn) 9%, var(--paper)); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.danger { background: color-mix(in srgb, var(--danger) 8%, var(--paper)); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.banner.ok { background: color-mix(in srgb, var(--ok) 8%, var(--paper)); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.banner .banner-body { flex: 1; }
.banner .banner-body strong { display: block; margin-bottom: 2px; }
.banner .btn { min-height: 42px; padding: 0 14px; font-size: 15px; margin-top: 10px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 7px; }
.field-hint { display: block; font-size: 14px; color: var(--muted); margin-top: 6px; }
.input, select.input, textarea.input { width: 100%; min-height: 54px; background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 12px 15px; font-size: 17px; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.4; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(165, 16, 25, 0.12); }
:root[data-theme='dark'] .input:focus { border-color: var(--gold-light); box-shadow: 0 0 0 4px rgba(216, 189, 132, 0.18); }
.field-error { color: var(--danger); font-size: 14.5px; font-weight: 600; margin-top: 7px; display: block; }

.amount-wrap { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 2px solid var(--line-strong); border-radius: 20px; padding: 10px 12px 10px 20px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.amount-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 5px rgba(165, 16, 25, 0.11); }
:root[data-theme='dark'] .amount-wrap:focus-within { border-color: var(--gold-light); }
.amount-wrap .peso { font-family: var(--serif); font-size: 40px; color: var(--gold-ink); line-height: 1; }
.amount-input { flex: 1; min-width: 0; border: 0; background: transparent; font-family: var(--serif); font-weight: 600; font-size: clamp(38px, 11vw, 50px); line-height: 1.15;
  padding: 6px 0; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.01em; }
.amount-input:focus { outline: none; }
.amount-input::placeholder { color: var(--line-strong); }
.mic-btn { width: 54px; height: 54px; flex: none; border-radius: 15px; border: 1px solid var(--line-strong); background: var(--paper-2); display: grid; place-items: center; cursor: pointer; color: var(--brand); }
:root[data-theme='dark'] .mic-btn { color: var(--gold-light); }
.mic-btn.is-listening { background: var(--brand); color: #fff; animation: pulse 1.2s ease-in-out infinite; }

.date-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 12px 16px; margin-bottom: 16px; }
.date-row .date-main { font-weight: 600; }
.date-row .date-sub { font-size: 14px; color: var(--muted); }
.date-change { position: relative; white-space: nowrap; flex: none; }
.date-change input[type='date'] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.division-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.division-tag b { color: var(--ink); font-family: var(--serif); font-size: 17px; }
.division-tag i { width: 10px; height: 10px; border-radius: 3px; }
.switch-div { font-size: 14.5px; }

.segmented { display: flex; background: var(--paper-2); border-radius: 13px; padding: 4px; gap: 4px; border: 1px solid var(--line); }
.segmented button { flex: 1; min-height: 42px; border: 0; background: transparent; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--muted); cursor: pointer; padding: 0 8px; }
.segmented button[aria-pressed='true'] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); font-weight: 600; font-size: 15px; cursor: pointer; color: var(--ink); }
.chip[aria-pressed='true'] { background: var(--burgundy); border-color: var(--burgundy); color: var(--on-brand); }
:root[data-theme='dark'] .chip[aria-pressed='true'] { background: var(--brand); border-color: var(--brand); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.toggle-row .t-text { flex: 1; }
.toggle-row .t-text span { display: block; font-size: 14.5px; color: var(--muted); }
.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background 0.18s ease; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.18s ease; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- lists / settings ---------- */
.list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 16px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; cursor: pointer; font-size: 17px; }
.list-item:first-child { border-top: 0; }
.list-item .li-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--paper-2); display: grid; place-items: center; color: var(--brand); flex: none; }
:root[data-theme='dark'] .list-item .li-icon { color: var(--gold-light); }
.list-item .li-text { flex: 1; min-width: 0; }
.list-item .li-text small { display: block; color: var(--muted); font-size: 14px; }
.list-item .li-end { color: var(--muted); font-size: 15px; text-align: right; }
.list-item .chev { color: var(--faint); flex: none; }

/* ---------- history ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; }
.month-nav h2 { font-size: 21px; text-align: center; flex: 1; }
.icon-btn { width: 46px; height: 46px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--paper); display: grid; place-items: center; cursor: pointer; color: var(--ink); flex: none; }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

.ledger { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; font-size: 15.5px; }
.ledger th { text-align: right; font-weight: 600; font-size: 13.5px; color: var(--burgundy); padding: 11px 12px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger td { padding: 0; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.ledger tbody tr:first-child td { border-top: 0; }
.ledger td > button, .ledger td > span { display: block; width: 100%; padding: 12px; min-height: 50px; background: none; border: 0; text-align: inherit; cursor: pointer; color: inherit; font: inherit; }
.ledger .d-date { font-weight: 600; white-space: nowrap; }
.ledger .d-date small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.ledger .amt { font-family: var(--serif); font-size: 16.5px; }
.ledger .missing { color: var(--faint); font-size: 14px; }
.ledger .zero { color: var(--muted); }
.ledger .zero small, .ledger .inc small { display: block; font-size: 12px; color: var(--faint); font-family: var(--sans); }
.ledger .inc { color: var(--warn); }
.ledger .combined-col { font-weight: 600; }
.ledger tfoot td { background: var(--paper-2); border-top: 1.5px solid var(--line-strong); padding: 13px 12px; font-weight: 700; }
.ledger tfoot td.amt { font-family: var(--serif); }
.ledger tr.is-today td { background: color-mix(in srgb, var(--gold) 12%, var(--paper)); }
.pending-mark { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--palamig); margin-left: 6px; vertical-align: 2px; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-head { font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; padding-bottom: 4px; }
.cal-day { aspect-ratio: 1 / 1.08; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); padding: 5px 3px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; cursor: pointer; font-size: 13px; min-width: 0; color: var(--ink); }
.cal-day .cd-n { font-weight: 600; font-size: 14px; }
.cal-day .cd-amt { font-family: var(--serif); font-size: 11.5px; line-height: 1; white-space: nowrap; overflow: hidden; max-width: 100%; }
.cal-day .cd-dot { width: 7px; height: 7px; border-radius: 50%; }
.cal-day.complete { background: color-mix(in srgb, var(--ok) 11%, var(--paper)); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.cal-day.complete .cd-dot { background: var(--ok); }
.cal-day.incomplete { background: color-mix(in srgb, var(--warn) 9%, var(--paper)); border-color: color-mix(in srgb, var(--warn) 32%, transparent); border-style: dashed; }
.cal-day.incomplete .cd-dot { background: var(--warn); }
.cal-day.zero .cd-dot { background: var(--faint); }
.cal-day.none .cd-dot { background: transparent; border: 1.5px solid var(--line-strong); }
.cal-day.future { opacity: 0.35; cursor: default; }
.cal-day.blank { visibility: hidden; }
.cal-day.is-today { outline: 2px solid var(--brand); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13.5px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- sheet / dialog ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 20, 14, 0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s ease; }
.sheet { background: var(--cream); width: 100%; max-width: 620px; max-height: 92dvh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 10px 20px calc(var(--safe-b) + 22px);
  animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 14px; }
.sheet h2 { margin-bottom: 6px; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 26px; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } }
.toast { animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 12px); transform: translateX(-50%); background: var(--burgundy-deep); color: var(--hero-ink); padding: 13px 18px; border-radius: 14px;
  font-size: 15.5px; font-weight: 500; z-index: 60; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5); max-width: calc(100% - 32px); animation: rise 0.22s ease; }

/* ---------- confirmation ---------- */
.confirm { text-align: center; padding: 26px 8px 10px; }
.confirm-check { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; color: var(--on-brand); box-shadow: 0 0 0 6px rgba(214, 163, 72, 0.25), 0 14px 30px -14px rgba(165, 16, 25, 0.7); }
.confirm-check.is-local { background: var(--palamig); }
.confirm-check:not(.is-local) svg path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.45s 0.1s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.confirm h1 { font-size: 28px; }
.confirm .confirm-amount { font-family: var(--serif); font-size: 44px; font-weight: 600; margin: 8px 0 2px; font-variant-numeric: lining-nums tabular-nums; }
.confirm-summary { margin: 22px 0; text-align: left; }

/* ---------- bottom nav ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar nav { max-width: 620px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--nav-h); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.tab[aria-current='page'] { color: var(--brand); }
.tab { position: relative; }
.tab[aria-current='page']::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--gold); }
:root[data-theme='dark'] .tab[aria-current='page'] { color: var(--gold-light); }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--faint); font-size: 12px; font-family: var(--sans); }
.chart .lbl { fill: var(--muted); font-size: 12px; font-family: var(--sans); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart-tip { position: absolute; pointer-events: none; background: var(--burgundy-deep); color: var(--hero-ink); border-radius: 10px; padding: 8px 11px; font-size: 13.5px; line-height: 1.35; white-space: nowrap; z-index: 5;
  transform: translate(-50%, calc(-100% - 10px)); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45); }
.chart-tip b { font-family: var(--serif); font-weight: 600; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 2px 10px; font-size: 14px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.chart-legend i.hatched { background: repeating-linear-gradient(135deg, var(--faint) 0 3px, transparent 3px 6px); border: 1px solid var(--line-strong); }
.table-toggle { margin-top: 8px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin-top: 8px; }
.mini-table th, .mini-table td { padding: 8px 6px; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table th { color: var(--muted); font-weight: 600; font-size: 13px; border-top: 0; }
.mini-table td.amt { font-family: var(--serif); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kpi { background: var(--paper); padding: 14px 16px; }
.kpi .k-label { font-size: 14px; color: var(--muted); }
.kpi .k-value { font-family: var(--serif); font-size: 21px; font-weight: 600; margin-top: 3px; font-variant-numeric: lining-nums tabular-nums; }
.kpi .k-sub { font-size: 13px; color: var(--faint); }
.kpi.wide { grid-column: span 2; }
.kpi.big .k-value { font-size: 34px; }

.contrib { display: flex; height: 16px; border-radius: 8px; overflow: hidden; gap: 2px; margin: 12px 0 10px; }
.contrib .k { background: var(--kainan); }
.contrib .p { background: var(--palamig); }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; max-width: 440px; margin: 0 auto; padding: calc(var(--safe-t) + 32px) 24px calc(var(--safe-b) + 32px); }
.auth-brand { text-align: center; margin-bottom: 34px; }
.auth-brand img { width: 92px; height: 92px; border-radius: 24px; box-shadow: 0 18px 36px -16px rgba(104, 16, 23, 0.7); }
.auth-brand h1 { color: var(--burgundy); }
:root[data-theme='dark'] .auth-brand h1 { color: var(--ink); }
.auth { background: radial-gradient(90% 50% at 50% 0%, rgba(214, 163, 72, 0.16), transparent 70%); }
.auth .card { border-top: 3px solid var(--brand); }
.auth-brand h1 { font-size: 30px; margin-top: 18px; letter-spacing: 0.01em; }
.auth-brand p { color: var(--muted); margin: 6px 0 0; }
.auth .card { padding: 22px; }
.codes { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 17px; letter-spacing: 0.04em; line-height: 2; background: var(--paper-2); border-radius: 12px; padding: 12px 16px; }

.empty { text-align: center; padding: 30px 14px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--brand); animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 60dvh; }

@media (min-width: 900px) {
  .shell.wide { max-width: 980px; }
  .report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .report-grid > .section { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .confirm-check:not(.is-local) svg path { stroke-dashoffset: 0; }
}

/* ---------- print (PDF reports) ---------- */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff; color: #111; font-size: 11pt; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #A51019; padding-bottom: 8px; margin-bottom: 14px; }
  .pr-brand { font-family: var(--serif); font-size: 20pt; font-weight: 700; color: #681017; }
  .pr-sub { font-size: 10pt; color: #555; }
  .pr-title { font-family: var(--serif); font-size: 15pt; margin: 14px 0 6px; }
  .pr-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
  .pr-kpis div { border: 1px solid #ccc; border-radius: 6px; padding: 8px; }
  .pr-kpis b { display: block; font-family: var(--serif); font-size: 14pt; }
  .pr-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  .pr-table th, .pr-table td { border-bottom: 1px solid #ddd; padding: 5px 6px; text-align: right; }
  .pr-table th:first-child, .pr-table td:first-child { text-align: left; }
  .pr-table th { background: #681017; color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-table tfoot td { font-weight: 700; border-top: 2px solid #A51019; }
  .pr-note { font-size: 9pt; color: #555; margin-top: 10px; }
  .pr-table tr { break-inside: avoid; }
}
