/* Paper and ink. Warm off-white, black type, one highlighter, thin rules.
   Lists and sentences instead of dashboards. */
:root {
  --paper: #fbf8f1; --card: #fffdf8; --ink: #1d1d1b; --muted: #6b675e; --faint: #a19c90; --line: #e6e0d2; --line2: #d6cfbe;
  --hl: #ffe680; --good: #1f7a3a; --bad: #b3261e; --link: #1d1d1b;
  --soft: #fff8d9; --soft-bad: #fbe9e7; --quiz: #fffdf2; --warn: #8a5a00;
  --blue: #2a78d6; --orange: #eb6834;
  --sans: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Segoe UI', Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); overscroll-behavior: none; }
body { font: 17px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
#app { display: flex; flex-direction: column; height: 100dvh; max-width: 680px; margin: 0 auto; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
main#view { flex: 1; overflow-y: auto; padding: 8px 22px 40px; -webkit-overflow-scrolling: touch; }

h1 { font-size: 32px; line-height: 1.12; letter-spacing: -0.025em; font-weight: 800; margin: 18px 0 4px; }
h2 { font-size: 20px; letter-spacing: -0.01em; font-weight: 800; margin: 34px 0 10px; padding-top: 18px; border-top: 2px solid var(--ink); }
h3 { font-size: 19px; line-height: 1.3; font-weight: 750; margin: 2px 0 6px; letter-spacing: -0.01em; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 6px; font-weight: 800; }
p { margin: 8px 0; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; cursor: pointer; }
mark { background: linear-gradient(transparent 55%, var(--hl) 55%); color: inherit; padding: 0 2px; }
b { font-weight: 750; }
.lead { font-size: 20px; line-height: 1.45; }
.dateline { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 15px; } .tiny { font-size: 13px; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.num, .n { font-variant-numeric: tabular-nums; }

/* Top bar, advance bar, tabs */
#top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 22px 8px; }
#top .wk { font-weight: 800; font-size: 16px; }
#top .cash, #top .nw { font-size: 15px; color: var(--muted); }
#top .cash b, #top .nw b { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
#top .race-bar { flex-basis: 100%; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
#top .race-bar i { display: block; height: 100%; background: var(--ink); }
#top .brand { font-weight: 800; }
#advance { display: flex; gap: 10px; padding: 10px 22px; border-top: 1px solid var(--line); background: var(--paper); }
#advance button { min-height: 50px; font-size: 17px; }
#advance button.go { flex: 1; }
#tabs { display: flex; justify-content: space-around; border-top: 1px solid var(--line); padding: 2px 8px env(safe-area-inset-bottom); background: var(--paper); }
#tabs button { border: 0; background: none; padding: 12px 6px 12px; min-height: 48px; font-size: 15px; color: var(--muted); border-radius: 0; font-weight: 600; }
#tabs button.on { color: var(--ink); box-shadow: inset 0 3px 0 var(--ink); }

/* Buttons */
button { font: inherit; color: var(--ink); background: var(--card); border: 1.5px solid var(--ink); border-radius: 999px; padding: 9px 18px; min-height: 44px; cursor: pointer; font-weight: 650; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .35; cursor: default; }
button.go { background: var(--ink); color: var(--paper); }
button.go.big { font-size: 19px; padding: 14px 28px; }
button.ghost { border-color: var(--line2); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.link { background: none; border: 0; padding: 0; min-height: 0; text-decoration: underline; }
.actions, .btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* Decision cards */
.item { background: var(--card); border: 1.5px solid var(--ink); border-radius: 12px; padding: 16px 18px; margin: 14px 0; }
.item.tempt { border-style: dashed; }
.item.done { border-color: var(--line2); }
.kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; color: var(--muted); margin-bottom: 2px; }
.note { border-left: 4px solid var(--hl); background: var(--soft); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 14px 0; font-size: 16px; }
.note.bad { border-left-color: var(--bad); background: var(--soft-bad); }
.note.ceo { border-left-color: var(--ink); background: var(--card); }

/* Lists */
ul.log { list-style: none; padding: 0; margin: 0; }
ul.log li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.log li.bad { color: var(--bad); }
ul.log .when { color: var(--faint); font-size: 13px; margin-right: 6px; }
ul.rows, ul.menu { list-style: none; padding: 0; margin: 8px 0; border-top: 1px solid var(--line2); }
ul.rows li, ul.menu li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line2); }
ul.rows li > a, ul.rows li > div, ul.menu li > a { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
ul.rows b, ul.menu b { display: block; font-size: 17px; }
ul.rows span, ul.menu span { display: block; color: var(--muted); font-size: 14px; }
ul.rows i { font-style: normal; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
ul.rows li > a:active, ul.menu li > a:active { opacity: .6; }
ul.rows.choose li.on b { background: linear-gradient(transparent 55%, var(--hl) 55%); display: inline; }
ul.rows.choose li i { font-size: 20px; }
em.new { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; background: var(--hl); padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 2px; }
.tabs-inline { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 12px 0 6px; }
.tabs-inline a { text-decoration: none; color: var(--muted); font-weight: 650; padding: 4px 0; }
.tabs-inline a.on { color: var(--ink); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 7px; }

/* Progress meter */
.meter { height: 12px; border: 1.5px solid var(--ink); border-radius: 99px; overflow: hidden; background: var(--card); margin: 10px 0; }
.meter i { display: block; height: 100%; background: var(--hl); border-right: 1.5px solid var(--ink); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); }

/* The financial statement */
.sheet-paper { background: var(--card); border: 1.5px solid var(--ink); border-radius: 4px; padding: 14px 16px; margin: 14px 0; }
.sheet-paper h4 { border-bottom: 1.5px solid var(--ink); padding-bottom: 4px; }
table.ledger { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 16px; }
table.ledger td { padding: 5px 0; border-bottom: 1px solid var(--line); }
table.ledger td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.ledger tr.total td { font-weight: 800; border-bottom: 0; border-top: 1.5px solid var(--ink); }
table.ledger tr.hl td { font-weight: 700; }
.bottom-line { display: flex; justify-content: space-between; font-size: 19px; font-weight: 800; padding-top: 8px; border-top: 3px double var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two .sheet-paper { margin: 0; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; gap: 0; } .two .sheet-paper { margin: 14px 0 0; } }
.networth { font-size: 19px; margin: 18px 0; }
svg.pattern { width: 100%; height: auto; display: block; margin: 8px 0; }
table.quad { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.quad td { border: 1.5px solid var(--ink); padding: 8px 6px; text-align: center; vertical-align: top; }
table.quad b { display: block; font-size: 24px; line-height: 1.1; }
table.quad span { display: block; font-size: 12px; color: var(--muted); }
table.quad em { display: block; font-style: normal; font-weight: 750; margin-top: 4px; }

/* Standings and comparison tables */
table.standings, .cmp { width: 100%; border-collapse: collapse; margin: 10px 0; }
table.standings th, .cmp th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 6px 4px; border-bottom: 1.5px solid var(--ink); }
table.standings td, .cmp td { padding: 10px 4px; border-bottom: 1px solid var(--line2); vertical-align: top; }
table.standings td span { display: block; font-size: 13px; color: var(--muted); }
table.standings .n, .cmp td, .cmp th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp td:first-child { text-align: left; white-space: normal; }
table.standings tr.me td:nth-child(2) b { background: linear-gradient(transparent 55%, var(--hl) 55%); }

/* Detail sheets (business, property, deals) */
.card { background: var(--card); border: 1px solid var(--line2); border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.card.tap { cursor: pointer; }
.title { font-weight: 750; }
.sub { color: var(--muted); font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 12px 0; border-top: 1px solid var(--line2); border-left: 1px solid var(--line2); }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.stat { padding: 8px 10px; border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); min-width: 0; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); margin-right: 4px; }
.tag.good { color: var(--good); border-color: currentColor; } .tag.bad { color: var(--bad); border-color: currentColor; } .tag.warn, .tag.ceo { color: var(--ink); background: var(--hl); border-color: transparent; }
.seg { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0; }
.seg button { border: 0; background: none; padding: 4px 0; min-height: 34px; border-radius: 0; color: var(--muted); }
.seg button.on { color: var(--ink); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 7px; }
.sticky-seg { position: sticky; top: 0; z-index: 2; background: var(--paper); padding: 2px 0; }
table.st { width: 100%; border-collapse: collapse; font-size: 15px; }
table.st td { padding: 6px 2px; border-bottom: 1px solid var(--line); }
table.st td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.st tr.head td { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; border-bottom: 0; padding-top: 14px; font-weight: 700; }
table.st tr.total td { font-weight: 800; border-bottom: 0; border-top: 1.5px solid var(--ink); }
table.st tr.sub td { color: var(--muted); }
table.st td.ind { padding-left: 12px; }
.ctl { margin: 18px 0; }
.ctl label { font-weight: 750; }
input[type=range] { width: 100%; accent-color: var(--ink); height: 30px; }
.stepper { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.stepper button { width: 44px; padding: 0; font-size: 20px; }
.stepper .val { min-width: 100px; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch { position: relative; width: 52px; height: 30px; flex: none; border-radius: 99px; background: var(--line); border: 1.5px solid var(--ink); padding: 0; min-height: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--ink); transition: transform .15s; }
.switch.on { background: var(--hl); }
.switch.on::after { transform: translateX(21px); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--ink); width: 0; transition: width .1s; }
.lock { padding: 6px 0; }
.check { list-style: none; padding: 0; margin: 10px 0; }
.check li { padding: 6px 0; color: var(--muted); }
.check li.done { color: var(--ink); font-weight: 650; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 4px 0; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.legend i.band { height: 10px; opacity: .35; }

/* Charts */
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .tip { position: absolute; top: 0; pointer-events: none; background: var(--card); border: 1.5px solid var(--ink); border-radius: 8px; padding: 6px 8px; font-size: 13px; white-space: nowrap; transform: translateX(-50%); display: none; z-index: 3; }

/* Sheets slide up over the page */
#sheetWrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
#sheetWrap[hidden] { display: none; }
#sheetBg { position: absolute; inset: 0; background: rgba(40, 34, 20, .35); }
#sheet { position: relative; width: 100%; max-width: 680px; max-height: 92dvh; overflow-y: auto; background: var(--paper); border-top: 2px solid var(--ink); border-radius: 16px 16px 0 0; padding: 6px 22px calc(28px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
#sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 4px auto 8px; }
#sheet .shead { display: flex; align-items: center; gap: 10px; position: sticky; top: -6px; background: var(--paper); padding: 8px 0 6px; z-index: 2; }
#sheet .shead .title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
#sheet .shead .x { margin-left: auto; width: 44px; padding: 0; border-color: var(--line2); }

#toast { position: fixed; left: 50%; bottom: calc(140px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); }

/* Start screen */
.hero { padding: 26px 0 6px; }
.hero .logo { font-weight: 900; letter-spacing: -0.03em; font-size: 20px; border-bottom: 3px solid var(--ink); display: inline-block; margin-bottom: 14px; }
.hero h1 { font-size: 36px; margin: 0 0 12px; }
.hero p { font-size: 18px; color: var(--muted); }
.hero p b { color: var(--ink); }
.profiles { display: none; }

/* What you own */
svg.stack { width: 100%; height: auto; display: block; margin: 6px 0 8px; }
ul.stack-legend { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--muted); }
ul.stack-legend i { display: inline-block; width: 12px; height: 12px; border: 1.2px solid var(--ink); border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
ul.stack-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
h2.split { display: flex; justify-content: space-between; }
ul.rows.holdings li { align-items: flex-start; flex-wrap: wrap; }
ul.rows.holdings .val { text-align: right; white-space: nowrap; }
ul.rows.holdings .val b { display: block; font-variant-numeric: tabular-nums; }
ul.rows.holdings .val i { display: block; font-style: normal; font-size: 13px; font-weight: 650; }
ul.rows.holdings li > div:first-child a { color: inherit; }
#tabs button { padding-left: 2px; padding-right: 2px; font-size: 14.5px; }
ul.rows.holdings span.ad { flex-basis: 100%; display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--ink); font-size: 14px; }
ul.rows.holdings span.ad span, ul.rows.holdings span.ad b { display: inline; color: var(--ink); font-size: 14px; }
button.mini { min-height: 28px; width: 30px; flex: none; padding: 0; font-size: 16px; line-height: 1; border-width: 1.2px; }

/* Growing-up choices */
.item.life { border-width: 2px; }
ul.choices { list-style: none; padding: 0; margin: 12px 0 0; }
ul.choices li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
ul.choices li span { font-size: 14px; color: var(--muted); }

/* Equipment */
ul.rows.gear li { align-items: flex-start; }
ul.rows.gear li.have b { background: linear-gradient(transparent 55%, var(--hl) 55%); display: inline; }
ul.rows.gear span.fx { color: var(--ink); margin-top: 4px; }
ul.rows.gear span.pay { color: var(--ink); margin-top: 2px; }
ul.rows.gear button { flex: none; }
button.mini-text { min-height: 32px; padding: 4px 14px; font-size: 15px; margin-left: 4px; }

/* The town */
.street { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
@media (min-width: 600px) { .street { gap: 12px; } }
a.bld { position: relative; display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1.5px solid var(--ink); border-radius: 10px; padding: 6px 7px 8px; min-width: 0; }
a.bld:active { transform: translateY(1px); background: var(--soft); }
a.bld svg.art { display: block; width: 100%; height: auto; margin-bottom: 4px; }
a.bld b { display: block; font-size: 13.5px; line-height: 1.2; }
a.bld span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; overflow-wrap: anywhere; }
a.bld em.badge { position: absolute; top: 6px; right: 6px; font-style: normal; font-size: 12px; font-weight: 800; background: var(--hl); border: 1.5px solid var(--ink); border-radius: 99px; padding: 0 7px; min-width: 22px; text-align: center; }
.place-head { display: flex; gap: 14px; align-items: center; margin: 4px 0 6px; }
.place-head svg.art { width: 110px; flex: none; }
.place-head h1 { margin: 0 0 4px; font-size: 28px; }
.place-head .host { margin: 0; font-size: 16px; color: var(--ink); }
.place-head .host b { font-weight: 700; color: var(--muted); }
p.back { margin: 12px 0 0; }
p.back a { text-decoration: none; font-weight: 700; }
#tabs:empty { display: none; }
span.mini-meter { display: block; width: 92px; height: 7px; margin: 4px 0 2px auto; border: 1.2px solid var(--ink); border-radius: 99px; overflow: hidden; background: var(--card); }
span.mini-meter i { display: block; height: 100%; background: var(--hl); }
table.standings td.n span:not(.mini-meter) { white-space: normal; }

/* Stockbroker */
ul.rows li.sec span.meta { color: var(--ink); font-size: 14px; margin-top: 4px; }
ul.rows li.sec span.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
ul.rows li.sec span.acts button { margin-left: 0; }

/* The week playing out */
#advance .days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; min-height: 50px; align-items: center; }
#advance .days span { text-align: center; font-size: 13px; font-weight: 700; color: var(--faint); border: 1.5px solid var(--line2); border-radius: 8px; padding: 12px 0; transition: background .1s; }
#advance .days span.past { color: var(--ink); border-color: var(--ink); background: var(--card); }
#advance .days span.now { color: var(--ink); border-color: var(--ink); background: var(--hl); transform: translateY(-2px); }

/* Health, contacts, opportunities */
.you-row { margin: 10px 0 14px; }
.meter.thin { height: 9px; margin: 6px 0 4px; }
.item.opp { border-style: double; border-width: 4px; }
ul.rows span.fx-line { color: var(--ink); margin-top: 4px; }
.btns.center { justify-content: center; }

/* The bottom menu: five sections and the play button */
#tabs { display: flex; align-items: stretch; gap: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); justify-content: space-between; }
#tabs button.nav { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; border-radius: 10px; padding: 6px 0 4px; min-height: 52px; color: var(--muted); font-size: 10.5px; font-weight: 650; box-shadow: none; }
#tabs button.nav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#tabs button.nav .ico { width: 24px; height: 24px; }
#tabs button.nav.on { color: var(--ink); background: var(--soft); box-shadow: none; }
#tabs button.nav em.dot { position: absolute; top: 5px; left: calc(50% + 6px); width: 10px; height: 10px; border-radius: 50%; background: var(--bad); border: 2px solid var(--paper); }
#tabs button.play { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--ink); color: var(--paper); border: 0; border-radius: 14px; padding: 6px 10px; min-height: 52px; min-width: 72px; font-size: 10.5px; font-weight: 750; margin-left: 4px; }
#tabs button.play .ico { width: 22px; height: 22px; }
#tabs button.play:disabled { opacity: .5; }
#advance:empty { display: none; }
#tabs { display: block; }
#tabs .navrow { display: flex; align-items: stretch; }
#tabs .goal, #top .goal { flex-basis: 100%; display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
#tabs .goal-bar, #top .goal-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
#tabs .goal-bar i, #top .goal-bar i { display: block; height: 100%; background: var(--ink); }
#tabs .goal span, #top .goal span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }

/* The front page: a mini statement and your week */
.welcome { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 6px 0 4px; }
a.mini-sheet { display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1.5px solid var(--ink); border-radius: 6px; padding: 8px 10px; }
.mini-sheet h4, .activities h4 { font-size: 10.5px; margin: 0 0 4px; border-bottom: 1.2px solid var(--ink); padding-bottom: 2px; }
.mini-sheet table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 8px; }
.mini-sheet td { padding: 2px 0; }
.mini-sheet td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-sheet tr.total td { font-weight: 800; border-top: 1px solid var(--ink); }
.mini-sheet tr.total.good td.n { color: var(--good); } .mini-sheet tr.total.bad td.n { color: var(--bad); }
.mini-sheet .more { font-size: 11.5px; font-weight: 700; text-decoration: underline; }
.activities { background: var(--card); border: 1.5px solid var(--ink); border-radius: 6px; padding: 8px 10px; min-width: 0; }
.activities ul { list-style: none; padding: 0; margin: 0; }
.activities li { display: flex; gap: 6px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line); }
.activities li a { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.activities li b { display: block; font-size: 12.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activities li span { display: block; font-size: 11px; color: var(--muted); }
.activities li i { font-style: normal; font-size: 12px; font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; }
.activities .hours { font-size: 11px; margin: 6px 0 0; color: var(--muted); }
.activities .hours.bad b { color: var(--bad); }
#tabs button.nav { font-size: 9.5px; }
#tabs button.play { min-width: 66px; padding: 6px 8px; }
#tabs button.nav span { font-size: 9.5px; letter-spacing: -0.3px; overflow: visible; }
#tabs .navrow button.nav { padding-left: 0; padding-right: 0; }
ul.rows.holdings span.ad a { margin-left: auto; font-weight: 700; }

/* Reading statements */
a.term { color: inherit; text-decoration: underline dotted; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.item.quiz { border-color: var(--ink); background: var(--quiz); }
table.ledger.quiz { margin: 6px 0 10px; }
ul.rows.holdings li { row-gap: 0; }
ul.rows.holdings span.ad { margin-top: 2px; }

/* Dark mode, following the system setting: dark paper, light ink, a muted highlighter */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #171613; --card: #201e1a; --ink: #ece7dc; --muted: #a8a194; --faint: #6f695e; --line: #2f2c26; --line2: #3d3931;
    --hl: #6e5c16; --good: #6fcf8e; --bad: #f08a80; --link: #ece7dc; --warn: #e3b24f;
    --soft: #2a2614; --soft-bad: #3a201c; --quiz: #23211a;
    --blue: #3987e5; --orange: #d95926;
  }
  /* The ink drawings and diagrams: flip ink and paper, keep the yellow */
  svg.art, svg.pattern, svg.stack { filter: invert(0.92) hue-rotate(180deg); }
  #sheetBg { background: rgba(0, 0, 0, .55); }
  em.new { color: var(--ink); }
}

#top a.wk { color: var(--ink); text-decoration: none; }
.card.on { border-color: var(--ink); border-width: 2px; }
#top .glance { display: flex; gap: 14px; align-items: baseline; }
#top a.cash, #top a.nw { text-decoration: none; }

/* The little i: tap for an explainer */
a.info { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--faint); color: var(--muted); font: italic 700 11px/1 Georgia, serif; text-decoration: none; vertical-align: 2px; margin-left: 2px; }
a.info:hover { border-color: var(--ink); color: var(--ink); }
h2 a.info, h3 a.info { vertical-align: 3px; }
/* Debts in line with the asset they're tied to */
ul.rows li.has-debt { flex-wrap: wrap; }
ul.rows li > div.owing { flex: 0 0 calc(100% - 12px); margin: 6px 0 2px 12px; padding-left: 10px; border-left: 2px solid var(--line2); }
.owed { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 2px 0; }
.owed b { color: var(--bad); font-weight: 600; font-variant-numeric: tabular-nums; }
.owed.mine { color: var(--ink); border-top: 1px dashed var(--line2); margin-top: 3px; padding-top: 4px; }
.owed.mine b { color: var(--ink); }
/* Sheets sit above the bottom bar, so Next works while you look at something */
#sheetWrap { bottom: var(--barH, 0px); }
#sheet { max-height: calc(92dvh - var(--barH, 0px)); padding-bottom: 22px; }
ul.why { margin: 0; padding-left: 18px; } ul.why li { margin: 3px 0; }

