/* Tokens and components: DESIGN.md. Ported from prototype/index.html. No transitions or animations. */
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/golos-text/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/golos-text/golos-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/golos-text/golos-text-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/golos-text/golos-text-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/golos-text/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/golos-text/golos-text-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Oswald"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/oswald/oswald-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Oswald"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/oswald/oswald-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Oswald"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/oswald/oswald-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Oswald"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/oswald/oswald-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --color-canvas: #E9E8E3; --color-surface: #F7F6F2; --color-sunk: #DEDCD5;
  --color-text: #1A1B18; --color-text-muted: #575953; --color-border: #CFCDC5;
  --color-control-border: #85847C; --color-action: #1A1B18; --color-on-action: #F7F6F2;
  --color-today: #B3261E; --color-focus: #2456A6;
  --color-level-4: #2D6A47; --color-level-3: #5E7A2E; --color-level-2: #9A5B0B; --color-level-1: #A3341F;
  --color-level-4-bg: #CFE3D5; --color-level-3-bg: #DFE6CB; --color-level-2-bg: #F0DDBF; --color-level-1-bg: #F1D0C7;
  --color-danger: #A3341F;
  --font-text: "Golos Text", system-ui, sans-serif; --font-num: "Oswald", "Arial Narrow", sans-serif;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;
  --radius-sheet: 6px; --radius-control: 12px; --radius-overlay: 16px; --radius-pill: 999px;
  --shadow-sheet: 0 1px 0 var(--color-border), 0 6px 16px -10px rgb(0 0 0 / .35);
  --shadow-overlay: 0 12px 40px -12px rgb(0 0 0 / .45);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --color-canvas: #121311; --color-surface: #1C1D1A; --color-sunk: #262723;
  --color-text: #ECEAE3; --color-text-muted: #A4A69E; --color-border: #30312C;
  --color-control-border: #75776F; --color-action: #ECEAE3; --color-on-action: #121311;
  --color-today: #FF8A80; --color-focus: #8AB4FF;
  --color-level-4: #6FCF97; --color-level-3: #B5D17A; --color-level-2: #F2B45A; --color-level-1: #FF8F7A;
  --color-level-4-bg: #1E3A2A; --color-level-3-bg: #2F3A1D; --color-level-2-bg: #44321A; --color-level-1-bg: #4A251F;
  --color-danger: #FF8F7A;
  --shadow-sheet: 0 1px 0 var(--color-border), 0 8px 20px -12px rgb(0 0 0 / .8);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --color-canvas: #121311; --color-surface: #1C1D1A; --color-sunk: #262723;
  --color-text: #ECEAE3; --color-text-muted: #A4A69E; --color-border: #30312C;
  --color-control-border: #75776F; --color-action: #ECEAE3; --color-on-action: #121311;
  --color-today: #FF8A80; --color-focus: #8AB4FF;
  --color-level-4: #6FCF97; --color-level-3: #B5D17A; --color-level-2: #F2B45A; --color-level-1: #FF8F7A;
  --color-level-4-bg: #1E3A2A; --color-level-3-bg: #2F3A1D; --color-level-2-bg: #44321A; --color-level-1-bg: #4A251F;
  --color-danger: #FF8F7A;
  --shadow-sheet: 0 1px 0 var(--color-border), 0 8px 20px -12px rgb(0 0 0 / .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; transition: none !important; animation: none !important; }
