/* Timono. Light first, dark by system setting or choice. */

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --surface-3: #e6e5e1;
  --ink: #1d1d1f;
  --ink-2: #55555a;
  --ink-3: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.15);
  --glass: rgba(245, 245, 243, 0.78);

  --accent: #2a78d6;
  --accent-fill: #256abf;
  --accent-ink: #1f63b8;
  --accent-soft: #e7f0fc;
  --on-accent: #ffffff;
  --danger: #c4372f;
  --danger-soft: #fcebea;
  --up: #0b7a35;
  --down: #b4471f;

  /* Day score scale: one hue, light to dark (sequential heatmap; every rated cell also shows its number).
     Text on each step: --b-*-ink. Checked for monotone lightness and step gaps. */
  --b-none: #ecebe7;
  --b-none-ink: #5f5f64;
  --b-struggling: #cde2fb;
  --b-low: #9ec5f4;
  --b-okay: #6da7ec;
  --b-good: #3987e5;
  --b-thriving: #1c5cab;
  --b-struggling-ink: #1d1d1f;
  --b-low-ink: #1d1d1f;
  --b-okay-ink: #1d1d1f;
  --b-good-ink: #0b0b0b;
  --b-thriving-ink: #ffffff;

  /* Area colours, fixed order (validated for colour-blind separation). */
  --c0: #2a78d6;
  --c1: #eb6834;
  --c2: #1baf7a;
  --c3: #eda100;
  --c4: #e87ba4;
  --c5: #008300;
  --c6: #6250d6;
  --c7: #e34948;

  --grid: #e8e7e2;
  --axis: #c3c2b7;

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 24px;
  --pill: 980px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);

  --top: 56px;
  --tabbar: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f11;
    --surface: #1c1c1e;
    --surface-2: #2a2a2d;
    --surface-3: #3a3a3d;
    --ink: #f5f5f7;
    --ink-2: #aeaeb2;
    --ink-3: #8e8e93;
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.17);
    --glass: rgba(15, 15, 17, 0.74);
    --accent: #3987e5;
    --accent-fill: #256abf;
    --accent-ink: #78aef0;
    --accent-soft: rgba(57, 135, 229, 0.17);
    --danger: #f06a60;
    --danger-soft: rgba(240, 106, 96, 0.14);
    --up: #3ec46d;
    --down: #f08a5d;
    --b-none: #2a2a2d;
    --b-none-ink: #a1a1a6;
    --b-struggling: #0d366b;
    --b-low: #184f95;
    --b-okay: #256abf;
    --b-good: #3987e5;
    --b-thriving: #9ec5f4;
    --b-struggling-ink: #ffffff;
    --b-low-ink: #ffffff;
    --b-okay-ink: #ffffff;
    --b-good-ink: #0b0b0b;
    --b-thriving-ink: #0b0b0b;
    --c0: #3987e5;
    --c1: #d95926;
    --c2: #199e70;
    --c3: #c98500;
    --c4: #d55181;
    --c5: #008300;
    --c6: #9085e9;
    --c7: #e66767;
    --grid: #2c2c2e;
    --axis: #48484a;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 16px 50px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f11;
  --surface: #1c1c1e;
  --surface-2: #2a2a2d;
  --surface-3: #3a3a3d;
  --ink: #f5f5f7;
  --ink-2: #aeaeb2;
  --ink-3: #8e8e93;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.17);
  --glass: rgba(15, 15, 17, 0.74);
  --accent: #3987e5;
  --accent-fill: #256abf;
  --accent-ink: #78aef0;
  --accent-soft: rgba(57, 135, 229, 0.17);
  --danger: #f06a60;
  --danger-soft: rgba(240, 106, 96, 0.14);
  --up: #3ec46d;
  --down: #f08a5d;
  --b-none: #2a2a2d;
  --b-none-ink: #a1a1a6;
  --b-struggling: #0d366b;
  --b-low: #184f95;
  --b-okay: #256abf;
  --b-good: #3987e5;
  --b-thriving: #9ec5f4;
  --b-struggling-ink: #ffffff;
  --b-low-ink: #ffffff;
  --b-okay-ink: #ffffff;
  --b-good-ink: #0b0b0b;
  --b-thriving-ink: #0b0b0b;
  --c0: #3987e5;
  --c1: #d95926;
  --c2: #199e70;
  --c3: #c98500;
  --c4: #d55181;
  --c5: #008300;
  --c6: #9085e9;
  --c7: #e66767;
  --grid: #2c2c2e;
  --axis: #48484a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 16px 50px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
