@font-face { font-family: Geist; src: url(/fonts/geist-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Geist; src: url(/fonts/geist-latin-ext-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light dark;
  --bg: #f6f5f1; --surface: #fffefb; --raised: #fff; --line: #e3e1da; --line-strong: #cfcdc4;
  --ink: #161614; --ink-2: #55544e; --ink-3: #6f6e66;
  --arc: #d9521f; --arc-soft: #f6e0d5;
  --good: #1a7f4e; --bad: #c0352f;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --rail: 208px;
  font-family: Geist, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211; --surface: #1a1a18; --raised: #232321; --line: #2c2c29; --line-strong: #3d3d39;
    --ink: #f1f0ec; --ink-2: #bdbcb2; --ink-3: #96958b;
    --arc: #f0763f; --arc-soft: #3b2418;
    --good: #4cc38a; --bad: #f2736b;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--arc); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; padding: 22px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 10px 20px; font-weight: 600; font-size: 17px; letter-spacing: -.02em; text-decoration: none; }
.brand svg { width: 24px; height: 24px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav:hover { background: var(--surface); color: var(--ink); }
.nav[aria-current=page] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
main { padding: 34px 40px 80px; max-width: 1080px; width: 100%; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.head h1 { font-size: 28px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
.head p { color: var(--ink-2); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

section { margin-bottom: 40px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; min-height: 34px; flex-wrap: wrap; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
.grid-2 > section { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 40px; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { opacity: .88; }
.btn.ghost { border-color: transparent; color: var(--ink-2); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: progress; }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; min-width: 0; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 400;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.form { display: flex; flex-direction: column; gap: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.inline-add { display: flex; gap: 8px; margin-bottom: 8px; }
.inline-add input[type=date] { width: 152px; flex: none; }

.seg { display: inline-flex; align-self: flex-start; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 11px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg input:checked + span { background: var(--ink); color: var(--bg); }
.seg input:focus-visible + span { outline: 2px solid var(--arc); outline-offset: -2px; }

/* Lists */
.list { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 2px; border-bottom: 1px solid var(--line); min-width: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { overflow-wrap: anywhere; }
.item .sub { font-size: 13px; color: var(--ink-2); }
.item.press { width: 100%; background: none; border-width: 0 0 1px; border-color: var(--line); text-align: left; cursor: pointer; font: inherit; color: inherit; }
.item.press:hover { background: var(--surface); }
.empty { color: var(--ink-2); padding: 14px 0; border-top: 1px solid var(--line); }
.tick { appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border: 1.5px solid var(--line-strong); border-radius: 50%; background: transparent; cursor: pointer; display: grid; place-content: center; }
.tick:checked { background: var(--arc); border-color: var(--arc); }
.tick:checked::after { content: ''; width: 10px; height: 5px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.is-done { color: var(--ink-3); text-decoration: line-through; }
.flag { font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.flag.late { color: var(--bad); }
.streak { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.pos { color: var(--good); } .neg { color: var(--bad); }

/* Today */
.hero-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: center; margin-bottom: 40px; }
.gauge { position: relative; width: 200px; height: 170px; }
.gauge svg { width: 100%; height: auto; display: block; }
.gauge-track { stroke: var(--line); } .gauge-fill { stroke: var(--arc); transition: stroke-dasharray .4s ease; }
.gauge-label { position: absolute; inset: 0 0 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-label b { font-size: 38px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.stat { text-decoration: none; display: block; min-width: 0; }
.stat .k { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.stat .v { font-size: 25px; font-weight: 600; letter-spacing: -.025em; line-height: 1.25; overflow-wrap: anywhere; }
.footer-links { display: flex; gap: 16px; padding-top: 8px; }

/* Wealth */
.networth { font-size: clamp(38px, 7vw, 56px); font-weight: 600; letter-spacing: -.04em; line-height: 1.05; }
.alloc { display: flex; gap: 2px; height: 12px; margin-bottom: 14px; }
.alloc i { display: block; min-width: 3px; background: var(--c); }
.alloc i:first-child { border-radius: 4px 0 0 4px; } .alloc i:last-child { border-radius: 0 4px 4px 0; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 20px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 7px; }
.legend .v { margin-left: auto; color: var(--ink-2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.key { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); } .key span { display: inline-flex; align-items: center; gap: 6px; }
.cat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 7px 0; font-size: 14px; }
.cat .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--s1); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-bottom: 20px; }

.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-size: 11px; fill: var(--ink-3); font-family: inherit; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); }
.chart .series { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--s1); stroke: var(--bg); stroke-width: 2; }
.chart .cross { stroke: var(--line-strong); }
.tip { position: absolute; top: 0; pointer-events: none; padding: 6px 9px; border-radius: 7px; background: var(--raised); border: 1px solid var(--line-strong); font-size: 13px; white-space: nowrap; z-index: 2; }
.tip small { display: block; color: var(--ink-2); font-size: 12px; }
details > summary { cursor: pointer; color: var(--ink-2); font-size: 13px; margin-top: 10px; }

/* Habits */
.board { display: grid; grid-template-columns: minmax(96px, 1fr) repeat(var(--days), 30px) 42px; gap: 5px 3px; align-items: center; overflow-x: auto; padding-bottom: 4px; }
.board .d { font-size: 11px; color: var(--ink-3); text-align: center; line-height: 1.2; }
.board .d.now { color: var(--ink); font-weight: 600; }
.board .name { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; overflow-wrap: anywhere; font: inherit; color: inherit; }
.board .name:hover { text-decoration: underline; text-underline-offset: 3px; }
.cell { appearance: none; width: 28px; height: 28px; margin: 0 1px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.cell:checked { background: var(--arc); border-color: var(--arc); }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); grid-auto-columns: 13px; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { display: block; border-radius: 3px; background: var(--line); }
.heat i.l1 { background: color-mix(in srgb, var(--arc) 35%, var(--line)); }
.heat i.l2 { background: color-mix(in srgb, var(--arc) 65%, var(--line)); }
.heat i.l3 { background: var(--arc); }
.heat i.pad { background: none; }

/* Comms */
.draft { padding: 14px 0; border-bottom: 1px solid var(--line); }
.draft .label { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.draft textarea { min-height: 96px; margin-bottom: 8px; }

dialog { width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 20px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
dialog h2 { font-size: 17px; margin-bottom: 14px; }
.dialog-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.dialog-foot div { display: flex; gap: 8px; margin-left: auto; }
.history { max-height: 200px; overflow: auto; margin-top: 16px; }

#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; max-width: min(92vw, 420px); }
#toast div { background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 9px; font-size: 14px; }

.login { min-height: 100dvh; display: grid; place-content: center; padding: 16px; }
.login form { width: min(320px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 12px; }
.login svg { width: 40px; height: 40px; }
.login h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.loading { color: var(--ink-3); padding: 40px 0; }

@media (max-width: 760px) {
  .shell { display: block; }
  .rail { position: fixed; z-index: 10; inset: auto 0 0; height: auto; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); background: var(--bg); }
  .brand { display: none; }
  .nav { flex: 1; min-width: 0; flex-direction: column; gap: 2px; padding: 5px 0; font-size: 11px; }
  .nav[aria-current=page] { box-shadow: none; }
  main { padding: 22px 16px calc(96px + env(safe-area-inset-bottom)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .hero-row { grid-template-columns: minmax(0, 1fr); gap: 16px; justify-items: center; }
  .hero-row .stats { width: 100%; }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stat { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .stat .v { font-size: 20px; }
  .tiles { gap: 12px; }
  .tiles .stat { display: block; }
  .tiles .stat .v { font-size: 17px; }
  .inline-add:has(input[type=date]) { flex-wrap: wrap; }
  .inline-add:has(input[type=date]) input:first-child { flex: 1 1 100%; }
  .inline-add input[type=date] { flex: 1; width: auto; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; } /* stops iOS zoom on focus */
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.coach { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.coach h3 { font-size: 15px; margin: 22px 0 6px; }
.coach ul { margin: 0; padding-left: 20px; }
.coach-summary { font-size: 17px; font-weight: 500; margin: 0 0 6px; }
.issue { padding: 12px 0; border-bottom: 1px solid var(--line); }
.issue p { margin: 6px 0 0; }
.issue blockquote { margin: 6px 0 0; padding-left: 10px; border-left: 3px solid var(--arc); color: var(--ink-2); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
