/* Satu prototype. One neutral palette, one accent, system fonts (nothing loaded from other sites). */

:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --sunken: #F1F0EA;
  --text: #1C1B18;
  --muted: #66635B;
  --line: #E5E2DA;
  --line-strong: #CBC7BC;
  --accent: #0F766E;
  --accent-ink: #FFFFFF;
  --accent-soft: #E1F0EE;
  --danger: #B42318;
  --shadow: 0 18px 50px rgba(28, 27, 24, .16);
  --r: 8px;
  --rail: 88px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --c-today: #0F766E; --s-today: #DDF1EE;
  --c-money: #15803D; --s-money: #E0F3E5;
  --c-notes: #B45309; --s-notes: #FBEED8;
  --c-health: #C7372F; --s-health: #FCE6E2;
  --c-fitness: #6D3FD4; --s-fitness: #EDE7FB;
  --c-work: #1D5FD1; --s-work: #E2ECFC;
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151513; --surface: #1D1D1A; --sunken: #232320; --text: #ECEAE3; --muted: #A5A299;
    --line: #2E2D29; --line-strong: #4A4842; --accent: #5EC4B8; --accent-ink: #0B1F1D;
    --accent-soft: #17302D; --danger: #F0806F; --shadow: 0 18px 50px rgba(0, 0, 0, .5);
    --c-today: #5EC4B8; --s-today: #17302D; --c-money: #5BD08A; --s-money: #14301F; --c-notes: #F0B35A; --s-notes: #33260F;
    --c-health: #FF8A7A; --s-health: #3A1B17; --c-fitness: #B39DFF; --s-fitness: #261D45; --c-work: #7FB0FF; --s-work: #152844;
    --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310100e' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  --bg: #151513; --surface: #1D1D1A; --sunken: #232320; --text: #ECEAE3; --muted: #A5A299;
  --line: #2E2D29; --line-strong: #4A4842; --accent: #5EC4B8; --accent-ink: #0B1F1D;
  --accent-soft: #17302D; --danger: #F0806F; --shadow: 0 18px 50px rgba(0, 0, 0, .5);
    --c-today: #5EC4B8; --s-today: #17302D; --c-money: #5BD08A; --s-money: #14301F; --c-notes: #F0B35A; --s-notes: #33260F;
    --c-health: #FF8A7A; --s-health: #3A1B17; --c-fitness: #B39DFF; --s-fitness: #261D45; --c-work: #7FB0FF; --s-work: #152844;
    --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310100e' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
kbd { font: 12px var(--mono); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px; background: var(--surface); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--r); z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--danger); }
.grow { flex: 1; min-width: 0; }
.small { font-size: 14px; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.private .amt { filter: blur(7px); user-select: none; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100dvh; padding: 20px 10px;
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.rail button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; min-height: 58px; border-radius: var(--r);
  font-size: 12px; color: var(--muted); transition: background-color .15s, color .15s;
}
.rail button:hover { color: var(--text); background: var(--sunken); }
.rail button[aria-current="page"] { color: var(--text); background: var(--sunken); font-weight: 600; }
.rail button[aria-current="page"] svg { stroke: var(--accent); }

main { width: 100%; max-width: 820px; margin: 0 auto; padding: 36px 32px 120px; outline: none; }
main.wide { max-width: 1120px; }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
h1 { font: 600 30px/1.15 var(--serif); letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 15px; font-weight: 500; white-space: nowrap; transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); padding: 0 10px; }
.btn.quiet:hover { color: var(--text); background: var(--sunken); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn svg.i { width: 18px; height: 18px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border-radius: var(--r); color: var(--muted); transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--sunken); color: var(--text); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.searchbtn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--muted); font-size: 14px; transition: border-color .15s;
}
.searchbtn:hover { border-color: var(--line-strong); }
.searchbtn svg.i { width: 18px; height: 18px; }

.fab-help {
  position: fixed; right: 20px; bottom: 20px; z-index: 5; width: 44px; height: 44px;
  display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  transition: color .15s, border-color .15s;
}
.fab-help:hover { color: var(--text); border-color: var(--text); }

.tabbar { display: none; }