/* Headings receive focus after navigation for screen readers; no ring needed. */
[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--pill);
  background: var(--ink); color: var(--bg); font-weight: 600;
}
.skip:focus { top: 10px; }
.icon { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- app frame ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top);
  display: flex; align-items: center; gap: 16px;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 650; font-size: 18px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--pill);
  color: var(--ink-2); font-size: 15px; font-weight: 500;
}
.topnav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sync-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-fill); color: #fff; font-weight: 650; font-size: 15px; border: 0;
}
.avatar.small { width: 28px; height: 28px; font-size: 13px; }

.tabbar { display: none; }

main {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px calc(72px + var(--tabbar) + var(--safe-b));
}
main.wide { max-width: 1040px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.foot {
  max-width: 1040px; margin: 0 auto; padding: 8px 20px calc(40px + var(--tabbar) + var(--safe-b));
  color: var(--ink-3); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center;
}
.foot a { color: var(--ink-2); }

@media (max-width: 759px) {
  :root { --top: 52px; --tabbar: 64px; }
  .topnav, .top-actions .when-wide { display: none; }
  main { padding: 18px 16px calc(40px + var(--tabbar) + var(--safe-b)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tabbar) + var(--safe-b));
    padding: 6px max(8px, env(safe-area-inset-left)) var(--safe-b) max(8px, env(safe-area-inset-right));
    background: var(--glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--ink-3); font-size: 11px; font-weight: 550; border-radius: 12px;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent-ink); }
}

