/* Heightened: "the aperture". One calm grey-blue room, one deep water-blue accent, one warm gold for a finished hour,
   the quarter ring as the signature mark. Flat surfaces, hairlines, no shadows on cards. MASTER_PLAN.md section 2. */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --bg: #F3F5F7; --surface: #FFFFFF; --surface-2: #EAEDF1;
  --ink: #151A23; --ink-soft: #4A5261; --ink-muted: #5F6878; --line: #D8DDE4;
  --accent: #2F6F8F; --accent-hover: #275E79; --on-accent: #FFFFFF; --accent-soft: #E2EEF4;
  --gold: #C99A3F; --gold-soft: #F6EEDC;
  --good: #257A5B; --miss: #B9544B; --warn: #8A6322; --focus: #2F6F8F;
  --toast-bg: #151A23; --toast-ink: #FFFFFF;
  --scrim: rgba(14, 17, 22, 0.45);
  --shadow-float: 0 16px 40px rgba(10, 14, 20, 0.16);
  --ring-glow: none;
  --miss-tint: rgba(185, 84, 75, 0.12);

  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 17px; --fs-lg: 20px; --fs-xl: 26px; --fs-2xl: 34px; --fs-timer: 88px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --gutter: 16px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --t-fast: 160ms; --t-base: 240ms; --t-slow: 400ms; --ease-out: cubic-bezier(.22, 1, .36, 1);
  --sidebar-w: 232px; --rail-w: 320px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E1116; --surface: #151A21; --surface-2: #1C222B;
    --ink: #E6E9EE; --ink-soft: #AEB6C2; --ink-muted: #7F8896; --line: #273039;
    --accent: #6FB3D2; --accent-hover: #8AC4DE; --on-accent: #0B1A23; --accent-soft: #16303D;
    --gold: #E2B86A; --gold-soft: #3A2F17;
    --good: #5CC49A; --miss: #E07B73; --warn: #D9A85A; --focus: #8AC4DE;
    --toast-bg: #E6E9EE; --toast-ink: #151A23;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow-float: 0 16px 40px rgba(0, 0, 0, 0.5);
    --ring-glow: 0 0 24px rgba(111, 179, 210, 0.25);
    --miss-tint: rgba(224, 123, 115, 0.14);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1116; --surface: #151A21; --surface-2: #1C222B;
  --ink: #E6E9EE; --ink-soft: #AEB6C2; --ink-muted: #7F8896; --line: #273039;
  --accent: #6FB3D2; --accent-hover: #8AC4DE; --on-accent: #0B1A23; --accent-soft: #16303D;
  --gold: #E2B86A; --gold-soft: #3A2F17;
  --good: #5CC49A; --miss: #E07B73; --warn: #D9A85A; --focus: #8AC4DE;
  --toast-bg: #E6E9EE; --toast-ink: #151A23;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-float: 0 16px 40px rgba(0, 0, 0, 0.5);
  --ring-glow: 0 0 24px rgba(111, 179, 210, 0.25);
  --miss-tint: rgba(224, 123, 115, 0.14);
}
@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1100px) { :root { --gutter: 32px; } }

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-base)/1.5 var(--font-body); }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.1; margin: 0 0 var(--s3); letter-spacing: 0; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0 0 var(--s3); }
a { color: var(--accent); }
img, svg, canvas { max-width: 100%; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.soft { color: var(--ink-soft); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-copy { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--ink); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--ink-muted); }
.label-caps { font: 500 var(--fs-xs)/1.3 var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); }