html, body { margin: 0; }
/* No zoom (owner decision 2026-10-27): no double-tap zoom; iOS text-size adjust off; pinch is blocked in main.ts. */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--color-canvas); color: var(--color-text); font: 400 16px/1.5 var(--font-text); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--color-text-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.h1 { font-size: 24px; line-height: 1.2; font-weight: 600; }
.h2 { font-size: 18px; line-height: 1.3; font-weight: 600; }
.small { font-size: 14px; line-height: 1.45; }
.caption { font-size: 12px; line-height: 1.35; font-weight: 500; }
.label { font-size: 15px; line-height: 1.2; font-weight: 500; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-16 { width: 16px; height: 16px; } .icon-24 { width: 24px; height: 24px; } .icon-32 { width: 32px; height: 32px; } .icon-48 { width: 48px; height: 48px; stroke-width: 1.5; }

/* Buttons and controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-4);
  border-radius: var(--radius-control); border: 1px solid transparent; cursor: pointer; font-size: 15px; font-weight: 500; line-height: 1.2; background: none; }
.btn-lg { min-height: 56px; padding: 0 var(--space-5); }
.btn-block { width: 100%; }
.btn-primary { background: var(--color-action); color: var(--color-on-action); }
.btn-primary:active { filter: brightness(.85); }
.btn-secondary { background: var(--color-surface); border-color: var(--color-control-border); }
.btn-secondary:active, .btn-ghost:active, .icon-btn:active, .li-btn:active, .tab:active, .key:active, .chip:active, .link:active { background: var(--color-sunk); }
.btn:disabled, .icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-control); border: 0; background: none; cursor: pointer; display: inline-grid; place-items: center; }
.link { border: 0; background: none; padding: 4px 6px; border-radius: 8px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover, .btn-ghost:hover, .icon-btn:hover:not(:disabled), .li-btn:hover, .chip:hover, .link:hover { background: var(--color-sunk); }
  .btn-primary:hover { filter: brightness(.92); }
}
.switch { position: relative; width: 52px; height: 32px; border-radius: var(--radius-pill); border: 0; padding: 0; cursor: pointer; flex: none; background: var(--color-control-border); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.switch[aria-checked="true"] { background: var(--color-level-4); }
.switch[aria-checked="true"]::after { left: 23px; }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: var(--radius-control); background: var(--color-sunk); }
.seg > button { white-space: nowrap; min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: none; cursor: pointer; font-size: 15px; font-weight: 500; color: var(--color-text-muted); }
.seg > button[aria-checked="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: 0 1px 2px rgb(0 0 0 / .15); }

/* Level colors */
.lv4 { color: var(--color-level-4); } .lv3 { color: var(--color-level-3); } .lv2 { color: var(--color-level-2); } .lv1 { color: var(--color-level-1); }
.bg4 { background: var(--color-level-4-bg); } .bg3 { background: var(--color-level-3-bg); } .bg2 { background: var(--color-level-2-bg); } .bg1 { background: var(--color-level-1-bg); }
.level { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.level::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: currentColor; }
.figure { font-family: var(--font-num); font-size: 56px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; }
.figure-sm { font-family: var(--font-num); font-size: 28px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Layout */
.app { display: none; min-height: 100dvh; }
.app.is-on { display: block; }
.main { max-width: 600px; margin: 0 auto; padding: var(--space-4) var(--space-4) calc(160px + env(safe-area-inset-bottom)); }
.screen { display: none; }
.screen.is-on { display: grid; gap: var(--space-4); }
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; }
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: var(--space-1) var(--space-2) calc(var(--space-1) + env(safe-area-inset-bottom)); background: var(--color-surface); border-top: 1px solid var(--color-border); }
.tab { display: grid; justify-items: center; gap: 2px; min-height: 56px; padding: var(--space-2) 0; border: 0; background: none; cursor: pointer; color: var(--color-text-muted); font-size: 12px; font-weight: 500; border-radius: var(--radius-control); }
.tab[aria-current="page"] { color: var(--color-text); }
.tab[aria-current="page"] .icon { stroke-width: 2.25; }
.brand { display: none; }
.fab { position: fixed; z-index: 21; right: var(--space-4); bottom: calc(76px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-overlay); }
@media (min-width: 900px) {
  .app.is-on { display: grid; grid-template-columns: 220px 1fr; }
  .tabbar { position: sticky; top: 0; height: 100dvh; inset: auto; display: flex; flex-direction: column; gap: var(--space-1);
    padding: var(--space-6) var(--space-3); border-top: 0; border-right: 1px solid var(--color-border); }
  .brand { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3) var(--space-6); font-weight: 600; }
  .tab { grid-template-columns: 24px 1fr; justify-items: start; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-3); font-size: 15px; }
  .tab[aria-current="page"] { background: var(--color-sunk); }
  .main { padding: var(--space-8) var(--space-6) var(--space-12); }
  .fab { position: static; box-shadow: none; justify-self: end; order: -1; }
}
.panel { position: relative; background: var(--color-surface); border-radius: var(--radius-sheet); box-shadow: var(--shadow-sheet); padding: var(--space-5); display: grid; gap: var(--space-4); }

/* Week navigation */
.wk-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: var(--space-2); }
.wk-pick { justify-self: center; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-control); background: none; cursor: pointer; font-size: 16px; font-weight: 600; }
.wk-pick:active { background: var(--color-sunk); }
@media (hover: hover) and (pointer: fine) { .wk-pick:hover { background: var(--color-sunk); } }