/* ---------- type ---------- */
.page-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 22px; }
.eyebrow { color: var(--ink-2); font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.page-title { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.022em; }
.section-title { font-size: 21px; line-height: 1.25; font-weight: 700; letter-spacing: -0.012em; }
.section-hint { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
@media (max-width: 759px) { .page-title { font-size: 30px; } }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-1);
}
.card + .card, .card + .grid2, .grid2 + .card, .grid2 + .grid2 { margin-top: 16px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head > div { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid2 > .card { margin-top: 0; }
@media (max-width: 759px) {
  .card { padding: 18px; border-radius: var(--r); }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border-radius: var(--pill); border: 0;
  background: var(--surface-2); color: var(--ink);
  font-size: 15px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap;
  transition: background-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent-fill) 88%, #000); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; color: var(--accent-ink); padding: 0 12px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; transform: none; }
.btn .icon svg { width: 18px; height: 18px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: 0.3; background: transparent; }
.icon-btn.filled { background: var(--surface-2); }

.link-btn { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--surface-3); border-radius: 11px;
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 550;
}
.seg-btn[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg-btn:hover:not([aria-checked="true"]) { color: var(--ink); }

.field {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-size: 16px;
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.field::placeholder { color: var(--ink-3); }
.label { display: block; font-size: 14px; font-weight: 550; color: var(--ink-2); margin: 0 0 6px 2px; }
.pass-wrap { position: relative; }
.pass-wrap .field { padding-right: 52px; }
.pass-wrap .icon-btn { position: absolute; right: 4px; top: 4px; }
.form-error { color: var(--danger); font-size: 14px; min-height: 0; }
.form-note { color: var(--ink-2); font-size: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--pill);
  background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 550;
}
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- dialogs ---------- */
dialog.dlg {
  border: 0; padding: 0; margin: auto;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-2);
  animation: pop 0.2s ease-out;
}
dialog.dlg.wide { width: min(640px, calc(100vw - 32px)); }
dialog.dlg:focus { outline: none; box-shadow: var(--shadow-2); }
dialog.dlg::backdrop { background: rgba(0, 0, 0, 0.36); animation: fade 0.2s ease-out; }
dialog.dlg.closing { animation: popout 0.16s ease-in forwards; }
dialog.dlg.closing::backdrop { animation: fadeout 0.16s ease-in forwards; }
.dlg-inner { display: flex; flex-direction: column; max-height: inherit; }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 18px 14px 4px 22px; }
.dlg-head.bare { justify-content: flex-end; padding-bottom: 0; }
.dlg-title { flex: 1; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.dlg-body { padding: 8px 22px 22px; overflow: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; flex-wrap: wrap; }
.confirm-body p + p { margin-top: 10px; }
.confirm-body .field { margin-top: 10px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes popout { to { opacity: 0; transform: translateY(6px) scale(0.98); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }

@media (max-width: 759px) {
  dialog.dlg.sheet {
    width: 100%; max-width: none; max-height: calc(100dvh - 24px);
    margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding-bottom: var(--safe-b);
    animation: sheetup 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  dialog.dlg.sheet.closing { animation: sheetdown 0.18s ease-in forwards; }
  dialog.dlg.sheet .dlg-inner::before {
    content: ""; display: block; width: 38px; height: 5px; border-radius: 3px;
    background: var(--surface-3); margin: 8px auto 0;
  }
}
@keyframes sheetup { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetdown { to { transform: translateY(100%); } }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(20px + var(--tabbar) + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  width: min(520px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: var(--bg);
  font-size: 15px; box-shadow: var(--shadow-2);
  animation: rise 0.2s ease-out;
}
.toast.out { opacity: 0; transition: opacity 0.2s; }
.toast-act { border: 0; background: none; color: inherit; font-weight: 700; padding: 0; }

/* ---------- today / day editor ---------- */
.day-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 22px; }
.day-head .titles { flex: 1; min-width: 0; }
.day-nav { display: flex; align-items: center; gap: 2px; }
.day-editor { display: grid; gap: 16px; }

.welcome { background: var(--accent-soft); box-shadow: none; }
.welcome h2 { font-size: 21px; font-weight: 700; margin-bottom: 6px; }
.welcome p { color: var(--ink-2); }
.welcome .row { margin-top: 14px; flex-wrap: wrap; }

.rate-card .card-head { margin-bottom: 6px; }
.score-hero { display: flex; align-items: center; gap: 16px; }
.ring { width: 76px; height: 76px; flex: none; }
.ring .track { stroke: var(--surface-2); }
.ring text { font: 650 24px var(--font); fill: var(--ink); font-variant-numeric: tabular-nums; }
.score-hero .band-word { font-size: 17px; font-weight: 650; }
.score-hero .caption { color: var(--ink-2); font-size: 14px; }

.rates { display: grid; gap: 6px; margin-top: 14px; }
.rate {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px;
  padding: 10px 0 6px;
  border-top: 1px solid var(--line);
}
.rate:first-child { border-top: 0; }
.rate-name { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; }
.rate-hint { grid-column: 1 / -1; color: var(--ink-3); font-size: 13px; margin: -2px 0 0 18px; }
.rate-val { display: flex; align-items: center; gap: 4px; min-height: 30px; font-variant-numeric: tabular-nums; }
.rate-val .icon-btn[hidden] { display: inline-flex !important; visibility: hidden; }
.rate-val strong { font-size: 17px; font-weight: 650; min-width: 2ch; text-align: right; }
.rate-val .word { color: var(--ink-2); font-size: 13px; min-width: 5.6em; text-align: right; }
.rate-val .icon-btn { width: 30px; height: 30px; }
.rate-val .icon-btn svg { width: 16px; height: 16px; }
.rate .slider { grid-column: 1 / -1; }

.slider { position: relative; height: 44px; display: flex; align-items: center; }
.slider input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer;
  touch-action: pan-y;
  --pct: 50%;
  --col: var(--accent);
}
.slider input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(to right, var(--col) 0 var(--pct), var(--surface-3) var(--pct) 100%);
}
.slider input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--surface-3); }
.slider input[type="range"]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--col); }
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; margin-top: -10px; border-radius: 50%;
  background: #fff; border: 0;
  box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.12), 0 6px 13px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  transition: transform 0.12s;
}
.slider input[type="range"]::-moz-range-thumb {
  width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.12), 0 6px 13px rgba(0, 0, 0, 0.12);
}
.slider input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.08); }
.slider input[type="range"]:focus-visible { outline: none; box-shadow: none; }
.slider.unset:focus-within .unset-label { box-shadow: 0 0 0 3px var(--accent); color: var(--ink); }
.slider input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent), 0 6px 13px rgba(0, 0, 0, 0.12); }
.slider input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--accent); }
.slider.unset input[type="range"]::-webkit-slider-runnable-track {
  background: repeating-linear-gradient(90deg, var(--surface-3) 0 6px, transparent 6px 10px);
}
.slider.unset input[type="range"]::-moz-range-track { background: repeating-linear-gradient(90deg, var(--surface-3) 0 6px, transparent 6px 10px); }
.slider.unset input[type="range"]::-moz-range-progress { background: transparent; }
.slider.unset input[type="range"]::-webkit-slider-thumb { opacity: 0; }
.slider.unset input[type="range"]::-moz-range-thumb { opacity: 0; }
.slider .unset-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 3px 12px; border-radius: var(--pill);
  background: var(--surface); color: var(--ink-3); font-size: 13px; font-weight: 550;
  pointer-events: none; white-space: nowrap; box-shadow: 0 0 0 1px var(--line);
}
.slider:not(.unset) .unset-label { display: none; }
.scale-ticks { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 11px; margin-top: -6px; padding: 0 4px; grid-column: 1 / -1; }

