/* Ledger — one stylesheet, no build step. Tokens follow the approved design (canvas "Proposed" boards). */
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/geist-latin.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/geist-mono-latin.woff2') format('woff2'); }

:root {
  --bg: #F7F8FA; --surface: #FFFFFF; --surface-2: #EEF1F5; --surface-3: #F3FAF8; --border: #E3E6EB; --border-strong: #DDE1E7; --line: #EEF0F3;
  --text: #0E1116; --muted: #5B6472; --faint: #8A93A1; --ink: #0E1116; --ink-fg: #FFFFFF;
  --accent: #0F766E; --accent-fg: #FFFFFF; --accent-soft: #E6F4F2;
  --pos: #136B3A; --pos-soft: #E6F5EC; --neg: #B4621A; --warn: #E08A1E; --warn-soft: #FFF4E5; --warn-ink: #9A5B0F;
  --danger: #B3261E; --danger-soft: #FDECEC; --pace-ok: #1F9D57; --pace-warn: #E08A1E; --pace-over: #D2452B; --track: #C9CED6;
  --shadow: 0 1px 2px rgba(14,17,22,.04);
  --r-lg: 20px; --r: 16px; --r-sm: 12px; --r-xs: 10px;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1116; --surface: #161A21; --surface-2: #1F2530; --surface-3: #15221F; --border: #262D38; --border-strong: #313945; --line: #222934;
    --text: #E8EDF3; --muted: #9AA3B0; --faint: #6F7986; --ink: #F3F5F8; --ink-fg: #0E1116;
    --accent: #2DD4BF; --accent-fg: #04211E; --accent-soft: #0F2E2B;
    --pos: #4ADE80; --pos-soft: #0F2618; --neg: #FB923C; --warn: #FBBF24; --warn-soft: #2B2210; --warn-ink: #FBBF24;
    --danger: #F87171; --danger-soft: #2D1414; --pace-ok: #34C77B; --pace-warn: #F2A64A; --pace-over: #F0624A; --track: #3A4250;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.02em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: .95rem; font-weight: 600; }
h3 { font-size: .9rem; font-weight: 600; }
.num, .amount, .mono, td.num { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .85rem; } .tiny { font-size: .76rem; }
.neg { color: var(--neg); } .pos { color: var(--pos); } .warn { color: var(--warn-ink); } .danger { color: var(--danger); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.eyebrow { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
[x-cloak] { display: none !important; }
svg.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* Layout */
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 14px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1rem; padding: 0 10px 16px; color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.nav-group { margin: 12px 10px 4px; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-xs); color: var(--muted); font-weight: 500; font-size: .9rem; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav .ico { width: 18px; height: 18px; flex: none; }
.badge { margin-left: auto; background: var(--accent); color: var(--accent-fg); border-radius: 999px; font: 600 .72rem/1.4 var(--mono); padding: 1px 7px; }
.main { min-width: 0; padding: 26px clamp(16px, 3vw, 36px) 60px; max-width: 1220px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabbar { display: none; }

/* Cards & grid */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.soft { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card.hero { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card.flush .card-head { padding: 16px 18px 0; }
.stack > * + * { margin-top: 16px; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat { font-family: var(--mono); font-size: 1.55rem; font-weight: 600; letter-spacing: -.03em; margin-top: 2px; line-height: 1.1; }
.stat.big { font-size: 2.6rem; }
.delta { font-size: .8rem; font-weight: 600; margin-top: 4px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .big-ico { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--faint); }
.tile-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 2px; }
.tile .k { font-size: .76rem; color: var(--muted); } .tile .v { font-family: var(--mono); font-size: 1.05rem; font-weight: 500; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); height: 40px; padding: 0 14px; border-radius: var(--r-sm); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--ink-fg); }
.btn.primary:hover, .btn.dark:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 32px; padding: 0 11px; font-size: .82rem; border-radius: var(--r-xs); }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.round { border-radius: 999px; }
.btn:disabled { opacity: .5; cursor: default; }
label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=month],
input[type=search], input[type=file], input:not([type]), select, textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS zooming */ }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input[type=file] { padding-top: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; border-color: var(--accent); }
input[type=color] { width: 44px; height: 42px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: .86rem; margin: 0; cursor: pointer; }
.check input { margin: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 160px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px; gap: 2px; background: var(--surface); }
.seg input { display: none; }
.seg label { margin: 0; height: 30px; padding: 0 14px; border-radius: 999px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font-size: .82rem; font-weight: 600; }
.seg input:checked + label { background: var(--ink); color: var(--ink-fg); }
.errors { background: var(--danger-soft); color: var(--danger); border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 16px; font-size: .9rem; }
.flash { background: var(--pos-soft); color: var(--pos); border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 16px; font-weight: 500; font-size: .9rem; }
details summary { cursor: pointer; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xs); color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; height: auto; padding: 0; flex: 1; min-width: 0; }
.search input:focus { outline: 0; }
.search .kbd { font: 500 .7rem/1.5 var(--mono); border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 6px; }
.kbd { font: 500 .72rem/1.5 var(--mono); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 5px; }