/* Home: week sheet */
.wk-head { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4); align-items: end; }
.wk-head .figure { font-size: 72px; line-height: .9; }
.wk-meta { display: grid; gap: 4px; padding-bottom: 4px; }
.wk-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-1); }
.wd { display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-2) 0; border: 0; border-radius: var(--radius-control); background: none; cursor: pointer; }
.wd:disabled { cursor: default; }
.wd:active:not(:disabled) { background: var(--color-sunk); }
@media (hover: hover) and (pointer: fine) { .wd:hover:not(:disabled) { background: var(--color-sunk); } }
.wd.is-today { background: var(--color-sunk); }
#s-home .panel { box-shadow: none; }
.wk-back { justify-self: center; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--color-control-border); background: var(--color-surface); cursor: pointer; font-size: 14px; font-weight: 500; }
.wk-back:active { background: var(--color-sunk); }
.wk-back[hidden] { display: none; }
.insights { display: grid; }
.insight { display: grid; gap: 2px; padding: var(--space-3) 0; border-top: 1px solid var(--color-border); }
.insight:first-child { border-top: 0; padding-top: 0; }
.insight b { font-weight: 600; }
.ai-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.wd .v { font-family: var(--font-num); font-size: 16px; line-height: 1; font-weight: 500; min-height: 16px; }
.wd .w, .tile .wl { font-size: 12px; font-weight: 500; color: var(--color-text-muted); }
.is-today .w, .is-today .wl { color: var(--color-today); font-weight: 600; }
.wd .d { font-family: var(--font-num); font-size: 15px; line-height: 1; }
.wd:disabled .d, .wd:disabled .w { opacity: .5; }
.bar { width: 22px; height: 80px; border-radius: 3px; background: var(--color-sunk); display: flex; align-items: flex-end; overflow: hidden; }
.bar > i { display: block; width: 100%; background: currentColor; height: calc(var(--v) * 1%); border-radius: 3px 3px 0 0; }
.bar.is-empty { background: none; border: 1.5px dashed var(--color-control-border); display: grid; place-items: center; color: var(--color-text-muted); }
.bar.is-future { background: none; border: 1px solid var(--color-border); }
.wk-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.wk-facts > div { display: grid; gap: 2px; align-content: start; }
.wk-facts .figure-sm { font-size: 24px; }

/* Day tiles (history) */
.tiles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.tile { display: grid; gap: 1px; justify-items: center; align-content: center; min-height: 96px; padding: var(--space-2) 2px; border: 0; border-radius: 6px; cursor: pointer; color: var(--color-text); }
.tile .dn { font-size: 12px; color: var(--color-text-muted); }
.tile .sc { font-family: var(--font-num); font-size: 22px; line-height: 1.1; font-weight: 500; }
.tile .f { font-size: 11px; line-height: 1.2; text-align: center; }
.tile.is-empty { background: none; border: 1.5px dashed var(--color-control-border); }
.tile.is-future { background: none; border: 1px solid var(--color-border); cursor: default; }
.tile.is-future > * { opacity: .5; }
.tile:active:not(:disabled) { filter: brightness(.93); }
.wsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-control); background: var(--color-sunk); font-size: 12px; color: var(--color-text-muted); }
.wsum b { display: block; font-family: var(--font-num); font-size: 20px; font-weight: 500; color: var(--color-text); }

