/* ZCS Accounts — mobile-first design system. No external dependencies. */
:root {
  --bg: #f3f5f4; --surface: #ffffff; --surface-2: #f7f9f8; --text: #13201c; --muted: #5d6b66;
  --border: #dde3e0; --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e0f2ef;
  --pos: #15803d; --neg: #b91c1c; --warn: #a16207; --cash: #1d4ed8;
  --pos-soft: #dcfce7; --neg-soft: #fee2e2; --warn-soft: #fef3c7; --cash-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(16, 24, 22, .06), 0 4px 16px rgba(16, 24, 22, .05);
  --radius: 14px; --radius-sm: 10px; --tap: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1211; --surface: #141c1a; --surface-2: #1a2422; --text: #e6eeeb; --muted: #9aa9a4;
    --border: #2a3532; --accent: #2dd4bf; --accent-ink: #032420; --accent-soft: #11332f;
    --pos: #4ade80; --neg: #f87171; --warn: #fbbf24; --cash: #93c5fd;
    --pos-soft: #12301f; --neg-soft: #3a1717; --warn-soft: #362a0b; --cash-soft: #142640;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1211; --surface: #141c1a; --surface-2: #1a2422; --text: #e6eeeb; --muted: #9aa9a4;
  --border: #2a3532; --accent: #2dd4bf; --accent-ink: #032420; --accent-soft: #11332f;
  --pos: #4ade80; --neg: #f87171; --warn: #fbbf24; --cash: #93c5fd;
  --pos-soft: #12301f; --neg-soft: #3a1717; --warn-soft: #362a0b; --cash-soft: #142640;
  --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
code { font-size: .9em; background: var(--surface-2); padding: 0 .3em; border-radius: 4px; }
small { font-size: .82rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); }
.pre { white-space: pre-wrap; }
.r { text-align: right; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: .55rem 1rem; padding-top: max(.55rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800;
}
.brand-mark.lg { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 12px; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; color: var(--muted); font-size: .72rem; font-weight: 600;
}
.nav-item:hover { text-decoration: none; color: var(--text); }
.nav-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active { color: var(--accent); }
.nav-add svg {
  width: 44px; height: 44px; padding: 10px; margin-top: -18px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); stroke: var(--accent-ink); box-shadow: 0 4px 14px rgba(15, 118, 110, .35);
}
.nav-add.active { color: var(--accent); }

.main { max-width: 980px; margin: 0 auto; padding: 1rem 1rem calc(96px + env(safe-area-inset-bottom)); }
.main-public { padding-bottom: 2rem; }

@media (min-width: 960px) {
  .nav {
    top: 0; right: auto; width: 210px; grid-template-columns: 1fr; align-content: start; gap: .25rem;
    padding: 72px .75rem 1rem; border-top: 0; border-right: 1px solid var(--border);
  }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: .7rem; min-height: 46px; padding: 0 .8rem; border-radius: 10px; font-size: .95rem; }
  .nav-item.active { background: var(--accent-soft); }
  .nav-add { order: -1; margin-bottom: .5rem; }
  .nav-add svg { margin: 0; width: 30px; height: 30px; padding: 6px; }
  .topbar { padding-left: 1.25rem; z-index: 40; }
  .main { margin-left: 210px; padding: 1.5rem 2rem 3rem; max-width: 1100px; }
  .main-public { margin: 0 auto; }
}