/* ---------- Common pieces ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs button { padding: 10px 0; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; min-height: 44px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--text); font-weight: 600; }
.count { font-size: 12px; font-weight: 600; margin-left: 6px; padding: 1px 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-height: 52px; border-bottom: 1px solid var(--line); }
.list > li.head { min-height: 0; padding: 22px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.rowbtn { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 32px; border-radius: 4px; }
.rowbtn:hover .t { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.t { display: block; }
.d { display: block; font-size: 14px; color: var(--muted); }
.empty { padding: 36px 0; color: var(--muted); }
.empty .btn { margin-top: 12px; }
.note { font-size: 14px; color: var(--muted); margin-top: 16px; max-width: 62ch; }
.tagchip { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px; white-space: nowrap; }
.h2 { font: 600 13px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 32px 0 4px; }

.check { display: inline-grid; place-items: center; width: 32px; height: 32px; margin: 0 -4px 0 -6px; flex: none; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.done .t { text-decoration: line-through; color: var(--muted); }

.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--text); border-radius: 2px; }
.bar.over > i { background: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stats > div { padding: 18px 16px 18px 0; }
.stats .k { font-size: 13px; color: var(--muted); }
.stats .v { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.stats .s { font-size: 13px; color: var(--muted); }

/* ---------- Today ---------- */
.trow { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.trow:last-child { border-bottom: 1px solid var(--line); }
.trow > h2 { font: 600 13px var(--sans); letter-spacing: .06em; text-transform: uppercase; margin-top: 5px; }
.trow > h2 a { color: var(--muted); text-decoration: none; }
.trow > h2 a:hover { color: var(--text); }
.lead { font-size: 20px; line-height: 1.35; }
.lead strong { font-weight: 650; }
.trow .bar { margin: 12px 0 10px; max-width: 420px; }
.trow .list > li:last-child { border-bottom: 0; }
.trow .list { margin-top: 6px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Money ---------- */
.budget > li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(80px, 1fr) auto; gap: 20px; }
.budget .fig { text-align: right; min-width: 190px; }
.budget .fig button { border-radius: 4px; }
.budget .fig button:hover { text-decoration: underline; text-underline-offset: 3px; }
.src { font-size: 12px; font-weight: 600; letter-spacing: .03em; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
select.inline { min-height: 36px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); padding: 0 8px; font-size: 14px; max-width: 150px; }

/* ---------- Notes ---------- */
.notes { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 36px; align-items: start; }
.notes-side { position: sticky; top: 24px; }
.field {
  width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r); background: var(--surface);
}
.field::placeholder { color: var(--muted); }
.notelist { list-style: none; margin: 10px 0 0; padding: 0; }
.notelist button { display: block; width: 100%; padding: 10px 12px; border-radius: var(--r); min-height: 44px; }
.notelist button:hover { background: var(--sunken); }
.notelist button[aria-current="true"] { background: var(--sunken); }
.notelist .t { font-weight: 500; }
.note-title { width: 100%; border: 0; background: none; font: 600 28px/1.2 var(--serif); padding: 0; margin-bottom: 6px; outline-offset: 6px; }
.note-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.seg button { padding: 0 12px; min-height: 34px; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--sunken); color: var(--text); font-weight: 600; }
.note-body {
  width: 100%; min-height: 52vh; resize: vertical; border: 0; background: none; padding: 0;
  font: 15px/1.7 var(--mono); outline-offset: 8px;
}
.prose { font-size: 17px; line-height: 1.7; max-width: 66ch; min-height: 30vh; }
.prose h2, .prose h3, .prose h4 { font-family: var(--serif); margin: 1.2em 0 .3em; line-height: 1.25; }
.prose h2 { font-size: 24px; } .prose h3 { font-size: 20px; } .prose h4 { font-size: 17px; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin: .6em 0; }
.prose ul { padding-left: 1.3em; margin: .5em 0; }
.prose li.cb { list-style: none; margin-left: -1.3em; }
.prose li.cb input { accent-color: var(--accent); margin-right: 6px; }
.prose code { font: 14px var(--mono); background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--sunken); padding: 12px 14px; border-radius: var(--r); overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.wl { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 3px; font: inherit; }
.wl.new { text-decoration-style: dashed; text-decoration-color: var(--accent); }
.tag { color: var(--muted); }
.backlinks { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 4px; }
.only-mobile { display: none; }