/* ---------------------------------------------------------------- buttons, inputs, chips, cards, tables */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 18px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 var(--fs-base) var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn.quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--miss); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: var(--fs-sm); }
.btn.icon { width: 40px; min-height: 40px; padding: 0; }
.btn.icon svg { width: 20px; height: 20px; }
.btn.wide { width: 100%; }
.btn.start { min-height: 56px; padding: 0 28px; font-size: var(--fs-md); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.label { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin: var(--s4) 0 6px; font: 500 var(--fs-sm) var(--font-body); color: var(--ink-soft); }
.label .hint { color: var(--ink-muted); font-weight: 400; }
.label .count { margin-left: auto; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.label .count.over { color: var(--miss); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], input[type="time"], input[type="search"], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 400 var(--fs-base)/1.5 var(--font-body);
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
textarea { resize: vertical; min-height: 96px; }
select { appearance: auto; }
input.code-field { font-family: var(--font-mono); font-size: 18px; letter-spacing: 0.06em; text-transform: uppercase; }
input.invalid, textarea.invalid { border-color: var(--miss); }
.error { margin: var(--s3) 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--miss-tint); color: var(--ink); border-left: 3px solid var(--miss); font-size: var(--fs-sm); }
.hint-line { margin-top: var(--s4); font-size: var(--fs-sm); color: var(--ink-soft); }
.field-row { display: grid; gap: var(--s3); }
@media (min-width: 640px) { .field-row.two { grid-template-columns: 1fr 1fr; } }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-soft); font: 500 var(--fs-sm) var(--font-body); white-space: nowrap; }
.chip.good { color: var(--good); } .chip.warn { color: var(--warn); } .chip.miss { color: var(--miss); }
.chip.gold { background: var(--gold-soft); color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; margin-bottom: var(--s4); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.stat { display: grid; gap: 2px; }
.stat .k { font: 500 var(--fs-xs) var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); }
.stat .v { font: 500 22px var(--font-mono); font-variant-numeric: tabular-nums; }
.stat .v.big { font-size: var(--fs-2xl); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table.tbl { border-collapse: collapse; width: 100%; }
.tbl th, .tbl td { padding: 0 12px; height: 48px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); font: 500 var(--fs-xs) var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); z-index: 1; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.me td { background: var(--accent-soft); }
.tbl tr.today td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.tbl tr.missed td { background: var(--miss-tint); }
.tbl tr.pinned td { background: var(--surface-2); font-weight: 600; }
.tbl th.sticky, .tbl td.sticky { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.tbl th.sticky { background: var(--surface-2); z-index: 3; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); opacity: 0; background: var(--toast-bg); color: var(--toast-ink); padding: 10px 16px; border-radius: var(--r-md); font: 500 var(--fs-sm) var(--font-body); z-index: 60; pointer-events: none; transition: opacity var(--t-base), transform var(--t-base) var(--ease-out); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.tabs { display: flex; gap: var(--s4); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 2px; color: var(--ink-soft); font: 600 var(--fs-sm) var(--font-body); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--ink-soft); display: grid; gap: var(--s3); justify-items: center; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; padding: 6px 0; border-top: 1px solid var(--line); }
.toggle:first-of-type { border-top: 0; }
.switch { width: 44px; height: 26px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); position: relative; cursor: pointer; flex: none; transition: background-color var(--t-fast); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); transition: transform var(--t-fast) var(--ease-out); }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); border-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; background: var(--surface); }
.seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-soft); font: 600 var(--fs-xs) var(--font-body); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.divider { height: 1px; background: var(--line); margin: var(--s4) 0; }
ul.clean, ol.clean { margin: 0; padding-left: 20px; }
ul.plain { list-style: none; margin: 0; padding: 0; }

/* ---------------------------------------------------------------- the quarter ring (widgets.ring) */
.ring { display: block; }
.ring .track { stroke: var(--surface-2); }
.ring .q-empty { stroke: var(--surface-2); }
.ring .q-done { stroke: var(--gold); }
.ring .q-run { stroke: var(--accent); }
.ring .q-progress { stroke: var(--accent); transition: stroke-dashoffset 1s linear; }
.ring .x-done { stroke: var(--gold); }
.ring.breathing { animation: breath 6s ease-in-out infinite; }
.ring.glow { filter: drop-shadow(var(--ring-glow)); }
@keyframes breath { 0%, 100% { opacity: 0.85; } 50% { opacity: 1; } }
.ring-mark { width: 20px; height: 20px; --q1: var(--surface-2); --q2: var(--surface-2); --q3: var(--surface-2); --q4: var(--surface-2); color: var(--surface-2); }

