:root {
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --num: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
[data-theme='dark'] {
  --bg: #121110; --panel: #1a1917; --panel-2: #221f1c; --line: #2d2a26; --line-2: #3a3631;
  --text: #ede6d9; --muted: #9b9385; --faint: #6c665c;
  --accent: #e0a458; --accent-ink: #1a1206; --accent-soft: rgba(224,164,88,.12);
  --green: #86bf7f; --green-soft: rgba(134,191,127,.12);
  --red: #e5826a; --red-soft: rgba(229,130,106,.12);
  --blue: #86a9d9;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  color-scheme: dark;
}
[data-theme='light'] {
  --bg: #f5f0e6; --panel: #fffdf8; --panel-2: #f8f3ea; --line: #e6dece; --line-2: #d8cfbd;
  --text: #24211c; --muted: #6f6759; --faint: #a29a8b;
  --accent: #b5691b; --accent-ink: #fffaf2; --accent-soft: rgba(181,105,27,.1);
  --green: #3e7d46; --green-soft: rgba(62,125,70,.1);
  --red: #b5472d; --red-soft: rgba(181,71,45,.09);
  --blue: #3f679e;
  --shadow: 0 20px 50px rgba(60,45,20,.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
#shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 26px 16px 18px; border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 0 8px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font: 600 22px/1 var(--serif);
}
.brand-text { font: 600 19px/1.1 var(--serif); letter-spacing: -.01em; display: flex; flex-direction: column; }
.brand-text small { font: 500 11px/1.4 var(--sans); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-small {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  border: 0; background: none; cursor: pointer; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav a:hover, .nav-small:hover { color: var(--text); background: var(--panel); }
.nav a.active, .nav-small.active { color: var(--text); background: var(--panel-2); }
.nav a.active svg { color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }

main { padding: 40px clamp(20px, 4vw, 56px) 80px; max-width: 1180px; width: 100%; outline: none; }
.page { animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head input[type=search] { width: 260px; max-width: 100%; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
h1 { margin: 0; font: 500 clamp(30px, 4vw, 42px)/1.08 var(--serif); letter-spacing: -.02em; }
h1 em { font-style: italic; color: var(--accent); }
h2 { margin: 0 0 14px; font: 700 12px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
h3 { margin: 0; font: 600 17px/1.3 var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 600; font-size: 14px;
  text-decoration: none; transition: border-color .15s, background .15s, transform .1s; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.row > h2 { margin: 0; }
.card > .row:first-child { margin-bottom: 16px; min-height: 30px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.grid-2.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.tile .label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tile .value { font: 500 28px/1.15 var(--serif); margin-top: 8px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--faint); font-size: 12.5px; margin-top: 4px; }
.pos { color: var(--green); } .neg { color: var(--red); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=month], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--panel-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 44px; height: 40px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); padding: 3px; cursor: pointer; }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fields .full { grid-column: 1 / -1; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty strong { display: block; font: 500 20px/1.3 var(--serif); color: var(--text); margin-bottom: 4px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.list-item:first-child { border-top: 0; padding-top: 2px; }
.list-item:hover .li-title { color: var(--accent); }
.li-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }

/* ---------- chart ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--faint); font: 600 11px var(--sans); stroke: none; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar-in { fill: var(--green); }
.chart .bar-out { fill: var(--red); opacity: .85; }
.chart rect:hover { opacity: 1; filter: brightness(1.15); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; gap: 7px; align-items: center; }

/* ---------- today ---------- */
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.note-preview { font: 400 16.5px/1.6 var(--serif); white-space: pre-wrap; margin: 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.startup-mini { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; }
.startup-mini:first-child { border-top: 0; padding-top: 0; }
.startup-mini:hover b { color: var(--accent); }
.startup-mini b { font-weight: 600; flex: 1; }

/* ---------- thoughts ---------- */
.capture { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 30px; transition: border-color .15s; }
.capture:focus-within { border-color: var(--line-2); }
.capture textarea { background: none; border: 0; box-shadow: none; padding: 4px 2px; font: 400 19px/1.6 var(--serif); min-height: 80px; resize: none; }
.capture textarea:focus { box-shadow: none; }
.capture-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.capture-foot input { max-width: 240px; padding: 7px 10px; font-size: 13px; }
.mood-pick button { border: 1px solid var(--line); background: none; border-radius: 99px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.mood-pick button.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.day { margin-bottom: 30px; }
.day-label { font: 600 12px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; display: flex; gap: 10px; align-items: center; }
.day-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.thought { position: relative; padding: 16px 18px 14px; border-radius: var(--radius); border: 1px solid transparent; transition: background .15s, border-color .15s; }
.thought:hover { background: var(--panel); border-color: var(--line); }
.thought.pinned { background: var(--panel); border-color: var(--line); }
.thought-body { font: 400 17px/1.65 var(--serif); white-space: pre-wrap; margin: 0; overflow-wrap: anywhere; }
.thought-meta { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 12.5px; color: var(--faint); flex-wrap: wrap; }
.thought-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.thought:hover .thought-actions, .thought:focus-within .thought-actions { opacity: 1; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 8px; color: var(--faint); cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn.on { color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- poetry ---------- */
.poems { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.poem-card {
  text-align: left; cursor: pointer; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 22px 18px; display: flex; flex-direction: column; gap: 12px; min-height: 230px;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.poem-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow); }
.poem-card h3 { font-size: 21px; font-weight: 500; font-style: italic; }
.poem-card pre { margin: 0; font: 400 15.5px/1.7 var(--serif); white-space: pre-wrap; color: var(--muted); flex: 1; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.poem-card .meta { font-size: 12px; color: var(--faint); display: flex; justify-content: space-between; gap: 8px; }
.reader { max-width: 620px; margin: 0 auto; text-align: center; padding: 20px 10px 10px; }
.reader h2 { font: italic 500 34px/1.2 var(--serif); letter-spacing: -.01em; color: var(--text); text-transform: none; margin: 0 0 8px; }
.reader .date { color: var(--faint); font-size: 13px; margin-bottom: 30px; }
.reader pre { font: 400 19px/1.85 var(--serif); white-space: pre-wrap; margin: 0 0 30px; text-align: left; display: inline-block; max-width: 100%; }
textarea.verse { font: 400 18px/1.8 var(--serif); min-height: 340px; }

/* ---------- plans ---------- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 260px; transition: border-color .15s, background .15s; }
.col.over { border-color: var(--accent); background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 12px; }
.col-head h2 { margin: 0; }
.col-head .count { color: var(--faint); font-size: 12px; font-weight: 700; }
.col-body { display: flex; flex-direction: column; gap: 9px; min-height: 40px; }
.plan {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px;
  cursor: grab; transition: border-color .15s, transform .15s;
}
.plan:hover { border-color: var(--line-2); }
.plan.dragging { opacity: .4; }
.plan-title { font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.plan.done .plan-title { text-decoration: line-through; color: var(--muted); }
.plan-desc { color: var(--muted); font-size: 13px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plan-meta { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; font-size: 12px; color: var(--faint); }
.prio-high { box-shadow: inset 3px 0 0 var(--red); }
.add-inline { width: 100%; border: 1px dashed var(--line-2); background: none; border-radius: 10px; padding: 9px; color: var(--faint); cursor: pointer; font-weight: 600; font-size: 13px; margin-top: 9px; }
.add-inline:hover { color: var(--text); border-color: var(--faint); }

/* ---------- finances ---------- */
.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; font-size: 14px; }
.cat-row .bar { grid-column: 1 / -1; height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.cat-row .bar i { display: block; height: 100%; border-radius: 99px; background: var(--red); opacity: .8; }
.cat-row .bar i.in { background: var(--green); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--faint); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover { background: var(--panel-2); }
td.right, th.right { text-align: right; }
.quick-tx { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.quick-tx .full { grid-column: 1 / -1; }

/* ---------- startups ---------- */
.startups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.startup-card {
  position: relative; overflow: hidden; text-decoration: none; display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.startup-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
.startup-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow); }
.startup-card h3 { font-size: 22px; font-weight: 500; }
.startup-card p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.startup-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.startup-hero { position: relative; padding: 26px 26px 24px; overflow: hidden; }
.startup-hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(600px 200px at 0% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%); pointer-events: none; }
.startup-hero > * { position: relative; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; margin-bottom: 18px; }
.back:hover { color: var(--text); }
.notes-area { background: none; border: 1px solid transparent; font: 400 16px/1.7 var(--serif); min-height: 200px; padding: 6px 4px; }
.notes-area:hover { border-color: var(--line); }

/* ---------- wealth ---------- */
.seg a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.seg a:hover { color: var(--text); }
.seg a.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.tile-link { text-decoration: none; transition: border-color .15s; }
.tile-link:hover { border-color: var(--line-2); }
.progress { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; margin-top: 6px; box-shadow: inset 0 0 0 1px var(--line); }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s var(--ease); }
.progress.good i { background: var(--green); }
.progress.warn i { background: var(--accent); }
.progress.bad i { background: var(--red); }
.stack { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--panel-2); gap: 2px; }
.stack i { display: block; height: 100%; }
.sheet > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.sheet > div:first-child { border-top: 0; }
.sheet > div b { font-variant-numeric: tabular-nums; font-weight: 600; }
.sheet > div.total { border-top: 1px solid var(--line-2); font-size: 16px; padding-top: 12px; }
.sheet > div.total b { font: 500 20px/1 var(--serif); }
.sheet > div.click { cursor: pointer; }
.sheet > div.click:hover span { color: var(--accent); }
.aside-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.aside-row:first-of-type { border-top: 0; }
.right { text-align: right; }
.num.saving { color: var(--blue); }
.accounts, .debts { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.acc {
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  transition: border-color .15s, transform .2s var(--ease);
}
.acc:hover { border-color: var(--line-2); transform: translateY(-2px); }
.acc-name { font: 500 19px/1.3 var(--serif); margin-top: 10px; }
.acc-bal { font: 500 26px/1.2 var(--serif); margin: 8px 0 4px; }
.debt { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; }
.debt.closed { opacity: .55; }
.debt-name { font: 500 18px/1.3 var(--serif); }
.debt-big { font: 500 26px/1.15 var(--serif); margin-right: 8px; }
.debt-actions { margin-top: auto; padding-top: 14px; gap: 6px; }
.prop-map { height: 380px; padding: 0; overflow: hidden; }
.pick-map { height: 260px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); overflow: hidden; margin-top: 4px; }
.leaflet-container { font: 13px var(--sans); background: var(--panel-2); }
[data-theme='dark'] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }

/* ---------- modal ---------- */
dialog {
  border: 1px solid var(--line-2); border-radius: 18px; padding: 0; background: var(--panel); color: var(--text);
  width: min(560px, calc(100vw - 28px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow);
}
dialog.wide { width: min(760px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(10, 8, 6, .55); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h3 { font-size: 22px; font-weight: 500; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; gap: 10px; padding: 0 22px 20px; align-items: center; }

/* ---------- auth ---------- */
#auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 15% 10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); }
.auth-card .brand-mark { width: 52px; height: 52px; font-size: 30px; border-radius: 15px; margin-bottom: 26px; }
.auth-card h1 { font-size: 36px; margin-bottom: 8px; }
.auth-card p { color: var(--muted); margin: 0 0 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { justify-content: center; padding: 12px; margin-top: 4px; }
.err { color: var(--red); font-size: 13.5px; min-height: 1em; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; font-size: 14px;
  transition: opacity .2s, transform .2s var(--ease); z-index: 100;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  #shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; height: auto; top: auto; z-index: 20; flex-direction: row; padding: 6px 8px;
    border-right: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px);
  }
  .brand, .sidebar-foot #themeToggle { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .sidebar-foot { margin: 0; }
  .nav a, .nav-small { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 7px 6px; width: auto; }
  main { padding: 28px 16px 110px; }
  .board { grid-template-columns: 1fr; }
  .fields, .quick-tx { grid-template-columns: 1fr; }
  .thought-actions { opacity: 1; }
  .hide-sm { display: none; }
}

/* v3: per-currency tiles, side-by-side blocks */
.tiles.auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tiles.auto .value { font-size: 23px; white-space: nowrap; }
.tile .value.v2 { font-size: 17px; margin-top: 2px; color: var(--muted); }
.tile .value.neg, .tile .value.v2.neg { color: var(--red); }
.tile .value.pos { color: var(--green); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.kv3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.kv3 > div { display: flex; flex-direction: column; gap: 4px; }
.kv3 span { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.kv3 b { font: 500 22px/1.2 var(--serif); }
.kv3 em { font-style: normal; font-size: 12.5px; }
.debt-name { display: block; }
.debt-actions { flex-wrap: wrap; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .kv3 { grid-template-columns: 1fr; } }

/* net worth in two currencies */
.nw-pair { display: flex; gap: 36px; flex-wrap: wrap; align-items: flex-end; }
.nw-pair span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px; }
.nw-pair h1 { margin: 0; }
.sheet2 > div { display: grid; grid-template-columns: 1fr 9.5em 7.5em; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sheet2 > div b { text-align: right; font-weight: 600; }
.sheet2 > .hd { color: var(--muted); font-size: 12px; letter-spacing: .08em; padding-top: 0; }
.sheet2 > .neg { color: var(--red); }
.sheet2 > .total { border-bottom: 0; padding-top: 14px; font: 500 17px var(--serif); }
.sheet2 > .total b { font-weight: 500; }

/* wealth header: totals left, actions right; tabs in their own bar underneath */
.wealth-head { flex-wrap: wrap; align-items: flex-end; margin-bottom: 22px; }
.nw-pair { gap: 28px; }
.nw-pair h1 { font-size: clamp(28px, 2.7vw, 40px); white-space: nowrap; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.head-actions:empty { display: none; }
.tabbar { display: flex; gap: 4px; box-shadow: inset 0 -1px var(--line); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabbar a { padding: 10px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.tabbar a:hover { color: var(--text); }
.tabbar a.on { color: var(--text); border-bottom-color: var(--accent); }
.head-actions .btn { padding: 8px 13px; font-size: 13px; }

/* budget + DD */
.bud-lines { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.bud-line { all: unset; display: block; cursor: pointer; padding: 12px 10px; margin: 0 -10px; border-radius: 10px; }
.bud-line:hover { background: var(--panel-2); }
.bud-line .row { gap: 8px; margin-bottom: 8px; }
.bud-line .row:last-child { margin: 6px 0 0; }
.dd-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.dd-preview div { display: flex; flex-direction: column; gap: 3px; }
.dd-preview span { color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.dd-preview b { font: 500 18px var(--serif); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .dd-preview { grid-template-columns: 1fr 1fr; } }
.table-scroll { overflow-x: auto; }
.dd-table td:first-child b { white-space: nowrap; }
.dd-table td, .dd-table th { white-space: nowrap; }
.dd-table td:first-child .small { white-space: normal; }

/* bank accounts page */
.acc.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
svg.ic { width: 14px; height: 14px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.tabbar .tab-n { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 4px; }

/* numbers: one clean sans-serif, every digit the same width so columns line up */
.num, .tile .value, .acc-bal, .debt-big, .kv3 b, .sheet > div b, .sheet > div.total b, .sheet2 > .total,
.dd-preview b, .nw-pair h1, td.num, .cat-row .num {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
  letter-spacing: -.02em;
}
.tile .value { font-weight: 600; font-size: 26px; }
.tile .value.v2 { font-weight: 500; font-size: 15px; letter-spacing: -.01em; }
.acc-bal, .debt-big { font-weight: 600; font-size: 24px; }
.kv3 b { font-weight: 600; font-size: 20px; }
.sheet > div.total b, .sheet2 > .total { font-weight: 600; font-size: 18px; }
.dd-preview b { font-weight: 600; font-size: 17px; }
.nw-pair h1 { font-weight: 600; letter-spacing: -.03em; }
.debt.overdue { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.sheet .icon-btn { width: 26px; height: 26px; vertical-align: middle; margin-left: 4px; }
.tx-filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(120px, 1fr)) auto; gap: 8px; margin-bottom: 14px; align-items: center; }
@media (max-width: 900px) { .tx-filters { grid-template-columns: 1fr 1fr; } .tx-filters input { grid-column: 1 / -1; } }
.quick-tx { grid-template-columns: 140px minmax(170px, 1.3fr) minmax(170px, 1fr) minmax(140px, 1fr); }
.quick-tx > button { justify-self: start; min-width: 110px; }
@media (max-width: 900px) { .quick-tx { grid-template-columns: 1fr 1fr; } }
.cat-cur { display: flex; justify-content: space-between; font: 700 11px/1 var(--sans); letter-spacing: .1em; color: var(--faint); margin: 14px 0 6px; }
.cat-cur span { font-family: var(--num); letter-spacing: 0; }
.cat-cur:first-child { margin-top: 0; }
.poem-item { cursor: pointer; }
.poem-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.poem-item-body { margin: 0; font: 400 16px/1.75 var(--serif); white-space: pre-wrap; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* maximized card */
.card-head { margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.max-backdrop { display: none; }
body.has-max .max-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); z-index: 60; }
body.has-max { overflow: hidden; }
.card.max { position: fixed; inset: 24px; z-index: 61; margin: 0 !important; overflow: auto; padding: 26px 30px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); animation: card-max .18s ease-out; }
.card.max table { font-size: 15px; }
@keyframes card-max { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) { .card.max { inset: 8px; padding: 18px; } }
/* long lists: first 6 rows on the page, everything when maximized */
.card.limited:not(.max) tbody tr:nth-child(n+7) { display: none; }
[data-open-all] { margin-right: 2px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
tbody tr.static { cursor: default; }

/* calendar */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.cal-card { padding: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font: 700 11px/1 var(--sans); letter-spacing: .06em; color: var(--faint); padding: 6px 8px; }
.cal-day { min-height: 100px; border: 1px solid var(--line); border-radius: 9px; background: none; padding: 6px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: var(--text); font: 13px var(--sans); min-width: 0; }
.cal-day:hover { border-color: var(--line-2); background: var(--panel-2); }
.cal-day.out { opacity: .4; }
.cal-day.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-n { font: 600 12px/22px var(--num); width: 22px; text-align: center; }
.cal-day.today .cal-n { background: var(--accent); color: var(--accent-ink); border-radius: 50%; }
.cal-item { font-size: 11px; line-height: 1.35; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--k) 20%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item.done, .cal-row.done b { text-decoration: line-through; opacity: .6; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 5px; }
.cal-row { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--k); background: none; padding: 5px 10px; margin: 7px 0; cursor: pointer; color: var(--text); font: 14px var(--sans); border-radius: 0 6px 6px 0; overflow-wrap: anywhere; }
.cal-row:hover { background: var(--panel-2); }
.cal-row small { display: block; color: var(--muted); font-size: 12px; }
.cal-key { border: 1px solid var(--line); background: none; border-radius: 99px; padding: 5px 12px; color: var(--text); font: 600 12px var(--sans); cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.cal-key.off { opacity: .4; text-decoration: line-through; }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .cal-day { min-height: 54px; padding: 3px; flex-flow: row wrap; align-content: flex-start; }
  .cal-n { width: 100%; }
  .cal-day.today .cal-n { width: 22px; margin-right: 10px; }
  .cal-item { font-size: 0; width: 7px; height: 7px; padding: 0; border-radius: 50%; background: var(--k); }
  .cal-item b, .cal-more { display: none; }
}

.dd-days td { vertical-align: top; }
.dd-days tbody tr { cursor: default; }
.dd-days .is-today td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.dd-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; white-space: normal; }
.dd-chips .chip { border: 0; cursor: pointer; font-family: inherit; }
