/* Money app. Dark surface, same validated palette as the cards dashboard:
   one sequential blue for every magnitude bar, status colours only for state. */
:root {
  color-scheme: dark;
  --plane:   #0d0d0d;
  --surface: #1a1a19;
  --raised:  #242422;
  --ink:     #ffffff;
  --ink-2:   #c3c2b7;
  --muted:   #898781;
  --hair:    rgba(255, 255, 255, 0.10);
  --rule:    #2c2c2a;

  --good:     #0ca30c;
  --warning:  #fab219;
  --critical: #d03b3b;

  --seq-fill:  #3987e5;
  --seq-track: #184f95;
  --seq-faint: #12345e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--plane);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(92px + env(safe-area-inset-bottom));
  font-variant-numeric: tabular-nums;
}
.wrap { max-width: 720px; margin: 0 auto; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

header { margin-bottom: 16px; }
h1 { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.stamp { color: var(--muted); font-size: 13px; margin-top: 2px; }
.msg { color: var(--ink-2); padding: 40px 0; text-align: center; }

h2 {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); margin: 28px 0 10px;
  display: flex; justify-content: space-between; align-items: baseline;
}
h2 .link { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--seq-fill); font-size: 14px; cursor: pointer; }

/* Hero: exactly one per view. */
.hero { background: var(--surface); border: 1px solid var(--hair); border-radius: 16px; padding: 20px; margin-bottom: 12px; }
.hero .label { color: var(--ink-2); font-size: 14px; }
.hero .value { font-size: 46px; font-weight: 650; line-height: 1.05; margin: 6px 0 4px; letter-spacing: -0.02em; }
.hero .sub { color: var(--muted); font-size: 14px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 14px; text-align: left; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 23px; font-weight: 650; margin-top: 4px; }
.tile .note { color: var(--muted); font-size: 12px; margin-top: 2px; }
button.tile { cursor: pointer; width: 100%; }

.list { background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-top: 1px solid var(--rule); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0;
  text-align: left; cursor: pointer;
}
.row:first-child { border-top: 0; }
.row:active { background: var(--raised); }
.row .main { flex: 1; min-width: 0; }
.row .name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { font-weight: 550; white-space: nowrap; }
.row .amt.in { color: var(--ink); }
.row .amt.in::before { content: "+"; }
.row.moved .name, .row.moved .amt { color: var(--muted); }
.row .side { text-align: right; }
.row .side .meta { font-size: 12px; }
.dayhead { padding: 10px 14px 6px; font-size: 13px; color: var(--muted); background: var(--plane); position: sticky; top: 0; }

.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; border: 1px solid var(--hair); color: var(--ink-2); margin-left: 6px; vertical-align: 2px; }
.pill.warn { border-color: var(--warning); color: var(--warning); }
.pill.good { border-color: var(--good); color: var(--good); }

/* Category share bars: one hue, magnitude only. Rounded data end, anchored left. */
.bar { height: 6px; background: var(--seq-faint); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--seq-fill); border-radius: 0 3px 3px 0; }
.sub-rows { background: var(--plane); }
.sub-rows .row { padding-left: 28px; }

/* 12-month spending bars. Selected month full blue, the rest the darker step. */
.chart { background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 14px 12px 10px; }
.chart .cap { font-size: 14px; color: var(--ink-2); min-height: 20px; margin-bottom: 8px; }
.chart .cap b { color: var(--ink); font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; }
.bars button {
  flex: 1; height: 100%; display: flex; align-items: flex-end; padding: 0; border: 0;
  background: none; cursor: pointer; min-width: 0;
}
.bars button i { display: block; width: 100%; background: var(--seq-track); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars button.sel i { background: var(--seq-fill); }
.axis { display: flex; gap: 2px; margin-top: 6px; }
.axis span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
.axis-rule { border-top: 1px solid var(--rule); }

.monthnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.monthnav button { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; width: 44px; height: 38px; font-size: 20px; cursor: pointer; }
.monthnav button:disabled { opacity: 0.3; }
.monthnav .m { font-size: 18px; font-weight: 600; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.controls input[type=search], .controls select {
  background: var(--surface); color: var(--ink); border: 1px solid var(--hair); border-radius: 10px;
  padding: 9px 12px; font: inherit; font-size: 16px;
}
.controls input[type=search] { flex: 1 1 100%; }
.controls select { flex: 1 1 40%; min-width: 0; }
.chip { background: var(--surface); border: 1px solid var(--hair); border-radius: 18px; padding: 6px 12px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.chip.on { border-color: var(--seq-fill); color: var(--ink); }
.more { display: block; margin: 12px auto; }
.empty { color: var(--muted); padding: 18px 14px; font-size: 14px; }
.note { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* Bottom tab bar. */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex;
  background: rgba(20, 20, 19, 0.94); border-top: 1px solid var(--rule);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 13px; padding: 10px 0; cursor: pointer; }
.tabs button.on { color: var(--ink); font-weight: 600; }

/* Bottom sheet for one transaction. */
.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto;
  background: var(--surface); border-top: 1px solid var(--hair); border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--rule); margin: -6px auto 14px; }
.sheet .big { font-size: 32px; font-weight: 650; }
.sheet .title { font-size: 19px; font-weight: 600; }
.sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 16px 0; }
.sheet dt { color: var(--muted); }
.sheet dd { margin: 0; overflow-wrap: anywhere; }
.sheet select { width: 100%; background: var(--plane); color: var(--ink); border: 1px solid var(--hair); border-radius: 10px; padding: 11px 12px; font: inherit; font-size: 16px; }
.sheet .btns { display: grid; gap: 8px; margin-top: 12px; }
.btn { background: var(--seq-fill); color: #fff; border: 0; border-radius: 12px; padding: 13px; font-weight: 600; cursor: pointer; font-size: 16px; }
.btn.ghost { background: none; border: 1px solid var(--hair); color: var(--ink); font-weight: 500; }
.btn:disabled { opacity: 0.5; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom));
  background: var(--raised); border: 1px solid var(--hair); border-radius: 12px; padding: 10px 16px; font-size: 14px;
  max-width: 90vw;
}

/* Sign-in pages. */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 18px; }
.card .btn { margin-top: 16px; width: 100%; }
.card .cap { color: var(--ink-2); font-size: 14px; margin-top: 10px; min-height: 20px; }