/* ---------- Health ---------- */
.water { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.water button.g { width: 30px; height: 36px; border: 1.5px solid var(--line-strong); border-radius: 3px 3px 8px 8px; transition: background-color .15s; }
.water button.g[aria-pressed="true"] { background: var(--c-work); border-color: var(--c-work); }
.spark { width: 100%; height: 150px; display: block; margin-top: 16px; }
.spark .raw { fill: none; stroke: var(--line-strong); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .trend { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.legend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid var(--accent); vertical-align: middle; margin-right: 6px; }
.legend i.raw { border-top: 1.5px solid var(--line-strong); }

/* ---------- Fitness ---------- */
.ex { padding: 20px 0; border-bottom: 1px solid var(--line); }
.ex-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ex-head h3 { font-size: 17px; font-weight: 600; }
.sets { border-collapse: collapse; margin-top: 8px; }
.sets th, .sets td { padding-right: 16px !important; }
.sets th { font-size: 13px; font-weight: 500; color: var(--muted); text-align: left; padding: 4px 8px 4px 0; }
.sets td { padding: 4px 8px 4px 0; }
.sets tr.done td { color: var(--muted); }
.cell { width: 76px; min-height: 40px; text-align: center; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); font-variant-numeric: tabular-nums; }
.rest {
  position: sticky; bottom: 16px; z-index: 4; display: flex; align-items: center; gap: 12px; margin-top: 20px;
  padding: 10px 12px 10px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
}
.rest strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin: 16px 0 4px; }
.filters select { min-height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); padding: 0 10px; }
.vol > li { display: grid; grid-template-columns: 110px minmax(0, 1fr) 70px; gap: 16px; }
.vol .bar { height: 8px; border-radius: 4px; }
.vol .bar > i { border-radius: 4px; }