.write-card { padding: 0; overflow: hidden; }
.write-top { padding: 22px 22px 0; }
.prompt { font-family: var(--font-serif); font-style: italic; font-size: 19px; line-height: 1.45; color: var(--ink); margin-top: 8px; }
.prompt-row { display: flex; align-items: flex-start; gap: 8px; }
.prompt-row .prompt { flex: 1; }
.note {
  display: block; width: 100%; min-height: 220px; resize: none; border: 0; outline: none;
  padding: 16px 22px 24px; background: transparent; color: var(--ink);
  font-family: var(--font-serif); font-size: 19px; line-height: 1.65;
  overflow: hidden;
}
.note::placeholder { color: var(--ink-3); }
.note:focus, .note:focus-visible { box-shadow: none; outline: none; }
.write-card:focus-within { box-shadow: var(--shadow-1), 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.write-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 22px; border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 13px;
}
.save-state { display: inline-flex; align-items: center; gap: 5px; }
.save-state .icon svg { width: 16px; height: 16px; }
.sit-line { color: var(--ink-2); font-size: 14px; text-align: center; padding: 6px 12px 0; }

.quote-card { text-align: center; padding: 28px 26px; background: transparent; box-shadow: none; }
.quote { font-family: var(--font-serif); font-size: 20px; line-height: 1.5; color: var(--ink); font-style: italic; max-width: 34em; margin: 0 auto; }
.quote-by { margin-top: 10px; color: var(--ink-2); font-size: 14px; letter-spacing: 0.02em; }

.future-note { text-align: center; padding: 48px 24px; color: var(--ink-2); }