/* Entry sheet */
dialog { border: 0; padding: 0; color: var(--color-text); background: var(--color-surface); box-shadow: var(--shadow-overlay); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
.sheet-dlg { width: 100%; max-width: 600px; margin: auto auto 0; border-radius: var(--radius-overlay) var(--radius-overlay) 0 0; max-height: 92dvh; }
@media (min-width: 900px) { .sheet-dlg { margin: auto; border-radius: var(--radius-overlay); max-width: 480px; } }
.dlg-body { display: grid; gap: var(--space-5); padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom)); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.chips { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 2px; margin: 0 calc(var(--space-5) * -1); padding-left: var(--space-5); padding-right: var(--space-5); scrollbar-width: none; }
.chip { flex: none; display: grid; justify-items: center; min-width: 52px; padding: 6px 10px; border-radius: var(--radius-control); border: 1px solid var(--color-control-border); background: var(--color-surface); cursor: pointer; }
.chip .w { font-size: 12px; font-weight: 500; color: var(--color-text-muted); }
.chip .d { font-family: var(--font-num); font-size: 18px; line-height: 1.1; }
.chip[aria-checked="true"] { background: var(--color-action); color: var(--color-on-action); border-color: var(--color-action); }
.chip[aria-checked="true"] .w { color: inherit; }
.form { display: grid; gap: var(--space-4); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 44px; }
.stepper { display: inline-flex; align-items: center; gap: var(--space-2); }
.stepper .icon-btn { border: 1px solid var(--color-control-border); background: var(--color-surface); }
.stepper output { min-width: 44px; text-align: center; font-family: var(--font-num); font-size: 28px; line-height: 1; font-weight: 500; }
.field { display: grid; gap: var(--space-2); }
.input, .textarea { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius-control); border: 1px solid var(--color-control-border); background: var(--color-surface); }
.input[aria-invalid="true"] { border-color: var(--color-danger); }
.textarea { padding: 12px 14px; min-height: 64px; resize: vertical; }
.input:focus-visible, .textarea:focus-visible, .num-input:focus-visible { outline: none; border-color: var(--color-focus); box-shadow: 0 0 0 2px var(--color-focus); }
.hint-text { font-size: 13px; color: var(--color-text-muted); }
.field-err { font-size: 13px; color: var(--color-danger); font-weight: 500; }
.field-err:empty { display: none; }
.preview { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-control); background: var(--color-sunk); }
.preview ul { margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--color-text-muted); text-align: right; }
.note-ro { font-size: 13px; color: var(--color-text-muted); padding: var(--space-3) var(--space-4); border: 1px dashed var(--color-control-border); border-radius: var(--radius-control); }
.kind { width: 100%; }
.dlg-actions { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-3); }

/* Calendar */
.cal-dlg { width: min(420px, calc(100vw - 24px)); border-radius: var(--radius-overlay); }
.cal { display: grid; gap: var(--space-3); padding: var(--space-4); }
.cal-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; }
.cal-grid { display: grid; gap: 4px; }
.cal-row, .cal-dow { display: grid; grid-template-columns: 44px var(--space-3) repeat(7, 1fr); column-gap: 4px; align-items: center; }
.cal-row { padding: 3px; border: 2px solid transparent; border-radius: 10px; background: none; cursor: pointer; width: 100%; }
.cal-row > :nth-child(2) { grid-column: 3; }
.cal-dow { padding: 0 5px; font-size: 12px; font-weight: 500; color: var(--color-text-muted); text-align: center; }
.cal-dow > :nth-child(2) { grid-column: 3; }
.cal-row:active:not(:disabled) { background: var(--color-sunk); }
@media (hover: hover) and (pointer: fine) { .cal-row:hover:not(:disabled) { background: var(--color-sunk); } }
.cal-row:disabled { cursor: default; }
.cal-row[aria-current="true"] { border-color: var(--color-text); }
.cal-wk { font-family: var(--font-num); font-size: 16px; height: 36px; border-radius: 6px; display: grid; place-items: center; font-weight: 500; }
.cal-wk.none { color: var(--color-text-muted); font-family: var(--font-text); font-size: 13px; }
.cal-day { height: 36px; border-radius: 6px; display: grid; place-items: center; font-family: var(--font-num); font-size: 15px; }
.cal-day.out { opacity: .35; }
.cal-day.future { color: var(--color-text-muted); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--color-today); }

/* Stats */
.keynums { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.keynums > div { display: grid; gap: 4px; align-content: start; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 500 12px var(--font-text); fill: var(--color-text-muted); }
.chart .val { font: 500 13px var(--font-num); fill: var(--color-text); }
.months { display: grid; }
.month { display: grid; gap: var(--space-2); padding: var(--space-3) 0; border-top: 1px solid var(--color-border); }
.month:first-child { border-top: 0; padding-top: 0; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; }
.strip { display: grid; gap: 2px; height: 24px; margin-bottom: 6px; }
.strip > i { position: relative; border-radius: 2px; }
.strip > i.none { background: var(--color-sunk); }
.strip > i.v::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--color-text); }
.mfacts { display: flex; flex-wrap: wrap; gap: 2px var(--space-4); font-size: 13px; color: var(--color-text-muted); }
.mfacts b { font-family: var(--font-num); font-size: 16px; font-weight: 500; color: var(--color-text); }