/* The panel: one look for every summary card. Same type sizes as the rest
   of the app, so small cards never shrink their text. */
.panel { background: var(--card); border: 1.5px solid var(--ink); border-radius: 6px; padding: 12px 16px 10px; }
.panel h4 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin: 0; padding-bottom: 5px; border-bottom: 1.5px solid var(--ink); }
.panel ul + h4 { margin-top: 14px; }
.panel ul { list-style: none; padding: 0; margin: 0; }
.panel li { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.panel li:last-child { border-bottom: 0; }
.panel li > a, .panel li > div { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.panel li b { display: block; font-size: 16px; font-weight: 600; line-height: 1.3; }
.panel li span { display: block; font-size: 14px; color: var(--muted); margin-top: 1px; }
.panel li i { font-style: normal; font-size: 16px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.panel li.total { border-top: 1.5px solid var(--ink); }
.panel li.total b, .panel li.total i { font-weight: 800; }
.panel li i.good { color: var(--good); } .panel li i.bad { color: var(--bad); }
.panel .foot { margin-top: 8px; font-size: 15px; }
.panel .foot a { font-weight: 700; color: var(--ink); }
.panel .foot .hours { margin: 0; color: var(--muted); }
.panel .foot .hours.bad b { color: var(--bad); }
.stepper.small { margin: 0; gap: 6px; } .stepper.small button { min-width: 38px; min-height: 34px; padding: 0 10px; }
.spark { margin: 8px 0 2px; } .spark .chart svg { max-height: 110px; } ul.rows li.sec span.meta.muted { color: var(--muted); }
ul.rows li.sec span.meta span, ul.rows li.sec span.meta b, ul.rows li span.meta span { display: inline; margin: 0; }
.living { padding: 12px 0; border-bottom: 1px solid var(--line2); }
.living p { margin: 4px 0; }
.living .seg { margin: 8px 0 6px; }
.living .seg button { font-size: 14px; padding: 8px 6px; }

/* Asset icons: a shape and a colour for each kind */
:root { --ic-cash: #f6e7a6; --ic-business: #d9e4f3; --ic-property: #f1dccb; --ic-stocks: #d8eedd; --ic-bonds: #e2e6d3; --ic-retire: #e8dff3; --ic-toys: #f5d9d9; }
@media (prefers-color-scheme: dark) { :root { --ic-cash: #4a3f12; --ic-business: #1f3048; --ic-property: #43301f; --ic-stocks: #1d3a26; --ic-bonds: #333823; --ic-retire: #33284a; --ic-toys: #4a2424; } }
.aicon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--ink); align-self: flex-start; margin-top: 2px; }
.aicon svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.aicon.cash { background: var(--ic-cash); border-radius: 6px; }
.aicon.business { background: var(--ic-business); border-radius: 4px; }
.aicon.property { background: var(--ic-property); border-radius: 50% 50% 6px 6px; }
.aicon.stocks { background: var(--ic-stocks); border-radius: 50%; }
.aicon.bonds { background: var(--ic-bonds); border-radius: 50%; }
.aicon.retire { background: var(--ic-retire); border-radius: 12px 12px 50% 50%; }
.aicon.toys { background: var(--ic-toys); border-radius: 6px; transform: rotate(-6deg); }
ul.rows li.with-icon { align-items: flex-start; }
/* Sparklines */
ul.rows li span.sparkrow { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.sparkline { width: 120px; height: 26px; flex: 0 0 auto; }
.sparkline polyline { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.sparkline.up polyline { stroke: var(--good); } .sparkline.down polyline { stroke: var(--bad); }
ul.rows li span.sparkrow em { font-style: normal; font-size: 13px; font-weight: 700; display: inline; }
ul.rows li span.sparkrow i { font-style: normal; font-size: 12px; color: var(--faint); display: inline; }
ul.rows li span.sparkrow em, ul.rows li span.sparkrow i { white-space: nowrap; } .sparkline { width: 96px; }

/* Where your time goes */
.timebar { position: relative; display: flex; height: 18px; border: 1.5px solid var(--ink); border-radius: 5px; overflow: visible; margin: 10px 0 6px; background: var(--card); }
.timebar i { display: block; height: 100%; }
.timebar i:first-child { border-radius: 3px 0 0 3px; }
.timebar b { position: absolute; top: -5px; bottom: -5px; border-left: 2px dashed var(--bad); }
/* Top bar: full-strength text, so it reads clearly on phones */
#top .cash, #top .nw { color: var(--ink); font-weight: 500; }
#top .wk .faint { color: var(--muted); }
#top a { -webkit-text-fill-color: currentColor; opacity: 1; }
/* Keep icon glyphs centred inside their tiles, even inside list rows */
ul.rows li span.aicon, .shead span.aicon, span.aicon { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.aicon svg { display: block; }
.aicon.property { border-radius: 10px; }

/* Amount picker: a dropdown and one button */
.amtpick { display: inline-flex; align-items: stretch; gap: 0; margin: 2px 6px 2px 0; }
.amtpick select { font: inherit; font-size: 15px; color: var(--ink); background: var(--card); border: 1.5px solid var(--ink); border-right: 0; border-radius: 99px 0 0 99px; padding: 0 28px 0 14px; min-height: 40px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px; background-repeat: no-repeat; }
.amtpick button { border-radius: 0 99px 99px 0 !important; margin: 0 !important; }
.amtpick button:only-child { border-radius: 99px !important; }
ul.rows li span.acts .amtpick select { min-height: 34px; font-size: 14px; }
ul.rows li span.amtpick, ul.rows li.sec span.acts span.amtpick { display: inline-flex; margin: 0 6px 0 0; }

/* The inbox */
ul.inbox { list-style: none; padding: 0; margin: 6px 0; border-top: 1px solid var(--line2); }
ul.inbox li { border-bottom: 1px solid var(--line2); position: relative; overflow: hidden; }
ul.inbox li a { display: block; padding: 10px 2px 10px 16px; text-decoration: none; color: var(--ink); position: relative; }
ul.inbox li span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.inbox .from { font-size: 14px; color: var(--muted); }
ul.inbox .subj { font-size: 16px; font-weight: 500; }
ul.inbox .prev { font-size: 14px; color: var(--faint); }
ul.inbox li.unread .from { color: var(--ink); font-weight: 700; }
ul.inbox li.unread .subj { font-weight: 800; }
ul.inbox li.unread a::before { content: ''; position: absolute; left: 2px; top: 17px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
em.mtag { font-style: normal; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.mailbody .item { border: 0; padding: 0; background: none; box-shadow: none; }
.mailbody .item .kicker { display: none; }

/* Debts, in payoff order */
ul.rows.debts .ord { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ink); font-size: 12px; margin-right: 8px; vertical-align: 1px; }
ul.rows.debts li.next .ord { background: var(--hl); }
ul.rows.debts li.outside { opacity: .7; }
ul.rows.debts li b span.muted { display: inline; } ul.rows.debts li b span.ord { display: inline-flex; }
ul.rows.debts b.dhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
ul.rows.debts b.dhead span.dname { display: block; }
ul.rows.debts b.dhead span.bal { display: inline; font-variant-numeric: tabular-nums; white-space: nowrap; }
ul.inbox .prev { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Naming a business */
.namefield { display: flex; gap: 8px; align-items: center; margin: 6px 0 4px; }
.namefield input { flex: 1; min-width: 0; font: inherit; font-size: 17px; color: var(--ink); background: var(--card); border: 1.5px solid var(--ink); border-radius: 8px; padding: 9px 12px; }

/* Celebrations */
.cheer { position: relative; text-align: center; padding: 18px 4px 4px; overflow: hidden; }
.cheer .confetti { position: absolute; inset: -20px 0 0; pointer-events: none; height: 420px; }
.cheer .confetti i { position: absolute; top: -20px; border-radius: 2px; opacity: 0; animation-name: fall; animation-timing-function: cubic-bezier(.3,.6,.5,1); animation-iteration-count: 2; }
@keyframes fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(420px) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { .cheer .confetti { display: none; } }
.cheer-badge { width: 76px; height: 76px; margin: 6px auto 8px; border-radius: 50%; background: var(--hl); border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.cheer-badge svg { width: 42px; height: 42px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { 0% { transform: scale(.3); } 100% { transform: scale(1); } }
.cheer-title { font-size: 26px; margin: 4px 0 8px; border: 0; padding: 0; }
.cheer .lead { font-size: 18px; }
.cheer > *:not(.confetti) { position: relative; z-index: 1; }
.runby { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin: 10px 0; border: 1.5px solid var(--line2); border-radius: 8px; background: var(--card); font-size: 15px; }
.runby button { flex: 0 0 auto; }
.runby > span:last-child { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.foot-links { margin-top: 28px; text-align: center; color: var(--muted); }

/* Asset pop-up: title, tabs and section shortcuts stay put while you scroll */
#sheet .astick { position: sticky; top: -6px; background: var(--paper); z-index: 3; padding-bottom: 4px; }
#sheet .astick .shead { position: static; }
#sheet .astick .seg { margin-bottom: 0; }
.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; font-size: 13px; padding: 4px 10px; border: 1px solid var(--line2); border-radius: 999px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.cashcard h3 { margin: 0; }
.cashcard.low { border-color: var(--orange); }

#top a.me { align-self: center; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1.5px solid var(--line2); border-radius: 50%; color: var(--ink); }
#top a.me svg { width: 20px; height: 20px; }
#top a.me.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
#tabs button.nav em.dot { width: auto; min-width: 18px; height: 18px; top: 2px; padding: 0 4px; font: 700 11px/14px system-ui, sans-serif; font-style: normal; color: #fff; text-align: center; }
@media (max-width: 440px) {
  #top { padding-left: 16px; padding-right: 16px; gap: 8px; }
  #top .wk .faint { display: none; }
  #top .glance { gap: 10px; }
}
.mini-text.bad { color: var(--bad); border-color: var(--bad); }
.bench { border-color: var(--orange); }
.bench h3 { margin: 0 0 4px; }
a.goal { color: inherit; text-decoration: none; }
.tabs-inline.big a { font-size: 18px; }
/* iOS Safari fades content in a band at the very top of the screen; keep the
   top bar below it (only on iOS, where -webkit-touch-callout exists) */
@supports (-webkit-touch-callout: none) {
  #app { padding-top: max(env(safe-area-inset-top), 14px); }
  #top { background: var(--paper); position: relative; z-index: 5; }
}
@media (max-width: 440px) { .tabs-inline { gap: 4px 13px; } }
#top .holdings-line { flex-basis: 100%; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-top: -4px; }
#top .holdings-line a { color: var(--muted); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top .holdings-line a.flow { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
#top .holdings-line a.flow.good { color: var(--good); }
#top .holdings-line a.flow.bad { color: var(--bad); }
#top .wk { font-weight: 500; font-size: 15px; color: var(--ink); }
#top .wk b { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
@media (max-width: 440px) {
  .tabs-inline { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; padding-bottom: 6px; }
  .tabs-inline::-webkit-scrollbar { display: none; }
  .tabs-inline a { flex: none; white-space: nowrap; }
}
#top a.me.mood { font-size: 20px; line-height: 1; text-decoration: none; }
#top a.me.mood.on { background: var(--hl); border-color: var(--ink); }
#top .goal { padding: 2px 0 0; margin-top: -2px; }
#top .goal span { max-width: 78%; }
#top { border-bottom: 1px solid var(--line); padding-bottom: 8px; }

/* Top bar: the ring (mood + progress), net worth, cash flow, then cash, progress and week */
#top { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
#top a { text-decoration: none; color: inherit; }
#top .ring { position: relative; width: 52px; height: 52px; flex: none; display: block; border-radius: 50%; }
#top .ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#top .ring .ring-bg { fill: none; stroke: var(--line); stroke-width: 5; }
#top .ring .ring-fill { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray .4s ease; }
#top .ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 25px; line-height: 1; }
#top .ring.on { background: var(--hl); }
#top .topmain { flex: 1; min-width: 0; }
#top .toprow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#top .big { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
#top .pill { flex: none; font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; font-variant-numeric: tabular-nums; }
#top .pill.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
#top .pill.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
#top .topsub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top .topsub b { color: var(--ink); font-variant-numeric: tabular-nums; }
#top .topsub b.bad, #top .big.bad { color: var(--bad); }
@media (max-width: 440px) { #top { padding: 10px 16px; gap: 12px; } }

/* The same head on every main page: title row, one line, tabs */
.phead { margin-bottom: 4px; }
.phead-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.phead-row h1 { margin-bottom: 0; }
.phead .dateline { margin-top: 4px; }
.phead .tabs-inline { margin-top: 10px; }

/* Celebrations: the face bounces and wiggles, the ring glows */
#top .ring.celebrate span { animation: party 0.9s ease-in-out infinite; }
#top .ring.celebrate { animation: glow 1.2s ease-in-out infinite; }
@keyframes party { 0%, 100% { transform: translateY(0) rotate(0) scale(1); } 25% { transform: translateY(-5px) rotate(-14deg) scale(1.15); } 50% { transform: translateY(0) rotate(0) scale(1); } 75% { transform: translateY(-3px) rotate(14deg) scale(1.1); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hl) 90%, transparent); } 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--hl) 0%, transparent); background: var(--hl); } }
@media (prefers-reduced-motion: reduce) { #top .ring.celebrate span, #top .ring.celebrate { animation: none; } }
#top.party { position: relative; z-index: 21; background: var(--paper); }

.phead .headchart { margin-top: 6px; }
.phead .headchart h3 { margin: 12px 0 4px; font-size: 16px; }

/* Swipe a letter left: red Delete shows underneath */
ul.inbox li::before { content: 'Delete'; position: absolute; inset: 0; background: var(--bad); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: flex-end; padding-right: 18px; }
ul.inbox li > a { background: var(--paper); z-index: 1; transition: transform .18s ease; touch-action: pan-y; }
/* A past game: why it went that way, and its timeline */
ul.why { margin: 6px 0 4px; padding-left: 20px; }
ul.why li { margin: 4px 0; }
ul.timeline { list-style: none; padding: 0; margin: 6px 0; border-left: 2px solid var(--ink); }
ul.timeline li { position: relative; padding: 5px 0 5px 14px; font-size: 15px; }
ul.timeline li::before { content: ''; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--hl); border: 1.5px solid var(--ink); }
ul.timeline .when { display: inline-block; min-width: 82px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
li.tap { cursor: pointer; }

/* Team: people as a simple list */
ul.people { list-style: none; padding: 0; margin: 6px 0; border-top: 1px solid var(--line2); }
ul.people li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line2); cursor: pointer; }
ul.people .who { flex: 1; min-width: 0; }
ul.people .who b { display: block; }
ul.people .who span { display: block; font-size: 14px; color: var(--muted); }
ul.people .pay { text-align: right; flex: none; }
ul.people .pay b { display: block; font-variant-numeric: tabular-nums; }
ul.people .pay span { font-size: 12px; color: var(--muted); }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--hl); border: 1.5px solid var(--ink); font-weight: 800; font-size: 14px; }
.avatar.firm { background: var(--card, #fffdf8); font-size: 16px; }
.avatar.big { width: 46px; height: 46px; font-size: 17px; }
/* Sticky bars sit flush with the top of the scrolling page (it has 8px of padding) */
.sticky-seg { top: -8px; padding-top: 10px; margin-top: -2px; }
/* Title and its button share one line: the space goes above the row, not inside it */
.phead-row { margin-top: 18px; align-items: center; }
.phead-row h1 { margin: 0; }
.phead-row > button { flex: none; }

/* Coming up: the week in its own column, so long lines wrap beside it */
ul.upcoming li { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: baseline; }
ul.upcoming .when { min-width: 0; }

/* First-run tour: dim everything but one thing, and point at it */
#tour { position: fixed; inset: 0; z-index: 50; }
#tour[hidden] { display: none; }
.tour-hole { position: absolute; border-radius: 14px; border: 2px solid var(--hl); box-shadow: 0 0 0 9999px rgba(29, 29, 27, .58); pointer-events: none; }
.tour-card { position: absolute; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; padding: 12px 16px 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.tour-card h3 { margin: 2px 0 4px; font-size: 19px; }
.tour-card p { margin: 0 0 8px; font-size: 15px; line-height: 1.45; }
.tour-card .btns { margin-top: 4px; }
.tour-step { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.tour-arrow { position: absolute; width: 0; height: 0; border: 13px solid transparent; margin-left: -13px; animation: tour-nudge 1.1s ease-in-out infinite; }
.tour-card.below .tour-arrow { top: -28px; border-bottom-color: var(--hl); filter: drop-shadow(0 -1.5px 0 var(--ink)); }
.tour-card.above .tour-arrow { bottom: -28px; border-top-color: var(--hl); filter: drop-shadow(0 1.5px 0 var(--ink)); }
.tour-card.below .tour-arrow { --nudge: -5px; }
.tour-card.above .tour-arrow { --nudge: 5px; }
@keyframes tour-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(var(--nudge)); } }
@media (prefers-reduced-motion: reduce) { .tour-arrow { animation: none; } }

/* HQ: the goal you're chasing, small */
.goalmini { margin: 4px 0 14px; padding: 10px 14px; }
.goalmini b { display: block; font-size: 17px; margin: 2px 0 0; }
.goalmini .meter { margin: 8px 0 4px; }
.note.tap { cursor: pointer; }

/* Next: a circle in the middle of the bar, a little bigger than it */
#tabs .navrow { align-items: flex-end; }
#tabs button.play { width: 66px; height: 66px; border-radius: 50%; padding: 0; margin: -24px 6px 2px; border: 4px solid var(--paper); box-shadow: 0 4px 14px rgba(29, 29, 27, .28); font-size: 11px; font-weight: 700; gap: 0; align-self: flex-end; }
#tabs button.play .ico { width: 24px; height: 24px; margin-left: 3px; }
#tabs button.play:active { transform: scale(.95); }
/* A bigger Next: it can rise well above the bar */
#tabs { overflow: visible; }
#tabs button.play { width: 80px; height: 80px; margin: -36px 4px 0; border-width: 5px; font-size: 12px; }
#tabs button.play .ico { width: 30px; height: 30px; }
/* The raised top of Next sits over pop-ups, so it's always whole and tappable */
#tabs button.play { position: relative; z-index: 30; }

/* Most pop-ups: most of the height of the window */
#sheet.tall { height: calc(92dvh - var(--barH, 0px)); }

/* The handle: a bigger target, and dragging it (or the header) moves the pop-up */
#sheet .grab { box-sizing: content-box; padding: 10px 40px; margin: -6px auto 2px; background-clip: content-box; cursor: grab; touch-action: none; }
#sheet .shead, #sheet .astick { touch-action: none; }
/* Next sits 10% of its size lower */
#tabs button.play { top: 16px; }
/* Leave room at the bottom of every pop-up for the raised Next button */
#sheet { padding-bottom: 60px; }

/* HQ: the goal card */
.goalcard { display: flex; align-items: center; gap: 14px; margin: 16px 0 10px; padding: 12px 14px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--card, #fffdf8); cursor: pointer; }
.goalcard .gring { position: relative; width: 54px; height: 54px; flex: none; }
.goalcard .gring svg { width: 100%; height: 100%; }
.goalcard .gring .ring-bg { fill: none; stroke: var(--line); stroke-width: 6; }
.goalcard .gring .ring-fill { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.goalcard .gring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.goalcard .gbody { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.goalcard .glabel { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.goalcard .gbody > b { font-size: 18px; line-height: 1.25; }
.goalcard .gdetail { font-size: 14px; color: var(--muted); margin-top: 2px; }
.goalcard .gdetail b { color: var(--ink); }
.chev { flex: none; font-size: 22px; line-height: 1; color: var(--muted); }
/* HQ: heads up, one row each */
ul.heads { list-style: none; padding: 0; margin: 0 0 6px; border-top: 1px solid var(--line2); }
ul.heads li { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line2); cursor: pointer; font-size: 15px; line-height: 1.4; }
ul.heads .hdot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--line2); }
ul.heads li.warn .hdot { background: #e0a400; }
ul.heads li.bad .hdot { background: var(--bad); }
ul.heads .htext { flex: 1; min-width: 0; }
ul.heads li, ul.heads li.warn, ul.heads li.bad { color: var(--ink); }

/* Inbox: a picture for each letter */
:root { --ic-repair: #f3e3c7; --ic-lease: #e3ecd6; --ic-scam: #f6d4cf; --ic-spam: #e8e5de; --ic-promo: #f6e7a6; --ic-offer: #d8eedd; --ic-quiz: #e8dff3; --ic-life: #f1dccb; --ic-debt: #e2e6d3; }
@media (prefers-color-scheme: dark) { :root { --ic-repair: #45351a; --ic-lease: #2c3a20; --ic-scam: #4a2420; --ic-spam: #33312c; --ic-promo: #4a3f12; --ic-offer: #1d3a26; --ic-quiz: #33284a; --ic-life: #43301f; --ic-debt: #333823; } }
.aicon.repair { background: var(--ic-repair); border-radius: 50%; }
.aicon.lease { background: var(--ic-lease); border-radius: 10px; }
.aicon.scam { background: var(--ic-scam); border-radius: 8px; }
.aicon.spam { background: var(--ic-spam); border-radius: 8px; }
.aicon.promo { background: var(--ic-promo); border-radius: 50%; }
.aicon.offer { background: var(--ic-offer); border-radius: 8px; transform: rotate(-6deg); }
.aicon.quiz { background: var(--ic-quiz); border-radius: 50%; }
.aicon.idea { background: var(--ic-promo); border-radius: 50%; }
.aicon.life { background: var(--ic-life); border-radius: 10px; }
.aicon.debt { background: var(--ic-debt); border-radius: 6px; }
ul.inbox li a { display: flex; align-items: center; gap: 12px; padding-left: 18px; }
ul.inbox li a .aicon { align-self: center; }
ul.inbox .mbody { flex: 1; min-width: 0; display: block; }
ul.inbox li.unread a::before { top: 50%; margin-top: -4px; }
/* The page itself never scrolls: only the content area and pop-ups do.
   (The round Next button hangs a little below the screen.) */
html, body { overflow: hidden; height: 100%; }
#tabs { touch-action: manipulation; overscroll-behavior: none; }

/* Debts: one row each, tap to pay */
ul.debtrows { list-style: none; padding: 0; margin: 10px 0; border-top: 1px solid var(--line2); }
ul.debtrows li { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line2); cursor: pointer; }
ul.debtrows .ord { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink); font-size: 13px; font-weight: 700; }
ul.debtrows li.next .ord { background: var(--hl); }
ul.debtrows li.outside { opacity: .6; }
ul.debtrows .dbody { flex: 1; min-width: 0; display: flex; flex-direction: column; }
ul.debtrows .dbody > b { font-size: 16px; }
ul.debtrows .dsub { font-size: 13.5px; color: var(--muted); }
ul.debtrows .dbar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 6px; max-width: 160px; }
ul.debtrows .dbar i { display: block; height: 100%; background: var(--good); }
ul.debtrows .dbal { text-align: right; flex: none; }
ul.debtrows .dbal b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
ul.debtrows .dbal span { font-size: 12.5px; color: var(--muted); }

/* Short of cash: one line that opens to the ways to find the money */
details.cover { margin: 10px 0; }
details.cover > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 10px 14px; border: 1.5px solid var(--line2); border-radius: 12px; cursor: pointer; font-size: 15px; }
details.cover > summary::-webkit-details-marker { display: none; }
details.cover > summary .link { margin-left: auto; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
details.cover > summary .chev { transition: transform .15s; }
details.cover[open] > summary .chev { transform: rotate(90deg); }
details.cover > .card { margin-top: 8px; }
/* Inbox icons: keep the picture centred in its badge */
ul.inbox li span.aicon { display: inline-flex; align-items: center; justify-content: center; overflow: visible; white-space: normal; }
ul.inbox li span.aicon svg { display: block; width: 20px; height: 20px; }

/* Steppers: hold to repeat, so no text selection or zoom on long press */
.stepper button { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* Toasts: a slim pill that slides down over the top bar, out of the way of what you're doing */
#toast { top: calc(env(safe-area-inset-top) + 10px); bottom: auto; transform: translate(-50%, -16px); max-width: min(90vw, 420px); width: max-content; text-align: center; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; line-height: 1.3; z-index: 60; box-shadow: 0 6px 20px rgba(29, 29, 27, .25); transition: opacity .2s, transform .2s; pointer-events: none; }
#toast.show { transform: translate(-50%, 0); pointer-events: auto; cursor: pointer; }

/* Assets: one row each */
ul.holdings li.arow { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; padding: 12px 2px; }
ul.holdings li.arow.tap { cursor: pointer; }
ul.holdings li.arow > .aicon { align-self: flex-start; margin-top: 2px; }
ul.holdings li.arow .abody { flex: 1; min-width: 0; display: flex; flex-direction: column; }
ul.holdings li.arow .abody > b { font-size: 16px; line-height: 1.3; }
ul.holdings li.arow .asub { font-size: 13.5px; color: var(--muted); line-height: 1.35; }
ul.holdings li.arow .sparkrow { margin-top: 6px; }
ul.holdings li.arow .aval { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; }
ul.holdings li.arow .aval b { font-size: 16px; font-variant-numeric: tabular-nums; }
ul.holdings li.arow .aval span { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
ul.holdings li.arow > .chev { align-self: center; }
ul.holdings li.arow > .owing { flex-basis: 100%; margin-left: 48px; }
ul.holdings li.arow .aval span.good { color: var(--good); }
ul.holdings li.arow .aval span.bad { color: var(--bad); }
ul.holdings li.arow .aval span.muted { color: var(--muted); }
/* Asset pop-up tabs stay on one line (and scroll sideways if they must) */
#sheet .astick .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 4px 14px; }
#sheet .astick .seg::-webkit-scrollbar { display: none; }
#sheet .astick .seg button { flex: none; white-space: nowrap; }
#sheet .astick .seg { gap: 4px 12px; }
#sheet .astick .seg button { font-size: 15px; }