/* ---------- Dialogs ---------- */
dialog {
  padding: 0; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px);
}
dialog::backdrop { background: rgba(20, 20, 18, .38); }
#palette { width: 620px; margin-top: 11vh; overflow: hidden; }
.pal { display: flex; flex-direction: column; max-height: 70vh; }
#pal-q { border: 0; border-bottom: 1px solid var(--line); background: none; padding: 18px 20px; font-size: 17px; outline: none; width: 100%; }
#pal-q::placeholder { color: var(--muted); }
#pal-list { overflow-y: auto; padding: 6px; }
.pal-group { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 14px 4px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 14px; min-height: 44px; border-radius: var(--r); }
.pal-item[aria-selected="true"] { background: var(--sunken); }
.pal-item .hint { font-size: 13px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.pal-foot { border-top: 1px solid var(--line); padding: 8px 16px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.pal-foot kbd + kbd { margin-left: -2px; }

dialog.sheet { margin: 0 0 0 auto; width: 400px; height: 100dvh; max-height: 100dvh; border-radius: 0; border-width: 0 0 0 1px; }
.sheet-in { padding: 24px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet h2 { font: 600 22px var(--serif); }
.sheet h3 { font: 600 13px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 26px 0 6px; }
.sheet p { color: var(--muted); font-size: 15px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 15px; align-items: center; margin: 0; }
.keys dt { white-space: nowrap; } .keys dd { margin: 0; color: var(--muted); }
.menu { list-style: none; margin: 0; padding: 0; }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 0; min-height: 44px; border-bottom: 1px solid var(--line); }
.menu button:hover { color: var(--accent); }
.menu button svg.i { color: var(--muted); width: 18px; height: 18px; }
.menu .danger { color: var(--danger); }

#form { width: 440px; }
#form form { padding: 24px; }
#form h2 { font: 600 22px var(--serif); margin-bottom: 16px; }
.fld { margin-bottom: 14px; }
.fld label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.fld .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.fld select.field { padding: 0 8px; }
.form-err { color: var(--danger); font-size: 14px; margin: 0 0 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.form-actions .left { margin-right: auto; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px;
  background: var(--text); color: var(--bg); border-radius: 10px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100vw - 24px);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 4px 6px; min-height: 32px; }

/* ---------- v2: colour per module, tiles, rings, motion ---------- */
body[data-mod="today"] { --accent: var(--c-today); --accent-soft: var(--s-today); }
body[data-mod="money"] { --accent: var(--c-money); --accent-soft: var(--s-money); }
body[data-mod="notes"] { --accent: var(--c-notes); --accent-soft: var(--s-notes); }
body[data-mod="health"] { --accent: var(--c-health); --accent-soft: var(--s-health); }
body[data-mod="fitness"] { --accent: var(--c-fitness); --accent-soft: var(--s-fitness); }
body[data-mod="work"] { --accent: var(--c-work); --accent-soft: var(--s-work); }

h1 { font-weight: 700; font-size: 32px; letter-spacing: -.02em; }
.sheet h2, #form h2, .note-title, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); letter-spacing: -.01em; }
.stats .v, .lead strong, .rest strong { font-family: var(--serif); }

.rail button, .tabbar button { transition: background-color .15s, color .15s, transform .12s; }
.rail button:hover svg, .tabbar button:hover svg { stroke: var(--c); }
.rail button[aria-current="page"], .tabbar button[aria-current="page"] { background: var(--s); }
.rail button[aria-current="page"] svg, .tabbar button[aria-current="page"] svg { stroke: var(--c); }
.rail button:active, .tabbar button:active, .btn:active, .icon-btn:active, .fab-help:active, .water button.g:active { transform: scale(.95); }
.btn, .icon-btn, .fab-help { transition: background-color .15s, border-color .15s, color .15s, transform .12s, filter .15s; }
.btn { border-radius: 12px; }
.btn.primary { box-shadow: 0 1px 0 rgba(0, 0, 0, .12), 0 6px 16px -8px var(--accent); }
.searchbtn, .field, .cell, .filters select, select.inline { border-radius: 12px; }

.bar { height: 6px; border-radius: 3px; }
.bar > i { background: var(--accent); border-radius: 3px; }
.enter .bar > i { animation: grow .7s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.enter .list > li, .enter .tile, .enter .ex { animation: rise .38s cubic-bezier(.2, .8, .2, 1) both; }
.enter .list > li:nth-child(2), .enter .tile:nth-child(2) { animation-delay: .04s; }
.enter .list > li:nth-child(3), .enter .tile:nth-child(3) { animation-delay: .08s; }
.enter .list > li:nth-child(4), .enter .tile:nth-child(4) { animation-delay: .12s; }
.enter .list > li:nth-child(n+5), .enter .tile:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.stats { background: var(--accent-soft); border: 0; border-radius: 20px; padding: 2px 20px; margin: 14px 0 6px; }
.stats .k { color: var(--text); opacity: .72; }
.tabs button[aria-selected="true"] { border-color: var(--accent); }
.count { background: var(--accent); color: var(--accent-ink); }

.check input {
  appearance: none; -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface) center / 16px no-repeat;
  transition: background-color .15s, border-color .15s, transform .15s cubic-bezier(.3, 1.6, .5, 1);
}
.check input:hover { border-color: var(--accent); }
.check input:active { transform: scale(.82); }
.check input:checked { background-color: var(--accent); border-color: var(--accent); background-image: var(--check); }

/* Today */
.bento { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px;
  display: flex; flex-direction: column; min-width: 0; transition: transform .18s, box-shadow .18s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -12px rgba(28, 27, 24, .22); }
.tile.span2 { grid-column: 1 / -1; }
.tile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.tile-head a { font-weight: 650; text-decoration: none; display: flex; align-items: center; gap: 10px; flex: 1; min-height: 36px; border-radius: 8px; }
.tile-head a .i:last-child { margin-left: auto; color: var(--muted); width: 18px; height: 18px; transition: transform .15s; }
.tile-head a:hover .i:last-child { transform: translateX(3px); color: var(--c); }
.badge { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--s); color: var(--c); flex: none; }
.big { font: 700 30px/1.1 var(--serif); letter-spacing: -.02em; }
.big small { font: 400 15px var(--sans); color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.tile .bar { margin: 14px 0 10px; }
.tile .bar > i { background: var(--c); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.tile .foot { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.tile .btn.tint { background: var(--s); border-color: transparent; color: var(--text); }
.tile .btn.tint:hover { filter: brightness(.96); }
.tile .list > li { min-height: 44px; padding: 6px 0; }
.tile .list > li:last-child { border-bottom: 0; }

.hero { flex-direction: row; align-items: center; gap: 28px; padding: 24px; }
.rings { width: 168px; height: 168px; flex: none; transform: rotate(-90deg); }
.rings circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring-p { transition: stroke-dashoffset .8s cubic-bezier(.2, .8, .2, 1); }
.legend2 { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 20px; }
.legend2 li { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 28px; }
.legend2 i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.legend2 .ok { color: var(--c); font-weight: 650; }
.week { display: flex; gap: 10px; margin-top: 16px; }
.week div { display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.week svg { width: 26px; height: 26px; transform: rotate(-90deg); }
.week circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.week .now { color: var(--text); font-weight: 650; }

.next { background: var(--s); border-color: transparent; flex-direction: row; align-items: center; gap: 16px; }
.next .kicker { font-size: 13px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--c); }
.next .ttl { font: 650 20px/1.3 var(--serif); letter-spacing: -.01em; }
.next .btn.go { background: var(--c); border-color: var(--c); color: var(--accent-ink); }
.next-actions { display: flex; gap: 6px; flex: none; }

.macro { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.macro .bar { margin: 4px 0 0; }
.macro span { font-size: 13px; color: var(--muted); }
.pips { display: flex; flex-wrap: wrap; gap: 5px; margin: 14px 0 4px; }
.pips { flex-wrap: nowrap; }
.pips i { flex: 1 1 0; max-width: 26px; height: 8px; border-radius: 4px; background: var(--line); transition: background-color .3s; }
.pips i.on { background: var(--c); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; width: 9px; height: 14px; border-radius: 3px; animation: fly 1.25s cubic-bezier(.12, .7, .3, 1) forwards; }
@keyframes fly {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}
#toast { border-radius: 14px; }

/* ---------- Lock screen ---------- */
#lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 24px; }
#lock[hidden] { display: none; }
.lock-card { width: 100%; max-width: 380px; text-align: center; }
.lock-mark { width: 64px; height: 64px; border-radius: 20px; background: var(--s-today); color: var(--c-today); display: grid; place-items: center; margin: 0 auto 20px; }
.lock-mark svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lock-card h1 { margin-bottom: 6px; }
.lock-card p { color: var(--muted); }
.lock-card .btn { width: 100%; min-height: 48px; margin-top: 24px; background: var(--c-today); border-color: var(--c-today); color: var(--accent-ink); }
.lock-card .btn[disabled] { opacity: .6; cursor: default; }
.lock-err { color: var(--danger) !important; margin-top: 14px; font-size: 15px; }
body.locked .app, body.locked .tabbar, body.locked .fab-help { display: none; }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  main { padding: 22px 18px 150px; }
  h1 { font-size: 26px; }
  .top { align-items: center; margin-bottom: 20px; }
  .searchbtn span, .searchbtn kbd { display: none; }
  .searchbtn { width: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .icon-btn { width: 44px; height: 44px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .top .btn.primary span { display: none; }
  .top .btn.primary { width: 44px; padding: 0; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; min-height: 56px; font-size: 12px; color: var(--muted); border-radius: var(--r); }
  .tabbar button[aria-current="page"] { color: var(--text); font-weight: 600; }
  .tabbar button[aria-current="page"] svg { stroke: var(--accent); }
  .fab-help { right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .trow { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 20px 0; }
  .lead { font-size: 18px; }
  .stats, .stats.three { grid-template-columns: repeat(2, 1fr); }
  .stats .v { font-size: 19px; }
  .budget > li { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .budget .bar { grid-column: 1 / -1; grid-row: 2; }
  .budget .fig { min-width: 0; }
  .notes { grid-template-columns: minmax(0, 1fr); }
  .notes-side { position: static; }
  .notes.has-sel .notes-side { display: none; }
  .notes:not(.has-sel) .notes-main { display: none; }
  .only-mobile { display: inline-flex; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field { grid-column: 1 / -1; }
  .vol > li { grid-template-columns: 90px minmax(0, 1fr) 60px; }
  .cell { width: 64px; min-height: 44px; }
  dialog.sheet { width: 100vw; border: 0; }
  #palette { margin-top: 12px; width: 100vw; }
  .hide-mobile { display: none; }
  h1 { font-size: 27px; }
  .bento { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero .rings { align-self: center; }
  .legend2 { grid-template-columns: minmax(0, 1fr); }
  .next { flex-direction: column; align-items: stretch; }
  .next-actions .btn { flex: 1; }
  .big { font-size: 27px; }
  .tile:hover { transform: none; box-shadow: none; }
}
@media (pointer: coarse) {
  .check { width: 44px; height: 44px; margin: 0 -8px 0 -12px; }
  .water button.g { width: 36px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