/* ---------- calendar ---------- */
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-bar .page-title { margin-right: auto; }
.month-nav { display: flex; align-items: center; gap: 2px; }
.weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekdays { margin-bottom: 6px; }
.weekdays span { text-align: center; color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.cell {
  position: relative; border: 0; padding: 8px 9px; min-height: 86px;
  border-radius: 14px; text-align: left;
  background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--shadow-1);
  transition: transform 0.12s;
}
.cell:hover:not(:disabled) { transform: translateY(-1px); }
.cell .d { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cell .v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; align-self: flex-end; }
.cell .pen { position: absolute; top: 9px; right: 9px; opacity: 0.75; }
.cell .pen svg { width: 13px; height: 13px; }
/* Days from the neighbouring months: quiet, no score colour (their own month shows it). */
.cell.out { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); }
.cell.future { background: transparent; box-shadow: none; border: 1px dashed var(--line-2); color: var(--ink-3); }
.cell.today { box-shadow: 0 0 0 2px var(--accent), var(--shadow-1); }
.cell[data-band] { box-shadow: none; }
.cell.today[data-band] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
[data-band="struggling"] { background: var(--b-struggling); color: var(--b-struggling-ink); }
[data-band="low"] { background: var(--b-low); color: var(--b-low-ink); }
[data-band="okay"] { background: var(--b-okay); color: var(--b-okay-ink); }
[data-band="good"] { background: var(--b-good); color: var(--b-good-ink); }
[data-band="thriving"] { background: var(--b-thriving); color: var(--b-thriving-ink); }
[data-band="none"] { background: var(--b-none); color: var(--b-none-ink); }
@media (max-width: 759px) {
  .weekdays, .cal-grid { gap: 4px; }
  .cell { min-height: 0; aspect-ratio: 1 / 1.08; padding: 5px 6px; border-radius: 10px; }
  .cell .d { font-size: 13px; }
  .cell .v { font-size: 12px; }
  .cell .pen { top: 5px; right: 5px; }
  .cell .pen svg { width: 11px; height: 11px; }
}
@media (max-width: 380px) {
  .cell .v { font-size: 11px; }
}

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 14px; color: var(--ink-2); font-size: 13px; }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 14px; border-radius: 4px; }
.month-sum { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.month-sum p { flex: 1; min-width: 200px; color: var(--ink-2); }

.journal { display: grid; gap: 10px; }
.search { position: relative; margin-bottom: 14px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search .field { padding-left: 44px; border-radius: var(--pill); background: var(--surface); }
.entry {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: start;
  width: 100%; border: 0; text-align: left; padding: 16px 18px;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-1);
}
.entry:hover { background: color-mix(in srgb, var(--surface) 94%, var(--ink)); }
.entry .when { text-align: center; }
.entry .when .wd { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.entry .when .dn { font-size: 24px; font-weight: 650; line-height: 1.1; }
.entry .score-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); font-weight: 600; margin-bottom: 4px; }
.entry .excerpt, .moment .ex, .moment .dt { overflow-wrap: anywhere; min-width: 0; }
.entry .excerpt {
  font-family: var(--font-serif); font-size: 16px; line-height: 1.5; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-line;
}
.entry .excerpt.none { color: var(--ink-3); font-family: var(--font); font-size: 14px; }
.entry mark { background: color-mix(in srgb, var(--c3) 35%, transparent); color: inherit; border-radius: 3px; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty .icon { color: var(--ink-3); margin-bottom: 8px; }
.empty h3 { color: var(--ink); font-size: 19px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- insights ---------- */
.ins-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.period-nav { display: flex; align-items: center; gap: 4px; }
.period-label { font-size: 17px; font-weight: 650; min-width: 9em; text-align: center; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-1); min-width: 0; }
.tile .k { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.tile .v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-top: 4px; }
.tile .v small { font-size: 15px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-left: 4px; }
.tile .sub { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.tile.hero .v { font-size: 46px; }
.tile .bar { height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.tile .bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; font-size: 13px; }
.delta .icon svg { width: 14px; height: 14px; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--ink-2); }
@media (max-width: 899px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 599px) {
  .tiles { gap: 10px; }
  .tile { padding: 14px 14px; }
  .tile .v { font-size: 26px; }
  .tile.hero .v { font-size: 34px; }
  .tile .v small.unit { display: block; margin: 0; font-size: 13px; }
}

.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.facts li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; line-height: 1.45; }
.facts .icon { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); }
.facts .icon svg { width: 17px; height: 17px; }

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-wrap .ax { fill: var(--ink-3); font: 500 11px var(--font); font-variant-numeric: tabular-nums; }
.chart-wrap .grid { stroke: var(--grid); stroke-width: 1; }
.chart-wrap .base { stroke: var(--axis); stroke-width: 1; }
.chart-wrap .hit { fill: transparent; cursor: pointer; }
.chart-wrap .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.tip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 120px; padding: 8px 11px; border-radius: 10px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2);
  font-size: 13px; line-height: 1.35; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 12px));
}
.tip b { font-weight: 650; }
.tip .t-row { display: flex; align-items: center; gap: 6px; }
.tip .t-sub { color: var(--ink-2); }