/* ---------- Cards & layout ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.pad { padding: 1rem; }
.center-page { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.page-title { font-size: 1.45rem; letter-spacing: -.01em; }
.page-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head.pad { border-bottom: 1px solid var(--border); }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 700; color: var(--muted); margin-bottom: .2rem; }
.back { display: inline-block; margin-bottom: .5rem; font-weight: 600; min-height: 32px; }
.grid-2 { display: grid; gap: 0 .75rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.detail-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: .75rem; }
.detail-head .page-title { margin-bottom: .2rem; }
.detail-grid { display: grid; gap: 0 1rem; }
@media (min-width: 760px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.badges { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--tap);
  padding: 0 1.1rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.07); border-color: var(--accent); }
.btn-secondary { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { background: var(--neg-soft); border-color: transparent; color: var(--neg); }
.btn-sm { min-height: 38px; padding: 0 .8rem; font-size: .88rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.link-btn { background: none; border: 0; color: var(--neg); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; padding: .4rem; min-height: 36px; }
.action-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.action-row form { margin: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: .9rem; min-width: 0; }
.field > label, .chips-field legend, .filter-grid label { display: block; font-weight: 650; font-size: .88rem; margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: .6rem .8rem; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); appearance: none;
}
textarea { min-height: 80px; resize: vertical; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.has-error input, .has-error select, .has-error textarea, [aria-invalid=true] { border-color: var(--neg); }
.error { display: block; color: var(--neg); margin-top: .25rem; font-weight: 600; }
.hint { display: block; color: var(--muted); margin-top: .25rem; }
.hint-box { background: var(--surface-2); border-left: 3px solid var(--accent); padding: .6rem .8rem; border-radius: 6px; font-size: .9rem; color: var(--muted); }
.money-wrap { position: relative; }
.money-wrap > span { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.money-wrap input { padding-left: 1.7rem; font-weight: 650; text-align: right; }
.money-wrap.sm { width: 128px; flex-shrink: 0; }
.money-grid { display: grid; gap: 0 .75rem; grid-template-columns: 1fr 1fr; }
.money-grid .field:first-child { grid-column: 1 / -1; }
@media (min-width: 560px) { .money-grid { grid-template-columns: 1fr 1fr 1fr; } .money-grid .field:first-child { grid-column: auto; } }
fieldset { border: 0; padding: 0; margin: 0 0 .9rem; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 .95rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); font-weight: 600; font-size: .92rem; cursor: pointer; user-select: none;
}
.chip-input:checked + .chip { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-input:focus-visible + .chip { outline: 3px solid var(--accent); outline-offset: 2px; }
.has-error .chip { border-color: var(--neg); }
.check { display: flex; align-items: center; gap: .55rem; min-height: 44px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
details.more { border-top: 1px dashed var(--border); padding-top: .6rem; margin: .5rem 0 .9rem; }
details > summary { cursor: pointer; font-weight: 650; color: var(--accent); min-height: 40px; display: flex; align-items: center; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; margin-right: .45rem; transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }
details.danger > summary { color: var(--neg); }
.form-actions {
  display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: calc(64px + env(safe-area-inset-bottom));
  background: var(--surface); padding: .75rem 0 .25rem; margin-top: .5rem; border-top: 1px solid var(--border);
}
.form-actions .btn-primary { flex: 1 1 140px; }
@media (min-width: 960px) { .form-actions { bottom: 0; } .form-actions .btn-primary { flex: 0 0 auto; min-width: 160px; } }

.calc-box {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; margin: .25rem 0 1rem;
  background: var(--accent-soft); border-radius: var(--radius-sm); padding: .75rem;
}
.calc-box div { display: flex; flex-direction: column; }
.calc-box span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.calc-box strong { font-size: 1.15rem; }
.collect-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .75rem 0; margin-bottom: .9rem; }
.collect-head { display: flex; gap: .6rem; align-items: flex-end; }
.collect-head .grow { flex: 1; }
.collect-head .btn { margin-bottom: .9rem; }

/* Segmented control */
.segmented { display: flex; gap: .25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .25rem; margin-bottom: 1rem; }
.segmented.scroll { overflow-x: auto; }
.segmented.sm { margin: 0; }
.seg { flex: 1; text-align: center; min-height: 44px; display: grid; place-items: center; padding: 0 .7rem; border-radius: 9px; color: var(--muted); font-weight: 650; white-space: nowrap; }
.segmented.sm .seg { min-height: 34px; font-size: .85rem; }
.seg:hover { text-decoration: none; color: var(--text); }
.seg.active { background: var(--accent); color: var(--accent-ink); }

/* Flash messages */
.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 600; }
.flash-ok { background: var(--pos-soft); color: var(--pos); }
.flash-error { background: var(--neg-soft); color: var(--neg); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }

/* Badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.badge-ok { background: var(--pos-soft); color: var(--pos); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--neg-soft); color: var(--neg); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------- Dashboard ---------- */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 76px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: .88rem; box-shadow: var(--shadow);
}
.quick-btn:hover { text-decoration: none; border-color: var(--accent); }
.quick-btn span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 1.25rem; margin-bottom: .2rem; }
.q-sale span { background: var(--accent-soft); color: var(--accent); }
.q-service span { background: var(--pos-soft); color: var(--pos); }
.q-expense span { background: var(--neg-soft); color: var(--neg); }
.q-payment span { background: var(--cash-soft); color: var(--cash); }
.summaries { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
@media (min-width: 680px) { .summaries { grid-template-columns: 1fr 1fr; } }
.mini { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.mini dl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; margin: 0; }
.mini dt { font-size: .74rem; color: var(--muted); font-weight: 600; }
.mini dd { margin: 0; font-weight: 700; }
.group-title { margin-top: 1rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.group-title small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
.kpis.three { grid-template-columns: repeat(3, 1fr); margin-bottom: 1rem; }
.kpis.three .kpi:last-child { grid-column: auto; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } .kpis .kpi:last-child:nth-child(odd) { grid-column: auto; } }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .8rem; display: flex; flex-direction: column; min-width: 0; }
.kpi-label { font-size: .78rem; font-weight: 650; color: var(--muted); }
.kpi-value { font-size: 1.3rem; font-weight: 750; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi-note { font-size: .74rem; color: var(--muted); }
.kpi-pos .kpi-value { color: var(--pos); } .kpi-neg .kpi-value { color: var(--neg); }
.kpi-warn { border-left: 3px solid var(--warn); } .kpi-warn .kpi-value { color: var(--warn); }
.kpi-cash { border-left: 3px solid var(--cash); } .kpi-cash .kpi-value { color: var(--cash); }
.counts { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 1rem 0 .5rem; color: var(--muted); }
.counts strong { color: var(--text); }

/* Range picker */
.range { margin-bottom: .25rem; }
.range-presets { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: thin; }
.pill { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 38px; padding: 0 .85rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-size: .88rem; font-weight: 600; background: var(--surface-2); }
.pill:hover { text-decoration: none; border-color: var(--accent); }
.pill.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.range-custom { margin-top: .3rem; }
.range-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.range-row label { flex: 1 1 140px; font-size: .85rem; font-weight: 600; }

/* ---------- Lists ---------- */
.hlist { list-style: none; margin: 0; padding: 0; }
.hrow + .hrow { border-top: 1px solid var(--border); }
.hrow a { display: flex; justify-content: space-between; gap: .75rem; padding: .8rem 1rem; color: var(--text); }
.hrow a:hover { background: var(--surface-2); text-decoration: none; }
.hrow-main { display: flex; flex-direction: column; min-width: 0; }
.hrow-main > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow-top { display: flex; gap: .5rem; align-items: center; font-size: .8rem; }
.hrow-title { font-weight: 650; }
.hrow-main .muted { font-size: .85rem; }
.hrow-right { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; flex-shrink: 0; text-align: right; }
.hrow .amt { font-weight: 750; }
.hrow .sub { font-size: .78rem; }
.is-void { opacity: .55; }
.is-void .amt { text-decoration: line-through; }
.kind { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: .05rem .4rem; border-radius: 5px; }
.kind-sale { background: var(--accent-soft); color: var(--accent); }
.kind-service { background: var(--pos-soft); color: var(--pos); }
.kind-expense { background: var(--neg-soft); color: var(--neg); }
.kind-payment { background: var(--cash-soft); color: var(--cash); }
.rows { list-style: none; margin: 0 0 .75rem; padding: 0; }
.rows li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rows li > a, .rows li > span:first-child { flex: 1 1 200px; min-width: 0; color: var(--text); }
.rows .amt { font-weight: 700; }
.rows form { margin: 0; }
.link-list { display: grid; }
.link-list a { padding: .8rem 0; border-bottom: 1px solid var(--border); font-weight: 650; min-height: var(--tap); }
.empty { text-align: center; padding: 2rem 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); margin-bottom: 1rem; }
.empty-title { font-weight: 750; font-size: 1.1rem; margin-bottom: .3rem; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 1rem 0; }
.count { margin: 0 0 .4rem .2rem; font-size: .88rem; }