/* Tables & lists */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.date-head { position: sticky; top: 0; background: var(--bg); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 18px 6px; z-index: 1; }
.card.flush .date-head { background: var(--surface-2); padding: 7px 18px; }
.tx { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.tx:last-child { border-bottom: 0; }
.tx:hover { background: var(--surface-2); }
.tx-main { flex: 1; min-width: 0; }
.tx-title { font-weight: 600; display: flex; gap: 8px; align-items: center; min-width: 0; font-size: .95rem; }
.tx-sub { color: var(--muted); font-size: .78rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tx-amt { text-align: right; font-family: var(--mono); font-weight: 500; font-size: .95rem; white-space: nowrap; }
.tx-amt .native { display: block; font-size: .72rem; color: var(--muted); }
.avatar { width: 36px; height: 36px; flex: none; border-radius: var(--r-xs); display: grid; place-items: center; font-size: 17px; background: var(--surface-2); }

/* Pills, chips, bars */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.pill.cat { background: color-mix(in srgb, var(--c, #64748b) 14%, transparent); color: color-mix(in srgb, var(--c, #64748b) 75%, var(--text)); }
.pill.review { background: var(--warn-soft); color: var(--warn-ink); }
.pill.ok { background: var(--pos-soft); color: var(--pos); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.outline { background: transparent; border-color: var(--border-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--c, #64748b); }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: visible; position: relative; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--pace-ok)); }
.bar.warn > span { background: var(--pace-warn); }
.bar.over > span { background: var(--pace-over); }
.bar .marker { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text); opacity: .4; }
.split-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; }
.split-bar > span { display: block; min-width: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; font: inherit; font-size: .82rem; font-weight: 500; cursor: pointer; color: var(--text); white-space: nowrap; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.chip.more { width: 34px; padding: 0; justify-content: center; color: var(--muted); }

/* Review */
.review-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.review-card.needs { border-left: 3px solid var(--warn); }
.review-card.done { opacity: .45; }
.reason { font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.conf { width: 40px; height: 4px; border-radius: 9px; background: var(--surface-2); overflow: hidden; display: inline-block; }
.conf > i { display: block; height: 100%; background: var(--accent); }
.raw { font: 12px/1.45 var(--mono); background: var(--surface-2); border-radius: var(--r-xs); padding: 8px 10px; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.inline-edit { border: 0; padding: 0; background: transparent; font: inherit; font-weight: 600; font-size: 1rem; color: var(--text); width: 100%; height: auto; border-radius: 0; }
.inline-edit:focus { outline: 0; border-bottom: 1px solid var(--accent); }

/* Modal / sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,14,20,.45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.sheet { background: var(--surface); border-radius: 18px; width: min(560px, 100%); max-height: 88vh; overflow-y: auto; padding: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

/* Charts */
.chart { position: relative; height: 240px; }
.chart.tall { height: 320px; } .chart.short { height: 160px; } .chart.mini { height: 96px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .line { width: 16px; height: 3px; background: var(--accent); border-radius: 2px; }
.legend .dash { width: 16px; border-top: 2px dashed var(--track); }
.axis { display: flex; justify-content: space-between; font: 500 .66rem/1.4 var(--mono); color: var(--faint); text-transform: uppercase; }

/* Pagination (Laravel default markup) */
nav[role=navigation] { margin-top: 14px; }
nav[role=navigation] svg { width: 18px; height: 18px; }
nav[role=navigation] > div:first-child { display: none; }
nav[role=navigation] p { color: var(--muted); font-size: .85rem; }
nav[role=navigation] span[aria-current] > span, nav[role=navigation] a { padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; margin: 0 2px; display: inline-block; }
nav[role=navigation] span[aria-current] > span { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
nav[role=navigation] .relative.z-0 { display: inline-flex; flex-wrap: wrap; gap: 2px; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(380px, 100%); padding: 28px; }
.code-input { font-family: var(--mono); font-size: 1.7rem; letter-spacing: .4em; text-align: center; height: 56px; }

/* Responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-wide { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
  .g2, .g3 { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
  .stat.big { font-size: 2.3rem; }
  .card { padding: 16px; border-radius: var(--r-lg); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; align-items: end;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); padding-top: 6px; position: relative; font-weight: 500; }
  .tabbar a .ico { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--accent); font-weight: 600; }
  .tabbar a.add { padding: 0; }
  .tabbar a.add span { width: 44px; height: 44px; border-radius: 14px; background: var(--ink); color: var(--ink-fg); display: grid; place-items: center; }
  .tabbar a.add span .ico { width: 20px; height: 20px; }
  .tabbar .badge { position: absolute; top: 0; left: 54%; margin: 0; font-size: .62rem; padding: 0 5px; }
  .tx { padding: 11px 14px; }
  .hide-sm { display: none !important; }
  td, th { padding: 9px 10px; }
  .page-head { margin-bottom: 14px; }
}
@media (max-width: 480px) { .g4 { grid-template-columns: 1fr 1fr; gap: 10px; } .stat { font-size: 1.3rem; } .tile-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 861px) { .show-sm { display: none !important; } }