/* ---------------------------------------------------------------- landing */
.landing { min-height: 100vh; }
.land { max-width: 640px; margin: 0 auto; padding: var(--s8) var(--gutter) var(--s8); text-align: center; }
.land-ring { width: 72px; height: 72px; margin: 0 auto var(--s4); --q1: var(--gold); --q2: var(--gold); --q3: var(--gold); --q4: var(--accent); }
.land-name { font-size: var(--fs-2xl); margin-bottom: var(--s2); }
.land-line { color: var(--ink-soft); font-size: var(--fs-md); max-width: 44ch; margin: 0 auto var(--s5); }
.land-actions { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }
.land-note { margin-top: var(--s3); font-size: var(--fs-sm); color: var(--ink-muted); }
.land-loop { text-align: left; max-width: 420px; margin: var(--s7) auto 0; padding-left: 22px; color: var(--ink-soft); }
.land-loop li { padding: 4px 0; }
.land-loop b { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- auth */
.auth-stage { min-height: 100vh; display: grid; place-items: start center; padding: var(--s7) var(--gutter); }
.auth-card { width: 100%; max-width: 420px; padding: 24px; }
.auth-ring { width: 40px; height: 40px; margin: 0 auto var(--s4); display: block; --q1: var(--gold); --q2: var(--gold); --q3: var(--gold); --q4: var(--accent); }
.auth-tabs { display: flex; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; margin-bottom: var(--s4); }
.auth-tab { flex: 1; min-height: 36px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-soft); font: 600 var(--fs-sm) var(--font-body); cursor: pointer; }
.auth-tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.auth-form h1 { font-size: var(--fs-lg); }
.auth-form .sub { color: var(--ink-soft); font-size: var(--fs-sm); }
.auth-form .btn.wide { margin-top: var(--s4); }