.areas { display: grid; gap: 4px; }
.area {
  display: grid; grid-template-columns: minmax(110px, 1.1fr) 2fr 64px 76px; align-items: center; gap: 14px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.area:first-child { border-top: 0; }
.area .nm { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.area .nm .nm-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area .nm .tag { flex: none; font-size: 11px; color: var(--ink-3); font-weight: 500; }
.area .track { height: 10px; border-radius: 5px; background: var(--surface-2); position: relative; }
.area .fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; }
.area .prev { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); border-radius: 1px; }
.area .av { font-size: 18px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.area .dl { text-align: right; }
.area .spark { grid-column: 2 / 3; height: 26px; margin-top: -6px; }
@media (max-width: 599px) {
  .area { grid-template-columns: 1fr auto auto; gap: 6px 12px; }
  .area .track { grid-column: 1 / -1; grid-row: 2; }
  .area .spark { grid-column: 1 / -1; grid-row: 3; }
}

.mixbar { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; margin: 6px 0 14px; }
.mixbar span { display: block; height: 100%; min-width: 3px; }
.mix-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 14px; font-size: 14px; }
.mix-legend .item { display: flex; align-items: center; gap: 8px; }
.mix-legend .item b { margin-left: auto; font-variant-numeric: tabular-nums; }