/* Filters */
.filters .search-row { display: flex; gap: .5rem; }
.filters .search-row input { flex: 1; }
.filters details { margin-top: .5rem; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .5rem; }
.filter-grid label { margin: 0; }
.filter-grid select, .filter-grid input { margin-top: .25rem; }

/* Statements */
dl.calc { margin: 0 0 .75rem; }
dl.calc > div { display: flex; justify-content: space-between; gap: 1rem; padding: .42rem 0; border-bottom: 1px dashed var(--border); }
dl.calc dt { color: var(--muted); }
dl.calc dt small { color: var(--muted); }
dl.calc dd { margin: 0; font-weight: 650; white-space: nowrap; }
dl.calc .sub dt, dl.calc .sub dd { color: var(--text); font-weight: 700; }
dl.calc .total { border-bottom: 2px solid var(--border); }
dl.calc .total dt { color: var(--text); font-weight: 750; }
dl.calc .total dd { font-size: 1.1rem; font-weight: 800; }
dl.calc .grand dd { font-size: 1.3rem; }
dl.kv { margin: 0; }
dl.kv > div { padding: .45rem 0; border-bottom: 1px solid var(--border); }
dl.kv dt { font-size: .8rem; font-weight: 650; color: var(--muted); }
dl.kv dd { margin: 0; }
.basis { font-size: .82rem; color: var(--muted); background: var(--surface-2); padding: .55rem .75rem; border-radius: 8px; margin: .75rem 0 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -1rem; padding: 0 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem .45rem; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: .55rem .45rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.r, .table td.r { text-align: right; }
.table tfoot td { font-weight: 750; border-top: 2px solid var(--border); }
.table.compact { margin-top: .75rem; }

/* Bars & trend */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.bar-label { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: .25rem 0 .15rem; border: 1px solid var(--border); }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bar-fill.neg { background: var(--neg); }
.trend { display: flex; align-items: flex-end; gap: .5rem; height: 170px; overflow-x: auto; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.trend-col { flex: 1 0 44px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend-bars { flex: 1; display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; }
.tb { width: 14px; border-radius: 4px 4px 0 0; }
.tb.rev, .sw.rev { background: var(--accent); }
.tb.pro, .sw.pro { background: var(--pos); }
.tb.neg { background: var(--neg); }
.trend-label { font-size: .72rem; color: var(--muted); margin-top: .3rem; white-space: nowrap; }
.legend { font-size: .82rem; color: var(--muted); margin-top: .5rem; display: flex; align-items: center; gap: .4rem; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: .5rem; }

/* Allocation list */
.alloc { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .25rem; }
.alloc-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.alloc-head h3 { margin: 0; }
.alloc-list { list-style: none; padding: 0; margin: .5rem 0; max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.alloc-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.alloc-list li:last-child { border-bottom: 0; }
.alloc-info { font-size: .85rem; min-width: 0; }
.alloc-info span { overflow-wrap: anywhere; }
.owed { color: var(--warn); font-weight: 700; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); }
.timeline > li { position: relative; padding: 0 0 .9rem .6rem; }
.timeline > li::before { content: ""; position: absolute; left: -1.43rem; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.tl-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.tl-head time { color: var(--muted); font-size: .82rem; }
.tl-changes { margin: .25rem 0 0; padding-left: 1rem; font-size: .85rem; color: var(--muted); }
.tl-changes span { font-weight: 650; color: var(--text); }
.tl-changes del { color: var(--neg); } .tl-changes ins { color: var(--pos); text-decoration: none; }

/* Auth */
.auth-card { margin-top: 8vh; }
.auth-brand { display: flex; gap: .8rem; align-items: center; margin-bottom: 1rem; }
.auth-brand h1 { margin: 0; font-size: 1.3rem; }
.auth-brand p { margin: 0; }
.theme-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

@media print {
  .topbar, .nav, .quick, .range, .form-actions, .actions-card, .btn { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