/* ---------------------------------------------------------------- the app shell */
.app { display: block; }
.sidebar { display: none; }
.main { min-width: 0; padding: 0 var(--gutter) 96px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); min-height: 56px; padding: var(--s4) 0 var(--s3); flex-wrap: wrap; }
.page-titles h1 { margin: 0 0 2px; font-size: var(--fs-xl); }
.page-line { margin: 0; color: var(--ink-soft); font-size: var(--fs-sm); }
.page-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.timer-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--accent); background: var(--accent-soft); color: var(--ink); font: 500 var(--fs-sm) var(--font-mono); cursor: pointer; }
.timer-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tabs-mobile { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.tabs-mobile .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border: 0; background: transparent; color: var(--ink-muted); font: 500 11px var(--font-body); cursor: pointer; }
.tabs-mobile .tab svg { width: 20px; height: 20px; }
.tabs-mobile .tab[aria-current="page"] { color: var(--accent); }
.nav { display: grid; gap: 2px; }
.nav .tab { position: relative; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px 0 14px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-soft); font: 600 var(--fs-sm) var(--font-body); text-align: left; cursor: pointer; transition: background-color var(--t-fast), color var(--t-fast); }
.nav .tab svg { width: 18px; height: 18px; flex: none; }
.nav .tab:hover { background: var(--surface-2); color: var(--ink); }
.nav .tab[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.nav .tab[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 4px 6px; min-height: 40px; }
.brand-ring { width: 22px; height: 22px; --q1: var(--gold); --q2: var(--gold); --q3: var(--gold); --q4: var(--accent); }
.brand-name { font: 700 var(--fs-md) var(--font-body); letter-spacing: 0; }
.side-foot { margin-top: auto; display: grid; gap: var(--s3); padding: 0 6px; }
.year-line { display: grid; gap: 4px; font: 500 var(--fs-xs) var(--font-mono); color: var(--ink-muted); }
.year-line .bar { height: 2px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.year-line .bar i { display: block; height: 100%; background: var(--accent); }
.streak-chip { display: flex; align-items: center; gap: 8px; font: 500 var(--fs-sm) var(--font-mono); color: var(--ink-soft); }
.side-row { display: flex; align-items: center; gap: 8px; }
.side-name { font-size: var(--fs-sm); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.icon .ico-sun, .btn.icon .ico-moon { display: none; }
:root[data-theme="light"] .btn.icon .ico-auto, :root[data-theme="dark"] .btn.icon .ico-auto { display: none; }
:root[data-theme="light"] .btn.icon .ico-sun { display: inline; }
:root[data-theme="dark"] .btn.icon .ico-moon { display: inline; }
.cloud-only { display: none; }
.is-cloud .cloud-only { display: inline-flex; }

/* the two-column desk: main + rail */
.desk { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
.rail { display: grid; gap: var(--s4); align-content: start; }
.rail .card { margin: 0; }
.narrow { max-width: 760px; }
.wide { max-width: 1144px; }

@media (min-width: 1100px) {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
  .sidebar { display: flex; flex-direction: column; gap: var(--s5); position: sticky; top: 0; height: 100vh; padding: 16px 12px 16px; background: var(--surface); border-right: 1px solid var(--line); transition: width var(--t-slow) var(--ease-out), opacity var(--t-slow); }
  .tabs-mobile { display: none; }
  .main { padding: 0 var(--gutter) 48px; max-width: 1208px; }
  .page-head { padding: var(--s5) 0 var(--s4); }
}
@media (min-width: 1240px) {
  .desk { grid-template-columns: minmax(520px, 1fr) var(--rail-w); gap: var(--s6); align-items: start; }
  .rail { position: sticky; top: 24px; }
}

/* the dim: everything but the Hour card steps back while an hour runs (and until the review closes) */
.app.dim .sidebar, .app.dim .rail, .app.dim .plan, .app.dim .page-head, .app.dim .slots { opacity: 0.45; transition: opacity var(--t-slow); }
.app.dim .sidebar:hover, .app.dim .sidebar:focus-within, .app.dim .rail:hover, .app.dim .rail:focus-within, .app.dim .plan:hover, .app.dim .plan:focus-within, .app.dim .page-head:hover, .app.dim .page-head:focus-within, .app.dim .slots:hover { opacity: 1; }
@media (min-width: 1100px) {
  .app.dim { grid-template-columns: 64px minmax(0, 1fr); }
  .app.dim .sidebar { padding-left: 8px; padding-right: 8px; }
  .app.dim .brand-name, .app.dim .nav .tab span, .app.dim .side-foot .year-line, .app.dim .side-name, .app.dim .sidebar .streak-chip span, .app.dim .side-foot .btn.small { display: none; }
  .app.dim .nav .tab { justify-content: center; padding: 0; }
  .app.dim .nav .tab[aria-current="page"]::before { display: none; }
}

/* ---------------------------------------------------------------- Today */
.day-head { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; min-height: 64px; margin-bottom: var(--s4); }
.day-head .date { font: 600 var(--fs-lg) var(--font-body); }
.day-head .stones { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; color: var(--ink-soft); font: 500 var(--fs-sm) var(--font-mono); }
.wake-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 4px 0 12px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); font-size: var(--fs-sm); }
.wake-chip input[type="time"] { width: 112px; min-height: 30px; padding: 2px 8px; border-radius: var(--r-pill); font-family: var(--font-mono); font-size: var(--fs-sm); }
.wake-chip .btn.small { min-height: 30px; }
.day-notice { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-bottom: var(--s4); font-size: var(--fs-sm); color: var(--ink-soft); }
.hour-card { padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); margin-bottom: var(--s5); display: grid; justify-items: center; gap: var(--s4); text-align: center; }
.hour-card.running { border-color: var(--accent); }
.hour-card .task-pick { width: 100%; max-width: 420px; }
.hour-card .task-title { color: var(--ink-soft); font-size: var(--fs-md); min-height: 24px; max-width: 48ch; }
.ring-stage { position: relative; width: 320px; height: 320px; display: grid; place-items: center; }
.ring-stage .ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-stage .digits { position: relative; font: 500 var(--fs-timer)/1 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.ring-stage .digits.accent { color: var(--accent); }
.state-line { font-size: var(--fs-sm); color: var(--ink-soft); min-height: 20px; }
.ends-line { font-size: var(--fs-sm); color: var(--ink-muted); }
.tally { display: grid; justify-items: center; gap: 6px; }
.tally-btn { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: 600 22px var(--font-mono); cursor: pointer; transition: transform var(--t-fast), background-color var(--t-fast); }
.tally-btn:hover { background: var(--accent-soft); }
.tally-btn:active { transform: scale(0.96); }
.tally .k { font-size: var(--fs-xs); color: var(--ink-muted); }
.stray { width: 100%; max-width: 520px; }
.stray textarea { min-height: 44px; resize: none; }
.hour-card .quiet-link { font-size: var(--fs-sm); }
.work-form { width: 100%; max-width: 560px; text-align: left; }
.work-form .head { font: 500 var(--fs-sm) var(--font-mono); color: var(--ink-soft); margin-bottom: var(--s2); }
.break-line { font: 500 var(--fs-lg) var(--font-mono); }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); margin-bottom: var(--s5); }
.slot { min-height: 72px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); display: grid; gap: 2px; align-content: start; font-size: var(--fs-sm); color: var(--ink-soft); }
.slot .n { font: 600 var(--fs-sm) var(--font-body); color: var(--ink); }
.slot .t { font-family: var(--font-mono); font-size: var(--fs-xs); }
.slot.done { background: var(--gold-soft); border-color: transparent; color: var(--ink); }
.slot.running { border-color: var(--accent); }
.slot.ghost { border-style: dashed; opacity: 0.7; }
.manual-link { margin: calc(-1 * var(--s3)) 0 var(--s5); font-size: var(--fs-sm); }
.plan { margin-bottom: var(--s5); }
.plan-row { display: grid; grid-template-columns: 28px 1fr auto auto 28px; align-items: center; gap: 10px; min-height: 48px; padding: 4px 8px; border-top: 1px solid var(--line); }
.plan-row:first-child { border-top: 0; }
.plan-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.plan-row .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; padding: 4px 0; min-height: 32px; color: var(--ink); font: inherit; width: 100%; }
.plan-row .title:focus-visible { outline-offset: 0; }
.plan-row.done .title { color: var(--ink-muted); text-decoration: line-through; }
.plan-row .spent { font: 500 var(--fs-xs) var(--font-mono); color: var(--ink-muted); }
.plan-row .drag { color: var(--ink-muted); cursor: grab; display: grid; place-items: center; }
.plan-row .drag svg { width: 18px; height: 18px; }
.plan-hint { font-size: var(--fs-xs); color: var(--ink-muted); padding: 0 8px 6px 46px; }
.plan-add { display: flex; gap: var(--s2); align-items: center; padding: 8px; border-top: 1px solid var(--line); }
.plan-add input { min-height: 36px; }
.plan-add input.count { width: 88px; }
.numbers-today .tbl th, .numbers-today .tbl td { height: 34px; padding: 0 6px; font-size: var(--fs-xs); }
.numbers-today .table-wrap { border: 0; border-radius: 0; margin: 0 -6px var(--s2); }
.rail .card { padding: 16px; }
.post-text { white-space: pre-wrap; font: 400 var(--fs-sm)/1.5 var(--font-mono); background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; margin: 0 0 var(--s3); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Numbers */
.rule-line { color: var(--ink-soft); font-size: var(--fs-sm); max-width: 72ch; }
.range { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.cell-hour { display: grid; gap: 1px; line-height: 1.2; padding: 6px 0; }
.cell-hour .t { font-family: var(--font-mono); font-size: var(--fs-sm); }
.cell-hour .d { font-size: var(--fs-xs); color: var(--ink-muted); font-family: var(--font-mono); }
.cell-hour .d.good { color: var(--good); } .cell-hour .d.warn { color: var(--warn); }
.cell-hour .e { font-size: var(--fs-xs); font-family: var(--font-mono); color: var(--ink-soft); }
.tbl td.has-hover { cursor: help; }
.strip { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: var(--s4); }
.strip i { flex: 1; display: block; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: 0.8; }
.strip i.gold { background: var(--gold); opacity: 1; }
.strip i.none { background: var(--surface-2); }
.tip { position: fixed; z-index: 70; max-width: 320px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--toast-bg); color: var(--toast-ink); font-size: var(--fs-xs); line-height: 1.4; pointer-events: none; }

/* ---------------------------------------------------------------- Calendar */
.cal-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.cal-head h2 { margin: 0; min-width: 160px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font: 500 var(--fs-xs) var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); text-align: center; padding-bottom: 4px; }
.cal-cell { position: relative; min-height: 96px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); display: grid; grid-template-rows: auto 1fr auto; justify-items: center; padding: 6px; cursor: pointer; font-size: var(--fs-xs); color: var(--ink-muted); transition: background-color var(--t-fast); }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell .d { justify-self: start; font-family: var(--font-mono); }
.cal-cell .ring { width: 22px; height: 22px; align-self: center; }
.cal-cell .c { font-family: var(--font-mono); }
.cal-cell .ring-space { height: 22px; }
.cal-cell.missed { background: var(--miss-tint); }
.cal-cell.rest .ring { display: none; }
.cal-cell.rest .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted); align-self: center; }
.cal-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-cell.other { opacity: 0.35; cursor: default; }
.cal-cell.future { cursor: default; }
@media (max-width: 639px) { .cal-grid { gap: 4px; } .cal-cell { min-height: 44px; padding: 3px; } .cal-cell .c { display: none; } }
.drawer-hours { display: grid; gap: var(--s2); }
.drawer-hour { display: grid; grid-template-columns: 64px 1fr; gap: var(--s3); padding: 8px 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.drawer-hour:first-child { border-top: 0; }
.drawer-hour .t { font-family: var(--font-mono); color: var(--ink-soft); }

/* ---------------------------------------------------------------- Board */
.strip7 { display: inline-flex; gap: 3px; }
.strip7 .ring { width: 10px; height: 10px; }
.feed { display: grid; gap: 0; }
.feed-row { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.feed-row:first-child { border-top: 0; }
.feed-row .t { font-family: var(--font-mono); color: var(--ink-soft); }

/* ---------------------------------------------------------------- Lists */
.lines { display: grid; }
.line-row { display: grid; grid-template-columns: 28px 1fr auto 28px; align-items: center; gap: 8px; min-height: 48px; border-top: 1px solid var(--line); }
.line-row:first-child { border-top: 0; }
.line-row .n { font: 500 var(--fs-xs) var(--font-mono); color: var(--ink-muted); text-align: center; }
.line-row input[type="text"] { border-color: transparent; background: transparent; padding-left: 4px; }
.line-row input[type="text"]:hover { border-color: var(--line); }
.line-row input[type="text"]:focus-visible { background: var(--surface); }
.line-row .drag { color: var(--ink-muted); cursor: grab; }
.line-row .drag svg { width: 18px; height: 18px; }
.cap-note { font-size: var(--fs-xs); color: var(--ink-muted); margin: var(--s2) 0; }
.vision-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.vision-slot { position: relative; aspect-ratio: 1; border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--ink-muted); font-size: var(--fs-xs); cursor: pointer; }
.vision-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vision-slot.filled { border-style: solid; }
.vision-slot .remove { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--scrim); color: #fff; cursor: pointer; display: grid; place-items: center; }
.vision-slot .remove svg { width: 14px; height: 14px; }
.vision-slot input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 639px) { .vision-grid { grid-template-columns: repeat(2, 1fr); } }
.horizon { font: 500 var(--fs-xs) var(--font-mono); color: var(--ink-muted); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px 8px; background: none; cursor: pointer; }