/* History */
.hist { display: grid; gap: var(--space-6); }
.hmonth { display: grid; gap: var(--space-2); }
.hmonth-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-1); }
.hweek { background: var(--color-surface); border-radius: var(--radius-sheet); box-shadow: var(--shadow-sheet); overflow: hidden; }
.hweek summary { list-style: none; display: grid; grid-template-columns: 1fr auto auto 20px; gap: var(--space-4); align-items: center; padding: var(--space-4); cursor: pointer; }
.hweek summary:active { background: var(--color-sunk); }
.hweek summary::-webkit-details-marker { display: none; }
.hweek[open] .chev { transform: rotate(90deg); }
.mini { display: grid; grid-template-columns: repeat(7, 8px); gap: 3px; align-items: end; height: 28px; }
.mini > i { display: block; border-radius: 2px; background: currentColor; height: calc(var(--v) * 1%); min-height: 3px; }
.mini > i.e { background: none; border: 1px dashed var(--color-control-border); height: 100%; }
.hbody { padding: 0 var(--space-4) var(--space-4); display: grid; gap: var(--space-3); }

/* Settings */
.group { display: grid; gap: var(--space-2); }
.group > .h2 { padding: 0 var(--space-1); }
.list { background: var(--color-surface); border-radius: var(--radius-sheet); box-shadow: var(--shadow-sheet); }
.li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 56px; padding: var(--space-2) var(--space-4); border-top: 1px solid var(--color-border); }
.li:first-child { border-top: 0; }
.li-btn { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 0; }
.li .note { display: block; font-size: 13px; color: var(--color-text-muted); }
.num-input { width: 72px; min-height: 44px; text-align: right; padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--color-control-border); background: var(--color-canvas); font-family: var(--font-num); font-size: 18px; }
.group-note { padding: 0 var(--space-1); font-size: 13px; color: var(--color-text-muted); }

/* Auth */
.auth { display: none; min-height: 100dvh; place-items: center; padding: var(--space-6) var(--space-4); }
.auth.is-on { display: grid; }
.auth-card { width: 100%; max-width: 360px; display: grid; gap: var(--space-5); }
.auth-card.center { justify-items: center; text-align: center; }
.step { font-size: 13px; color: var(--color-text-muted); justify-self: start; }
.mark { display: flex; align-items: center; gap: var(--space-3); }
.logo { width: 44px; height: 48px; border-radius: 4px; background: var(--color-surface); box-shadow: var(--shadow-sheet); display: grid; place-items: center; font-family: var(--font-num); font-size: 22px; font-weight: 600; }
.err { display: flex; gap: var(--space-2); align-items: flex-start; color: var(--color-danger); font-size: 14px; font-weight: 500; }
.err:empty { display: none; }
.dots { display: flex; gap: var(--space-4); justify-content: center; min-height: 20px; }
.dots > i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--color-text); }
.dots > i.on { background: var(--color-text); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: var(--space-3) var(--space-5); justify-content: center; }
.key { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--color-surface); box-shadow: var(--shadow-sheet); font-family: var(--font-num); font-size: 30px; font-weight: 500; cursor: pointer; display: grid; place-items: center; }
.key.k-plain { background: none; box-shadow: none; }
.face-dlg { width: min(340px, calc(100vw - 32px)); border-radius: var(--radius-overlay); }
.face-dlg .body { display: grid; gap: var(--space-4); justify-items: center; text-align: center; padding: var(--space-6); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

.toast { position: fixed; left: 50%; bottom: calc(140px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: none;
  background: var(--color-action); color: var(--color-on-action); padding: var(--space-3) var(--space-4); border-radius: var(--radius-control); font-size: 14px; font-weight: 500; }
.toast.is-on { display: block; }
@media (min-width: 900px) { .toast { bottom: var(--space-8); } }
.center-text { text-align: center; }
.stack-4 { display: grid; gap: var(--space-1); }
.stack-8 { display: grid; gap: var(--space-2); }
.stack-12 { display: grid; gap: var(--space-3); width: 100%; }
.app-loading { min-height: 100dvh; display: grid; place-items: center; color: var(--color-text-muted); }
.error-panel { display: grid; gap: var(--space-3); justify-items: start; }
.stack { display: grid; gap: var(--space-4); }
.text-font { font-family: var(--font-text); }
.chev { display: inline-grid; }
.month-avg { font-size: 18px; font-weight: 500; }
.inline-gap { display: flex; align-items: center; gap: var(--space-2); }
.danger-text { color: var(--color-danger); }
.screen.settings.is-on { gap: var(--space-6); }
.sprite { position: absolute; }
.li > :first-child { flex: 1 1 180px; min-width: 0; }