.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 16px; }
.minis.one { grid-template-columns: minmax(0, 420px); justify-content: center; }
.mini h3 { margin: 0 0 6px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.mini h3 .link-btn { font-weight: 650; font-size: 13px; }
.mini .g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mini .g span, .mini .g button { aspect-ratio: 1; border-radius: 4px; border: 0; padding: 0; display: block; }
:where(.mini .g) :where(span, button) { background: var(--b-none); }
.mini .g button { cursor: pointer; }
.mini .g button:hover { outline: 2px solid var(--ink-3); outline-offset: 1px; }
.mini .wk { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 4px; color: var(--ink-3); font-size: 11px; font-weight: 600; text-align: center; }
.mini .g .blank { background: transparent; }
.mini .g .future { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.minis.one .g { gap: 5px; }
.minis.one .g button, .minis.one .g span { border-radius: 8px; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }

.moments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.moment {
  display: block; width: 100%; border: 0; text-align: left; padding: 16px 18px;
  border-radius: var(--r); background: var(--surface-2); color: var(--ink);
}
.moment:hover { background: var(--surface-3); }
.moment .k { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.moment .dt { font-size: 17px; font-weight: 650; margin: 2px 0 6px; display: flex; align-items: center; gap: 8px; }
.moment .ex { font-family: var(--font-serif); color: var(--ink-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 599px) { .moments { grid-template-columns: minmax(0, 1fr); } }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--ink-2); font-weight: 600; font-size: 13px; }
.data-table td.n, .data-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

/* ---------- you / settings ---------- */
.settings { display: grid; gap: 16px; }
.acct { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.acct .avatar { width: 48px; height: 48px; font-size: 20px; }
.acct .who { flex: 1; min-width: 180px; }
.acct .who strong { display: block; font-size: 17px; overflow-wrap: anywhere; }
.sync-line { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; margin-top: 14px; flex-wrap: wrap; }
.sync-line.warn { color: var(--down); }
.auth-buttons { display: grid; gap: 10px; margin-top: 16px; max-width: 380px; }
.list { border-radius: var(--r); background: var(--surface-2); overflow: hidden; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; min-height: 52px; }
.li + .li { border-top: 1px solid var(--line); }
.li .grow { flex: 1; min-width: 0; }
.list .faint { color: var(--ink-2); }
a.li { color: var(--ink); }
a.li:hover { text-decoration: none; background: var(--surface-3); }
a.li > .icon { color: var(--ink-2); }
.li input.inline {
  width: 100%; border: 0; background: transparent; padding: 6px 8px; margin-left: -8px; border-radius: 8px; font-weight: 600; font-size: 16px;
}
.li input.inline:focus { background: var(--surface); outline: none; box-shadow: var(--focus); }
.li .acts { display: flex; gap: 0; }
.li .acts .icon-btn { width: 36px; height: 36px; }
.li .acts .icon-btn svg { width: 18px; height: 18px; }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row .field { flex: 1; }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pref:first-of-type { border-top: 0; }
.pref .k { font-weight: 550; }
.btn-col { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-col .btn, .danger-zone .btn { white-space: normal; text-align: center; }
.danger-zone { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- auth ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.auth p, .confirm-body p { overflow-wrap: anywhere; }
.auth .sub { color: var(--ink-2); margin: -4px 0 6px; }
.btn.apple { background: #000; color: #fff; }
.btn.apple:hover { background: #1d1d1f; }
:root[data-theme="dark"] .btn.apple { background: #fff; color: #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.apple { background: #fff; color: #000; } }
.btn.google { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.google:hover { background: var(--surface-2); }
.btn.apple, .btn.google, .btn.email { min-height: 48px; font-size: 16px; }
.gsi-slot { min-height: 44px; display: flex; justify-content: center; }
.gsi-slot > div { width: 100%; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; margin: 4px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.auth form { display: grid; gap: 12px; }
.auth .links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.auth .legal { color: var(--ink-3); font-size: 12px; text-align: center; }
.auth .big-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- about ---------- */
.about { max-width: 640px; margin: 0 auto; }
.about .hero { text-align: center; padding: 18px 0 30px; }
.about .hero img { width: 84px; height: 84px; border-radius: 20px; box-shadow: var(--shadow-2); }
.about .hero h1 { font-size: 40px; font-weight: 700; letter-spacing: -0.025em; margin-top: 18px; }
.about .hero p { font-size: 21px; color: var(--ink-2); margin-top: 6px; }
.about .card p + p { margin-top: 12px; }
.about .card h2 { margin-bottom: 12px; }
.about .tagline { font-weight: 650; }
.about ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.about ul { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.about .card ul + p { margin-top: 12px; }
.about dl { margin: 0; display: grid; gap: 14px; }
.about dt { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.about dd { margin: 2px 0 0 18px; color: var(--ink-2); }
.about .cta { text-align: center; margin: 28px 0 8px; }

/* ---------- print & motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
@media (forced-colors: active) {
  .cell[data-band], .mixbar span, .area .fill { forced-color-adjust: none; }
}
@media print {
  .topbar, .tabbar, .foot, .toasts { display: none !important; }
  body { background: #fff; }
  .card, .tile { box-shadow: none; border: 1px solid #ddd; }
}