/* ---------------------------------------------------------------- Settings, Admin, Onboarding */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); margin-bottom: var(--s4); }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 12px 14px; }
.days7 { display: flex; gap: 6px; flex-wrap: wrap; }
.days7 button { min-width: 40px; min-height: 36px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-soft); font: 600 var(--fs-xs) var(--font-body); cursor: pointer; }
.days7 button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.onb { display: grid; gap: var(--s5); }
.onb-rail { display: grid; gap: 2px; }
.onb-step { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 8px; border-radius: var(--r-sm); color: var(--ink-soft); font-size: var(--fs-sm); border: 0; background: none; text-align: left; cursor: pointer; }
.onb-step .n { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font: 500 11px var(--font-mono); flex: none; }
.onb-step[aria-current="step"] { background: var(--accent-soft); color: var(--ink); }
.onb-step[aria-current="step"] .n { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.onb-step.done .n { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.onb-group { font: 500 var(--fs-xs) var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); padding: 10px 8px 2px; }
.onb-instr { padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; margin-bottom: var(--s4); }
@media (min-width: 960px) { .onb { grid-template-columns: 220px minmax(0, 1fr); align-items: start; } }
.sample { color: var(--ink-muted); font-style: italic; }

/* ---------------------------------------------------------------- overlays: sheets, the review */
.overlay-root { position: fixed; inset: 0; z-index: 50; background: var(--scrim); backdrop-filter: blur(6px); display: grid; place-items: center; padding: var(--gutter); overflow: auto; }
.sheet { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-float); max-height: calc(100vh - 32px); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; animation: rise var(--t-base) var(--ease-out); }
.sheet-sm { max-width: 440px; } .sheet-md { max-width: 640px; } .sheet-lg { max-width: 720px; } .sheet-xl { max-width: 960px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 16px 20px 0; }
.sheet-head h2 { margin: 0; }
.sheet-body { padding: 16px 20px; overflow: auto; }
.sheet-actions { display: flex; gap: var(--s2); justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.review { display: grid; gap: var(--s4); min-height: 360px; }
.review-strip { display: flex; align-items: center; gap: var(--s3); font: 500 var(--fs-xs) var(--font-mono); color: var(--ink-muted); }
.review-strip .bar { flex: 1; height: 2px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.review-strip .bar i { display: block; height: 100%; background: var(--accent); }
.review-card { display: grid; gap: var(--s3); align-content: start; }
.review-card h2 { font-size: var(--fs-lg); }
.review-nums { display: grid; gap: var(--s3); }
div.review-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { div.review-nums { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.review-nums .stat.good .v { color: var(--good); }
.review-day { display: flex; align-items: center; gap: var(--s4); }
.review-day .ring { width: 56px; height: 56px; }
.review-lines { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.review-reward { font-size: var(--fs-md); padding: 16px; border-radius: var(--r-md); background: var(--gold-soft); }
.review-nav { display: flex; justify-content: space-between; gap: var(--s2); align-items: center; }
.vision-view { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.vision-view img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); display: block; }
.ticklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ticklist li { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: var(--fs-sm); }
.ticklist input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.keys { display: grid; grid-template-columns: 72px 1fr; gap: 6px 12px; font-size: var(--fs-sm); }
.keys kbd { font: 500 var(--fs-xs) var(--font-mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 8px; background: var(--surface-2); }

/* ---------------------------------------------------------------- the pages on the system: helpers, tables, drawer, lists, onboarding */
.view { display: block; }
.boot-in { letter-spacing: 0.08em; }
.main-col { min-width: 0; }
.grow { flex: 1; }
.row-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-top: var(--s3); }
.inline-field { display: flex; gap: var(--s2); align-items: center; }
.inline-field input { flex: 1; min-width: 0; }
.small-field { max-width: 140px; }
.field { min-width: 0; }
.nav a.tab, .tabs-mobile a.tab { text-decoration: none; }
svg.flip { transform: scaleX(-1); }
.month-pick { width: auto; min-height: 36px; padding: 4px 10px; font-size: var(--fs-sm); }
input[type="month"] { min-height: 36px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 400 var(--fs-sm) var(--font-mono); }
.cap-note.over { color: var(--miss); }
.saved { font-size: var(--fs-xs); color: var(--good); white-space: nowrap; }
.empty .sample { margin: 0; }

/* Today, the pieces the views add */
.notices:empty { display: none; }
.work-form .field-row { grid-template-columns: 120px minmax(0, 1fr); align-items: start; }
.work-form .field-row textarea { min-height: 44px; }
.check-line { display: flex; align-items: center; gap: 10px; min-height: 40px; margin-top: var(--s2); font-size: var(--fs-sm); cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.count-box { display: grid; }
.stray-ta { font-size: var(--fs-sm); }
.hour-card.closed { gap: var(--s3); }
.hour-card.closed .post-text { width: 100%; max-width: 560px; text-align: left; }
.plan-list { display: grid; }
.chip-space { width: 0; }
.plan-row.dragging, .line-row.dragging { opacity: 0.5; }
.plan-row.drop, .line-row.drop { box-shadow: inset 0 2px 0 var(--accent); }
.streak-chip.big { font-size: var(--fs-md); color: var(--ink); gap: 10px; flex-wrap: wrap; }
.streak-chip.big .muted { font-size: var(--fs-sm); }
.avg7-line { margin: var(--s2) 0 0; }

/* tables: row headers read like cells; today's border, missed and pinned rows; the sticky own row on the board */
.tbl th[scope="row"] { position: static; background: none; font: 500 var(--fs-sm) var(--font-body); text-transform: none; letter-spacing: 0; color: var(--ink-soft); }
.tbl th[scope="row"].sticky { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.tbl tr.today > :first-child { box-shadow: inset 2px 0 0 var(--accent); }
.tbl tr.missed > th { background: linear-gradient(var(--miss-tint), var(--miss-tint)), var(--surface); }
.tbl tr.pinned > th { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.tbl td.good { color: var(--good); }
.tbl td.warn { color: var(--warn); }
.tbl.compact th, .tbl.compact td { height: 36px; padding: 0 8px; font-size: var(--fs-sm); }
.numbers-table th, .numbers-table td { height: auto; min-height: 48px; padding-top: 6px; padding-bottom: 6px; vertical-align: top; }
.numbers-table thead th { vertical-align: middle; height: 40px; }
.board-table { overflow: visible; }
.board-table tr.me > td { position: sticky; bottom: 0; z-index: 1; border-top: 1px solid var(--accent); }
.board-table .name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.host-note p { margin: 0; }

/* Calendar */
.cal-cell { font: inherit; color: var(--ink); width: 100%; cursor: pointer; }
.cal-cell:disabled { cursor: default; }
.cal-cell:disabled:hover { background: var(--surface); }
.cal-cell.missed:disabled:hover { background: var(--miss-tint); }
.cal-empty { margin-top: var(--s4); }
.big-stat { display: grid; gap: 2px; margin-bottom: var(--s3); }
.big-stat .v { font: 500 var(--fs-2xl)/1.1 var(--font-mono); font-variant-numeric: tabular-nums; }
.big-stat .k { color: var(--ink-soft); font-size: var(--fs-sm); }
.week-card .post-text { margin-bottom: var(--s3); }

/* the day drawer: a sheet docked on the right */
.overlay-root:has(.sheet-drawer) { place-items: stretch end; padding: 0; }
.sheet-drawer { max-width: 440px; height: 100vh; max-height: 100vh; border-radius: 0; border-width: 0 0 0 1px; animation: slide var(--t-base) var(--ease-out); }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.drawer-body { display: grid; gap: var(--s4); align-content: start; }
.drawer-note { display: grid; gap: 4px; }
.drawer-note p { margin: 0; }
.drawer-hour.stopped .t { color: var(--ink-muted); }

/* the day close */
.dayclose { display: grid; }
.dayclose h3 { margin: var(--s5) 0 var(--s2); }
.dayclose h3:first-child { margin-top: 0; }
.dayclose .tiles { margin-bottom: 0; }

/* Lists */
.scroll-x { overflow-x: auto; scrollbar-width: none; }
.tabs.scroll-x button { white-space: nowrap; }
.lines.card { padding: 4px 12px; }
.line-row { grid-template-columns: 24px 20px minmax(0, 1fr) auto 40px; }
.add-line { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.add-line input { flex: 1; min-width: 0; }
.add-line select { width: 120px; }
.vision-slot { cursor: pointer; }
.vision-slot:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.vision-slot.busy { opacity: 0.5; pointer-events: none; }

/* onboarding */
.onb-stage { min-height: 380px; }
.onb-phone { display: none; }
.method { display: grid; gap: var(--s4); justify-items: start; }
.method-ring, .method-ring .ring { width: 120px; height: 120px; }
.onb-lists h3 { margin: var(--s4) 0 var(--s2); }
.onb-lists h3:first-child { margin-top: 0; }
.onb-lists .sample { margin: 0 0 6px; }
.done-plain { grid-template-columns: 8px 1fr; }
.review-card-host { min-height: 240px; }
.notify-note { padding-bottom: var(--s2); }
@media (max-width: 959px) { .onb-rail, .onb .onb-group { display: none; } .onb-phone { display: block; color: var(--ink-muted); } }
@media (max-width: 639px) { .work-form .field-row { grid-template-columns: minmax(0, 1fr); } .sheet-drawer { max-width: 100%; } .line-row { grid-template-columns: 20px minmax(0, 1fr) auto 40px; } .line-row .drag { display: none; } }

/* ---------------------------------------------------------------- phone and tablet sizes */
@media (max-width: 1099px) {
  .ring-stage { width: 240px; height: 240px; }
  .ring-stage .digits { font-size: 64px; }
  .slots { grid-template-columns: repeat(2, 1fr); }
  .app.running-phone .hour-card { min-height: calc(100vh - 120px); }
}
@media (max-width: 639px) {
  .ring-stage .digits { font-size: 56px; }
  .page-titles h1 { font-size: var(--fs-lg); }
  .day-head .stones { margin-left: 0; }
}

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .ring.breathing { animation: none; }
  .ring .q-progress { transition: none; }
}
