/* Summit — Notion-like structure with Claude's warm paper, serif headings and clay accent. */

/* ---------- Tokens ---------- */
:root {
  --bg: #fbfaf8;
  --sidebar: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f4f3ef;
  --hover: rgba(55, 53, 47, .06);
  --active: rgba(55, 53, 47, .09);
  --border: rgba(55, 53, 47, .13);
  --border-soft: rgba(55, 53, 47, .08);
  --track: #ebe9e3;
  --text: #2f2d2a;
  --muted: #716f6a;
  --faint: #8e8b85;
  --ink: #2f2d2a;
  --ink-text: #ffffff;
  --accent: #b95c3d;
  --accent-soft: #f7ebe5;
  --on-accent: #ffffff;
  --danger: #d44c47;
  --warn: #b9821d;
  --ok: #448361;
  /* Text that sits on a filled status colour (generated themes get their own in themes.js). */
  --on-ok: #ffffff;
  --on-danger: #ffffff;
  --on-warn: #ffffff;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 15, 15, .04);
  --shadow-hover: 0 1px 2px rgba(15, 15, 15, .04), 0 6px 18px rgba(15, 15, 15, .07);
  --shadow-lg: 0 0 0 1px rgba(15, 15, 15, .05), 0 3px 6px rgba(15, 15, 15, .1), 0 9px 24px rgba(15, 15, 15, .2);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: ui-serif, "New York", Georgia, Cambria, "Times New Roman", serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #161615;
  --sidebar: #0f0f0e;
  --surface: #1e1e1c;
  --surface-2: #262624;
  --hover: rgba(255, 255, 255, .05);
  --active: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .1);
  --border-soft: rgba(255, 255, 255, .065);
  --track: #2e2e2b;
  --text: #ecebe5;
  --muted: #9d9a91;
  --faint: #716f69;
  --ink: #ecebe5;
  --ink-text: #141413;
  --accent: #d97757;
  --accent-soft: rgba(217, 119, 87, .16);
  --danger: #e5675f;
  --warn: #dba54a;
  --ok: #6aaa85;
  /* White on the clay accent needs it a shade deeper; the light greens/ambers take dark text. */
  --accent-btn: color-mix(in srgb, #d97757 88%, #000);
  --on-ok: #141413;
  --on-danger: #ffffff;
  --on-warn: #141413;
  --shadow: none;
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, .3);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .06), 0 9px 30px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
/* Ink / Ink Dark (colours in themes.js): Notion-style — one sans-serif font, bold titles, flatter and squarer. */
:root[data-theme="ink"], :root[data-theme="ink-dark"] {
  --serif: var(--sans);
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: none;
  --shadow-hover: 0 1px 3px rgba(15, 15, 15, .08);
}
:root[data-theme="ink"] h1, :root[data-theme="ink-dark"] h1 { font-weight: 700; letter-spacing: -.025em; }
:root[data-theme="ink"] .hero-name, :root[data-theme="ink-dark"] .hero-name,
:root[data-theme="ink"] .level-rank, :root[data-theme="ink-dark"] .level-rank { font-weight: 700; letter-spacing: -.02em; }
:root[data-theme="ink"] .coach-fab, :root[data-theme="ink-dark"] .coach-fab { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, a, [data-act], input, select, textarea, label { touch-action: manipulation; }
body.modal-open { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-family: var(--serif); font-size: 34px; font-weight: 500; letter-spacing: -.015em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 8px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.i { flex-shrink: 0; display: block; stroke-width: 1.8; }

.muted { color: var(--muted); }
.sm { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger { color: var(--danger); }
.faint { color: var(--faint); }
.warn { color: var(--warn); }
.accent { color: var(--accent); }
.pad { padding: 8px 4px; }
.hint { margin: 10px 2px 0; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 10px;
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 16px; font-weight: 600; font-size: 15px; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--ink); color: var(--ink-text); position: relative; }
.brand-mark::after { content: ""; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 14px;
}
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link.on { background: var(--active); color: var(--text); font-weight: 600; }
.nav-badge { margin-left: auto; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; line-height: 18px; }
.nav-badge.quiet { background: var(--active); color: var(--muted); }
.nav-more-toggle { width: 100%; border: 0; background: none; font: inherit; font-weight: 500; font-size: 14px; text-align: left; cursor: pointer; }
.nm-chev { display: grid; margin-left: auto; color: var(--faint); transition: transform .2s; transform: rotate(90deg); }
.nav-more-toggle.open .nm-chev { transform: rotate(-90deg); }
.nav-more-toggle .nav-dot { margin-left: 6px; }
.nav-more { display: flex; flex-direction: column; gap: 1px; padding-left: 12px; }
.section.first { margin-top: 0; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }

.main { flex: 1; min-width: 0; padding: 48px 56px 96px; }
.page { max-width: 980px; margin: 0 auto; }
.page.narrow { max-width: 740px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.head-actions { align-items: center; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.head-actions { display: flex; gap: 8px; }

/* minmax(0, …) stops long one-line text (e.g. notes) from stretching a column past the screen */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; align-items: start; }
/* Ask Summit (coach.js) */
/* The ✨ button: bottom-right on a laptop, bottom-left on a phone (the ＋ sits on the right there) */
.coach-fab-wrap { position: fixed; right: 24px; bottom: 24px; z-index: 32; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
body.modal-open .coach-fab-wrap, body.cal-full .coach-fab-wrap { display: none; }
.coach-fab {
  width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; font-size: 23px;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 70%, #000));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 6px rgba(0, 0, 0, .2);
  transition: transform .25s cubic-bezier(.2, 1.4, .4, 1);
}
.coach-fab:hover { transform: scale(1.06); }
.coach-fab:active { transform: scale(.94); }
.coach-fab-wrap.open .coach-fab { transform: rotate(-20deg) scale(1.05); }
.coach-menu { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.cm-item {
  display: flex; align-items: center; gap: 12px; width: 270px; padding: 11px 14px; border-radius: 16px; cursor: pointer; text-align: left;
  background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border); color: var(--text); font: inherit;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(12px) scale(.95); transition: opacity .18s ease, transform .25s cubic-bezier(.2, 1.3, .4, 1);
}
.cm-item:hover { border-color: var(--accent); }
.coach-fab-wrap.open .coach-menu { pointer-events: auto; }
.coach-fab-wrap.open .cm-item { opacity: 1; transform: none; }
.coach-fab-wrap.open .cm-item:nth-child(1) { transition-delay: 40ms; }
.cm-ic { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; font-size: 19px; background: var(--accent-soft); }
.cm-txt { display: flex; flex-direction: column; min-width: 0; }
.cm-txt b { font-size: 15px; }
.cm-txt small { font-size: 12.5px; color: var(--muted); }
.ask-modal textarea { width: 100%; resize: vertical; min-height: 84px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; line-height: 1.45; outline: none; }
.ask-modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.ask-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ask-ex { padding: 6px 11px; border-radius: 99px; border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.ask-ex:hover { color: var(--text); border-color: var(--accent); }
@media (min-width: 761px) {
  /* Keep corner cards clear of the ✨ button */
  #cheer-stack, #coach-added { bottom: 92px; }
}
@media (max-width: 760px) {
  .coach-fab-wrap { right: auto; left: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); align-items: flex-start; }
  .coach-menu { align-items: flex-start; }
  .cm-item { width: min(290px, calc(100vw - 32px)); }
  #coach-added { bottom: calc(142px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .coach-fab, .cm-item { transition: none; } }

/* The goal behind a task or habit, right above its title */
.goal-ribbon {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; margin-bottom: 3px; padding: 1px 8px 1px 3px;
  border-radius: 99px; font-size: 11.5px; font-weight: 650; line-height: 1.6; cursor: pointer;
  color: color-mix(in srgb, var(--c) 78%, var(--text)); background: color-mix(in srgb, var(--c) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); transition: background .15s;
}
.goal-ribbon:hover { background: color-mix(in srgb, var(--c) 22%, transparent); }
.gr-icon { width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; background: color-mix(in srgb, var(--c) 20%, var(--surface)); flex-shrink: 0; }
.gr-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.item.task.done .goal-ribbon { opacity: .55; }
.ht-name .item-body { display: flex; flex-direction: column; align-items: flex-start; }
.hc-text { align-items: flex-start; }
/* "Why this matters": on a task's dialog and a habit's page */
.why-banner {
  display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; cursor: pointer;
  background: linear-gradient(105deg, color-mix(in srgb, var(--c) 14%, var(--surface)), color-mix(in srgb, var(--c) 4%, var(--surface)) 70%);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border-soft)); transition: border-color .15s;
}
.why-banner:hover { border-color: color-mix(in srgb, var(--c) 60%, var(--border-soft)); }
.wb-icon { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; font-size: 22px; background: color-mix(in srgb, var(--c) 20%, var(--surface-2)); }
.wb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wb-kicker { font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: color-mix(in srgb, var(--c) 80%, var(--text)); }
.wb-goal { font-size: 14.5px; font-weight: 650; line-height: 1.3; }
.wb-why { font-size: 13px; color: var(--muted); font-style: italic; line-height: 1.4; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wb-go { color: var(--faint); display: grid; flex-shrink: 0; }

/* ---------- Today: minimal header, small XP line, compact goals ---------- */
.today-head { margin-bottom: 28px; }
.th-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.th-row h1 { font-size: 30px; }
.dot-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.today-head .day-progress-wrap { margin-top: 16px; }
.day-line { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.dl-text b { color: var(--text); font-weight: 600; }
.dl-bar { display: block; height: 4px; border-radius: 99px; background: var(--track); overflow: hidden; }
.dl-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.day-line:hover .dl-text, .day-line.open .dl-text { color: var(--text); }
.today-head .day-sheet { left: 0; right: auto; transform-origin: top left; }

.today-insights { margin-top: 10px; }
.today-insights > * { min-width: 0; }
.xp-strip { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 2px; border: 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); background: none; color: var(--muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.xp-strip:hover { color: var(--text); }
.xs-num b { font-size: 20px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; margin-right: 2px; }
.xs-spark { flex-shrink: 0; overflow: visible; }
.xs-line { fill: none; stroke: var(--faint); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.xs-usual { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; }
.xs-dot { fill: var(--text); }
.xs-note { margin-left: auto; text-align: right; }

.focus-goals { display: flex; flex-direction: column; }
.fg-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 10px; color: var(--text); cursor: pointer; -webkit-touch-callout: none; }
.fg-row:hover { background: var(--hover); }
.fg-row > .drag-handle { margin: 0 -6px; }
.fg-row:hover > .drag-handle { opacity: 1; }
.fg-row.dragging { background: var(--surface); box-shadow: 0 12px 28px rgba(0, 0, 0, .28); position: relative; z-index: 5; }
.fg-icon { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; font-size: 18px; background: var(--surface-2); }
.fg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fg-title { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.fg-bar { display: flex; align-items: center; gap: 10px; }
.fg-bar .bar { flex: 1; height: 4px; }
.fg-bar b { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.fg-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-meta:empty { display: none; }

/* Daily reflection: a slim, quiet bar at the very bottom */
.reflect-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; margin-top: 30px; padding: 12px 14px 12px 18px;
  border-radius: 14px; border: 0; background: var(--surface-2); color: var(--text); font: inherit; text-align: left;
}
.rb-q { flex: 1; min-width: 160px; font-size: 14px; color: var(--muted); }
.rb-moods { display: flex; gap: 2px; }
.rb-btn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 22px; cursor: pointer; transition: transform .15s, background .15s; }
.rb-btn:hover { background: var(--hover); transform: scale(1.1); }
.reflect-bar.done { cursor: pointer; flex-wrap: nowrap; }
.rb-mood { font-size: 24px; }
.rb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rb-text b { font-size: 13px; }
.rb-text span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-go { color: var(--faint); display: grid; }
@media (max-width: 760px) {
  .th-row h1 { font-size: 26px; }
  .today-head { margin-bottom: 20px; }
  .today-head .day-sheet { left: 0; right: 0; }
  .xp-strip { gap: 12px; }
  .xs-note { font-size: 12.5px; }
  .reflect-bar:not(.done) { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px; }
  .rb-moods { justify-content: space-between; }
  .rb-btn { width: 48px; height: 44px; font-size: 24px; }
}
.coach-modal .modal-head h3 { display: flex; align-items: center; gap: 6px; }
.coach-said { margin: -4px 0 12px; padding: 8px 12px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--surface-2); color: var(--muted); font-style: italic; font-size: 13.5px; }
.coach-loading { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 10px 30px; text-align: center; }
.coach-orb { width: 46px; height: 46px; border-radius: 50%; margin-bottom: 6px; background: conic-gradient(from 0deg, var(--accent), #cb912f, #9065b0, var(--accent)); animation: orb-spin 1.6s linear infinite; -webkit-mask: radial-gradient(circle, transparent 52%, #000 54%); mask: radial-gradient(circle, transparent 52%, #000 54%); }
@keyframes orb-spin { to { transform: rotate(360deg); } }
.coach-error { padding: 10px 0 4px; }
.coach-error p { margin: 0 0 12px; }
.coach-reply { margin: 0 0 14px; font-size: 15px; line-height: 1.5; }
.coach-label { margin: 14px 2px 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.coach-items { display: flex; flex-direction: column; gap: 8px; }
.coach-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: opacity .15s, border-color .15s; animation: ds-in .35s cubic-bezier(.2, .8, .2, 1) backwards; }
.coach-item:nth-child(2) { animation-delay: 60ms; } .coach-item:nth-child(3) { animation-delay: 120ms; } .coach-item:nth-child(n+4) { animation-delay: 180ms; }
.coach-item:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.coach-item.off { opacity: .5; }
.coach-item > input[type=checkbox] { margin-top: 4px; accent-color: var(--accent); width: 17px; height: 17px; flex-shrink: 0; }
.ci-icon { font-size: 24px; line-height: 1; margin-top: 2px; }
.ci-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ci-kind { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ci-title { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; font-weight: 650; padding: 2px 0; border-bottom: 1px dashed transparent; width: 100%; }
.ci-title:hover, .ci-title:focus { border-bottom-color: var(--border); outline: none; }
.ci-meta { font-size: 12.5px; color: var(--muted); }
.ci-notes { font-size: 12.5px; color: var(--muted); font-style: italic; }
.ci-subs { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.coach-mem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, #9065b0 10%, var(--surface-2)); margin-bottom: 6px; font-size: 13.5px; cursor: pointer; }
.coach-mem.off { opacity: .5; }
.coach-mem input { accent-color: #9065b0; flex-shrink: 0; }
.coach-sugg { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.cs-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; line-height: 1.45; }
.cs-dot { color: var(--accent); }
.cs-hint { font-size: 11.5px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
/* ---------- Habits page views: Week / Cards / Grid, and the month calendar ---------- */
.habit-views { margin: -6px 0 16px; }
.habit-views .seg-btn { display: inline-flex; align-items: center; gap: 6px; }
.color-opt.auto span { background: conic-gradient(#3ecf8e, #38bdf8, #a78bfa, #f472b6, #fb923c, #fbbf24, #3ecf8e); }
/* Day states, shared by the card heatmaps and the month tiles */
.hc-cells i, .hk-month i { display: block; aspect-ratio: 1; border-radius: 3px; background: color-mix(in srgb, var(--c) 13%, var(--surface-2)); }
.hc-cells i.on, .hk-month i.on { background: var(--c); }
.hc-cells i.part, .hk-month i.part { background: color-mix(in srgb, var(--c) 50%, var(--surface-2)); }
.hc-cells i.rest, .hk-month i.rest { background: color-mix(in srgb, var(--c) 6%, var(--surface-2)); }
.hc-cells i.skip, .hk-month i.skip { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent); }
.hc-cells i.before, .hk-month i.before { background: color-mix(in srgb, var(--text) 4%, transparent); }
.hc-cells i.future, .hk-month i.future { background: color-mix(in srgb, var(--c) 6%, transparent); opacity: .5; }
.hk-month i.blank { visibility: hidden; }
.hc-cells i.today, .hk-month i.today { box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px var(--text); }
/* Cards */
/* Laptop: cards sit side by side so each heatmap stays compact. Phone: one per row (see the media query). */
.hcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; align-items: start; }
@media (min-width: 761px) {
  .hcard { padding: 14px; border-radius: 16px; }
  .hc-top { gap: 10px; margin-bottom: 12px; }
  .hc-icon { width: 40px; height: 40px; border-radius: 11px; font-size: 21px; }
  .hc-text b { font-size: 15px; }
  .hc-text > span { font-size: 12.5px; }
  .hc-check.lg { width: 42px; height: 42px; border-radius: 13px; }
  .hc-check.lg.ring { border-radius: 50%; }
  .hc-chips { margin-top: 12px; gap: 6px; }
  .hc-chip { padding: 4px 9px; font-size: 12px; }
  .hc-cells, .hc-wd { gap: 2.5px; }
}
.hcard {
  padding: 16px; border-radius: 18px; cursor: pointer; -webkit-touch-callout: none;
  background: linear-gradient(165deg, color-mix(in srgb, var(--c) 9%, var(--surface)), var(--surface) 55%);
  border: 1px solid color-mix(in srgb, var(--c) 20%, var(--border-soft)); transition: border-color .15s, box-shadow .15s;
}
.hcard:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--border-soft)); }
.hcard.dragging { box-shadow: 0 16px 36px rgba(0, 0, 0, .3); }
.hc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hc-icon { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 13px; font-size: 24px; background: color-mix(in srgb, var(--c) 20%, var(--surface-2)); }
.hc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hc-text b { font-size: 16.5px; line-height: 1.25; overflow-wrap: anywhere; }
.hc-text > span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.hc-check {
  flex-shrink: 0; position: relative; display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--c) 35%, var(--border)); background: color-mix(in srgb, var(--c) 8%, var(--surface-2));
  color: color-mix(in srgb, var(--c) 65%, var(--muted)); transition: background .15s, transform .12s, color .15s;
}
.hc-check:active { transform: scale(.9); }
.hc-check.lg { width: 50px; height: 50px; border-radius: 15px; }
.hc-check.sm { width: 32px; height: 32px; border-radius: 50%; }
.hc-check.on { background: var(--c); border-color: var(--c); color: color-mix(in srgb, var(--c) 18%, #000); }
.hc-check.skip { border-style: dashed; background: transparent; }
.hc-check.ring { border: 0; border-radius: 50%; background: conic-gradient(var(--c) var(--p), color-mix(in srgb, var(--c) 16%, var(--surface-2)) 0); }
.hc-check.ring::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.hc-check.sm.ring::before { inset: 3px; }
.hc-check.ring.on::before { background: var(--c); }
.hc-check svg, .hc-emoji { position: relative; }
.hc-emoji { font-size: 15px; line-height: 1; }
.hc-heat { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 6px; row-gap: 5px; }
.hc-months { grid-column: 2; display: grid; grid-template-columns: repeat(var(--weeks), minmax(0, 1fr)); font-size: 10.5px; color: var(--faint); }
.hc-months span { white-space: nowrap; }
.hc-wd { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(7, minmax(0, 1fr)); gap: 3px; font-size: 10px; color: var(--faint); }
.hc-wd span { display: flex; align-items: center; }
.hc-cells { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(var(--weeks), minmax(0, 1fr)); grid-template-rows: repeat(7, auto); grid-auto-flow: column; gap: 3px; }
.hc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hc-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--c) 70%, var(--text)); background: color-mix(in srgb, var(--c) 14%, var(--surface-2)); }
/* Grid tiles */
.hk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.hk-tile { padding: 10px; border-radius: 16px; cursor: pointer; background: var(--surface); border: 1px solid color-mix(in srgb, var(--c) 14%, var(--border-soft)); transition: border-color .15s; }
.hk-tile:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--border-soft)); }
.hk-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-width: 0; }
.hk-icon { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--c) 18%, var(--surface-2)); }
.hk-text { display: flex; flex-direction: column; min-width: 0; }
.hk-text b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hk-text span { font-size: 11px; color: var(--muted); }
.hk-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
/* Month calendar on a habit's page */
.month-cal { padding: 14px 12px 10px; }
.mcal-head, .mc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mcal-head span { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.mc-day { position: relative; aspect-ratio: 1; max-height: 54px; width: 100%; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; font-size: 15px; font-variant-numeric: tabular-nums; cursor: pointer; transition: background .15s; }
button.mc-day:hover { background: var(--hover); }
.mc-day i { position: absolute; bottom: 6px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; }
.mc-day.on { background: color-mix(in srgb, var(--c) 24%, var(--surface-2)); }
.mc-day.on i { background: var(--c); }
.mc-day.part { background: color-mix(in srgb, var(--c) 11%, var(--surface-2)); }
.mc-day.part i { background: color-mix(in srgb, var(--c) 60%, transparent); }
.mc-day.skip { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent); }
.mc-day.rest > span { color: var(--muted); }
.mc-day.today { box-shadow: inset 0 0 0 2px var(--c); font-weight: 700; }
.mc-day.future, .mc-day.before { color: var(--faint); opacity: .55; cursor: default; }
.mc-day.blank { visibility: hidden; }
.mc-nav { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.mc-nav .icon-btn:disabled { opacity: .3; cursor: default; }
@media (max-width: 760px) {
  .habit-views { margin: 0 0 14px; }
  .hcards { grid-template-columns: minmax(0, 1fr); }
  .hcard { padding: 14px; }
  .hc-text b { font-size: 16px; }
  .hk-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .hk-tile { padding: 8px; border-radius: 14px; }
  .hk-top { gap: 6px; margin-bottom: 8px; }
  .hk-top .hc-check.sm, .hk-icon { width: 28px; height: 28px; }
  .hk-top .hc-emoji { font-size: 13px; }
  .hk-text b { font-size: 12.5px; }
  .hk-text span { font-size: 10px; }
  .hk-month { gap: 2.5px; }
  /* Few habits: 2 per row, with bigger buttons and dots */
  .hk-grid.roomy { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hk-grid.roomy .hk-tile { padding: 12px; border-radius: 16px; }
  .hk-grid.roomy .hk-top { gap: 9px; margin-bottom: 12px; }
  .hk-grid.roomy .hk-top .hc-check.sm, .hk-grid.roomy .hk-icon { width: 40px; height: 40px; }
  .hk-grid.roomy .hc-emoji { font-size: 19px; }
  .hk-grid.roomy .hk-text b { font-size: 14.5px; }
  .hk-grid.roomy .hk-text span { font-size: 11.5px; }
  .hk-grid.roomy .hk-month { gap: 4px; }
  .hk-grid.roomy .hk-month i { border-radius: 4px; }
  .mcal-head, .mc-grid { gap: 4px; }
  .mc-day { border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) { .hc-check, .hcard { transition: none; } }

/* "Added by Summit": what the coach just created, one tap away */
#coach-added {
  position: fixed; right: 20px; bottom: 20px; z-index: 62; width: 320px; max-width: calc(100vw - 24px);
  border-radius: 16px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .3); animation: cheer-in .45s cubic-bezier(.2, 1.2, .3, 1) both; overflow: hidden;
}
#coach-added.out { animation: cheer-out .25s ease forwards; }
.ca-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 14px; }
.ca-head b { font-size: 14px; }
.ca-head .icon-btn { margin-left: auto; }
.ca-list { display: flex; flex-direction: column; padding: 0 6px; max-height: 260px; overflow-y: auto; }
.ca-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ca-row:hover, .ca-row.on { background: var(--hover); }
.ca-row.on .ca-go { color: var(--accent); }
.ca-icon { font-size: 20px; width: 26px; text-align: center; flex-shrink: 0; }
.ca-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ca-kind { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ca-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-go { color: var(--faint); display: grid; }
.ca-foot { display: flex; justify-content: flex-end; padding: 4px 8px 8px; border-top: 1px solid var(--border-soft); margin-top: 4px; }
/* The item you jumped to glows for a moment */
.flash { animation: flash-glow 2.2s ease-out; position: relative; z-index: 1; }
@keyframes flash-glow {
  0%, 30% { box-shadow: 0 0 0 3px var(--accent), 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent); background-color: color-mix(in srgb, var(--accent) 12%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (max-width: 760px) {
  #coach-added { left: 12px; right: 12px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { #coach-added, .flash { animation: none; } .flash { outline: 3px solid var(--accent); } }

.mem-list { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.mem-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.mem-add { margin-top: 6px; }
@media (max-width: 760px) {
  .ask-bar { margin: 0 0 18px; padding-left: 12px; }
  .ask-bar input { font-size: 16px; }
  .ci-title { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .coach-orb, .coach-item { animation: none; } }

/* Tomorrow page: today's unfinished focus that will carry over, and Today's link to tomorrow's plan */
.carry { margin-top: 14px; }
.carry-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 2px 6px; }
.carry .list { opacity: .7; }
.planned-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); }
.planned-note:hover { filter: brightness(1.1); }
/* Today: extras sit together in one row at the bottom (three across on wide screens) */
.today-bottom { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; align-items: start; margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.today-bottom > * { min-width: 0; }
@media (max-width: 1180px) { .today-bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .today-bottom { grid-template-columns: minmax(0, 1fr); } }
.cols > *, .section, .list, .item-body { min-width: 0; }
.page { min-width: 0; }
.section { margin-top: 30px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; min-height: 28px; }
.section-head h2 { font-size: 15px; font-weight: 600; color: var(--text); }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar.end { justify-content: flex-end; }

.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--sidebar) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-soft);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 11px; font-weight: 500; color: var(--faint); }
.tab.on { color: var(--text); font-weight: 600; }

/* ---------- Cards, buttons, chips ---------- */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 550; font-size: 14px; white-space: nowrap;
  box-shadow: 0 1px 1px rgba(15, 15, 15, .03);
  transition: background .12s, opacity .12s, transform .05s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.btn.primary:hover { opacity: .86; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.danger:not(.ghost) { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn.sm { padding: 4px 9px; font-size: 13px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.link { color: var(--muted); font-size: 13px; font-weight: 500; }
.link-btn.link { color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; }
.link-btn.link:hover { color: var(--text); }
.link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--text); font-weight: 600; font-size: inherit; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.link-btn:hover { text-decoration-color: currentColor; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: transparent; border: 0; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.subtle { width: 26px; height: 26px; opacity: .5; }
.icon-btn.subtle:hover { opacity: 1; }
.icon-btn.star.on { color: var(--accent); }
.icon-btn.star.on svg { fill: currentColor; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px; border-radius: 4px;
  font-size: 12.5px; font-weight: 500;
  background: color-mix(in srgb, var(--c, var(--muted)) 15%, var(--surface));
  color: color-mix(in srgb, var(--c, var(--muted)) 72%, var(--text));
}
.chip.plain { background: var(--surface-2); color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
}
.badge.ok, .badge.pace-ahead { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--ok); }
.badge.pace-close { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); color: var(--warn); }
.badge.pace-behind { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: var(--danger); }
.count { font-size: 12px; color: var(--faint); font-weight: 500; margin-left: 2px; }

/* Segmented control (forms, settings) */
.seg { display: inline-flex; background: var(--surface-2); padding: 2px; border-radius: 8px; gap: 2px; flex-wrap: wrap; }
.seg-btn { border: 0; background: transparent; padding: 4px 11px; border-radius: 6px; font-weight: 500; font-size: 14px; color: var(--muted); }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 15, 15, .08), 0 0 0 1px var(--border-soft); }
/* Page tabs look like Notion database views */
.toolbar .seg { background: transparent; padding: 0; border-radius: 0; gap: 4px; width: 100%; border-bottom: 1px solid var(--border-soft); }
.toolbar .seg-btn { border-radius: 6px 6px 0 0; padding: 6px 10px 8px; position: relative; }
.toolbar .seg-btn:hover { background: var(--hover); }
.toolbar .seg-btn.on { background: transparent; box-shadow: none; font-weight: 600; }
.toolbar .seg-btn.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-chip {
  border: 1px solid var(--border-soft); background: transparent;
  padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 500; color: var(--muted);
}
.filter-chip:hover { background: var(--hover); color: var(--text); }
.filter-chip.on { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }

/* ---------- Progress ---------- */
.bar { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; flex: 1; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.ring { flex-shrink: 0; }
.ring circle { transition: stroke-dashoffset .5s ease; }
.ring text { fill: var(--text); font-family: var(--serif); font-weight: 500; }
.pct { font-size: 12.5px; font-weight: 600; color: var(--muted); min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Lists & items ---------- */
/* Quiet lists: no box around them, just hairlines between rows */
.list { display: flex; flex-direction: column; background: transparent; border: 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); border-radius: 0; overflow: hidden; }
.list:empty { display: none; }
.list.gap { gap: 10px; background: transparent; border: 0; border-radius: 0; overflow: visible; }
.item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  background: transparent;
  cursor: pointer; transition: background .12s;
}
.list > * + * { border-top: 1px solid var(--border-soft); }
.list.gap > * + * { border-top: 0; }
.item:hover { background: var(--hover); }
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 500; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.item-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.item.done .item-title { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--faint); }
.item.step { cursor: default; }
.item.step:hover { background: transparent; }

.check {
  --c: var(--ink);
  width: 20px; height: 20px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--c) 55%, var(--border));
  background: transparent; color: transparent; padding: 0;
  transition: background .12s, transform .1s;
}
.task .check, .step .check, .subtask .check { border-radius: 5px; }
.check:hover { background: color-mix(in srgb, var(--c) 10%, transparent); color: color-mix(in srgb, var(--c) 50%, transparent); }
.check.on { background: var(--c); border-color: var(--c); color: var(--ink-text); }
.check:not([style]).on { color: var(--ink-text); }
.check[style].on { color: #fff; }
.check:active { transform: scale(.88); }
.prio { display: inline-flex; }
.prio.p1 { color: #337ea9; }
.prio.p2 { color: var(--warn); }
.prio.p3 { color: var(--danger); }
.prio svg { fill: currentColor; }

/* Drag to reorder */
.drag-handle {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 16px; margin: -10px -6px -10px -8px; padding: 10px 0;
  color: var(--faint); cursor: grab; touch-action: none;
  opacity: 0; transition: opacity .15s, color .15s;
}
.drag-handle:hover { color: var(--text); }
.goal-mini .drag-handle { margin-right: -4px; }
.item:hover > .drag-handle, .subtask:hover > .drag-handle, .sub-row:hover > .drag-handle, .ht-row:hover .drag-handle,
.dragging .drag-handle, .drag-handle:focus-visible { opacity: 1; }
.ht-name .drag-handle { margin: 0 -6px 0 -4px; flex-shrink: 0; }
.habit-table .ht-row.dragging { background: var(--surface); box-shadow: 0 10px 24px rgba(0, 0, 0, .22); position: relative; z-index: 5; }
.habit-table .ht-row { -webkit-touch-callout: none; }
.list[data-drag-list="habits"] .item { -webkit-touch-callout: none; }
@media (hover: none) { .drag-handle { opacity: .5; } }
.subtask .drag-handle, .sub-row .drag-handle { margin: -6px -4px -6px -6px; padding: 6px 0; }
.list.drag-active, .subtasks.drag-active { overflow: visible; }
.drag-shift { transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
/* The item you're holding: lifted, with a soft shadow, following your finger instantly */
.dragging {
  position: relative; z-index: 30;
  background: var(--surface); border-radius: 10px; cursor: grabbing;
  scale: 1.02;
  box-shadow: 0 14px 32px rgba(15, 15, 15, .16), 0 2px 6px rgba(15, 15, 15, .08), 0 0 0 1px var(--border);
  transition: scale .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s;
}
[data-mode="dark"] .dragging { box-shadow: 0 14px 32px rgba(0, 0, 0, .55), 0 0 0 1px var(--border); }
.dragging .drag-handle { cursor: grabbing; color: var(--text); }
/* Letting go: glide into the slot and set down */
.drag-settle {
  position: relative; z-index: 30; background: var(--surface); border-radius: 10px;
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), scale .2s, box-shadow .2s;
}
.list > .dragging + *, .list > .drag-settle + *, .list > * + .dragging, .list > * + .drag-settle { border-top-color: transparent; }
body.is-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
[data-drag-group] [data-drag-id] { -webkit-touch-callout: none; }
.list[data-drag-sorted] .drag-handle { cursor: grab; }
body.is-dragging .item:hover { background: transparent; }
.done-list { margin-top: 8px; }

/* Today's focus */
.focus-section .section-head h2 { display: inline-flex; align-items: center; gap: 7px; }
.focus-section .section-head h2 .i { color: var(--accent); }
.focus-section .zone-focus { border-top-color: color-mix(in srgb, var(--accent) 45%, var(--border-soft)); }
.drop-zone {
  display: flex; align-items: center; gap: 10px; padding: 18px 16px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--radius);
  color: var(--muted); font-size: 14px; background: color-mix(in srgb, var(--accent) 4%, transparent);
  transition: background .15s, border-color .15s, transform .15s;
}
.drop-zone .i { color: var(--accent); flex-shrink: 0; }
.drop-zone.small { padding: 12px 14px; border-color: var(--border); background: transparent; font-size: 13.5px; }
.drop-target.drop-zone { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: var(--accent); transform: scale(1.01); }
.list.drop-target { box-shadow: 0 0 0 2px var(--accent); overflow: visible; }
.list > .drop-before { box-shadow: inset 0 3px 0 -1px var(--accent); }
.list.drop-end > [data-drag-id]:last-child { box-shadow: inset 0 -3px 0 -1px var(--accent); }
.drag-drop-away { opacity: 0; scale: .96; transition: opacity .14s, scale .14s !important; }
.focus-btn.add { color: var(--accent); opacity: .55; }
.focus-btn.add:hover { opacity: 1; background: var(--accent-soft); }
@media (hover: hover) { .item:not(:hover) > .focus-btn { opacity: 0; } }
.coming-up { margin-top: 10px; }
.coming-up > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 4px 8px; margin-bottom: 6px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.coming-up > summary::-webkit-details-marker { display: none; }
.coming-up > summary:hover { background: var(--hover); color: var(--text); }
.coming-up > summary .i { transition: transform .2s; }
.coming-up[open] > summary .i { transform: rotate(90deg); }

/* Task sort menu: a small pill with a native dropdown laid invisibly over it */
.list-tools { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
.sort-pick {
  position: relative; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer;
  max-width: 220px;
}
.sort-pick:hover { background: var(--hover); color: var(--text); }
.sort-pick.on { background: var(--accent-soft); color: var(--accent); }
.sort-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sort-pick select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; font-size: 16px; }
.section-head .head-btns { align-items: center; gap: 8px; }

/* Goal tree: sub-goals unfold inside cards and in the Outline view */
.goals-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.layout-seg .seg-btn { display: inline-flex; align-items: center; gap: 5px; }
.sub-toggle-chip { border: 0; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 500; }
.sub-toggle-chip:hover { background: var(--active); color: var(--text); }
.sub-toggle-chip .i, .tree-toggle .i { transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.sub-toggle-chip.open .i, .tree-toggle.open .i { transform: rotate(90deg); }
.card-tree { margin: 2px -8px 0; padding-top: 6px; border-top: 1px solid var(--border-soft); }
.tree-card { padding: 6px; }
.tree-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 6px 8px 6px calc(8px + var(--depth) * 22px); border-radius: 6px; cursor: pointer;
  animation: tree-in .22s cubic-bezier(.2, .8, .2, 1);
}
.tree-row:hover { background: var(--hover); }
.tree-card > .tree-row.top + .tree-row.top, .tree-card > .tree-kids + .tree-row.top { margin-top: 2px; border-top: 1px solid var(--border-soft); border-radius: 0 0 6px 6px; }
.tree-card .tree-row.top { padding-top: 9px; padding-bottom: 9px; }
.tree-card .tree-row.top .tree-title { font-weight: 600; font-size: 15px; }
.tree-kids { position: relative; }
/* thin guide line connecting a goal to its sub-goals */
.tree-kids::before { content: ""; position: absolute; top: 0; bottom: 6px; left: calc(19px + var(--line-depth, 0) * 22px); width: 1px; background: var(--border-soft); }
.tree-toggle {
  width: 22px; height: 22px; flex-shrink: 0; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 5px; background: transparent; color: var(--muted);
}
.tree-toggle:hover { background: var(--active); color: var(--text); }
.tree-spacer { width: 22px; flex-shrink: 0; }
.tree-emoji { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.tree-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row.done .tree-title { color: var(--faint); text-decoration: line-through; }
.tree-count { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 0 6px; border-radius: 99px; line-height: 17px; flex-shrink: 0; }
.tree-progress { width: 90px; flex-shrink: 0; display: flex; }
.tree-progress .bar { height: 5px; }
.tree-row .pct { min-width: 34px; font-size: 12px; }
@keyframes tree-in { from { opacity: 0; transform: translateY(-4px); } }
/* Inside a card there's less room: names wrap to two lines, the % stays, the bar goes */
.card-tree .tree-progress { display: none; }
.card-tree .tree-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; font-size: 13.5px; }
.card-tree .tree-row { align-items: flex-start; }
.card-tree .tree-row > :not(.tree-title) { margin-top: 1px; }
@media (max-width: 760px) {
  .tree-row { padding-left: calc(6px + var(--depth) * 16px); gap: 6px; }
  .tree-progress { width: 52px; }
  .tree-kids::before { left: calc(17px + var(--line-depth, 0) * 16px); }
}

/* Sub-goal linking */
.head-btns { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.part-of { text-decoration: none; }
.part-of:hover { color: var(--text); background: var(--active); }
.pick-list { max-height: 50vh; overflow-y: auto; margin-top: 12px; }
.item.pick { width: 100%; text-align: left; border: 0; font: inherit; color: inherit; }
.pick-add { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 8px; border-radius: 6px; flex-shrink: 0; }
.item.pick:hover .pick-add { background: var(--ink); color: var(--ink-text); }

/* Subtasks */
.sub-toggle {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  border: 0; background: transparent; padding: 3px 6px; border-radius: 5px;
  font-size: 12.5px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums;
}
.sub-toggle:hover { background: var(--hover); color: var(--text); }
.sub-toggle.all { color: var(--ok); }
.sub-toggle .i:last-child { transition: transform .15s; }
.sub-toggle.open .i:last-child { transform: rotate(90deg); }
.subtasks { padding: 0 12px 8px 43px; }
.subtask { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 14px; }
.subtask .check { width: 16px; height: 16px; border-width: 1.5px; }
.subtask .check .i { width: 11px; height: 11px; }
.subtask.done .subtask-title { color: var(--faint); text-decoration: line-through; }
/* Today's slice of a big task, and "Done for today" */
.subtask.in-slice { background: var(--accent-soft); border-radius: 6px; margin: 1px -8px; padding-left: 8px; padding-right: 4px; }
.subtask.in-slice .subtask-title { font-weight: 550; }
.subtask .subtask-title { flex: 1; min-width: 0; }
.slice-btn { width: 26px; height: 26px; color: var(--faint); opacity: .6; flex-shrink: 0; }
.slice-btn:hover { opacity: 1; color: var(--accent); }
.slice-btn.on { color: var(--accent); opacity: 1; }
.slice-hint { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 2px 0 6px; }
.slice-hint .i { color: var(--accent); }
.slice-tag { color: var(--accent); font-weight: 600; }
.pushed-tag { color: var(--muted); font-weight: 600; }
.pushed-tag.real { color: var(--ok); }
.icon-btn.day-done-btn { font-size: 17px; line-height: 1; color: var(--accent); opacity: .9; }
.day-done-btn:hover { background: var(--accent-soft); }
.pushed-list { margin-top: 8px; }
.item.pushed { opacity: .8; }
.item.pushed .item-title { color: var(--muted); }
.pushed-icon { width: 20px; text-align: center; font-size: 16px; color: var(--muted); flex-shrink: 0; }
.item.pushed.real .pushed-icon { color: var(--ok); }
.push-task { margin: 0 0 14px; }
.verdict-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.verdict { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.verdict:active { transform: scale(.98); }
.verdict b { display: block; font-size: 14.5px; }
.verdict small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.verdict .v-emoji { font-size: 26px; }
.verdict.real:hover { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.verdict.not:hover { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
@media (max-width: 760px) {
  .verdict-opts { grid-template-columns: 1fr; }
  .slice-btn { width: 34px; height: 34px; }
}

.subtask-add { display: flex; align-items: center; gap: 8px; padding: 4px 0 2px 1px; }
.subtask-add input[name=title] { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; padding: 2px 0; }
.subtask-add input::placeholder { color: var(--faint); }

.sub-edit { display: flex; flex-direction: column; }
.sub-row, .sub-new-row { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 6px; }
.sub-row:hover { background: var(--hover); }
.sub-check input { position: absolute; opacity: 0; pointer-events: none; }
.sub-check span { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 4px; border: 1.5px solid color-mix(in srgb, var(--ink) 55%, var(--border)); color: transparent; cursor: pointer; }
.sub-check input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.sub-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field .sub-title, .field .sub-new { flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 5px 2px !important; }
.sub-row:has(input[name=sub_done]:checked) .sub-title { color: var(--faint); text-decoration: line-through; }
/* Long subtask names wrap and the box grows to fit; the checkbox and buttons stay level with the first line */
.sub-row { align-items: flex-start; }
.sub-row > .sub-check, .sub-row > .icon-btn, .sub-row > .drag-handle { margin-top: 3px; }
.sub-row > .sub-check { margin-top: 8px; }
.field textarea.sub-title { resize: none; overflow: hidden; line-height: 1.45; min-height: 0; height: auto; overflow-wrap: anywhere; font: inherit; }
.sub-new-row { padding-left: 5px; }

.streak { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.habit-emoji { font-size: 19px; width: 26px; text-align: center; flex-shrink: 0; }

.group { margin-top: 22px; }
.group-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 2px 8px; display: flex; gap: 6px; align-items: baseline; }
.group-title.danger { color: var(--danger); }
.group-title .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }

.empty { text-align: center; padding: 52px 20px; border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.empty h3 { margin-bottom: 6px; font-family: var(--serif); font-size: 20px; font-weight: 500; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 16px; }
.empty-mini { padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); font-size: 14px; }

/* ---------- Quick add ---------- */
.quick-add {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 10px; margin-bottom: 10px;
  background: transparent; border: 1px solid var(--border-soft); border-radius: 8px;
  transition: background .12s, border-color .12s;
}
.quick-add:hover { background: var(--hover); }
.quick-add:focus-within { background: var(--surface); border-color: var(--border); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.qa-icon { color: var(--faint); display: flex; }
.quick-add input[name=title] { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 5px 0; }
.quick-add input::placeholder { color: var(--faint); }
.quick-add select { border: 0; background: var(--surface-2); border-radius: 6px; padding: 4px 8px; font-size: 13px; color: var(--muted); flex-shrink: 0; max-width: 40%; }
.quick-add .btn { flex-shrink: 0; }

/* ---------- Today ---------- */
.today-summary { display: flex; align-items: center; gap: 20px; }
.summary-title { font-family: var(--serif); font-size: 21px; font-weight: 500; margin-bottom: 2px; }
.welcome { display: flex; gap: 18px; align-items: flex-start; background: var(--surface-2); border-color: transparent; box-shadow: none; }
.welcome h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 6px; }
.welcome-art { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; background: var(--ink); color: var(--ink-text); flex-shrink: 0; position: relative; }
.welcome-art::after { content: ""; position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.prompt-card h3 { margin-bottom: 12px; font-family: var(--serif); font-size: 18px; font-weight: 500; }
.mood-picker { display: flex; gap: 6px; }
.mood-btn { flex: 1; border: 1px solid var(--border-soft); background: transparent; border-radius: 8px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .1s, background .12s; }
.mood-btn span { font-size: 22px; line-height: 1.2; }
.mood-btn small { font-size: 11px; color: var(--muted); font-weight: 500; }
.mood-btn:hover { background: var(--hover); transform: translateY(-2px); }

/* ---------- Goals ---------- */
/* align-items: start — each card keeps its own height, so unfolding one doesn't stretch its neighbours */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; align-items: start; }
.goal-card { cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s; }
.goal-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.goal-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.goal-emoji { width: 40px; height: 40px; display: grid; place-items: center; font-size: 30px; flex-shrink: 0; line-height: 1; }
.goal-emoji.sm { width: 28px; height: 28px; font-size: 20px; }
.goal-emoji.lg { width: 72px; height: 72px; font-size: 60px; }
.goal-title { font-size: 16px; font-weight: 600; }
.goal-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.goal-progress, .mini-progress { display: flex; align-items: center; gap: 10px; }
.mini-progress { margin-top: 6px; }
.mini-progress .bar { height: 4px; }
.goal-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.goal-foot > span:first-child { display: inline-flex; align-items: center; gap: 5px; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; font-size: 14px; margin-bottom: 18px; padding: 3px 8px 3px 4px; border-radius: 6px; }
.back:hover { color: var(--text); background: var(--hover); }
/* Goal & habit pages read like a Notion page header, not a card */
.goal-hero, .habit-hero { background: transparent; border: 0; box-shadow: none; padding: 0; border-radius: 0; }
.hero-top { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.hero-top > .grow { flex-basis: 260px; }
.hero-top h1 { font-size: 38px; margin: 6px 0 10px; overflow-wrap: anywhere; }
.hero-actions { display: flex; gap: 2px; }
.why { margin: 20px 0 0; padding: 14px 16px 14px 46px; background: var(--surface-2); border-radius: 8px; font-size: 15px; position: relative; }
.why::before { content: "💡"; position: absolute; left: 16px; top: 13px; font-size: 18px; }
.why-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.hero-progress { display: flex; gap: 22px; align-items: center; margin-top: 22px; padding: 18px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); flex-wrap: wrap; }
.hp-type { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hp-summary { font-family: var(--serif); font-size: 21px; font-weight: 500; }
.hp-deadline { color: var(--muted); font-size: 14px; }
.pace { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-width: 420px; align-items: flex-start; }
.pace-row { display: grid; grid-template-columns: 74px 1fr 40px; align-items: center; gap: 10px; width: 100%; font-size: 12.5px; color: var(--muted); }
.pace-row .bar { height: 5px; }
.hero-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.linked-goal { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; font-weight: 500; color: var(--muted); }
.linked-goal:hover { color: var(--text); }
.notes { width: 100%; resize: vertical; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border-soft); background: var(--surface); outline: none; line-height: 1.6; }
.notes:focus { border-color: var(--border); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.danger-zone { display: flex; gap: 8px; justify-content: flex-end; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }

.target-nums { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 8px; margin-bottom: 14px; }
.target-nums > div { display: flex; flex-direction: column; }
.target-nums b { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.target-nums .now b { font-size: 30px; color: var(--accent); }
.checkin-form { display: flex; gap: 8px; }
.checkin-form input { min-width: 0; border: 1px solid var(--border-soft); border-radius: 6px; padding: 6px 10px; background: var(--surface-2); outline: none; }
.checkin-form input[type=number] { width: 120px; flex-shrink: 0; }
.checkin-form input[name=note] { flex: 1; }
.checkin-form input:focus { border-color: var(--border); background: var(--surface); }
.target-note { text-align: center; margin: -4px 0 14px; }
.target-source { display: flex; align-items: center; gap: 6px; margin: 10px 2px 0; }
.checkin.record b { color: var(--accent); }
.type-grid.modes { grid-template-columns: repeat(3, 1fr); }
.checkins { margin-top: 14px; border-top: 1px solid var(--border-soft); padding-top: 6px; }
.checkin { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.checkin > .muted:first-child { width: 80px; flex-shrink: 0; }
.checkin-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checkin.has-note { cursor: pointer; border-radius: 6px; margin: 0 -6px; padding: 4px 6px; flex-wrap: wrap; }
.checkin.has-note:hover { background: var(--hover); }
.note-chevron { color: var(--faint); display: flex; transition: transform .15s; }
.checkin.open .note-chevron { transform: rotate(90deg); }
/* Open: the full note drops onto its own line underneath, wrapped and readable */
.checkin.open .checkin-note {
  order: 10; flex-basis: 100%; white-space: normal; overflow: visible;
  margin: 2px 0 4px 92px; padding: 8px 10px; border-radius: 6px;
  background: var(--surface-2); color: var(--text); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere;
}
.checkin.open .note-chevron { margin-left: auto; }

/* ---------- Habits ---------- */
.habit-table { padding: 6px 8px; overflow-x: auto; }
.ht-row { display: grid; grid-template-columns: minmax(170px, 1fr) repeat(7, 42px) 52px; align-items: center; gap: 2px; padding: 7px 6px; border-top: 1px solid var(--border-soft); border-radius: 6px; }
.ht-row:not(.ht-head):hover { background: var(--hover); }
.ht-row:first-child, .ht-head + .ht-row { border-top: 0; }
.ht-head { padding-bottom: 4px; }
.ht-day { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--faint); font-weight: 500; }
.ht-day b { font-size: 13px; color: var(--muted); font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; }
.ht-day.is-today b { color: var(--on-accent); background: var(--accent); border-radius: 99px; }
.ht-name { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; padding-right: 8px; }
.ht-name:hover .item-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border); }
.ht-cell { display: grid; place-items: center; }
.ht-stat { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--c) 40%, var(--border));
  background: transparent; color: #fff; display: grid; place-items: center; padding: 0;
  transition: background .12s, transform .1s;
}
.dot:hover { background: color-mix(in srgb, var(--c) 14%, transparent); }
.dot.on { background: var(--c); border-color: var(--c); }
.dot.rest:not(.on) { border-style: dashed; opacity: .45; }
.dot:active { transform: scale(.88); }

/* Skip days: a soft striped circle with a pause mark */
.dot.skip {
  border-style: dashed; border-color: color-mix(in srgb, var(--c) 45%, var(--border)); color: var(--muted); opacity: 1;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, transparent) 0 3px, transparent 3px 6px);
}
.hm-cell.skip { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 45%, var(--track)) 0 2px, var(--track) 2px 4px); opacity: 1; }
.item.habit.skipped .item-title { color: var(--muted); }
.item.habit.skipped .check { opacity: .45; }
.skip-label { color: var(--muted); font-weight: 500; }
.skip-label .i { display: inline-block; }
.skip-btn { flex-shrink: 0; }
@media (hover: hover) { .item.habit:not(:hover):not(.skipped) > .skip-btn { opacity: 0; } }
.break-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between;
  padding: 10px 14px; margin-bottom: 10px; border-radius: var(--radius); font-size: 14px;
  background: color-mix(in srgb, #337ea9 12%, var(--surface)); border: 1px solid color-mix(in srgb, #337ea9 30%, var(--border-soft));
}
.break-banner.upcoming { background: var(--surface-2); border-color: var(--border-soft); }
.page > .break-banner { margin-bottom: 14px; }
[data-skip-day] { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }

.dot.part { background: color-mix(in srgb, var(--c) 28%, transparent); border-color: var(--c); color: var(--text); }
.dot.on .dot-num { color: #fff; }
.dot-num { font-size: 10.5px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.dot.before { border: 0; background: transparent; position: relative; cursor: default; }
.dot.before::after { content: ""; position: absolute; inset: 50% 9px auto; height: 1.5px; background: var(--border); }
.starts { color: var(--accent); font-weight: 500; }
.hint .i { display: inline-block; vertical-align: -2px; }
.up { color: var(--ok); font-weight: 600; }
.down { color: var(--danger); font-weight: 600; }
.trend { font-size: 12.5px; font-weight: 600; min-width: 56px; text-align: right; color: var(--muted); }
.weekly-chart .bar-label { font-size: 9.5px; }

.habit-today { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); font-weight: 500; }
.habit-today .check { width: 26px; height: 26px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi b { font-family: var(--serif); font-size: 32px; font-weight: 500; line-height: 1.15; margin-top: 4px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.heatmap-wrap { overflow-x: auto; }
.heatmap { display: flex; gap: 6px; width: max-content; margin: 0 auto; }
.hm-days { display: grid; grid-template-rows: repeat(7, 15px); gap: 4px; font-size: 10px; color: var(--faint); font-weight: 500; }
.hm-days span { line-height: 15px; }
.hm-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 15px); grid-auto-columns: 15px; gap: 4px; }
.hm-cell { width: 15px; height: 15px; border-radius: 3px; border: 0; padding: 0; background: var(--track); }
.hm-cell.rest { opacity: .5; }
.hm-cell.on { background: var(--c); opacity: 1; }
.hm-cell.part { background: color-mix(in srgb, var(--c) 35%, var(--track)); opacity: 1; }
.hm-cell.future { background: transparent; }
/* Today: a clay ring around its square, and its weekday letter in clay */
.hm-cell.is-today { outline: 2px solid var(--accent); outline-offset: 1.5px; }
button.hm-cell.is-today:hover { outline-color: var(--accent); }
.hm-days span.is-today { color: var(--accent); font-weight: 800; }
button.hm-cell:hover { outline: 2px solid var(--c); outline-offset: 1px; }

/* ---------- Journal ---------- */
.entry { cursor: pointer; padding: 14px 16px; transition: box-shadow .15s; position: relative; }
.entry:hover { box-shadow: var(--shadow-hover); }
.entry-head { display: flex; align-items: center; gap: 10px; }
.entry-mood { font-size: 22px; }
.entry-text { margin-top: 8px; color: var(--text); overflow-wrap: anywhere; font-family: var(--serif); font-size: 16px; line-height: 1.6; }
.mood-strip { display: flex; justify-content: space-between; gap: 2px; padding: 12px; margin-top: 14px; }
.mood-day { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.md-emoji { font-size: 19px; line-height: 1.4; color: var(--faint); }
.mood-day small { font-size: 10px; color: var(--faint); font-weight: 500; }
.mood-day.is-today small { color: var(--accent); font-weight: 700; }

/* ---------- Life areas ---------- */
.wheel-card { display: flex; gap: 24px; align-items: center; margin-bottom: 18px; }
.wheel { width: 300px; max-width: 100%; flex-shrink: 0; }
.wheel-grid { fill: none; stroke: var(--border); stroke-width: 1; }
.wheel-data { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; }
.wheel-icon { font-size: 20px; }
.wheel-side h3 { margin-bottom: 8px; font-family: var(--serif); font-size: 21px; font-weight: 500; }
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.area-card { cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .15s, transform .15s; }
.area-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.area-top { display: flex; justify-content: space-between; align-items: flex-start; }
.area-icon { font-size: 28px; }

/* ---------- Plan (day calendar) ---------- */
.plan-page { max-width: 1100px; }
.day-nav { display: flex; align-items: center; gap: 2px; }
.now-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border-soft));
  font-size: 14px;
}
.nb-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); animation: pulse 2s ease-in-out infinite; }
.nb-next { margin-left: auto; }

.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 14px; }
.ws-day {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 0 5px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 500;
}
.ws-day:hover { background: var(--hover); color: var(--text); }
.ws-day b { font-size: 16px; font-weight: 600; color: var(--text); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; }
.ws-day.is-today b { color: var(--accent); }
.ws-day.on { background: var(--surface); box-shadow: 0 0 0 1px var(--border-soft), var(--shadow); color: var(--text); }
.ws-day.on.is-today b { background: var(--accent); color: var(--on-accent); }
.ws-day i { width: 4px; height: 4px; border-radius: 50%; }
.ws-day i.has { background: var(--faint); }

.plan-cols { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.cal-card { padding: 0; overflow: hidden; position: relative; }
/* Pills pointing at blocks scrolled out of view */
.cal-more {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content; z-index: 12;
  display: flex; align-items: center; gap: 5px; max-width: calc(100% - 90px);
  padding: 4px 11px 4px 8px; border: 0; border-radius: 99px;
  background: var(--ink); color: var(--ink-text); font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-lg); cursor: pointer; animation: pop .18s ease;
}
.cal-more span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-more[hidden] { display: none; }
.cal-more.up { top: 10px; }
.cal-card.has-head .cal-more.up { top: 74px; }
.cal-more.down { bottom: 12px; }
.cal-more.up .i { transform: rotate(-90deg); }
.cal-more.down .i { transform: rotate(90deg); }
.cal-more:hover { opacity: .9; }
.cal-scroll { height: calc(100vh - 260px); min-height: 420px; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: auto; }
.cal-grid { position: relative; height: 1440px; margin: 12px 0; }
.cal-hour { position: absolute; left: 0; width: 50px; text-align: right; font-size: 11px; color: var(--faint); font-weight: 500; transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.plan-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -8px 0 14px; flex-wrap: wrap; }
.plan-page.multi .plan-cols { grid-template-columns: minmax(0, 1fr); }
.cal-cols { position: absolute; top: 0; bottom: 0; left: 60px; right: 10px; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
.cal-cols .cal-events + .cal-events { border-left: 1px solid var(--border-soft); }
.plan-page.multi .cal-events.is-today { background-color: color-mix(in srgb, var(--accent) 4%, transparent); }
/* Day headers for 3-day and week views; they stay put while the hours scroll */
.cal-head {
  position: sticky; top: 0; z-index: 9; display: grid; grid-template-columns: repeat(var(--cols, 7), minmax(0, 1fr));
  padding: 6px 10px 6px 60px; background: var(--surface); border-bottom: 1px solid var(--border-soft);
}
.ch-day { display: flex; flex-direction: column; align-items: center; gap: 1px; border: 0; background: transparent; padding: 2px 0; border-radius: 8px; color: var(--muted); font-size: 11.5px; font-weight: 500; min-width: 0; }
.ch-day:hover { background: var(--hover); color: var(--text); }
.ch-day b { font-size: 17px; font-weight: 600; color: var(--text); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; }
.ch-day.is-today { color: var(--accent); }
.ch-day.is-today b { background: var(--accent); color: var(--on-accent); }
.cal-now-all { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); z-index: 3; pointer-events: none; transition: top 1s linear; }
.view-3day .cal-block, .view-week .cal-block { padding: 3px 5px 5px; font-size: 11.5px; border-left-width: 2.5px; }
.view-week .cb-title { white-space: normal; overflow-wrap: anywhere; align-items: flex-start; }
.view-week .cb-time { font-size: 10.5px; }
.view-week .cal-block.short .cb-time { display: none; }
.cal-events {
  position: relative; height: 100%; cursor: crosshair;
  /* hour lines, plus fainter half-hour lines (--hr is one hour at the current zoom) */
  background:
    repeating-linear-gradient(to bottom, var(--border-soft) 0 1px, transparent 1px var(--hr, 60px)),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--hr, 60px) / 2), color-mix(in srgb, var(--border-soft) 50%, transparent) calc(var(--hr, 60px) / 2) calc(var(--hr, 60px) / 2 + 1px), transparent calc(var(--hr, 60px) / 2 + 1px) var(--hr, 60px));
}
@media (hover: none) { .cal-events { cursor: default; } }
/* Viewing (not editing): blocks are tap-to-open only, so scrolling can never move or resize them */
.cal-card:not(.editing) .cal-events { cursor: default; }
.cal-card:not(.editing) .cal-resize { display: none; }
.cal-viewport { position: relative; }
.cal-tools { display: flex; align-items: center; gap: 6px; margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--border-soft); }
.zoom-btns { display: flex; border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden; }
.zoom-btns .icon-btn { border-radius: 0; width: 32px; height: 32px; }
.zoom-btns .icon-btn + .icon-btn { border-left: 1px solid var(--border-soft); }
.zoom-btns .icon-btn:disabled { opacity: .35; cursor: default; }
.edit-btn { display: inline-flex; align-items: center; gap: 5px; }
/* Edit mode */
.cal-editbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border-soft));
  animation: ds-pop .25s ease;
}
.ceb-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12.5px; }
.ceb-text b { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-size: 13.5px; }
.ceb-btns { display: flex; gap: 6px; margin-left: auto; }
.cal-card.editing { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow); }
.cal-card.editing .cal-block { outline: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); outline-offset: -1px; }
.cal-card.editing .cal-resize::after { opacity: .6; }
/* Full screen */
body.cal-full { overflow: hidden; }
.plan-page.expanded .cal-card {
  position: fixed; z-index: 45; inset: 16px; display: flex; flex-direction: column; border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45); animation: ds-pop .3s cubic-bezier(.2, .9, .25, 1);
}
.plan-page.expanded::before { content: ''; position: fixed; inset: 0; z-index: 44; background: rgba(10, 10, 10, .55); }
.plan-page.expanded .cal-viewport { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.plan-page.expanded .cal-scroll { flex: 1; height: auto; min-height: 0; }
.cal-xbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.cx-title { display: flex; flex-direction: column; min-width: 0; }
.cx-title b { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.cx-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cx-controls .day-nav { display: flex; align-items: center; gap: 4px; }

.cal-block {
  position: absolute; box-sizing: border-box; overflow: hidden;
  padding: 4px 8px 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 17%, var(--surface));
  border-left: 3px solid var(--c);
  color: color-mix(in srgb, var(--c) 28%, var(--text));
  font-size: 12.5px; line-height: 1.3;
  cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow .18s, scale .18s, opacity .18s;
}
.cal-block:hover { background: color-mix(in srgb, var(--c) 24%, var(--surface)); }
.cal-block.past { opacity: .55; }
.cal-block.is-now { box-shadow: 0 0 0 1.5px var(--c), 0 4px 14px color-mix(in srgb, var(--c) 25%, transparent); opacity: 1; }
.cal-block.task-done .cb-title > span { text-decoration: line-through; opacity: .7; }
.cal-block.lifting {
  z-index: 6; cursor: grabbing; scale: 1.02; opacity: .97;
  box-shadow: 0 14px 30px rgba(15, 15, 15, .2), 0 0 0 1px color-mix(in srgb, var(--c) 50%, transparent);
}
.cb-title { display: flex; align-items: center; gap: 5px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.cb-title > span { overflow: hidden; text-overflow: ellipsis; }
.cb-time { font-size: 11.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block.short { display: flex; align-items: center; gap: 8px; padding-top: 1px; padding-bottom: 1px; }
.cal-block.short .cb-time { font-size: 11px; }
.cb-check {
  width: 14px; height: 14px; flex-shrink: 0; padding: 0; display: grid; place-items: center;
  border-radius: 4px; border: 1.5px solid var(--c); background: transparent; color: transparent;
}
.cb-check.on { background: var(--c); color: #fff; }
.cal-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; cursor: ns-resize; touch-action: none; }
.cal-resize::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 22px; height: 3px; margin-left: -11px; border-radius: 3px; background: var(--c); opacity: 0; transition: opacity .15s; }
.cal-block:hover .cal-resize::after, .cal-block.lifting .cal-resize::after { opacity: .6; }
@media (hover: none) { .cal-resize { height: 16px; } .cal-resize::after { opacity: .45; } }
.cal-block.ghost { --c: var(--accent); pointer-events: none; opacity: .9; z-index: 5; box-shadow: 0 6px 18px rgba(15, 15, 15, .12); }

/* The moving "now" line */
.cal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--accent); z-index: 7; pointer-events: none; transition: top 1s linear; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.cal-now-label {
  position: absolute; left: 4px; width: 50px; text-align: center; box-sizing: border-box; transform: translateY(-50%); z-index: 8;
  padding: 1px 4px; border-radius: 99px; pointer-events: none; transition: top 1s linear;
  background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
}

.plan-side { display: flex; flex-direction: column; gap: 12px; }
.plan-card { padding: 16px; }
.plan-card h3 { margin-bottom: 4px; }
.plan-hint { margin-top: 8px; }
.plan-tasks { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.plan-task { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border-soft); font-size: 14px; }
.plan-task-title { min-width: 0; padding-top: 4px; line-height: 1.35; overflow-wrap: anywhere; }
.plan-task .btn { flex-shrink: 0; }
.plan-task:first-child { border-top: 0; }

/* "Right now" on Today */
.now-card { cursor: pointer; border-left: 4px solid var(--c); display: flex; flex-direction: column; gap: 4px; }
.nc-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.nc-title { font-family: var(--serif); font-size: 21px; font-weight: 500; }
.nc-title.free { color: var(--muted); }
.nc-progress { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.nc-next { display: flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--muted); margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.nc-next b { color: var(--text); font-weight: 600; }

/* ---------- Insights ---------- */
.chart-card { padding: 16px 14px 10px; }
.bars { display: flex; align-items: stretch; gap: 5px; height: 160px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bar-val { font-size: 11px; color: var(--muted); font-weight: 600; height: 16px; }
.bar-track { flex: 1; width: 100%; max-width: 24px; display: flex; align-items: flex-end; }
.bar-track span { width: 100%; border-radius: 4px 4px 2px 2px; min-height: 0; transition: height .4s; }
.bar-label { font-size: 10.5px; color: var(--faint); font-weight: 500; margin-top: 6px; white-space: nowrap; height: 15px; }
.mood-chart .bars { gap: 2px; height: 120px; }
.mood-chart .bar-val, .mood-chart .bar-label { display: none; }
.stat-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-top: 1px solid var(--border-soft); cursor: pointer; border-radius: 6px; }
.stat-row:hover { background: var(--hover); }
.stat-row:first-child { border-top: 0; }
.stat-bar { width: 32%; flex-shrink: 0; display: flex; }

/* ---------- Settings & more ---------- */
.settings-card { margin-bottom: 14px; }
.settings-card h3 { margin-bottom: 12px; font-family: var(--serif); font-size: 19px; font-weight: 500; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; flex-wrap: wrap; }
.setting-row select { padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border-soft); background: var(--surface-2); }
.tz-select { max-width: 100%; min-width: 0; }
.tz-now { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 0; }
.more-list { padding: 4px; }
.more-list + .more-list { margin-top: 18px; }
.more-link { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 6px; font-weight: 500; }
.more-link:hover { background: var(--hover); }
.more-list > .more-link + .more-link { border-top: 1px solid var(--border-soft); border-radius: 0; }

.sync-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.sidebar .sync-status { justify-content: flex-start; padding: 6px 10px 0; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.sync-dot.syncing { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.sync-dot.offline { background: var(--faint); }
.sync-dot.error { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }
.choice-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.choice { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: transparent; }
.choice:hover { background: var(--hover); }
.choice small { color: var(--muted); }

/* ---------- Forms & modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 15, 15, .4);
  display: grid; place-items: center; padding: 20px;
  animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; overflow-x: hidden;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 20px 22px; animation: pop .18s ease;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3, .confirm h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; }
.modal-foot { display: flex; gap: 8px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.confirm h3 { margin-bottom: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--muted); }
.field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea {
  width: 100%; padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--border-soft); background: var(--surface-2); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--border); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field textarea { resize: vertical; }
.field-row { display: flex; gap: 12px; }
.emoji-field { width: 74px; flex-shrink: 0; }
.emoji-field input { text-align: center; font-size: 20px; padding: 5px !important; }
.emoji-row { display: flex; flex-wrap: wrap; gap: 2px; margin-top: -6px; }
.emoji-opt { border: 0; background: transparent; font-size: 19px; width: 34px; height: 34px; border-radius: 6px; padding: 0; }
.emoji-opt:hover { background: var(--hover); }
.emoji-opt.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.emoji-more { display: inline-flex; align-items: center; gap: 3px; height: 34px; padding: 0 10px; border: 1px dashed var(--border); border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.emoji-more:hover { color: var(--text); border-color: var(--muted); }
.emoji-more .i { transform: rotate(90deg); transition: transform .2s; }
.emoji-more.open { color: var(--accent); border-color: var(--accent); border-style: solid; }
.emoji-more.open .i { transform: rotate(-90deg); }
.ep-panel { margin-top: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); overflow: hidden; animation: ds-pop .25s cubic-bezier(.2, .9, .25, 1.1); }
.ep-top { padding: 8px 8px 0; }
.ep-search { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.ep-cats { display: flex; gap: 6px; overflow-x: auto; padding: 8px; scrollbar-width: none; }
.ep-cats::-webkit-scrollbar { display: none; }
.ep-cat { flex-shrink: 0; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--muted); font: inherit; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.ep-cat:hover, .ep-cat.on { color: var(--text); border-color: var(--accent); }
.ep-grid { position: relative; max-height: 230px; overflow-y: auto; padding: 0 8px 8px; overscroll-behavior: contain; }
.ep-sec-title { position: sticky; top: 0; z-index: 1; padding: 6px 2px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.ep-sec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; }
.ep-sec-list .emoji-opt { width: 100%; font-size: 21px; }
.ep-empty { padding: 18px 8px; text-align: center; font-size: 13px; color: var(--muted); }
#f-habit-icon.picked, #f-goal-icon.picked { animation: icon-pick .35s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes icon-pick { 50% { transform: scale(1.15); } }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-opt input, .seg-opt input, .mood-opt input, .color-opt input, .day-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-opt span { display: flex; flex-direction: column; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; height: 100%; transition: background .12s; }
.type-opt span:hover { background: var(--hover); }
.type-opt small { color: var(--muted); font-size: 12px; }
.type-opt input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.type-opt input:focus-visible + span { outline: 2px solid var(--accent); }
.cond { display: none !important; }
form:has(input[name=progressType][value=target]:checked) .cond-target { display: flex !important; }
form:has(input[name=progressType][value=steps]:checked) .cond-steps { display: flex !important; }
form:has(select[name=freqType] option[value=days]:checked) .cond-days { display: flex !important; }
form:has(select[name=freqType] option[value=weekly]:checked) .cond-weekly { display: flex !important; }
form:has(input[name=hasMetric]:checked) .cond-metric { display: flex !important; }
form:has(select[name=repeat] option[value=days]:checked) .cond-repeat-days { display: flex !important; margin-top: -6px; }
form:has(select[name=repeat] option:not([value=none]):checked) .cond-repeating { display: flex !important; }
.repeat-note { display: flex; align-items: center; gap: 6px; margin: -4px 0 0; }
.cb-repeat { display: inline-flex; opacity: .65; flex-shrink: 0; margin-left: auto; }
/* Narrow columns: the repeat mark sits in the corner instead of taking room from the name */
.view-3day .cb-repeat { position: absolute; top: 3px; right: 3px; margin: 0; }
.view-week .cb-repeat { display: none; }
.view-week .cb-title { overflow-wrap: break-word; word-break: normal; }

.check-field small { font-weight: 400; }
.ongoing { font-weight: 500; }
.check-field { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check-field input { position: absolute; opacity: 0; pointer-events: none; }
.check-field .box { width: 18px; height: 18px; flex-shrink: 0; display: grid; place-items: center; border-radius: 5px; border: 1.5px solid color-mix(in srgb, var(--ink) 55%, var(--border)); color: transparent; }
.check-field input:checked + .box { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.check-field input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.start-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.start-row input[type=date] { width: auto !important; flex: 1; min-width: 150px; }

.amount-when { margin-top: -6px; }
.amount-row { display: flex; align-items: stretch; gap: 10px; }
.amount-step { width: 52px; font-size: 22px; font-weight: 400; padding: 0; }
.amount-box { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.amount-box:focus-within { border-color: var(--ink); background: var(--surface); }
.amount-box input { width: 100%; min-width: 0; max-width: 140px; border: 0; background: transparent; outline: none; text-align: right; font-family: var(--serif); font-size: 34px; -moz-appearance: textfield; }
.amount-box input::-webkit-outer-spin-button, .amount-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-box span { font-size: 16px; color: var(--muted); min-width: 30px; }
.amount-target { align-self: center; }

.seg-form { display: flex; }

/* Effort slider (task dialog): four stops, glides while dragging, settles on release */
.effort { --thumb: 26px; padding: 2px 0 0; user-select: none; -webkit-user-select: none; }
.ef-rail { position: relative; height: 36px; }
.ef-track { position: absolute; left: calc(var(--thumb) / 2); right: calc(var(--thumb) / 2); top: 50%; height: 6px; margin-top: -3px; border-radius: 99px; background: var(--track); }
.ef-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p) * 100%); border-radius: inherit; background: var(--accent); }
.effort.auto .ef-fill { background: color-mix(in srgb, var(--accent) 45%, var(--track)); }
.ef-tick { position: absolute; top: 50%; left: calc(var(--i) * 100%); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--track); transition: border-color .15s; }
.ef-tick.on { border-color: var(--accent); }
.effort.auto .ef-tick.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--track)); }
.ef-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: grab; touch-action: pan-y; }
.ef-range:active { cursor: grabbing; }
.ef-range:focus { outline: none; }
.ef-range::-webkit-slider-runnable-track { height: 36px; background: transparent; border: 0; }
.ef-range::-moz-range-track { height: 36px; background: transparent; border: 0; }
.ef-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: var(--thumb); height: var(--thumb); margin-top: calc((36px - var(--thumb)) / 2);
  border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: transform .18s cubic-bezier(.2, 1.4, .4, 1), box-shadow .18s;
}
.ef-range::-moz-range-thumb { width: var(--thumb); height: var(--thumb); border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); transition: transform .18s cubic-bezier(.2, 1.4, .4, 1); }
.effort.dragging .ef-range::-webkit-slider-thumb { transform: scale(1.15); box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 16%, transparent), 0 3px 10px rgba(0, 0, 0, .3); }
.effort.dragging .ef-range::-moz-range-thumb { transform: scale(1.15); }
.ef-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.ef-stops { position: relative; height: 26px; margin: 0 calc(var(--thumb) / 2); }
.ef-stop { position: absolute; left: calc(var(--i) * 100%); top: 0; transform: translateX(-50%); padding: 3px 10px; border: 0; border-radius: 6px; background: none; color: var(--faint); font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; transition: color .15s; }
.ef-stop:hover { color: var(--text); }
.ef-stop.on { color: var(--text); }
.ef-caption { font-size: 13px; margin-top: 2px; min-height: 20px; }
.ef-auto { color: var(--faint); }
/* Effort on a task row: only the sizes worth noticing (S, L, XL) */
.effort-tag { font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--faint); border: 1px solid var(--border-soft); border-radius: 5px; padding: 0 5px; line-height: 16px; }
.effort-tag.big { color: var(--muted); border-color: var(--border); }
@media (max-width: 760px) { .effort { --thumb: 30px; } .ef-rail { height: 40px; } .ef-range::-webkit-slider-runnable-track { height: 40px; } .ef-range::-webkit-slider-thumb { margin-top: 5px; } .ef-stop { font-size: 13.5px; padding: 6px 12px; } }
.seg-opt { flex: 1; }
.seg-opt span { display: block; text-align: center; padding: 4px 8px; border-radius: 6px; font-weight: 500; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg-opt input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 15, 15, .08), 0 0 0 1px var(--border-soft); }
.day-row { gap: 6px; flex-wrap: wrap; }
.day-opt span { display: block; padding: 5px 11px; border-radius: 6px; border: 1px solid var(--border); font-weight: 500; font-size: 13px; cursor: pointer; }
.day-opt input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--ink-text); }
.mood-row { display: flex; gap: 6px; }
.mood-opt { flex: 1; }
.mood-opt span { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border: 1px solid var(--border); border-radius: 8px; font-size: 22px; cursor: pointer; line-height: 1.2; }
.mood-opt small { font-size: 11px; color: var(--muted); font-weight: 500; }
.mood-opt input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--hover); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt span { display: block; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--border); }
.color-opt input:checked + span { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }

/* ---------- Toast & confetti ---------- */
#toast-root { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; pointer-events: none; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--ink-text); padding: 10px 16px; border-radius: 12px; font-weight: 500; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
.toast > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.has-undo { pointer-events: auto; padding-right: 8px; }
.toast-undo { border: 0; background: color-mix(in srgb, var(--ink-text) 14%, transparent); color: var(--ink-text); font-weight: 700; font-size: 13px; padding: 5px 12px; border-radius: 8px; flex-shrink: 0; }
.toast-undo:hover { background: color-mix(in srgb, var(--ink-text) 24%, transparent); }

/* ---------- Sidebar search & groups ---------- */
.nav-search {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 10px;
  padding: 7px 10px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface);
  color: var(--muted); font-size: 14px; text-align: left; box-shadow: var(--shadow);
}
.nav-search:hover { color: var(--text); border-color: var(--border); }
.nav-search span { flex: 1; }
.nav-search.big { padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
kbd { font: 600 11px/1 var(--sans); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.nav-label { margin: 16px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.sidebar-foot .nav-link { margin-top: 2px; }

/* ---------- Gamification ---------- */
.level-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 0 0 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border-soft); font-size: 12px; }
.level-bar:hover { border-color: var(--border); }
.lb-level { font-weight: 800; color: var(--accent); white-space: nowrap; }
.lb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lb-rank { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-body .bar { height: 4px; }
.lb-xp { color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.more-level { padding: 6px; margin-bottom: 14px; }
.more-level .level-bar { margin: 0; border: 0; }
.xp-pop {
  position: fixed; z-index: 80; pointer-events: none; transform: translate(-50%, 0);
  padding: 3px 9px; border-radius: 99px; background: var(--accent); color: var(--on-accent);
  font-size: 12.5px; font-weight: 800; letter-spacing: .01em; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent);
  animation: xp-float 1.3s cubic-bezier(.2, .8, .2, 1) forwards;
}
@keyframes xp-float { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -54px) scale(1); } }

/* Your climber: the character for your rank, inside the ring that fills toward the next level */
.hero-card { display: flex; align-items: center; gap: 32px; padding: 26px 28px; background: radial-gradient(120% 140% at 0% 50%, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface) 60%); }
.hero-avatar { position: relative; width: 168px; height: 168px; flex-shrink: 0; display: grid; place-items: center; }
.hero-avatar .ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-avatar::before { content: ''; position: absolute; inset: 18px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent) 6%, transparent) 70%); }
/* Characters are pictures trimmed to their drawing (see emojiArt), so a square box centres them exactly */
.emoji-art { display: block; }
img.emoji-art { width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.hero-emoji, .evo-emoji, .hero-next-emoji, .lb-avatar { display: grid; place-items: center; flex-shrink: 0; line-height: 1; text-align: center; }
.hero-emoji { position: relative; width: 92px; height: 92px; font-size: 76px; animation: hero-bob 3.2s ease-in-out infinite; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25)); }
@keyframes hero-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .hero-emoji { animation: none; } }
.hero-level { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); padding: 4px 14px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 14px; white-space: nowrap; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
.hero-info { flex: 1; min-width: 0; }
.hero-kicker { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.hero-name { font-family: var(--serif); font-size: 34px; font-weight: 500; line-height: 1.15; margin-top: 2px; }
.hero-tag { color: var(--muted); margin: 4px 0 16px; }
.hero-xp { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.hero-info .bar { height: 9px; }
.hero-next { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.hero-next-emoji { width: 36px; height: 36px; font-size: 30px; }
/* Locked characters show as a mystery silhouette */
.silhouette { filter: brightness(0); opacity: .35; }
:root[data-mode="dark"] .silhouette { filter: brightness(0) invert(1); opacity: .2; }
.evo-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.evo { flex: 0 0 88px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 4px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-soft); text-align: center; }
.evo-emoji { width: 36px; height: 36px; font-size: 30px; margin-bottom: 2px; }
.evo-name { font-size: 11.5px; font-weight: 600; line-height: 1.2; min-height: 2.4em; display: flex; align-items: center; }
.evo-lv { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.evo.current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.evo.current .evo-lv { color: var(--accent); font-weight: 700; }
.evo.locked .evo-name { color: var(--faint); }
.lb-avatar { width: 20px; height: 20px; font-size: 17px; }
.trophy-recent { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; }
.tr-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.tr-row:first-child { border-top: 0; }
.tr-row > span:first-child { font-size: 22px; }
.tier-hint { margin: -6px 0 12px; }
.trophy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 8px; }
.trophy { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-soft); opacity: .55; filter: grayscale(1); transition: transform .15s, opacity .15s; }
.trophy:hover { opacity: .8; }
.trophy.on { opacity: 1; filter: none; border-color: color-mix(in srgb, var(--accent) 35%, var(--border-soft)); }
.trophy.on.tier-legendary { background: linear-gradient(135deg, color-mix(in srgb, #cb912f 14%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, #cb912f 50%, var(--border-soft)); }
.trophy.on.tier-hard { border-color: color-mix(in srgb, #9065b0 45%, var(--border-soft)); }
.trophy-icon { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; font-size: 24px; border-radius: 10px; background: var(--surface-2); }
.trophy.on .trophy-icon { background: var(--accent-soft); }
.trophy-body { flex: 1; min-width: 0; }
.trophy-name { font-weight: 650; font-size: 14px; }
.trophy-desc { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.trophy-date { font-size: 11.5px; color: var(--accent); font-weight: 600; margin-top: 4px; }
.trophy-prog { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.trophy-prog .bar { height: 4px; }
@media (max-width: 760px) {
  .hero-card { flex-direction: column; text-align: center; gap: 22px; padding: 24px 16px 18px; background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface) 70%); }
  .hero-avatar { width: 150px; height: 150px; }
  .hero-emoji { width: 82px; height: 82px; font-size: 68px; }
  .hero-info { width: 100%; }
  .hero-name { font-size: 30px; }
  .hero-next { text-align: left; }
  .trophy-grid { grid-template-columns: 1fr; }
}

/* ---------- Quest map ---------- */
.quest-section > p { margin: -4px 0 14px; }
.qb { --qc: var(--accent); margin-bottom: 14px; padding: 14px 16px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-soft); }
.qb.complete { border-color: color-mix(in srgb, var(--qc) 55%, var(--border-soft)); background: linear-gradient(120deg, color-mix(in srgb, var(--qc) 10%, var(--surface)), var(--surface) 60%); }
.qb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.qb-icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; font-size: 20px; border-radius: 10px; background: color-mix(in srgb, var(--qc) 18%, var(--surface-2)); }
.qb-prog { font-size: 12.5px; font-weight: 700; color: var(--qc); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qb-scroll { overflow-x: auto; margin: 0 -16px; padding: 6px 16px 4px; scrollbar-width: thin; }
.qb-grid { position: relative; display: grid; gap: 14px 0; width: max-content; }
/* The chain: a line through the main row, behind the badges */
.qb-grid::before { content: ''; position: absolute; left: 48px; right: 48px; top: 32px; height: 3px; border-radius: 2px; background: var(--track); }
.qb-grid.no-chain::before { display: none; }
.qn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 96px; padding: 0 4px; background: none; border: 0; cursor: pointer; font: inherit; color: var(--text); text-align: center; }
.qn-ring {
  position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 3px solid var(--border); transition: transform .15s, box-shadow .15s;
}
.qn:hover .qn-ring { transform: scale(1.06); }
.qn-icon { font-size: 26px; line-height: 1; }
.qn-name { font-size: 11.5px; font-weight: 650; line-height: 1.2; max-width: 96px; }
.qn-sub { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qn.done .qn-ring { background: color-mix(in srgb, var(--qc) 22%, var(--surface)); border-color: var(--qc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--qc) 18%, transparent), 0 6px 16px color-mix(in srgb, var(--qc) 25%, transparent); }
.qn.done .qn-sub { color: var(--qc); font-weight: 600; }
/* Next in reach: a progress ring that fills as you get closer, and a soft pulse */
.qn.next .qn-ring { border-color: transparent; background: conic-gradient(var(--qc) var(--p, 0%), var(--track) 0); animation: qn-pulse 2.4s ease-in-out infinite; }
.qn.next .qn-ring::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface); }
.qn.next .qn-icon { position: relative; }
.qn.next .qn-sub { color: var(--text); font-weight: 600; }
@keyframes qn-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--qc) 35%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--qc) 0%, transparent); } }
.qn.locked { opacity: .5; }
.qn.locked .qn-icon { filter: grayscale(1); opacity: .6; }
.qn.locked .qn-ring::after { content: '🔒'; position: absolute; right: -4px; bottom: -4px; font-size: 13px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; }
.qn.locked:hover { opacity: .8; }
/* Side badges hang below the badge they branch from */
.qn.side::before { content: ''; position: absolute; left: 50%; top: -14px; height: 14px; border-left: 2px dashed var(--border); }
.qn.side .qn-ring { width: 52px; height: 52px; }
.qn.side .qn-icon { font-size: 21px; }
.qn.tier-legendary.done .qn-ring { background: linear-gradient(135deg, color-mix(in srgb, #cb912f 35%, var(--surface)), color-mix(in srgb, var(--qc) 25%, var(--surface))); border-color: #cb912f; }
.qb.unexplored { opacity: .85; }
.qb-areas { display: flex; flex-wrap: wrap; gap: 8px; }
.qb-area { --qc: var(--muted); padding: 6px 12px; border-radius: 99px; font-size: 13px; border: 1px dashed color-mix(in srgb, var(--qc) 60%, var(--border)); color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .qn.next .qn-ring { animation: none; } }
@media (max-width: 760px) { .qb { padding: 12px 12px 10px; } .qb-scroll { margin: 0 -12px; padding: 6px 12px 4px; } }
/* New badge: the nudge, then the reveal on the map */
.nav-badge.new { background: var(--accent); color: var(--on-accent); animation: pip-pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.nav-badge.nav-dot { width: 7px; height: 7px; padding: 0; border-radius: 50%; }
@keyframes pip-pop { from { transform: scale(.4); opacity: 0; } }
.tab { position: relative; }
.tab-dot { position: absolute; top: 2px; left: calc(50% + 8px); width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.new-chip { display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.cheer-badge { --cheer: #cb912f; }
.cheer.tappable:hover { transform: translateX(-3px); border-color: var(--cheer); }
.cheer.tappable .cheer-sub { color: var(--cheer); font-weight: 600; }
.qn.reveal .qn-ring { animation: qn-reveal 1.1s cubic-bezier(.2, 1.3, .3, 1) both; }
.qn.reveal::after { content: ''; position: absolute; left: 50%; top: 32px; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 0 color-mix(in srgb, var(--qc) 70%, transparent); animation: qn-burst 1s .1s ease-out forwards; }
@keyframes qn-reveal { 0% { transform: scale(.4); filter: brightness(2); } 55% { transform: scale(1.25); } 100% { transform: scale(1); filter: none; } }
@keyframes qn-burst { to { box-shadow: 0 0 0 46px transparent; transform: scale(1.2); } }
.qn.lit .qn-ring { animation: qn-lit 1.4s ease-out both; }
@keyframes qn-lit { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--qc) 80%, transparent); transform: scale(.9); } 40% { transform: scale(1.12); } 100% { box-shadow: 0 0 0 14px transparent; transform: scale(1); } }
.qn-lit-tag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 99px; background: var(--qc); color: #fff; font-size: 10px; font-weight: 800; white-space: nowrap; letter-spacing: .03em; animation: cheer-in .4s .3s cubic-bezier(.2, 1.2, .3, 1) both; z-index: 2; }
@media (prefers-reduced-motion: reduce) { .qn.reveal .qn-ring, .qn.reveal::after, .qn.lit .qn-ring, .qn-lit-tag, .nav-badge.new { animation: none; } }
/* Badge detail */
.qd { --qc: var(--accent); }
.qd-top { display: flex; align-items: flex-start; gap: 14px; }
.qd-icon { width: 64px; height: 64px; flex-shrink: 0; display: grid; place-items: center; font-size: 32px; border-radius: 50%; background: var(--surface-2); border: 3px solid var(--border); }
.qd-icon.done { background: color-mix(in srgb, var(--qc) 22%, var(--surface)); border-color: var(--qc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--qc) 18%, transparent); }
.qd-icon.locked { filter: grayscale(1); opacity: .6; }
.qd-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--qc); }
.qd-top h3 { margin: 2px 0 4px; }
.qd-top p { margin: 0; }
.qd-status { margin-top: 14px; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.qd-status.done { color: var(--qc); background: color-mix(in srgb, var(--qc) 12%, var(--surface-2)); }
.qd-status.next { color: var(--text); }
.qd-prog { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.qd-prog .bar { flex: 1; height: 8px; }
.qd-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; }
.qd-label { flex: 0 0 56px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 5px; }
.qd-row > div { display: flex; flex-wrap: wrap; gap: 6px; }
.qd-chip { padding: 4px 10px; border-radius: 99px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.qd-chip.on { color: var(--qc); border-color: color-mix(in srgb, var(--qc) 45%, var(--border)); }

/* ---------- Theme gallery ---------- */
.theme-group-label { margin: 16px 0 8px; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-card {
  display: flex; flex-direction: column; gap: 7px; padding: 6px 6px 8px; border: 1.5px solid var(--border-soft); border-radius: 12px;
  background: var(--surface); text-align: left; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.theme-card:hover { border-color: var(--border); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.theme-name { display: flex; align-items: center; gap: 5px; padding: 0 4px; font-size: 13px; font-weight: 600; }
.theme-name .i { color: var(--accent); }
/* The mini app preview inside each card */
.tm { display: flex; height: 70px; border-radius: 8px; overflow: hidden; background: var(--tb); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tt) 12%, transparent); }
.tm-side { width: 28%; background: var(--ts); padding: 8px 6px; display: flex; flex-direction: column; gap: 5px; }
.tm-side i { display: block; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--tt) 25%, transparent); }
.tm-side i:first-child { background: var(--ta); width: 70%; }
.tm-main { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.tm-main b { display: block; height: 6px; width: 55%; border-radius: 3px; background: var(--tt); }
.tm-card { display: flex; align-items: center; gap: 5px; padding: 5px; border-radius: 4px; background: var(--tc); box-shadow: 0 0 0 1px color-mix(in srgb, var(--tt) 8%, transparent); }
.tm-card i { flex: 1; height: 4px; border-radius: 2px; background: var(--tm); opacity: .7; }
.tm-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--tm); flex-shrink: 0; }
.tm-dot.on { background: var(--ta); border-color: var(--ta); }
.tm-split { display: grid; grid-template-columns: 1fr 1fr; border-radius: 8px; overflow: hidden; }
.tm-split .tm { border-radius: 0; }
.tm-split .tm:first-child .tm-main { padding-right: 0; }
.tm-split .tm:last-child .tm-side { display: none; }
@media (max-width: 760px) { .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Command bar ---------- */
.palette-backdrop { place-items: start center; padding-top: 12vh; background: rgba(15, 15, 15, .3); }
.palette {
  width: 100%; max-width: 620px; max-height: 70vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease;
}
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); color: var(--muted); }
.palette-input input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 17px; color: var(--text); }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.palette-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; text-align: left; font-size: 14.5px; color: var(--text);
}
.palette-item.on, .palette-item:hover { background: var(--active); }
.pi-icon { width: 22px; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; font-size: 16px; }
.pi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.palette-empty { padding: 24px; text-align: center; color: var(--muted); }

/* ---------- Floating ＋ (phones) ---------- */
.fab { display: none; }

/* ---------- Today's compact progress ---------- */
.day-progress-wrap { position: relative; }
.day-progress { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border-soft); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.day-progress:hover { border-color: var(--border); background: var(--hover); }
.day-progress.open { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.day-progress .summary-title { font-family: var(--sans); font-size: 14px; font-weight: 650; margin: 0; }
.day-progress .ring text { display: none; }
.dp-chevron { color: var(--faint); display: grid; transform: rotate(90deg); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.day-progress.open .dp-chevron { transform: rotate(-90deg); color: var(--accent); }

/* Corner cards when you finish something (cheer.js) */
#cheer-stack { position: fixed; right: 20px; bottom: 20px; z-index: 65; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.cheer {
  --cheer: var(--ok);
  pointer-events: auto; cursor: pointer; width: 300px; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 12px; padding: 11px 14px 11px 11px; border-radius: 14px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--cheer) 18%, var(--surface)), color-mix(in srgb, var(--surface) 94%, transparent) 65%);
  border: 1px solid color-mix(in srgb, var(--cheer) 40%, var(--border));
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25), 0 0 0 1px rgba(255, 255, 255, .02) inset;
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  animation: cheer-in .45s cubic-bezier(.2, 1.2, .3, 1) both;
}
.cheer.out { animation: cheer-out .3s ease forwards; }
@keyframes cheer-in { from { opacity: 0; transform: translateX(40px) scale(.96); } }
@keyframes cheer-out { to { opacity: 0; transform: translateX(30px) scale(.97); } }
.cheer-subtask { --cheer: #4f8ff7; }
.cheer-subtask .cheer-icon { font-size: 13px; width: 30px; height: 30px; margin: 2px; }
.cheer-milestone { --cheer: #a46cf5; }
.cheer-icon {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px;
  background: var(--cheer); color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--cheer) 45%, transparent); animation: cheer-icon .5s .1s cubic-bezier(.2, 1.5, .4, 1) both;
}
@keyframes cheer-icon { from { transform: scale(.3) rotate(-30deg); } }
.cheer-body { min-width: 0; flex: 1; }
.cheer-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--cheer); }
.cheer-xp { margin-left: auto; letter-spacing: 0; font-size: 11.5px; color: var(--text); opacity: .75; }
.cheer-title { font-size: 14px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cheer-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  /* On phones they drop in from the top, like a notification, clear of the tab bar and the + button */
  #cheer-stack { top: calc(10px + env(safe-area-inset-top)); bottom: auto; left: 12px; right: 12px; align-items: stretch; flex-direction: column-reverse; }
  .cheer { width: auto; max-width: none; }
  @keyframes cheer-in { from { opacity: 0; transform: translateY(-24px) scale(.97); } }
  @keyframes cheer-out { to { opacity: 0; transform: translateY(-16px) scale(.97); } }
}
@media (prefers-reduced-motion: reduce) { .cheer, .cheer-icon { animation: none; } }

/* Goal achieved: fireworks over everything and a gold card */
.goal-win { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 45%, rgba(20, 16, 6, .55), rgba(5, 5, 5, .78)); animation: ds-fade .35s ease; }
.goal-win.out { opacity: 0; transition: opacity .4s ease; }
.fireworks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.goal-win-card {
  position: relative; width: min(420px, 100%); text-align: center; padding: 30px 26px 24px; border-radius: 22px;
  background: linear-gradient(160deg, #3a2c0c, #1d1a14 55%); color: #fff7e0; border: 1px solid rgba(255, 210, 63, .45);
  box-shadow: 0 0 0 6px rgba(255, 210, 63, .08), 0 30px 80px rgba(0, 0, 0, .55), 0 0 80px rgba(255, 190, 40, .25);
  animation: gw-pop .7s .15s cubic-bezier(.2, 1.4, .3, 1) both;
}
@keyframes gw-pop { from { opacity: 0; transform: scale(.6) translateY(30px); } }
.gw-trophy { font-size: 72px; line-height: 1; filter: drop-shadow(0 8px 20px rgba(255, 190, 40, .5)); animation: gw-trophy 1.6s .5s ease-in-out infinite; }
@keyframes gw-trophy { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
.gw-kicker { margin-top: 12px; font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #ffd23f; }
.gw-title { margin-top: 6px; font-family: var(--serif); font-size: 28px; line-height: 1.2; overflow-wrap: anywhere; }
.gw-sub { margin-top: 8px; color: rgba(255, 247, 224, .7); font-size: 14px; }
.gw-xp { display: inline-block; margin-top: 14px; padding: 4px 14px; border-radius: 99px; background: rgba(255, 210, 63, .16); color: #ffd23f; font-weight: 800; }
.goal-win .btn.gw-btn { display: block; width: 100%; margin-top: 20px; background: #ffd23f; color: #2a1f00; border-color: #ffd23f; font-weight: 700; }
.goal-win .btn.gw-btn:hover { background: #ffdc66; }
@media (prefers-reduced-motion: reduce) { .goal-win-card, .gw-trophy { animation: none; } }

/* XP today vs your usual */
.xp-card { padding: 16px 18px 14px; }
.xp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.xp-big { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; color: var(--accent); font-variant-numeric: tabular-nums; }
.xp-big span { font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.xp-vs { flex-shrink: 0; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.xp-vs.up { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.xp-vs.down { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.xp-meter { height: 6px; border-radius: 99px; background: var(--track); margin: 12px 0 4px; overflow: hidden; }
.xp-meter span { display: block; height: 100%; border-radius: inherit; background: var(--warn); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.xp-meter.full span { background: var(--ok); }
/* Stock-style charts (xpcharts.js): stretched SVG lines with crisp HTML labels on top */
.schart { margin-top: 12px; user-select: none; -webkit-user-select: none; }
.schart-plot { position: relative; touch-action: pan-y; cursor: crosshair; }
.schart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.schart .ln { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.schart .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; opacity: .7; }
.schart .fill-accent { fill: var(--accent); fill-opacity: .12; }
.schart-ref {
  position: absolute; right: 0; transform: translateY(-50%); z-index: 2; pointer-events: none;
  padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.schart-x { position: relative; height: 20px; margin-top: 6px; }
.schart-x span { position: absolute; top: 0; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.schart-x span.first { transform: none; }
.schart-x span.last { transform: translateX(-100%); }
.schart-cross { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--muted); opacity: 0; pointer-events: none; z-index: 3; }
.schart-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px rgba(0, 0, 0, .2); opacity: 0; pointer-events: none; z-index: 4; }
.schart-tip {
  position: absolute; z-index: 5; min-width: 150px; padding: 9px 11px; border-radius: 10px; pointer-events: none; opacity: 0;
  transform: translate(14px, -50%); background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 12.5px; line-height: 1.45; white-space: nowrap;
}
.schart-tip.flip { transform: translate(calc(-100% - 14px), -50%); }
.schart.hovering .schart-cross, .schart.hovering .schart-dot, .schart.hovering .schart-tip { opacity: 1; }
.tip-date { font-weight: 700; margin-bottom: 3px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row b { font-size: 14px; }
.tip-dot { width: 8px; height: 8px; border-radius: 50%; }
.tip-sub { color: var(--muted); font-size: 11.5px; }
.tip-pace { font-weight: 700; margin-top: 2px; }
.tip-up { padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }
/* Level lines on the history chart */
.has-levels .schart-plot { margin-right: 74px; }
.schart-level { position: absolute; left: 0; right: -74px; height: 0; border-top: 1px dashed color-mix(in srgb, var(--muted) 55%, transparent); pointer-events: none; }
.schart-level span { position: absolute; right: 0; top: 0; transform: translateY(-50%); padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface); white-space: nowrap; }
.schart-level.next { border-top-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.schart-level.next span { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.schart-up { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); z-index: 2; pointer-events: none; }
/* The XP history window */
.modal.wide { max-width: 940px; }
.xh-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.xh-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.xh-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.xh-num { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.xh-num.up { color: var(--ok); }
.xh-sub { display: block; font-size: 11.5px; color: var(--muted); }
.xh-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.xh-legend span { display: inline-flex; align-items: center; gap: 6px; }
.xh-legend b { color: var(--text); }
.xh-legend i { width: 14px; height: 4px; border-radius: 2px; }
.xh-legend i.dash { height: 0; border-top: 2px dashed var(--muted); }
@media (max-width: 760px) {
  .has-levels .schart-plot { margin-right: 62px; }
  .schart-level { right: -62px; }
  .xh-stats { gap: 18px; }
  .xh-num { font-size: 19px; }
}
.xp-note { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.xp-note.warn { color: var(--warn); font-weight: 550; }

/* Today at a glance: a glassy panel under the pill (a bottom sheet on phones) */
.day-sheet-backdrop { display: none; }
.day-sheet {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 45; width: 360px; max-height: min(70vh, 560px); overflow-y: auto;
  padding: 14px 14px 16px; border-radius: 16px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .12);
  transform-origin: top right; text-align: left;
}
.day-sheet.anim { animation: ds-pop .32s cubic-bezier(.2, .9, .25, 1.15); }
@keyframes ds-pop { from { opacity: 0; transform: translateY(-8px) scale(.92); } to { opacity: 1; transform: none; } }
.day-sheet.anim .ds-row, .day-sheet.anim .ds-chip { animation: ds-in .35s cubic-bezier(.2, .8, .2, 1) backwards; }
.day-sheet.anim .ds-row:nth-child(2) { animation-delay: 40ms; } .day-sheet.anim .ds-row:nth-child(3) { animation-delay: 80ms; }
.day-sheet.anim .ds-row:nth-child(4) { animation-delay: 120ms; } .day-sheet.anim .ds-row:nth-child(n+5) { animation-delay: 160ms; }
.day-sheet.anim .ds-chip { animation-delay: 180ms; }
@keyframes ds-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .day-sheet.anim, .day-sheet.anim .ds-row, .day-sheet.anim .ds-chip { animation: none; } }
.ds-grip { display: none; }
.ds-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border-soft); }
.ds-head .ring text { font-size: 12px; font-weight: 700; fill: var(--text); }
.ds-big { font-size: 18px; font-weight: 700; }
.ds-xp { color: var(--accent); font-weight: 650; }
.ds-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 2px 6px; }
.ds-list { display: flex; flex-direction: column; gap: 2px; }
.ds-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; }
.ds-row:hover { background: var(--hover); }
.ds-row .check { flex-shrink: 0; }
.ds-body { flex: 1; min-width: 0; }
.ds-title { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.ds-meta { display: flex; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 1px; }
.ds-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.ds-done { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 10px; border-radius: 99px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.ds-chip .i { color: var(--ok); flex-shrink: 0; }
.ds-chip.more { text-decoration: none; }
.ds-empty { padding: 18px 8px 6px; text-align: center; color: var(--muted); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 7px; height: 12px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .7; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .main { padding: 40px 32px 90px; }
}
@media (max-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .plan-cols { grid-template-columns: minmax(0, 1fr); }
  .wheel-card { flex-direction: column; text-align: center; }
}
/* Touch screens: no hover lift, which would stick after a tap. */
@media (hover: none) {
  .goal-card:hover, .area-card:hover { transform: none; box-shadow: var(--shadow); }
  .mood-btn:hover { transform: none; }
  .entry:hover { box-shadow: var(--shadow); }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .tabbar { display: flex; }
  .main { padding: calc(20px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); }
  .cal-scroll { height: calc(100dvh - 330px - env(safe-area-inset-bottom)); min-height: 380px; }
  .cal-cols { left: 46px; right: 4px; }
  /* Easier reading on a phone: bigger block text, roomier padding */
  .cal-block { font-size: 13.5px; padding: 5px 9px 7px; border-radius: 8px; }
  .cb-time { font-size: 12px; }
  .cal-block.short .cb-time { font-size: 11.5px; }
  .cal-block.past { opacity: .65; }
  .cal-card.editing .cal-resize { height: 22px; }
  .cal-card.editing .cal-resize::after { width: 30px; height: 4px; margin-left: -15px; bottom: 5px; opacity: .7; }
  .plan-toolbar .day-nav { flex-wrap: wrap; justify-content: flex-end; }
  .cal-tools { margin-left: 2px; padding-left: 6px; }
  .edit-btn { padding: 0 10px; }
  /* Full screen on a phone: edge to edge, above the tab bar */
  .plan-page.expanded .cal-card { inset: 0; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .cal-xbar { padding: 10px 12px; gap: 8px; }
  .cx-title b { font-size: 18px; }
  .cx-controls { width: 100%; justify-content: space-between; }
  .cal-editbar .ceb-text .muted { display: none; }
  .cal-head { padding: 4px 4px 4px 46px; }
  .ch-day { font-size: 10px; }
  .ch-day b { width: 26px; height: 26px; font-size: 14px; }
  .view-week .cal-block { padding: 2px 3px 4px; font-size: 10.5px; border-left-width: 2px; border-radius: 4px; }
  .view-week .cb-time { display: none; }
  .cal-hour { width: 40px; font-size: 10px; }
  .cal-now-label { left: 1px; width: 42px; font-size: 9.5px; padding: 1px 2px; }
  .plan-toolbar { margin-top: -4px; }
  .nb-next { margin-left: 0; flex-basis: 100%; padding-left: 19px; }
  .ws-day { font-size: 10.5px; }
  .ws-day b { width: 28px; height: 28px; font-size: 15px; }
  .page-head .day-nav .icon-btn { width: 36px; height: 36px; }
  /* The installed app should never wobble sideways. */
  html, body { overflow-x: hidden; }
  .section-head .link { white-space: nowrap; }

  /* Phones zoom in on text boxes under 16px, so every input is 16px here. */
  .dot-num { font-size: 9.5px; }
  .amount-box input { font-size: 34px; }
  input, select, textarea,
  .quick-add input[name=title], .subtask-add input[name=title], .checkin-form input, .notes { font-size: 16px; }
  .quick-add select { font-size: 14px; }

  /* Bigger tap targets */
  .check { width: 24px; height: 24px; }
  .subtask .check { width: 20px; height: 20px; }
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn.subtle { width: 34px; height: 34px; }
  .btn.sm { padding: 7px 12px; }
  .sub-toggle { padding: 8px 8px; }
  .item { padding: 12px; }
  .nav-link, .more-link { min-height: 44px; }
  .subtask { padding: 6px 0; }

  /* Tabs and filter chips scroll sideways instead of wrapping onto several lines */
  .toolbar .seg, .chip-row {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px;
  }
  .toolbar .seg { width: auto; }
  .toolbar .seg::-webkit-scrollbar, .chip-row::-webkit-scrollbar { display: none; }
  .toolbar .seg-btn, .filter-chip { flex-shrink: 0; white-space: nowrap; }
  .filter-chip { padding: 6px 12px; }

  .page-head { margin-bottom: 18px; }
  .page-head .btn { padding: 8px 12px; }
  .section { margin-top: 26px; }
  .today-summary { gap: 16px; padding: 16px; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 28px; }
  h1 { font-size: 30px; }
  .hero-top h1 { font-size: 30px; }
  .goal-emoji.lg { width: 56px; height: 56px; font-size: 46px; }
  .hero-progress { gap: 16px; padding: 14px; }
  .ht-row { grid-template-columns: minmax(0, 1fr) repeat(7, 32px); padding: 7px 2px; }
  .ht-stat { display: none; }
  .ht-name { gap: 6px; padding-right: 4px; }
  .ht-name .habit-emoji { display: none; }
  .dot { width: 27px; height: 27px; }
  .habit-table { padding: 4px 8px; }
  .type-grid, .type-grid.modes { grid-template-columns: 1fr; }
  .field-row { flex-wrap: wrap; }
  .field-row > .field.grow { flex-basis: 140px; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; max-height: 92dvh; padding: 18px 16px 0; overscroll-behavior: contain; }
  /* Save / Cancel stay visible at the bottom of long forms */
  .modal-foot {
    position: sticky; bottom: 0; z-index: 2;
    margin: 18px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border-soft);
  }
  .modal-foot .btn { padding: 9px 14px; }
  .confirm { padding-bottom: 4px; }
  .modal-head { position: sticky; top: -18px; z-index: 2; background: var(--surface); margin: -18px -16px 10px; padding: 16px 16px 10px; }
  #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 31;
    right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 54px; height: 54px;
    border: 0; border-radius: 50%; background: var(--ink); color: var(--ink-text);
    box-shadow: 0 8px 24px rgba(15, 15, 15, .28);
  }
  .fab:active { transform: scale(.94); }
  body.modal-open .fab { display: none; }
  .palette-backdrop { padding: calc(8px + env(safe-area-inset-top)) 8px 0; place-items: start center; top: var(--vvt, 0); height: var(--vvh, 100%); bottom: auto; }
  .palette { max-height: calc(var(--vvh, 100dvh) - 24px - env(safe-area-inset-top)); }

  /* ---- iPhone pass ---- */
  /* Pop-ups follow the visible screen: when the keyboard opens they shrink to fit above it (--vvh, set in
     app.js from visualViewport), so fields and Save buttons are never hidden behind the keyboard. */
  .modal-backdrop { top: var(--vvt, 0); height: var(--vvh, 100%); bottom: auto; }
  .modal { max-height: calc(var(--vvh, 100dvh) - max(16px, env(safe-area-inset-top))); }
  /* Pop-ups without a Save/Cancel bar keep their last line clear of the home bar. */
  .modal:not(:has(.modal-foot)) { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  /* iPhone zooms the whole page into any text box under 16px — never let that happen. */
  :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea) { font-size: 16px !important; }
  /* Comfortable tap targets (Apple suggests 44pt) without changing how things look. */
  .check { position: relative; }
  .check::after { content: ''; position: absolute; inset: -9px; }
  .section-head .link, .section-head .link-btn.link { padding: 10px 4px; margin: -10px -4px; }
  .back { padding: 9px 10px 9px 4px; margin-top: -6px; }
  .linked-goal { padding: 8px 0; margin-top: 4px; }
  .chip.plain { padding: 5px 9px; }
  .ep-cat { padding: 8px 12px; }
  .icon-btn.subtle { width: 32px; height: 32px; }
  .goal-win { padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
  .seg-btn { min-height: 34px; }
  .palette input { padding-top: 10px; padding-bottom: 10px; }
  .day-progress-wrap { order: -1; flex-basis: 100%; }
  .day-progress { width: 100%; border-radius: 12px; }
  .dp-chevron { margin-left: auto; }
  .day-sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(10, 10, 10, .45); animation: ds-fade .25s ease; }
  @keyframes ds-fade { from { opacity: 0; } }
  .day-sheet {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 78dvh;
    border-radius: 20px 20px 0 0; border-bottom: 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
    background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; overscroll-behavior: contain;
  }
  .day-sheet.anim { animation: ds-up .38s cubic-bezier(.2, .9, .25, 1); }
  @keyframes ds-up { from { transform: translateY(100%); } }
  .ds-grip { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto 10px; }
  .ds-row { padding: 9px 6px; }
  .ds-title { font-size: 15px; }
  .main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .stat-row .nowrap { display: none; }
  .welcome { flex-direction: column; }
  .checkin-form { flex-wrap: wrap; }
  .checkin-form input[name=note] { flex-basis: 100%; order: 3; }
  .checkin-form input[type=number] { flex: 1; }
  .checkin.open .checkin-note { margin-left: 0; }
  .checkin > .muted:first-child { width: 64px; }
}

/* ---------- Insights ---------- */
.insights .page-head .seg { flex-wrap: nowrap; }
.ins-kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 26px; }
.ins-kpis .kpi { background: transparent; border: 0; border-top: 1px solid var(--border-soft); border-radius: 0; padding: 12px 2px 4px; }
.ins-kpis .kpi b { font-size: 28px; }
.ins-kpis .kpi b small { font-size: 15px; color: var(--muted); font-family: var(--sans); }
.ins-d { font-size: 12px; font-weight: 650; white-space: nowrap; }
.ins-d.up { color: var(--ok); }
.ins-d.down { color: var(--danger); }
.ins-d.same { color: var(--faint); }
.ins-note { margin: 10px 2px 0; }

/* Column charts */
.ins-chart { padding-top: 6px; }
.ic-plot { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 150px; border-bottom: 1px solid var(--border-soft); }
.ic-col { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.ic-stack { width: 100%; min-height: 0; display: flex; flex-direction: column; border-radius: 3px 3px 0 0; overflow: hidden; transition: height .4s ease; }
.ic-stack > span { display: block; min-height: 1px; background: var(--faint); }
.ic-col.cur .ic-stack > span:not([class^="e"]):not([style*="background"]) { background: var(--accent); }
.ic-col:hover .ic-stack { filter: brightness(1.15); }
.ic-avg { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--muted); pointer-events: none; z-index: 1; }
.ic-avg span { position: absolute; left: 0; bottom: 2px; font-size: 11px; color: var(--muted); background: var(--bg); padding: 0 4px; }
.ic-labels { display: flex; gap: 3px; margin-top: 6px; }
.ic-labels span { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--faint); white-space: nowrap; overflow: visible; }
/* Effort sizes: from faint (S) to full accent (XL) */
.e1 { background: color-mix(in srgb, var(--faint) 55%, transparent) !important; }
.e2 { background: var(--faint) !important; }
.e3 { background: color-mix(in srgb, var(--accent) 60%, var(--faint)) !important; }
.e4 { background: var(--accent) !important; }
.eff-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.eff-legend.inline { margin: 0; gap: 4px 10px; }
.eff-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.eff-mix { display: flex; height: 28px; border-radius: 8px; overflow: hidden; gap: 2px; }
.eff-mix span { display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--bg); min-width: 2px; }
.ins-calls { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-top: 16px; font-size: 14px; }
.ins-calls b { font-size: 18px; font-weight: 650; }

/* Horizontal rows */
.ins-rows { display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }
.ir-row { display: grid; grid-template-columns: minmax(82px, max-content) 1fr 64px; align-items: center; gap: 10px; font-size: 13px; }
.ir-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ir-bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.ir-bar span { display: block; height: 100%; border-radius: inherit; opacity: .55; transition: width .4s ease; }
.ir-row.top .ir-bar span { opacity: 1; }
.ir-row.top .ir-label, .ir-row.top .ir-val { color: var(--text); font-weight: 600; }
.ir-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ins-goal .stat-bar { width: 22%; }

/* AI review */
.review-card { margin-top: 4px; padding: 22px 24px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border-soft); }
.rv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rv-k { font-size: 12.5px; font-weight: 650; color: var(--accent); letter-spacing: .02em; }
.rv-headline { font-family: var(--serif); font-size: 22px; line-height: 1.3; margin: 0 0 10px; }
.rv-summary { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: 0 0 6px; }
.rv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.rv-sec { margin-top: 18px; }
.rv-sec h3 { font-size: 13px; font-weight: 650; color: var(--muted); margin: 0 0 8px; }
.rv-sec.wins h3 { color: var(--ok); }
.rv-sec.concerns h3 { color: var(--warn); }
.rv-sec.next h3 { color: var(--accent); }
.rv-note { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--border-soft); font-size: 14px; }
.rv-note:first-of-type { border-top: 0; padding-top: 0; }
.rv-note span { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.rv-goal { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; font-size: 14px; line-height: 1.5; cursor: pointer; }
.rv-pill { flex-shrink: 0; font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.rv-pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.rv-pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.rv-pill.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.rv-try { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14px; line-height: 1.5; }
.rv-try-k { display: block; font-size: 12px; font-weight: 650; color: var(--accent); margin-bottom: 2px; }
.rv-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.rv-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 4px 0 6px; }
.rv-empty p { margin: 0; max-width: 520px; }
.rv-loading { display: flex; align-items: center; gap: 16px; padding: 10px 0 8px; }
.rv-loading .coach-orb { flex-shrink: 0; }

@media (max-width: 760px) {
  .insights .head-actions { width: 100%; }
  .insights .page-head .seg { width: 100%; }
  .insights .page-head .seg-btn { flex: 1; white-space: nowrap; padding-left: 6px; padding-right: 6px; }
  .review-card { padding: 18px 16px 14px; }
  .rv-grid { grid-template-columns: 1fr; }
  .rv-headline { font-size: 19px; }
  .ic-plot { height: 120px; gap: 2px; }
  .ic-labels { gap: 2px; }
  .ir-row { grid-template-columns: 72px 1fr 56px; }
  .ins-goal .stat-bar { display: none; }
}

/* ---------- Rich notes ---------- */
:root { --c-red: #d44c47; --c-orange: #d9730d; --c-yellow: #b8860b; --c-green: #3f8f55; --c-blue: #2f74c0; --c-purple: #8a5cc7; --c-pink: #c4407f; --c-gray: #787774; }
:root[data-mode="dark"] { --c-red: #ff7b72; --c-orange: #ffa657; --c-yellow: #e3c45b; --c-green: #6fcf87; --c-blue: #79b8ff; --c-purple: #c89cff; --c-pink: #ff8ac0; --c-gray: #a9a69f; }
.tc-red { color: var(--c-red); } .tc-orange { color: var(--c-orange); } .tc-yellow { color: var(--c-yellow); } .tc-green { color: var(--c-green); }
.tc-blue { color: var(--c-blue); } .tc-purple { color: var(--c-purple); } .tc-pink { color: var(--c-pink); } .tc-gray { color: var(--c-gray); }
.hl-red, .hl-orange, .hl-yellow, .hl-green, .hl-blue, .hl-purple, .hl-pink, .hl-gray { border-radius: 3px; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hl-red { background: color-mix(in srgb, var(--c-red) 26%, transparent); } .hl-orange { background: color-mix(in srgb, var(--c-orange) 28%, transparent); }
.hl-yellow { background: color-mix(in srgb, #f5d000 38%, transparent); } .hl-green { background: color-mix(in srgb, var(--c-green) 26%, transparent); }
.hl-blue { background: color-mix(in srgb, var(--c-blue) 24%, transparent); } .hl-purple { background: color-mix(in srgb, var(--c-purple) 26%, transparent); }
.hl-pink { background: color-mix(in srgb, var(--c-pink) 24%, transparent); } .hl-gray { background: color-mix(in srgb, var(--c-gray) 24%, transparent); }

.rt { border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.rt:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.rt-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; z-index: 3; background: var(--surface); border-radius: 14px 14px 0 0; }
.rt-btn { min-width: 30px; height: 30px; padding: 0 6px; display: inline-grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.rt-btn:hover { background: var(--hover); color: var(--text); }
.rt-btn b, .rt-btn i, .rt-btn u, .rt-btn s { font-family: var(--serif); font-size: 16px; }
.rt-ol { font-weight: 700; font-size: 13px; }
.rt-q { font-size: 18px; line-height: 1; }
.rt-a { font-weight: 700; text-decoration: underline 3px var(--c-red); text-underline-offset: 3px; }
.rt-hl { font-weight: 600; padding: 0 3px; border-radius: 3px; background: color-mix(in srgb, #f5d000 45%, transparent); color: var(--text); }
.rt-clear { font-size: 15px; }
.rt-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.rt-saved { font-size: 12px; color: var(--faint); margin-right: 6px; }
.rt-fix { font-size: 12.5px; }
.rt-pop-wrap { position: relative; }
.rt-pop { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; padding: 8px; gap: 6px; grid-template-columns: repeat(5, 26px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.rt-pop-wrap.open .rt-pop, .rt-pop.open-pop { display: grid; }
.rt-pop.open-pop { position: fixed; z-index: 1000; top: auto; }
.rt-sw { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border-soft); cursor: pointer; display: grid; place-items: center; color: var(--muted); background: var(--surface-2); }
.rt-sw:hover { transform: scale(1.1); }
.rt-pop-label { grid-column: 1 / -1; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 0 2px 2px; }
.rt-sw { font-weight: 800; font-size: 14px; color: var(--text); background: var(--surface); }
.rt-sw.sw-tc.sw-red { color: var(--c-red); } .rt-sw.sw-tc.sw-orange { color: var(--c-orange); } .rt-sw.sw-tc.sw-yellow { color: var(--c-yellow); } .rt-sw.sw-tc.sw-green { color: var(--c-green); }
.rt-sw.sw-tc.sw-blue { color: var(--c-blue); } .rt-sw.sw-tc.sw-purple { color: var(--c-purple); } .rt-sw.sw-tc.sw-pink { color: var(--c-pink); } .rt-sw.sw-tc.sw-gray { color: var(--c-gray); }
.rt-sw.sw-hl.sw-red { background: color-mix(in srgb, var(--c-red) 45%, var(--surface)); } .rt-sw.sw-hl.sw-orange { background: color-mix(in srgb, var(--c-orange) 45%, var(--surface)); }
.rt-sw.sw-hl.sw-yellow { background: color-mix(in srgb, #f5d000 55%, var(--surface)); } .rt-sw.sw-hl.sw-green { background: color-mix(in srgb, var(--c-green) 45%, var(--surface)); }
.rt-sw.sw-hl.sw-blue { background: color-mix(in srgb, var(--c-blue) 45%, var(--surface)); } .rt-sw.sw-hl.sw-purple { background: color-mix(in srgb, var(--c-purple) 45%, var(--surface)); }
.rt-sw.sw-hl.sw-pink { background: color-mix(in srgb, var(--c-pink) 45%, var(--surface)); } .rt-sw.sw-hl.sw-gray { background: color-mix(in srgb, var(--c-gray) 45%, var(--surface)); }
.rt-sw.none { font-weight: 400; }
.rt-redo { display: grid; transform: scaleX(-1); }

.rt-body, .rt-view { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.rt-body { padding: 14px 18px 18px; min-height: 110px; outline: none; cursor: text; }
.rt.big .rt-body { min-height: 240px; padding: 18px 22px 24px; font-size: 15.5px; }
.rt-body:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.rt-body > :first-child, .rt-view > :first-child { margin-top: 0; }
.rt-body p, .rt-view p { margin: 0 0 6px; }
.rt-body h2, .rt-view h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 18px 0 6px; line-height: 1.3; }
.rt-body h3, .rt-view h3 { font-size: 16.5px; font-weight: 650; margin: 14px 0 4px; }
.rt-body ul, .rt-body ol, .rt-view ul, .rt-view ol { margin: 4px 0 8px; padding-left: 24px; }
.rt-body li, .rt-view li { margin: 2px 0; }
.rt-body blockquote, .rt-view blockquote { margin: 8px 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.rt-body a, .rt-view a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.rt-body code, .rt-view code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.rt-body hr, .rt-view hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
/* Checklists: a box on each line, tick it to cross the item off */
.rt-body ul[data-check], .rt-view ul[data-check] { list-style: none; padding-left: 4px; }
.rt-body ul[data-check] > li, .rt-view ul[data-check] > li { position: relative; padding-left: 28px; }
.rt-body ul[data-check] > li::before, .rt-view ul[data-check] > li::before {
  content: ''; position: absolute; left: 0; top: .3em; width: 17px; height: 17px; border-radius: 5px; border: 1.6px solid var(--muted); cursor: pointer; box-sizing: border-box;
}
.rt-body ul[data-check] > li[data-done]::before, .rt-view ul[data-check] > li[data-done]::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat; border-color: var(--accent);
}
.rt-body ul[data-check] > li[data-done], .rt-view ul[data-check] > li[data-done] { color: var(--faint); text-decoration: line-through; }
.goal-notes .section-head h2, .files-sec .section-head h2 { display: inline-flex; align-items: center; gap: 7px; }
.goal-notes { margin-top: 22px; }
.field-row-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Fix writing */
.fix-panel { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border-soft); font-size: 14px; }
.fix-panel.loading, .fix-panel.ok, .fix-panel.err { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.fix-panel.ok { color: var(--ok); }
.fix-panel.err { color: var(--danger); }
.fix-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.fix-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; margin-bottom: 10px; }
.fix-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.fix-row s { color: var(--danger); text-decoration-thickness: 1.5px; }
.fix-row b { color: var(--ok); }
.fix-arrow { color: var(--faint); }
.fix-preview { max-height: 220px; overflow-y: auto; padding: 10px 12px; border-radius: 8px; background: var(--surface); line-height: 1.6; white-space: normal; }
.fix-mark { background: color-mix(in srgb, var(--ok) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.fix-spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: fix-spin .8s linear infinite; display: inline-block; flex-shrink: 0; }
@keyframes fix-spin { to { transform: rotate(360deg); } }

/* ---------- Files & links ---------- */
.files-sec.drop-on { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 12px; }
.file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--surface); cursor: pointer; min-width: 0; transition: border-color .15s, background .15s; }
.file-row:hover { border-color: var(--border); background: var(--hover); }
.file-row.uploading { opacity: .7; cursor: default; }
.file-ic { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); font-size: 18px; }
.file-ic.big { width: 64px; height: 64px; font-size: 34px; border-radius: 16px; }
.file-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-weight: 550; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-empty { padding: 16px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: 13.5px; text-align: center; }
.link-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.link-form input[name=url] { flex: 2 1 260px; }
.link-form input[name=name] { flex: 1 1 140px; }
.link-form input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
/* Viewer */
.modal.file-viewer { width: min(1100px, calc(100vw - 32px)); max-width: none; height: min(88vh, 1000px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.fv-head { gap: 10px; padding: 12px 14px; margin: 0; border-bottom: 1px solid var(--border-soft); }
.fv-head h3 { margin: 0; font-size: 15px; }
.fv-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.fv-frame { flex: 1; width: 100%; min-height: 60vh; border: 0; background: #fff; }
.fv-note { padding: 6px 14px; margin: 0; }
.fv-img { flex: 1; display: grid; place-items: center; padding: 16px; background: var(--surface-2); }
.fv-img img { max-width: 100%; max-height: 75vh; border-radius: 8px; }
.fv-media { width: 100%; max-height: 75vh; background: #000; }
.fv-pre { margin: 0; padding: 18px 22px; font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.fv-doc { padding: 26px clamp(18px, 6vw, 70px); max-width: 860px; margin: 0 auto; width: 100%; }
.fv-doc table { border-collapse: collapse; }
.fv-loading, .fv-link { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 20px; color: var(--muted); text-align: center; }
.fv-loading { flex-direction: row; }
.fv-url { color: var(--accent); word-break: break-all; }
.sheet-tabs { margin: 10px 12px 0; }
.sheet-tab { display: none; flex: 1; min-height: 0; }
.sheet-tab.on { display: block; }
.sheet-scroll { overflow: auto; height: 100%; padding: 12px; }
table.sheet { border-collapse: collapse; font-size: 13px; }
table.sheet th, table.sheet td { border: 1px solid var(--border-soft); padding: 5px 9px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
table.sheet th { background: var(--surface-2); font-weight: 600; position: sticky; top: 0; }
/* Review: things it learned about you */
.rv-mem-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border-soft); font-size: 14px; }
.rv-mem-row:first-of-type { border-top: 0; }

@media (max-width: 760px) {
  .rt-bar { gap: 0; padding: 4px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .rt-bar::-webkit-scrollbar { display: none; }
  .rt-btn { min-width: 36px; height: 36px; }
  .rt-bar .grow, .rt-saved { display: none; }
  .rt-fix { order: -1; flex-shrink: 0; margin-right: 4px; }
  .rt.big .rt-body { min-height: 200px; padding: 14px 14px 20px; }
  .rt-pop { position: fixed; left: 50%; top: auto; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); }
  .file-list { grid-template-columns: minmax(0, 1fr); }
  .modal.file-viewer { width: 100vw; height: calc(var(--vvh, 100dvh) - env(safe-area-inset-top)); border-radius: 18px 18px 0 0; }
  .fv-head .btn { padding: 6px 9px; }
}

/* Insights: chapters and the extra charts */
.ins-chapter { display: flex; align-items: flex-start; gap: 14px; margin: 46px 0 6px; padding-top: 22px; border-top: 1px solid var(--border-soft); }
.insights .page-head + .ins-chapter { margin-top: 6px; padding-top: 0; border-top: 0; }
.ins-ch-n { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); margin-top: 2px; }
.ins-chapter h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin: 0; }
.ins-chapter p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.ins-chapter + .review-card, .ins-chapter + .section { margin-top: 14px; }
.ins-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; padding-top: 4px; }
.ins-stats > div { display: flex; flex-direction: column; gap: 2px; }
.ins-stats b { font-family: var(--serif); font-size: 24px; font-weight: 500; }
.ins-stats span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.ic-pair { width: 100%; height: 100%; display: flex; align-items: flex-end; gap: 1px; }
.ic-pair span { flex: 1; min-height: 1px; border-radius: 2px 2px 0 0; }
.pa { background: var(--faint); }
.pb { background: var(--accent); }
.eff-legend i.pa, .eff-legend i.pb { display: inline-block; }
.hm-wrap { display: flex; gap: 6px; }
.hm-rows { display: grid; grid-template-rows: repeat(7, 12px); gap: 3px; font-size: 10px; color: var(--faint); line-height: 12px; padding-top: 0; }
.hm-scroll { overflow-x: auto; padding-bottom: 4px; }
.hm-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); grid-auto-columns: 12px; gap: 3px; }
.hm-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--track); display: inline-block; }
.hm-cell.l-1 { background: transparent; }
.hm-cell.l1 { background: color-mix(in srgb, var(--accent) 28%, var(--track)); }
.hm-cell.l2 { background: color-mix(in srgb, var(--accent) 52%, var(--track)); }
.hm-cell.l3 { background: color-mix(in srgb, var(--accent) 76%, var(--track)); }
.hm-cell.l4 { background: var(--accent); }
.hm-cell.perfect { box-shadow: inset 0 0 0 2px #cb912f; }
.hm-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.hm-legend span:not(.hm-cell) { margin: 0 4px; }
@media (min-width: 761px) { .insights .hm-grid { grid-template-rows: repeat(7, 14px); grid-auto-columns: 14px; } .insights .hm-cell { width: 14px; height: 14px; } .insights .hm-rows { grid-template-rows: repeat(7, 14px); line-height: 14px; } }
@media (max-width: 760px) { .ins-chapter { margin-top: 34px; } .ins-chapter h2 { font-size: 19px; } .ins-stats b { font-size: 20px; } }

/* Theme list (Settings → Appearance) */
.tl-search { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; padding: 0 10px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-2); }
.tl-search input { flex: 1; border: 0; background: transparent; padding: 9px 0; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.theme-list { max-height: 520px; overflow-y: auto; margin: 0 -6px; padding: 0 6px 6px; overscroll-behavior: contain; }
.tl-group[hidden], .theme-row[hidden] { display: none; }
.tl-group .theme-group-label { position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 10px 2px 6px; margin: 0; }
.tl-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 8px; }
.theme-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.theme-row:hover, .theme-row:focus-visible { background: var(--hover); border-color: var(--border-soft); outline: none; }
.theme-row.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tr-sw { flex-shrink: 0; width: 42px; height: 24px; border-radius: 6px; display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid rgba(128, 128, 128, .35); }
.tr-sw i { flex: 1; height: 100%; border-radius: 3px; }
.tr-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-mode { color: var(--faint); font-size: 12px; }
.tr-check { color: var(--accent); display: grid; }
@media (max-width: 760px) { .theme-list { max-height: 60vh; } .tl-rows { grid-template-columns: minmax(0, 1fr); } .theme-row { padding: 10px 8px; } }

/* Sick mode / breaks */
.th-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sick-btn { color: var(--muted); }
.sick-banner { display: flex; align-items: center; gap: 14px; margin: -8px 0 22px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--c-blue, #2f74c0) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c-blue, #2f74c0) 25%, var(--border-soft)); }
.sb-ic { font-size: 28px; line-height: 1; }
.sick-banner .grow { display: flex; flex-direction: column; gap: 2px; }
.sick-banner b { font-size: 15px; }
.sick-banner .grow span { font-size: 13px; color: var(--muted); }
.welcome-back p { line-height: 1.55; }
.welcome-back .check-field small { display: block; margin-top: 2px; }
.hm-cell.paused { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c-blue, #2f74c0) 45%, transparent) 0 2px, transparent 2px 4px), var(--track); }
.ic-col.paused { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c-blue, #2f74c0) 16%, transparent) 0 3px, transparent 3px 7px); border-radius: 3px 3px 0 0; }
.ic-stack > span.paused-bar { background: color-mix(in srgb, var(--c-blue, #2f74c0) 55%, var(--faint)); }
@media (max-width: 760px) {
  .sick-btn span { display: none; }
  .sick-banner { flex-wrap: wrap; margin-top: -4px; }
  .sick-banner .btn { margin-left: auto; }
}

/* Reminders */
.push-status { margin: 10px 0 6px; }
.push-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; line-height: 1.45; }
.push-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.push-dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.push-dot.err { background: var(--danger); }
.rem-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rem-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--text); font-size: 13.5px; font-weight: 550; }
.rem-chip .icon-btn { width: 22px; height: 22px; }
.rem-add { display: inline-flex; gap: 6px; align-items: center; }
.rem-add input[type=time] { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }

/* File viewer on its own layer (above dialogs); inline "Remove?" */
.fv-backdrop { z-index: 70; }
.file-row.confirm { cursor: default; border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.file-row.confirm .btn { flex-shrink: 0; }
.files-sec.compact { margin-top: 18px; }
.files-sec.compact .section-head { margin-bottom: 8px; }
.files-sec.compact .file-list { grid-template-columns: minmax(0, 1fr); }
.files-sec.compact .file-empty { padding: 10px; }
.modal .files-sec .section-head h2 { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ---------- Side panel (laptop) / sheet (phone) for tasks, habits, goals, entries ---------- */
.sheet-grip { display: none; }
@media (min-width: 900px) {
  .modal-backdrop.as-panel { background: transparent; pointer-events: none; display: block; padding: 0; animation: none; }
  .modal-backdrop.as-panel .modal {
    pointer-events: auto; position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 92vw; max-height: none; height: 100vh;
    border-radius: 0; border-left: 1px solid var(--border); box-shadow: -14px 0 40px rgba(0, 0, 0, .16); padding: 18px 22px 0;
    display: flex; flex-direction: column; animation: panel-in .22s cubic-bezier(.2, .8, .2, 1);
  }
  .modal.panel > form { flex: 1; display: flex; flex-direction: column; }
  .modal.panel .modal-foot { position: sticky; bottom: 0; margin: auto -22px 0; padding: 12px 22px; background: var(--surface); border-top: 1px solid var(--border-soft); z-index: 2; }
  @keyframes panel-in { from { transform: translateX(30px); opacity: 0; } }
  /* Wide screens: the page makes room, so the list stays fully visible next to the panel. */
  body.panel-open .main { transition: padding-right .2s ease; }
  body.panel-open .coach-fab-wrap { right: 484px; }
}
@media (min-width: 1280px) { body.panel-open .main { padding-right: 500px; } }
@media (max-width: 760px) {
  .modal.panel { animation: sheet-up .28s cubic-bezier(.2, .9, .25, 1); }
  .modal.panel .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: -8px auto 10px; }
  @keyframes sheet-up { from { transform: translateY(40%); opacity: .6; } }
}

/* ---------- Shorter task form ---------- */
.task-title-input { width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 20px; font-weight: 600; padding: 4px 0 10px; outline: none; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; }
.task-title-input:focus { border-bottom-color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-btn:hover { color: var(--text); border-color: var(--muted); }
.chip-btn.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--text); }
.date-chip { padding: 2px 4px 2px 10px; }
.date-chip input { border: 0; background: transparent; color: inherit; font: inherit; font-size: 13px; padding: 4px; max-width: 135px; }
.chip-select { appearance: none; -webkit-appearance: none; padding-right: 14px; max-width: 170px; }
.more-opts { border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); margin: 4px 0; }
.more-opts > summary { display: flex; align-items: center; gap: 10px; padding: 12px 2px; cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; }
.more-opts > summary::-webkit-details-marker { display: none; }
.more-opts > summary .muted { flex: 1; min-width: 0; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-opts > summary .i { color: var(--faint); transition: transform .2s; transform: rotate(90deg); flex-shrink: 0; }
.more-opts[open] > summary .i { transform: rotate(-90deg); }
.more-body { display: flex; flex-direction: column; gap: 14px; padding: 2px 0 16px; }
.task-form .why-banner { margin-top: 10px; }

/* Quick add: what it understood */
.qp-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.qp-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); font-size: 12.5px; font-weight: 550; }
.qp-chip .warn { font-weight: 550; }

/* ---------- New goal wizard ---------- */
.wz-steps { display: flex; gap: 6px; margin: -4px 0 18px; }
.wz-dot { flex: 1; padding-top: 8px; border-top: 3px solid var(--track); font-size: 12px; font-weight: 600; color: var(--faint); transition: border-color .2s, color .2s; }
.wz-dot.on { border-top-color: var(--accent); color: var(--text); }
.wizard .wz-step { display: none; flex-direction: column; gap: 14px; min-height: 230px; }
.wizard[data-step="1"] .wz-step[data-n="1"], .wizard[data-step="2"] .wz-step[data-n="2"], .wizard[data-step="3"] .wz-step[data-n="3"], .wizard[data-step="4"] .wz-step[data-n="4"] { display: flex; animation: wz-in .2s ease; }
@keyframes wz-in { from { opacity: 0; transform: translateX(10px); } }
.wizard[data-step="1"] .wz-back, .wizard[data-step="4"] .wz-next, .wizard:not([data-step="4"]) .wz-done { display: none; }
.wz-first { display: flex; align-items: center; gap: 10px; }
.wz-num { width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); font-size: 13px; font-weight: 700; }
.wz-first input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.wz-ai { align-self: flex-start; }
.wz-hint { margin: 0; }

/* ---------- Goal page: next step + tabs ---------- */
.next-step { margin: 18px 0 6px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--c, var(--accent)) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 35%, var(--border-soft)); }
.ns-k { font-size: 12px; font-weight: 700; color: color-mix(in srgb, var(--c, var(--accent)) 75%, var(--text)); margin-bottom: 8px; }
.ns-row { display: flex; align-items: center; gap: 12px; }
.ns-row .check { width: 24px; height: 24px; }
.ns-body { flex: 1; min-width: 0; cursor: pointer; }
.ns-title { font-size: 16.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.ns-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.next-step.empty .quick-add { margin: 8px 0 0; }
.ns-breakdown { margin: 10px 0 0 36px; }
.ns-breakdown summary { width: fit-content; color: var(--muted); font-size: 14px; cursor: pointer; }
.ns-breakdown .quick-add { margin: 8px 0 0; }
.next-step .ns-meta { overflow-wrap: anywhere; }
.goal-tabs { margin-top: 22px; }
.tab-dot-in { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 2px; }
.goal-tabs .count { margin-left: 5px; }
@media (max-width: 760px) { .ns-row { flex-wrap: wrap; } .ns-row .btn { margin-left: 36px; } }

/* One + button on phones: the AI is in its menu (Ask AI, Coach me), so the ✨ button doesn't float over lists. */
@media (max-width: 760px) { .coach-fab-wrap { display: none !important; } }
@media (max-width: 760px) {
  .palette-backdrop.mode-new { place-items: end center; padding: 0 0 calc(8px + env(safe-area-inset-bottom)); }
  .palette-backdrop.mode-new .palette { width: calc(100vw - 16px); border-radius: 18px; animation: sheet-up .25s cubic-bezier(.2, .9, .25, 1); }
  .palette-backdrop.mode-new .palette-item { padding-top: 12px; padding-bottom: 12px; }
}

/* ---------- Settings: four groups with a sticky index ---------- */
.set-index { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 10px 0; margin: -10px 0 6px; background: var(--bg); }
.set-index::-webkit-scrollbar { display: none; }
.set-index .chip-btn { flex-shrink: 0; }
.set-group { font-family: var(--serif); font-size: 21px; font-weight: 500; margin: 34px 0 12px; scroll-margin-top: 64px; }
.set-index + .set-group { margin-top: 14px; }
@media (max-width: 760px) { .set-index { top: env(safe-area-inset-top); } }

/* ===== Round 2: planning, snooze, selection, day/night, calendar ===== */
.snooze-tag { color: var(--muted); font-style: italic; }
.planned-note.quiet { color: var(--muted); background: var(--surface-2); font-weight: 550; }
.planned-note.quiet:hover { color: var(--text); }

/* Energy filter above the plate */
.chip-row.plate-filter { margin: 0 0 10px; gap: 5px; }
.plate-filter .chip-btn { padding: 4px 10px; font-size: 12.5px; }
.plate-filter .count { margin-left: 0; }

/* Overdue clean-up */
.overdue-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 10px; margin: 0 0 10px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); font-size: 13.5px; }
.overdue-bar b { color: var(--danger); }
.overdue-bar .grow { flex: 1; }
.overdue-bar .chip-btn { padding: 4px 10px; font-size: 12.5px; }

/* Morning check-in */
.morning { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 0 1px var(--border-soft), var(--shadow); }
.mc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.mc-list { display: flex; flex-direction: column; }
.mc-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border-soft); }
.mc-row:first-child { border-top: 0; }
.mc-title { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.mc-btns { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.mc-btns .chip-btn { padding: 3px 9px; font-size: 12.5px; }

/* This week's 3 priorities on Today */
.prio-strip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; font-size: 13px; }
.ps-k { font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-decoration: none; margin-right: 2px; }
.ps-k:hover { color: var(--accent); }
.ps-p { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 99px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; max-width: 100%; }
.ps-p:hover { border-color: var(--border); }
.ps-n { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; flex-shrink: 0; }
.ps-p.done { color: var(--muted); text-decoration: line-through; }
.ps-p.done .ps-n { background: var(--ok); color: var(--on-ok); }
.week-nudge { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 9px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); text-decoration: none; font-size: 13.5px; }
.week-nudge > span { flex: 1; min-width: 0; }
.week-nudge:hover { filter: brightness(1.03); }

/* Weekly planning page */
.week-page .section { margin-bottom: 22px; }
.week-last { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.week-last b { font-size: 20px; color: var(--text); margin-right: 3px; }
.wk-pr { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wk-pr input[name^=p] { flex: 1; min-width: 0; }
.wk-pr select { max-width: 180px; }
.wk-spread { display: flex; flex-direction: column; }
.wk-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border-soft); }
.wk-title { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.wk-days { display: flex; gap: 3px; flex-shrink: 0; }
.wk-day { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-soft); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.wk-day:hover { color: var(--text); border-color: var(--border); }
.wk-day.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Select several tasks */
body.selecting #main .item.task:not(.done) { cursor: pointer; }
body.selecting #main .item.task .check { pointer-events: none; }
#main .item.task.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.sel-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 8px 10px 8px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); font-size: 13.5px; }
.sel-count { white-space: nowrap; color: var(--muted); }
.sel-count b { color: var(--text); }
.sel-btns { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.sel-btns .chip-btn { padding: 5px 10px; font-size: 13px; flex-shrink: 0; }
.sel-btns .chip-btn:disabled { opacity: .45; cursor: default; }
.chip-btn.danger-btn:not(:disabled):hover { color: var(--danger); border-color: var(--danger); }

/* Rename in place */
.rename-input { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--accent); border-radius: 6px; padding: 2px 6px; margin: -3px -7px; outline: none; }
#main .item.task .item-title { -webkit-touch-callout: none; }

/* Day and night themes */
input.switch { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--track); position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; margin: 0; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(16px); }
.daynight { margin: 14px 0 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-soft); }
.daynight .dn-head { margin: 0; cursor: pointer; }
.dn-grid { display: grid; grid-template-columns: 1fr 110px; gap: 8px 10px; margin-top: 10px; }
.dn-grid .field { margin: 0; }

/* Calendar link */
.cal-link { display: flex; gap: 6px; margin: 8px 0 10px; }
.cal-link input { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.cal-help { margin-top: 10px; }
.cal-help summary { cursor: pointer; }

@media (max-width: 760px) {
  .mc-row { flex-wrap: wrap; }
  .mc-title { flex-basis: 100%; }
  .overdue-bar .grow { flex-basis: 100%; height: 0; }
  .sel-bar { left: 8px; right: 8px; transform: none; bottom: calc(68px + env(safe-area-inset-bottom)); max-width: none; flex-wrap: wrap; gap: 6px; }
  .sel-btns { order: 3; flex-basis: 100%; }
  .sel-count { flex: 1; }
  .wk-row { flex-wrap: wrap; }
  .wk-title { flex-basis: 100%; }
  .wk-pr { flex-wrap: wrap; }
  .wk-pr select { max-width: none; flex: 1; margin-left: 34px; }
  .dn-grid { grid-template-columns: 1fr 100px; }
}
/* ===== Round 3: priorities card, done habits, sick card, 3D character ===== */
.cm-item[hidden] { display: none; }

/* This week's priorities on Today */
.prio-card { margin: 0 0 18px; padding: 14px 16px 16px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 62%); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, var(--border-soft)), var(--shadow); }
.pc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pc-k { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.pc-meta { flex: 1; font-size: 12.5px; color: var(--muted); }
.pc-edit { font-size: 12.5px; color: var(--muted); text-decoration: none; font-weight: 550; }
.pc-edit:hover { color: var(--text); }
.pc-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.pc-item { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; min-width: 0; transition: transform .12s, border-color .12s, box-shadow .12s; }
.pc-item:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.pc-check { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent); font-size: 13px; font-weight: 750; }
.pc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-text b { font-size: 14.5px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.pc-text small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-item.done { background: transparent; border-style: dashed; }
.pc-item.done .pc-check { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.pc-item.done .pc-text b { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); font-weight: 550; }
.prio-card.all-done { background: linear-gradient(135deg, color-mix(in srgb, var(--ok) 12%, var(--surface)), var(--surface) 62%); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 30%, var(--border-soft)), var(--shadow); }
.prio-card.all-done .pc-k { color: var(--ok); }

/* Habits checked off today: at the bottom, quieter, still fully usable */
.hcard.is-done, .hk-tile.is-done, .ht-row.is-done, .item.habit.done { opacity: .58; filter: saturate(.55); transition: opacity .2s, filter .2s; }
.hcard.is-done:hover, .hk-tile.is-done:hover, .ht-row.is-done:hover, .item.habit.done:hover,
.hcard.is-done:focus-within, .ht-row.is-done:focus-within { opacity: 1; filter: none; }
.hcard.is-done { background: transparent; box-shadow: none; }

/* 3D character */
.lb-avatar[data-act], .hero-avatar[data-act] { cursor: pointer; }
.lb-avatar[data-act] { transition: transform .15s; }
.lb-avatar[data-act]:hover { transform: scale(1.35) rotate(-8deg); }
.hero-avatar[data-act] .hero-emoji { transition: transform .2s; }
.hero-avatar[data-act]:hover .hero-emoji { transform: scale(1.08) rotate(-4deg); }
.hero-3d { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); }
.hero-avatar .hero-level { bottom: 18px; }
body.av-open { overflow: hidden; }
#av-root { position: fixed; inset: 0; z-index: 200; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: grid; place-items: center; padding: 20px; animation: av-in .2s ease-out; }
@keyframes av-in { from { opacity: 0; } }
.av-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; width: min(1060px, 100%); height: min(680px, 100%); border-radius: 22px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-lg); }
.av-stage { position: relative; min-height: 0; background: radial-gradient(ellipse at 50% 38%, color-mix(in srgb, var(--accent) 22%, var(--surface-2)), var(--bg) 72%); touch-action: none; }
.av-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.av-stage canvas:active { cursor: grabbing; }
.av-id { position: absolute; top: 18px; left: 20px; display: flex; flex-direction: column; gap: 1px; pointer-events: none; }
.av-kicker { font-size: 10.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.av-id b { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.av-id span:last-child { font-size: 13px; color: var(--muted); }
.av-hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted); pointer-events: none; }
.av-close { position: absolute; top: 14px; right: 14px; background: var(--surface); box-shadow: var(--shadow); border-radius: 50%; width: 34px; height: 34px; }
.av-load { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: var(--muted); font-size: 14px; }
.av-ward { display: flex; flex-direction: column; min-height: 0; padding: 18px 16px 12px; border-left: 1px solid var(--border-soft); }
.aw-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.aw-head h3 { margin: 0; font-size: 17px; }
.aw-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.aw-tab { position: relative; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border-soft); background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.aw-tab.on { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.aw-tab.worn::after { content: ""; position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.aw-grid { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 0; padding: 2px; }
.aw-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 13px; border: 1.5px solid color-mix(in srgb, var(--r) 45%, var(--border-soft)); background: linear-gradient(100deg, color-mix(in srgb, var(--r) 10%, var(--surface)), var(--surface) 55%); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.aw-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.aw-ic { width: 44px; height: 44px; flex-shrink: 0; border-radius: 11px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--r) 16%, var(--surface-2)); }
.aw-txt { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.aw-txt b { font-size: 14px; }
.aw-rar { font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--r); }
.aw-how { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.aw-item.on { border-color: var(--r); box-shadow: 0 0 0 2px color-mix(in srgb, var(--r) 35%, transparent); }
.aw-item.locked { background: var(--surface-2); border-style: dashed; cursor: default; }
.aw-item.locked .aw-ic { font-size: 18px; filter: grayscale(1); opacity: .7; }
.aw-item.locked b { color: var(--muted); }
.aw-item.r-hard:not(.locked) { box-shadow: 0 0 14px color-mix(in srgb, var(--r) 25%, transparent); }
.aw-item.r-legendary:not(.locked) { background: linear-gradient(100deg, color-mix(in srgb, var(--r) 24%, var(--surface)), var(--surface) 50%, color-mix(in srgb, var(--r) 14%, var(--surface))); background-size: 200% 100%; animation: aw-shine 3.5s linear infinite; box-shadow: 0 0 18px color-mix(in srgb, var(--r) 35%, transparent); }
@keyframes aw-shine { to { background-position: -200% 0; } }
.aw-foot { margin: 10px 2px 0; }
@media (prefers-reduced-motion: reduce) { .aw-item.r-legendary:not(.locked) { animation: none; } }

@media (max-width: 760px) {
  .pc-list { grid-template-columns: 1fr; gap: 8px; }
  .pc-item { padding: 11px 12px; }
  #av-root { padding: 0; }
  .av-wrap { grid-template-columns: 1fr; grid-template-rows: 46% minmax(0, 1fr); width: 100%; height: 100%; border-radius: 0; }
  .av-ward { border-left: 0; border-top: 1px solid var(--border-soft); padding: 12px 12px calc(10px + env(safe-area-inset-bottom)); }
  .av-id { top: calc(12px + env(safe-area-inset-top)); left: 14px; }
  .av-id b { font-size: 20px; }
  .av-close { top: calc(10px + env(safe-area-inset-top)); }
  .aw-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .aw-tab { flex-shrink: 0; }
}
/* ===== Round 4: follow-through nudges, loot, climber, design polish ===== */

/* Habit nudges */
.habit-nudges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; font-size: 12px; }
.habit-nudges .cue { color: var(--muted); font-style: italic; }
.miss-twice { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-weight: 700; color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.mini-day { padding: 2px 8px; border-radius: 99px; font-weight: 600; color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.mini-btn { padding: 2px 9px; border-radius: 99px; border: 1px dashed var(--border); background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-btn:hover { color: var(--text); border-color: var(--muted); border-style: solid; }
.hcard:has(.miss-twice), .item.habit:has(.miss-twice) { box-shadow: inset 3px 0 0 var(--warn); }

/* Quiet goal: its why, on Today */
.fg-why { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.fg-why i { color: var(--text); }
.pct { min-width: 36px; white-space: nowrap; }

/* Stuck task */
.stuck p { margin: 0 0 12px; }
.stuck .why-banner { margin-bottom: 12px; }

/* Check-off: a springy pop */
@keyframes check-pop { 0% { transform: scale(.6); } 45% { transform: scale(1.32); } 70% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes check-ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c, var(--accent)) 55%, transparent); } to { box-shadow: 0 0 0 14px transparent; } }
@keyframes row-pop { 0% { background: color-mix(in srgb, var(--ok) 16%, transparent); } 100% { background: transparent; } }
.check.pop, .hc-check.pop, .dot.pop { animation: check-pop .42s cubic-bezier(.3, 1.6, .5, 1), check-ring .6s ease-out; }
.item.row-pop { animation: row-pop .9s ease-out; }
.pc-item.done .pc-check { animation: check-pop .42s cubic-bezier(.3, 1.6, .5, 1); }
@media (prefers-reduced-motion: reduce) { .check.pop, .hc-check.pop, .dot.pop, .item.row-pop, .pc-item.done .pc-check { animation: none; } }

/* Your climber on empty screens */
.climber { display: block; object-fit: contain; cursor: pointer; transition: transform .2s; }
.climber:hover { transform: translateY(-3px) rotate(-3deg); }
.climber.lg { width: 132px; height: 132px; margin: -10px auto 6px; }
.climber.lg:not(.ready) { width: 64px; height: 64px; margin: 0 auto 14px; }
.climber.sm { width: 46px; height: 46px; flex-shrink: 0; }
.climber.sm:not(.ready) { width: 26px; height: 26px; }

/* One accent per screen: on Today, colour is kept for the day's progress and the one thing to do next */
.today-page .prio-card, .today-page .prio-card.all-done { background: var(--surface); box-shadow: 0 0 0 1px var(--border-soft), var(--shadow); }
.today-page .pc-k { color: var(--muted); }
.today-page .pc-check { border-color: var(--border); color: var(--muted); }
.today-page .pc-item:hover { border-color: var(--border); }
.today-page .planned-note { color: var(--muted); background: var(--surface-2); }
.today-page .focus-section .section-head h2 .i { color: var(--muted); }
.today-page .focus-section .zone-focus { border-top-color: var(--border-soft); }
.today-page .slice-tag, .today-page .item-meta .accent { color: var(--text); }
.today-page .overdue-bar { background: var(--surface-2); border-color: var(--border-soft); }
.today-page .week-nudge { background: var(--surface-2); }
/* …the next thing to do: the first focus task */
.today-page .zone-focus > :first-child:not(.done) .item-title, .today-page .zone-focus > .task-wrap:first-child .item-title { font-weight: 650; }
.today-page .zone-focus > .item.task:first-child, .today-page .zone-focus > .task-wrap:first-child > .item.task { box-shadow: inset 3px 0 0 var(--accent); }

/* Bigger, calmer type and more air */
h1 { font-size: 38px; letter-spacing: -.02em; line-height: 1.15; }
.section { margin-top: 38px; }
.section-head { margin-bottom: 14px; }
.section-head h2 { font-size: 16px; letter-spacing: -.005em; }
.eyebrow { font-size: 12.5px; letter-spacing: .02em; }
.item-title { letter-spacing: -.003em; }

/* Soft depth instead of hairlines */
.card { border: 0; box-shadow: 0 1px 2px rgba(15, 15, 15, .05), 0 8px 24px -12px rgba(15, 15, 15, .14); border-radius: 16px; }
.hcard, .hk-tile { border-color: transparent; box-shadow: 0 1px 2px rgba(15, 15, 15, .05), 0 8px 24px -12px rgba(15, 15, 15, .14); }
.morning, .today-page .prio-card { box-shadow: 0 1px 2px rgba(15, 15, 15, .05), 0 8px 24px -12px rgba(15, 15, 15, .14); }
.empty { border: 0; background: var(--surface-2); border-radius: 16px; }
:root[data-mode="dark"] .card, :root[data-mode="dark"] .hcard, :root[data-mode="dark"] .hk-tile { box-shadow: 0 0 0 1px var(--border-soft), 0 10px 28px -14px rgba(0, 0, 0, .6); }

@media (max-width: 760px) {
  h1 { font-size: 30px; }
  .section { margin-top: 30px; }
  /* Sheets: a handle on every one; swipe it down to close */
  .modal { border-radius: 20px 20px 0 0; will-change: transform; }
  .modal .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: -8px auto 10px; }
  .modal-foot .btn { min-height: 44px; padding: 10px 16px; }
  .modal-foot .btn.primary { flex: 1; justify-content: center; }
  .choices .choice { min-height: 56px; }
}
/* Round 4 fixes: phone viewer width, nudge pills in narrow columns */
.av-wrap { min-width: 0; }
.av-ward { min-width: 0; overflow: hidden; }
@media (max-width: 760px) {
  .av-wrap { grid-template-columns: minmax(0, 1fr); }
  .ht-name .habit-nudges > * { white-space: normal; border-radius: 10px; }
}
/* The 3D window appears at once (a fade could get stuck half-way on a busy device) */
#av-root { animation: none; }
.aw-note { margin: 0 2px 10px; }
.wk-help { margin: 0 0 14px; border-radius: 12px; background: var(--surface-2); padding: 10px 14px; }
.wk-help summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.wk-help-body p { margin: 10px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.wk-help-body b { color: var(--text); }

/* Kairos logo */
.brand-mark { background: none; border-radius: 0; }
.brand-mark::after { display: none; }
.logo-mark { display: block; border-radius: 26%; }
.welcome-art { background: none; }

/* Round 6: done for the day, goal story */
.day-done { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--ok) 11%, var(--surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 28%, transparent); }
.dd-ic { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: var(--on-ok); font-size: 18px; font-weight: 800; }
.dd-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dd-body b { font-size: 15.5px; }
.dd-body span { font-size: 13px; color: var(--muted); }
.dd-btns { display: flex; gap: 6px; flex-shrink: 0; }
.xs-note .up { color: var(--ok); font-weight: 650; }
.xs-note .down { color: var(--warn); font-weight: 650; }
.goal-story p { margin: 10px 0 0; line-height: 1.5; }
.gs-hero { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.gs-hero b { display: block; font-size: 17px; }
.gs-ic { font-size: 34px; }
.gs-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gs-stat { padding: 10px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.gs-stat b { display: block; font-size: 22px; }
.gs-stat span { font-size: 12px; color: var(--muted); }
.gs-why { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
@media (max-width: 760px) {
  .day-done { flex-wrap: wrap; }
  .dd-btns { width: 100%; }
  .dd-btns .btn { flex: 1; justify-content: center; }
  .gs-stats { grid-template-columns: repeat(2, 1fr); }
}
/* Ask for advice: a chat */
.advice-modal { display: flex; flex-direction: column; min-height: min(70vh, 640px); }
.advice-modal .modal-head { flex-shrink: 0; }
.adv-head-btns { display: flex; align-items: center; gap: 8px; }
.adv-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 10px; max-height: 60vh; }
.adv-intro { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.adv-msg { display: flex; }
.adv-msg.me { justify-content: flex-end; }
.adv-bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; }
.adv-msg.me .adv-bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.adv-msg.ai .adv-bubble { background: var(--surface-2); border-bottom-left-radius: 6px; }
.adv-bubble p { margin: 0 0 8px; }
.adv-bubble p:last-child { margin-bottom: 0; }
.adv-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.adv-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--border-soft); }
.adv-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.adv-card-body b { font-size: 13.5px; }
.adv-card-body small { font-size: 11.5px; }
.adv-card.added { opacity: .7; }
.adv-added { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ok); font-weight: 600; }
.adv-mem { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.adv-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.adv-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: adv-dot 1s infinite ease-in-out; }
.adv-typing i:nth-child(2) { animation-delay: .15s; }
.adv-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes adv-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.adv-error { font-size: 13px; color: var(--danger); padding: 4px 2px; }
.adv-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0 10px; }
.adv-form { display: flex; align-items: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.adv-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 9px 12px; border-radius: 12px; font: inherit; line-height: 1.4; }
.adv-send { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; flex-shrink: 0; }
@media (max-width: 760px) {
  .advice-modal { min-height: 0; height: calc(var(--vvh, 100dvh) - 60px); }
  .adv-log { max-height: none; }
  .adv-form { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .adv-form textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .adv-typing i { animation: none; } }
/* Daily check-in (can't be skipped) */
.modal.locked .sheet-grip { display: none; }
.daily-checkin { display: flex; flex-direction: column; gap: 14px; }
.dc-head { display: flex; flex-direction: column; gap: 4px; }
.dc-k { font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.dc-head h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.dc-moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.dc-mood { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; border: 1.5px solid var(--border-soft); background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; transition: transform .12s, border-color .12s; }
.dc-mood span { font-size: 28px; line-height: 1; }
.dc-mood small { font-size: 12px; font-weight: 600; }
.dc-mood:hover { transform: translateY(-2px); }
.dc-mood.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--text); }
.dc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dc-tags .chip-btn { padding: 4px 11px; font-size: 12.5px; }
.daily-checkin textarea { width: 100%; resize: vertical; min-height: 96px; }
.dc-foot { display: flex; align-items: center; gap: 12px; justify-content: space-between; }

/* Operating manual */
.manual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.manual-grid textarea { width: 100%; resize: vertical; font-size: 13.5px; line-height: 1.5; }

/* Early warning on Today */
.warn-card { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--warn) 11%, var(--surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 30%, transparent); }
.wc-ic { font-size: 20px; color: var(--warn); line-height: 1.2; }
.wc-body { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.wc-body span { color: var(--muted); }

/* Review: new sections */
.rv-learned { padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); }
.rv-learn { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); }
.rv-learn:first-of-type { border-top: 0; }
.rv-learn b { font-size: 14.5px; }
.rv-learn span { font-size: 12.5px; color: var(--muted); }
.rv-say { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 13.5px; border-top: 1px solid var(--border-soft); }
.rv-say:first-of-type { border-top: 0; }
.rv-say > div { display: flex; flex-direction: column; gap: 3px; }
.rv-exp-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.rv-exp-mark { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.rv-exp-mark .chip-btn { padding: 3px 10px; font-size: 12.5px; }
.rv-question { margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); }
.rv-question p { margin: 6px 0 10px; font-family: var(--serif); font-size: 18px; line-height: 1.35; }
@media (max-width: 760px) {
  .manual-grid { grid-template-columns: 1fr; }
  .dc-mood span { font-size: 24px; }
  .dc-foot { flex-direction: column; align-items: stretch; }
  .dc-foot .btn { justify-content: center; min-height: 46px; }
}
/* Obstacle plan (WOOP) */
.woop { display: flex; flex-direction: column; gap: 12px; }
.plan-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 14px; line-height: 1.45; }
.pl-k { font-size: 10.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); flex-basis: 100%; }
.pl-if { color: var(--muted); }
.pl-then { font-weight: 650; color: var(--text); }
.plan-card { display: block; width: 100%; margin: 12px 0 4px; padding: 11px 14px; border-radius: 12px; background: var(--accent-soft); border: 0; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.plan-card:hover { filter: brightness(1.03); }
.plan-card.empty { display: flex; flex-direction: column; gap: 3px; background: transparent; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); }
.plan-card.empty b { font-size: 14px; }
.plan-card.empty span { font-size: 12.5px; color: var(--muted); }
.plan-line.in-banner { margin-top: 6px; font-size: 12.5px; }
.plan-line.in-banner .pl-k { flex-basis: auto; }
/* Quest map: a clean progress ring that fills as you get closer */
.qn.next .qn-ring { border: 0; background: conic-gradient(var(--qc) var(--p, 0%), color-mix(in srgb, var(--qc) 14%, var(--track)) 0); }
.qn.next .qn-ring::before { inset: 6px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .08); }
.qn.side.next .qn-ring::before { inset: 5px; }
.qn.next .qn-ring::after { content: ''; position: absolute; top: 0; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--qc); }
.qn.done .qn-ring { border-width: 4px; }
/* ===== Motion and interaction (js/motion.js) ===== */
:root { --spring: cubic-bezier(.2, 1.4, .35, 1); --ease-out: cubic-bezier(.2, .8, .2, 1); }
@supports (transition-timing-function: linear(0, 1)) {
  :root { --spring: linear(0, 0.21 6%, 0.67 13%, 1.03 21%, 1.17 27%, 1.17 31%, 1.08 39%, 0.99 48%, 0.97 54%, 1 66%, 1); }
}

/* 3. Page transitions: the new page slides in a little and fades; going back slides the other way.
   A tapped goal card grows into the goal's page. */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-out .22s var(--ease-out) both; }
  ::view-transition-new(root) { animation: vt-in .32s var(--ease-out) both; }
  :root[data-nav="back"]::view-transition-old(root) { animation-name: vt-out-back; }
  :root[data-nav="back"]::view-transition-new(root) { animation-name: vt-in-back; }
  ::view-transition-group(goal-hero) { animation-duration: .42s; animation-timing-function: var(--ease-out); }
  ::view-transition-old(goal-hero), ::view-transition-new(goal-hero) { height: 100%; object-fit: cover; }
}
@keyframes vt-out { to { opacity: 0; transform: translateX(-16px); } }
@keyframes vt-in { from { opacity: 0; transform: translateX(22px); } }
@keyframes vt-out-back { to { opacity: 0; transform: translateX(16px); } }
@keyframes vt-in-back { from { opacity: 0; transform: translateX(-22px); } }
/* The sidebar and tab bar stay put while the page changes. */
.sidebar { view-transition-name: sidebar; }
.tabbar { view-transition-name: tabbar; }

/* 1. Goal progress chip */
.gp-chip { position: fixed; z-index: 210; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 16px; max-width: min(360px, calc(100vw - 24px));
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gc) 35%, var(--border-soft)), 0 12px 32px -10px rgba(0,0,0,.35); pointer-events: none; }
.gp-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--gc) 18%, var(--surface-2)); flex-shrink: 0; }
.gp-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.gp-body b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-bar { display: block; height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; min-width: 120px; }
.gp-bar i { display: block; height: 100%; border-radius: inherit; background: var(--gc); transition: width .9s var(--spring); }
.gp-pct { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gp-pct b { color: var(--text); }
[data-href].gp-hit { animation: gp-hit 1.1s var(--ease-out); }
@keyframes gp-hit { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* 2. Milestone moment */
.ms-moment { position: fixed; inset: auto 0 calc(96px + env(safe-area-inset-bottom)) 0; z-index: 215; display: flex; justify-content: center; padding: 0 16px; animation: ms-in .5s var(--spring) both; }
.ms-moment.out { animation: ms-out .28s ease-in both; }
.ms-card { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 22px; max-width: 460px; width: 100%;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gc) 40%, var(--border-soft)), 0 20px 50px -14px rgba(0,0,0,.45); cursor: pointer; }
.ms-ring { width: 64px; height: 64px; flex-shrink: 0; transform: rotate(-90deg); }
.ms-ring circle { fill: none; stroke-width: 7; }
.ms-track { stroke: var(--track); }
.ms-fill { stroke: var(--gc); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--spring) .15s; }
.ms-ring text { transform: rotate(90deg); transform-origin: 36px 36px; font-size: 15px; font-weight: 800; fill: var(--text); text-anchor: middle; }
.ms-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ms-k { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gc); }
.ms-text b { font-size: 15.5px; }
.ms-text span:last-child { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.climber.ms-climber { width: 58px; height: 58px; flex-shrink: 0; animation: ms-cheer .7s var(--spring) .2s 2; }
@keyframes ms-in { from { opacity: 0; transform: translateY(24px) scale(.94); } }
@keyframes ms-out { to { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes ms-cheer { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-14px) rotate(-8deg); } 70% { transform: translateY(0) rotate(6deg); } }

/* 4. Quiet "this is waiting" cues: a slow breathing edge, not a red alarm */
@media (prefers-reduced-motion: no-preference) {
  #main .item.task.is-overdue:not(.done) { animation: breathe-warn 3.6s ease-in-out infinite; }
  .fg-row.is-quiet, .goal-card.is-quiet { animation: breathe-quiet 4.2s ease-in-out infinite; }
}
.goal-card.is-quiet::after, .fg-row.is-quiet::after { content: 'quiet for a week'; position: absolute; top: 10px; right: 12px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); opacity: .8; }
.fg-row.is-quiet { position: relative; }
.fg-row.is-quiet::after { top: 6px; right: 6px; }
@keyframes breathe-warn { 0%, 100% { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--danger) 35%, transparent); } 50% { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--danger) 85%, transparent); } }
@keyframes breathe-quiet { 0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 15%, transparent); } 50% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 55%, transparent), 0 0 18px -6px color-mix(in srgb, var(--warn) 50%, transparent); } }

/* 6. Goal colour stripe on tasks, habits and journal entries */
#main .item.has-goal { position: relative; }
#main .item.has-goal::before, .card.entry.has-goal::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--gc); opacity: .85; }
.card.entry.has-goal { position: relative; }

/* 5. Today's first focus task: one clear place to start */
.today-page .zone-focus > .item.task:first-child:not(.done),
.today-page .zone-focus > .task-wrap:first-child > .item.task:not(.done) {
  padding: 16px 16px 16px 18px; margin: 6px 0 8px; border-radius: 16px; background: var(--surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, var(--border-soft)), 0 10px 26px -14px color-mix(in srgb, var(--accent) 60%, rgba(0,0,0,.4));
}
.today-page .zone-focus > .item.task:first-child:not(.done) .item-title,
.today-page .zone-focus > .task-wrap:first-child > .item.task .item-title { font-size: 16.5px; font-weight: 650; }
.today-page .zone-focus > .item.task:first-child:not(.done) .check,
.today-page .zone-focus > .task-wrap:first-child > .item.task .check { width: 28px; height: 28px; border-radius: 9px; }
.today-page .zone-focus > .item.task:first-child:not(.done)::after { content: 'Start here'; position: absolute; top: -8px; left: 16px; padding: 1px 8px; border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: var(--on-accent); }
.today-page .zone-focus > .item.task:first-child { position: relative; }

/* 8. Empty states that point forward */
.empty-next { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); }
.empty-next b { font-size: 14px; }
.empty .btn { margin-top: 12px; }

/* 10. "When will you do it?" */
.when-bar { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 205; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 99px; max-width: calc(100vw - 24px);
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--ink-text); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 14px 34px -12px rgba(0,0,0,.5); animation: wb-in .45s var(--spring) both; }
.when-bar.out { animation: wb-out .22s ease-in both; }
.wb-q { font-size: 13px; font-weight: 600; white-space: nowrap; }
.wb-opts { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.wb-opt { padding: 7px 12px; border-radius: 99px; border: 0; background: color-mix(in srgb, var(--ink-text) 14%, transparent); color: inherit; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .15s var(--spring); }
.wb-opt:hover { background: color-mix(in srgb, var(--ink-text) 24%, transparent); }
.wb-opt:active { transform: scale(.94); }
@keyframes wb-in { from { opacity: 0; transform: translate(-50%, 20px) scale(.95); } }
@keyframes wb-out { to { opacity: 0; transform: translate(-50%, 12px); } }

/* 11. Quick menu: a floating menu on a laptop, a bottom sheet on a phone */
.qm-panel { display: flex; flex-direction: column; padding: 6px; border-radius: 16px; min-width: 230px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: 0 0 0 1px var(--border-soft), 0 18px 44px -12px rgba(0,0,0,.45); }
.qm.pop .qm-panel { position: fixed; z-index: 220; animation: qm-pop .22s var(--spring) both; transform-origin: top left; }
.qm.out .qm-panel { animation: qm-out .16s ease-in both; }
.qm-title { padding: 8px 10px 6px; font-size: 12px; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.qm-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.qm-item:hover, .qm-item:focus-visible { background: var(--hover); outline: none; }
.qm-item .i { color: var(--muted); }
.qm-item.danger, .qm-item.danger .i { color: var(--danger); }
.qm.sheet { position: fixed; inset: 0; z-index: 220; }
.qm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.28); animation: fade-in .2s both; }
.qm.sheet .qm-panel { position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); border-radius: 22px; padding: 8px; animation: qm-sheet .32s var(--spring) both; }
.qm.sheet .qm-item { padding: 14px 12px; font-size: 15.5px; }
.qm.sheet .qm-title { text-align: center; max-width: none; padding: 10px; }
.qm.sheet.out .qm-panel { animation: qm-sheet-out .18s ease-in both; }
@keyframes qm-pop { from { opacity: 0; transform: scale(.9); } }
@keyframes qm-out { to { opacity: 0; transform: scale(.96); } }
@keyframes qm-sheet { from { transform: translateY(105%); } }
@keyframes qm-sheet-out { to { transform: translateY(105%); } }
@keyframes fade-in { from { opacity: 0; } }

/* 7. Tactile, thumb-friendly controls */
.btn, .chip-btn, .icon-btn, .check, .tab, .fab, .coach-fab, .wb-opt, .qm-item { -webkit-tap-highlight-color: transparent; }
.btn:active, .chip-btn:active, .icon-btn:active { transform: scale(.96); transition: transform .08s; }
.check { transition: transform .2s var(--spring), background .15s, border-color .15s; }
.check:active { transform: scale(.86); }
@media (max-width: 760px) {
  /* Every target at least 44px to the finger, even when it looks smaller */
  /* :where() keeps this at zero specificity, so buttons placed with position: absolute (close buttons…) stay put */
  :where(.check, .icon-btn, .chip-btn, .ps-p, .pc-item, .mini-btn) { position: relative; }
  .check::after, .icon-btn::after { content: ''; position: absolute; inset: -12px; }
  .check { width: 24px; height: 24px; border-radius: 8px; }
  .chip-btn { min-height: 36px; }
  .btn { min-height: 42px; }
  .item { min-height: 52px; }
  /* Glass tab bar */
  .tabbar { background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6); border-top: 1px solid color-mix(in srgb, var(--border-soft) 70%, transparent); }
  .tab { min-height: 50px; }
  .tab.on .i { transform: translateY(-1px) scale(1.08); transition: transform .3s var(--spring); }
  .fab { width: 58px; height: 58px; border-radius: 20px; box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--accent) 70%, rgba(0,0,0,.5)); }
  .when-bar { bottom: calc(86px + env(safe-area-inset-bottom)); left: 12px; right: 12px; transform: none; border-radius: 22px; flex-direction: column; align-items: stretch; padding: 12px; gap: 8px; }
  .when-bar .wb-opts { justify-content: space-between; }
  .when-bar .wb-opt { flex: 1; padding: 10px 6px; }
  @keyframes wb-in { from { opacity: 0; transform: translateY(20px) scale(.97); } }
  @keyframes wb-out { to { opacity: 0; transform: translateY(12px); } }
  .ms-moment { bottom: calc(150px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .gp-bar i, .ms-fill { transition: none; }
  .ms-moment, .when-bar, .qm-panel, .climber.ms-climber { animation: none !important; }
}
/* The "Start here" card stays inside the column on every screen */
.today-page .zone-focus > .item.task:first-child:not(.done),
.today-page .zone-focus > .task-wrap:first-child > .item.task:not(.done) { margin-left: 0; margin-right: 0; width: auto; max-width: 100%; box-sizing: border-box; }
.today-page .zone-focus { overflow: visible; }

/* ---------- Habit routines ---------- */
/* Routines: wide cards (two side by side on a big screen), full habit names, the current step highlighted. */
.routines { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; margin: 4px 0 18px; align-items: start; }
.routine-add { justify-self: start; align-self: center; }
.routine-card { padding: 16px 16px 10px; position: relative; overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.routine-card.finished { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.rt-head { display: flex; align-items: center; gap: 12px; }
.rt-icon { font-size: 24px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-2); flex: none; }
.rt-name { font-weight: 700; font-size: 16.5px; line-height: 1.3; }
.rt-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.rt-sub b { color: var(--text); font-weight: 650; }
.routine-card.finished .rt-sub { color: var(--ok); font-weight: 600; }
/* The chain at a glance: one piece per habit, in its colour, filled when done. */
.rt-segs { display: flex; gap: 4px; margin: 14px 0 8px; }
.rt-segs i { flex: 1; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--c) 18%, var(--track)); transition: background .4s; }
.rt-segs i.on { background: var(--c); }
.rt-segs i.now { background: color-mix(in srgb, var(--c) 40%, var(--track)); }
.routine-card .rt-chain { margin-top: 4px; }
.routine-card .rt-step { align-items: flex-start; gap: 12px; padding: 10px 10px 10px 4px; min-height: 0; border-radius: 12px; }
.routine-card .rt-step:not(:last-child)::after { left: 17px; top: 42px; bottom: -8px; }
.routine-card .rt-step.done:not(:last-child)::after { background: color-mix(in srgb, var(--c) 55%, transparent); }
.routine-card .rt-mark { flex: none; width: 28px; display: grid; place-items: center; padding-top: 1px; }
.routine-card .rt-mark .check { width: 26px; height: 26px; border-radius: 8px; }
.routine-card .rt-rest { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; border: 1.5px dashed var(--border); font-size: 12px; font-weight: 650; }
.routine-card .rt-sbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.routine-card .rt-label { display: flex; gap: 7px; align-items: baseline; font-size: 15px; font-weight: 550; line-height: 1.35; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.routine-card .rt-emoji { flex: none; }
.routine-card .rt-meta { font-size: 12.5px; color: var(--muted); }
.routine-card .rt-sbody:hover .rt-label { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border); }
/* The step to do now: its own panel, a touch bigger. */
.routine-card .rt-step.next { background: color-mix(in srgb, var(--c) 10%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.routine-card .rt-step.next .rt-label { font-size: 16px; font-weight: 700; }
.routine-card .rt-now { align-self: flex-start; font-size: 10.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: color-mix(in srgb, var(--c) 70%, var(--text)); background: color-mix(in srgb, var(--c) 16%, transparent); padding: 2px 8px; border-radius: 99px; margin-bottom: 2px; animation: none; }
.routine-card .rt-step.done .rt-label { color: var(--muted); font-weight: 500; text-decoration: line-through; text-decoration-color: var(--faint); }
.routine-card .rt-step.done .rt-meta { opacity: .7; }
.rt-done { flex: none; display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; font-size: 12px; font-weight: 650; color: var(--c); }
.routine-card .rt-step > .miss-label { flex: none; margin-top: 3px; }
/* Routine progress bar ("rtn-", not "rt-": .rt-bar is the notes editor's formatting bar). */
.rtn-bar { height: 4px; border-radius: 4px; background: var(--track); margin: 10px 0 6px; overflow: hidden; }
.rtn-bar span { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--accent); border-radius: inherit; transition: width .7s var(--spring); }
.routine-card.finished .rtn-bar span { background: var(--ok); }
.rt-chain { list-style: none; margin: 0; padding: 0; position: relative; }
.rt-step { display: flex; align-items: center; gap: 10px; padding: 6px 0; position: relative; min-height: 40px; }
/* the thread that links one step to the next */
.rt-step:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 34px; bottom: -6px; width: 2px; border-radius: 2px; background: var(--border); }
.rt-step.done:not(:last-child)::after { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.rt-step .check { flex: none; }
.rt-label { flex: 1; min-width: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-step.done .rt-label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.rt-step.next .rt-label { font-weight: 600; }
.rt-step.rest { opacity: .55; }
.rt-rest { width: 28px; text-align: center; color: var(--faint); flex: none; }
.rt-now { font-size: 11px; font-weight: 650; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; animation: rt-pulse 2.4s ease-in-out infinite; }
@keyframes rt-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); } }
.routine-hint { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px 14px; margin: 4px 0 16px; border: 1px dashed var(--border); border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; cursor: pointer; font-size: 20px; }
.routine-hint > span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.routine-hint:hover { background: var(--hover); border-style: solid; }
.rt-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-icon-opt input { position: absolute; opacity: 0; pointer-events: none; }
.rt-icon-opt span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; font-size: 20px; border: 1px solid var(--border-soft); cursor: pointer; transition: transform .2s var(--spring); }
.rt-icon-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }
.rt-icon-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.rt-pick { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rt-pick li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--surface-2); }
.rt-n { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; flex: none; }
.rt-pick .icon-btn[disabled] { opacity: .3; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .rt-now { animation: none; } }

/* ---------- Huge task: the big win ---------- */
.big-win { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 55%, transparent); animation: ds-fade .25s ease; cursor: pointer; }
.big-win.out { opacity: 0; transition: opacity .3s; }
.bw-card { width: 340px; max-width: 100%; text-align: center; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 22px; padding: 22px 22px 20px; box-shadow: var(--shadow-lg); animation: bw-in .55s var(--spring) both; }
@keyframes bw-in { from { transform: scale(.7) translateY(30px); opacity: 0; } }
.bw-climber { height: 96px; display: grid; place-items: center; font-size: 56px; }
.bw-climber .climber { height: 96px; width: auto; animation: bw-jump 1s var(--spring) .25s 2; transform-origin: 50% 100%; }
@keyframes bw-jump { 0% { transform: translateY(0) scale(1, 1); } 18% { transform: translateY(0) scale(1.12, .86); } 45% { transform: translateY(-26px) scale(.94, 1.08); } 70% { transform: translateY(0) scale(1.06, .94); } 100% { transform: none; } }
.bw-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-top: 6px; }
.bw-title { font-size: 19px; font-weight: 700; margin: 4px 0 6px; overflow-wrap: anywhere; }
.bw-sub { color: var(--muted); font-size: 14px; }
.bw-xp { display: inline-block; margin-top: 12px; font-weight: 700; color: var(--on-accent); background: var(--accent); padding: 4px 12px; border-radius: 99px; animation: bw-in .5s var(--spring) .35s both; }
.cheer-big .cheer-icon, .cheer-routine .cheer-icon { background: var(--ok); color: var(--on-ok); }
@media (prefers-reduced-motion: reduce) { .bw-card, .bw-climber .climber, .bw-xp { animation: none; } }

/* ---------- What's new ---------- */
.wn-root { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .38); animation: ds-fade .25s ease; }
.wn-root.out { opacity: 0; transition: opacity .25s; }
.wn-sheet { width: min(420px, 100%); background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; animation: bw-in .45s var(--spring) both; display: flex; flex-direction: column; }
.wn-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 0 18px; }
.wn-k { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.wn-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.wn-track::-webkit-scrollbar { display: none; }
.wn-card { flex: 0 0 100%; scroll-snap-align: center; padding: 18px 24px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 230px; }
.wn-icon { font-size: 40px; width: 76px; height: 76px; display: grid; place-items: center; border-radius: 22px; background: var(--accent-soft); margin-bottom: 4px; }
.wn-card h3 { margin: 0; font-size: 19px; }
.wn-card p { margin: 0; color: var(--muted); line-height: 1.5; max-width: 32ch; }
.wn-card .btn { margin-top: 6px; }
.wn-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 16px 20px; }
.wn-dots { display: flex; gap: 6px; }
.wn-dot { width: 7px; height: 7px; border-radius: 99px; border: 0; padding: 0; background: var(--border); cursor: pointer; transition: width .3s var(--spring), background .2s; }
.wn-dot.on { width: 20px; background: var(--accent); }
@media (max-width: 600px) {
  .wn-root { place-items: end center; padding: 0; }
  .wn-sheet { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); animation-name: wn-up; }
  @keyframes wn-up { from { transform: translateY(100%); } }
}

/* ---------- Backups ---------- */
.backup-list { margin: 10px 0 4px; }
.backup-row { padding: 8px 4px; }
.bk-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--muted); flex: none; }

/* Goal board branch cards and nested task blocks. */
.goal-board { margin: 8px 0 16px; }
.gb-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.goal-board > .gb-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 14px; align-items: start; }
.gb-card { min-width: 0; border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface); }
.goal-board > .gb-list > .gb-card { padding: 6px; border-radius: 18px; box-shadow: var(--shadow); }
.gb-card.active-branch { border-color: color-mix(in srgb, var(--c) 48%, var(--border)); background: color-mix(in srgb, var(--c) 5%, var(--surface)); }
.gb-card > .gb-list { margin: 0 6px; }
.gb-card .gb-card .gb-list { margin-inline: 2px; }
.goal-board > .gb-list > .gb-card > .gb-row { grid-template-columns: 30px minmax(0, 1fr) 30px 28px; padding: 10px; }
.goal-board > .gb-list > .gb-card > .gb-row > :first-child { grid-area: 1 / 4; }
.goal-board > .gb-list > .gb-card > .gb-row > :nth-child(2) { grid-area: 1 / 1; }
.goal-board > .gb-list > .gb-card > .gb-row > .gb-open { grid-area: 1 / 3; }
.goal-board > .gb-list > .gb-card > .gb-row > .gb-body { grid-area: 2 / 1 / 3 / -1; }
.goal-board > .gb-list > .gb-card > .gb-row .gb-title { font-size: 18px; }
.goal-board > .gb-list > .gb-card > .gb-row .gb-focus { grid-column: 1 / -1; }
.gb-row {
  display: grid; grid-template-columns: auto 26px minmax(0, 1fr) auto;
  align-items: center; gap: 6px; min-height: 54px; padding: 9px;
}
.gb-row > span:first-child:empty { width: 0; }
.gb-toggle { display: grid; place-items: center; width: 28px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.gb-toggle:hover, .gb-create summary:hover { background: var(--hover); color: var(--text); }
.gb-toggle[aria-expanded="true"] .i { transform: rotate(90deg); }
.gb-row .check, .gb-ring { justify-self: center; }
.gb-ring { display: inline-grid; place-items: center; }
.gb-row.is-next { border-radius: 10px; border-bottom-color: transparent; background: color-mix(in srgb, var(--c) 8%, var(--surface)); box-shadow: inset 3px 0 var(--c); }
.gb-title { font-size: 15px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.gb-row.done .gb-title { color: var(--muted); text-decoration: line-through; }
.gb-meta { margin-top: 2px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.gb-next { display: block; color: color-mix(in srgb, var(--c) 68%, var(--text)); font-size: 12px; font-weight: 650; }
.gb-open { grid-column: 4; }
.gb-focus { grid-column: 3 / -1; justify-self: start; }
.gb-create { margin: 5px 8px 8px; }
.goal-milestones .milestone-fields { display: grid; gap: 6px; }
.goal-milestones > button { align-self: flex-start; }
.gb-create summary { display: inline-flex; align-items: center; gap: 5px; padding: 6px; border-radius: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }
.gb-add { display: grid; gap: 6px; max-width: 420px; margin: 6px 0; }
.gb-add-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.gb-add-btn { margin-left: auto; }
.gb-add input[name=title], .gb-add select { min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.gb-add input[name=title] { width: 100%; }
@media (max-width: 600px) {
  .goal-board > .gb-list { grid-template-columns: minmax(0, 1fr); }
  .gb-row { gap: 4px; }
  .gb-row .check::after { inset: -6px; }
}


/* ---------- Task summary: how long it took ---------- */
.ts-root { position: fixed; inset: 0; z-index: 88; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .34); animation: ds-fade .2s ease; }
.ts-root.out { opacity: 0; transition: opacity .2s; }
.ts-card { width: 360px; max-width: 100%; background: var(--surface); border-radius: 22px; padding: 22px 20px 18px; box-shadow: var(--shadow-lg); text-align: center; animation: bw-in .45s var(--spring) both; max-height: calc(100dvh - 32px); overflow-y: auto; }
.ts-badge { width: 52px; height: 52px; margin: 0 auto 6px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-size: 24px; font-weight: 700; }
.ts-root.celebrate .ts-badge { background: var(--ok); color: var(--on-ok); animation: ts-pop .5s var(--spring) .1s both; }
@keyframes ts-pop { from { transform: scale(.3) rotate(-20deg); } }
.ts-climber { margin-bottom: 2px; }
.ts-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ts-root.celebrate .ts-kicker { color: var(--ok); }
.ts-title { margin: 4px 0 14px; font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.ts-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ts-stat { background: var(--surface-2); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ts-stat b { font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ts-stat span { font-size: 11.5px; color: var(--muted); }
.ts-stat.took { background: var(--accent-soft); }
.ts-stat.xp b { color: var(--ok); }
.ts-insights { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.ts-insights li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.ts-ic { flex: none; width: 22px; text-align: center; }
.ts-when { margin-top: 14px; font-size: 12px; color: var(--muted); }
.ts-ok { width: 100%; margin-top: 14px; height: 44px; font-size: 15px; }
.item.task .ts-btn { color: var(--muted); }
@media (max-width: 600px) {
  .ts-root { place-items: end center; padding: 0; }
  .ts-card { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); animation-name: wn-up; }
}
@media (prefers-reduced-motion: reduce) { .ts-card, .ts-badge { animation: none !important; } }

/* Goal story: XP and deadline highlights, and the button on achieved goals */
.gs-highlights { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.gs-xp, .gs-dl { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 650; }
.gs-xp { background: var(--accent); color: var(--on-accent); }
.gs-dl.ok { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--text); }
.gs-dl.late { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--text); }
.goal-foot .gs-open { margin-left: auto; padding: 4px 10px; }

/* ---------- Inventory (rarity cards, item page, preview label) ---------- */
.av-wrap { grid-template-columns: minmax(0, 1fr) 410px; }
.iv-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.iv-head h3 { margin: 0; font-size: 18px; }
.iv-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.iv-count b { color: var(--text); font-size: 15px; }
.iv-collect { display: flex; gap: 3px; height: 6px; margin-bottom: 12px; }
.iv-seg { position: relative; border-radius: 3px; background: color-mix(in srgb, var(--r) 18%, var(--surface-2)); overflow: hidden; }
.iv-seg i { position: absolute; inset: 0 auto 0 0; background: var(--r); border-radius: inherit; }
.iv-slots { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; padding-bottom: 2px; }
.iv-slots::-webkit-scrollbar { display: none; }
.iv-slot { position: relative; flex: none; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border-soft); background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.iv-slot.on { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.iv-slot.worn::after { content: ""; position: absolute; top: -1px; right: -1px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.iv-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.iv-toggle { padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border-soft); background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.iv-toggle.on { color: var(--text); border-color: var(--text); }
.iv-sort { display: flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.iv-sort button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; cursor: pointer; }
.iv-sort button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.iv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; overflow-y: auto; flex: 1; min-height: 0; padding: 2px 2px 6px; align-content: start; }
.iv-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
  gap: 4px; min-width: 0; padding: 10px; border: 1px solid var(--border-soft); border-radius: 11px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.iv-card:hover, .iv-card:focus-visible { border-color: var(--r); background: var(--surface-2); }
.iv-card .iv-ic { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: auto; border-radius: 10px; background: color-mix(in srgb, var(--r) 11%, var(--surface-2)); font-size: 23px; }
.iv-name { font-size: 12px; font-weight: 650; line-height: 1.22; overflow-wrap: anywhere; }
.iv-rname { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.iv-rname::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--r); }
.iv-eq { position: absolute; top: 7px; right: 5px; font-size: 9px; font-weight: 650; color: var(--text); }
.iv-card.eq { border-color: color-mix(in srgb, var(--ok) 55%, var(--border)); }
.iv-card.eq .iv-ic { margin-top: 5px; }
.iv-lock { position: absolute; top: 7px; right: 7px; font-size: 11px; }
.iv-card.locked .iv-ic { filter: saturate(.5); }
.iv-dtop { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.iv-detail { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; flex: 1; animation: iv-in .3s var(--spring); }
@keyframes iv-in { from { opacity: 0; transform: translateY(10px); } }
.iv-hero { position: relative; height: 150px; flex: none; border-radius: 14px; display: grid; place-items: center; overflow: hidden; border: 1px solid color-mix(in srgb, var(--r) 40%, var(--border-soft)); background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--r) 45%, transparent), transparent 65%), linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--r) 20%, var(--surface))); }
.iv-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--r); }
.iv-hero .iv-ic { font-size: 72px; filter: drop-shadow(0 8px 18px color-mix(in srgb, var(--r) 60%, transparent)); animation: iv-float 3s ease-in-out infinite; }
.iv-detail.locked .iv-hero .iv-ic { filter: grayscale(1); opacity: .5; }
.iv-hero .iv-lock { font-size: 18px; top: 10px; right: 12px; }
@keyframes iv-float { 50% { transform: translateY(-6px) rotate(3deg); } }
.iv-rarity { display: flex; align-items: center; gap: 8px; }
.iv-pill { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--r); padding: 3px 9px; border-radius: 99px; }
.iv-title { margin: 0; font-size: 21px; }
.iv-props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.iv-props div { background: var(--surface-2); border-radius: 10px; padding: 7px 8px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.iv-props span { font-size: 10.5px; color: var(--muted); }
.iv-props b { font-size: 12.5px; line-height: 1.25; }
.iv-how { margin: 2px 0 0; font-size: 13.5px; line-height: 1.45; }
.iv-actions { display: flex; gap: 8px; margin-top: 4px; }
.iv-actions .btn { flex: 1; height: 42px; }
.iv-actions .btn.on { border-color: var(--r); color: var(--text); }
.iv-note { margin: 0; }

/* label over the 3D view */
.av-preview { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 99px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--r); box-shadow: 0 4px 18px color-mix(in srgb, var(--r) 35%, transparent); font-size: 13px; font-weight: 650; white-space: nowrap; pointer-events: none; animation: iv-in .3s var(--spring); max-width: calc(100% - 120px); overflow: hidden; text-overflow: ellipsis; }
.av-preview span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.av-preview i { font-style: normal; font-size: 11px; color: var(--r); }
@media (max-width: 760px) {
  .av-wrap { grid-template-columns: 1fr; }
  .iv-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .iv-hero { height: 110px; }
  .iv-hero .iv-ic { font-size: 54px; }
  .av-preview { top: calc(64px + env(safe-area-inset-top)); max-width: calc(100% - 28px); }
}
@media (prefers-reduced-motion: reduce) { .iv-card::before, .iv-card, .iv-hero .iv-ic { animation: none !important; } }

.hero-inv { align-self: flex-start; margin: 8px 0 4px; }

.iv-card { aspect-ratio: auto; height: 124px; flex: none; }
@media (max-width: 760px) { .iv-card { height: 112px; } }

.iv-grid { grid-auto-rows: 124px; }
@media (max-width: 760px) { .iv-grid { grid-auto-rows: 112px; } }

@media (min-width: 761px) { .av-preview { top: auto; bottom: 42px; } }

@media (max-width: 760px) { .av-preview { top: auto; bottom: 36px; } .av-stage:has(.av-preview) .av-hint { display: none; } }

/* All categories visible at once: they wrap instead of scrolling sideways */
.iv-slots { flex-wrap: wrap; overflow: visible; }

/* ---------- "Made by …" AI model tag ----------
   A pill with a slowly turning gradient border, a twinkling spark, and a one-time shine as it slides in. */
@property --ai-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.ai-tag { --ai-c1: #6aa8ff; --ai-c2: #a77bff; --ai-c3: #ff7eb3; --ai-c4: #ffc75a;
  position: relative; display: flex; width: fit-content; max-width: 100%; margin: 14px 0 2px; padding: 1.5px; border-radius: 99px;
  background: conic-gradient(from var(--ai-a), var(--ai-c1), var(--ai-c2), var(--ai-c3), var(--ai-c4), var(--ai-c1));
  animation: ai-in .6s var(--spring) both, ai-spin 5s linear infinite; cursor: default; }
.ai-tag::before { content: ''; position: absolute; inset: -4px; border-radius: inherit; background: inherit; filter: blur(10px); opacity: .28; z-index: -1; }
.ai-tag.is-backup { --ai-c1: #ffb35a; --ai-c2: #ff8a5a; --ai-c3: #ffd36a; --ai-c4: #ffb35a; }
.ai-tag.still { animation: ai-spin 5s linear infinite; }
.ai-tag.inline { display: inline-flex; margin: 0 0 0 10px; vertical-align: middle; }
.ai-tag-in { position: relative; display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px; border-radius: inherit; background: var(--surface); font-size: 12px; line-height: 1.2; white-space: nowrap; overflow: hidden; min-width: 0; }
.ai-tag-in::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, color-mix(in srgb, #fff 55%, transparent) 50%, transparent 65%); transform: translateX(-120%); animation: ai-shine 1.4s ease-out .45s 1 both; pointer-events: none; }
.ai-tag.still .ai-tag-in::after { animation: none; }
.ai-spark { font-size: 13px; background: linear-gradient(135deg, var(--ai-c1), var(--ai-c3)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: ai-twinkle 2.6s ease-in-out infinite; display: inline-block; }
.ai-by { color: var(--muted); }
.ai-name { font-weight: 700; background: linear-gradient(90deg, var(--ai-c1), var(--ai-c2) 55%, var(--ai-c3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ai-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); flex: none; }
.ai-meta { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.ai-backup { font-size: 10px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: #8a4b00; background: #ffd99a; padding: 2px 6px; border-radius: 99px; }
:root[data-mode="dark"] .ai-backup { color: #ffd99a; background: color-mix(in srgb, #ffb35a 25%, transparent); }
@keyframes ai-spin { to { --ai-a: 360deg; } }
@keyframes ai-in { from { opacity: 0; transform: translateY(8px) scale(.92); filter: blur(4px); } }
@keyframes ai-shine { to { transform: translateX(120%); } }
@keyframes ai-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.25) rotate(90deg); } }
.adv-msg.ai .ai-tag { margin: 6px 0 0 4px; }
@media (max-width: 600px) { .ai-by { display: none; } }
@media (prefers-reduced-motion: reduce) { .ai-tag, .ai-tag-in::after, .ai-spark { animation: none !important; } }

.adv-msg.ai { flex-direction: column; align-items: flex-start; }

/* ---------- The coach's notebook and "talk it through" ---------- */
.rv-note-row { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.rv-note-row > b { flex: 1; min-width: 0; }
.kn-discuss { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; opacity: .75; transition: opacity .15s, border-color .15s, transform .15s var(--spring); }
.kn-discuss:hover { opacity: 1; border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.has-talk:hover .kn-discuss { opacity: 1; }
.kn-discuss.has { opacity: 1; border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--text); }
.kn-discuss b { font-size: 11px; color: var(--accent); }
.kn-discussed { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; padding: 7px 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 9%, transparent); font-size: 12.5px; line-height: 1.4; animation: iv-in .3s var(--spring); }
.kn-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 5px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.rv-was { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.rv-upd { font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); padding: 1px 6px; border-radius: 99px; margin-right: 4px; }
.rv-learn.is-updated { border-left: 3px solid var(--accent); padding-left: 10px; }
.rv-all { margin-left: 8px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.rv-say.has-talk { align-items: flex-start; }
.rv-goal .kn-discuss { margin-left: auto; }

/* what it just learned */
.kn-line { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 2px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); font-size: 13px; animation: iv-in .4s var(--spring); }
.kn-brain { font-size: 18px; line-height: 1; animation: kn-think 2.8s ease-in-out infinite; }
@keyframes kn-think { 50% { transform: scale(1.12) rotate(-6deg); } }
.kn-lines { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.kn-line .link-btn { flex: none; }

/* the discussion window */
.kn-modal { display: flex; flex-direction: column; max-height: min(78vh, 680px); }
.kn-insight { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--accent); margin-bottom: 10px; }
.kn-sec { font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.kn-was { font-size: 12px; color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.kn-thread { flex: 1; min-height: 80px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 10px; }
.kn-hint { margin: 6px 2px; }
.kn-msg { display: flex; flex-direction: column; animation: iv-in .3s var(--spring); }
.kn-msg.you { align-items: flex-end; }
.kn-msg.coach { align-items: flex-start; }
.kn-bubble { max-width: 85%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.kn-msg.you .kn-bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.kn-msg.coach .kn-bubble { background: var(--surface-2); border-bottom-left-radius: 6px; }
.kn-msg .ai-tag { margin: 4px 0 0 4px; }

/* the notebook */
.kn-book { display: flex; flex-direction: column; max-height: min(84vh, 760px); }
.kn-filters { flex-wrap: wrap; margin: 8px 0 10px; }
.kn-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 10px; }
.kn-entry { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--surface); border-left: 3px solid var(--faint); }
.kn-entry.k-pattern { border-left-color: var(--accent); }
.kn-entry.k-context { border-left-color: var(--ok); }
.kn-entry.retired { opacity: .65; }
.kn-text { font-size: 14px; font-weight: 550; line-height: 1.4; }
.kn-ev { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.kn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.kn-chip { font-size: 10px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text); }
.kn-hist { margin-top: 6px; font-size: 12px; }
.kn-hist summary { cursor: pointer; color: var(--muted); }
.kn-hist div { margin-top: 4px; }
.kn-edit textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); resize: vertical; }
.kn-sum { display: flex; gap: 14px; margin: 8px 0; font-size: 13px; color: var(--muted); }
.kn-sum b { color: var(--text); font-size: 16px; }
@media (prefers-reduced-motion: reduce) { .kn-brain, .kn-line, .kn-msg, .kn-discussed { animation: none; } }

/* ---------- Discussion: stance, proposal, agreement ---------- */
.kn-stance { font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; margin: 0 0 4px 4px; }
.kn-stance.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.kn-stance.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.kn-stance.bad { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.kn-proposal { margin: 6px 0 2px; padding: 12px; border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); animation: iv-in .35s var(--spring); }
.kn-prop-k { font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.kn-prop-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.kn-prop { display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; border-radius: 10px; font-size: 13px; line-height: 1.4; min-width: 0; }
.kn-prop.now { background: var(--surface-2); color: var(--muted); }
.kn-prop.now b { color: var(--muted); font-weight: 600; }
.kn-prop.next { background: var(--surface); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.kn-prop-l { font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.kn-prop.next .kn-prop-l { color: var(--ok); }
.kn-prop .rv-pill { align-self: flex-start; }
.kn-agreed { align-self: center; font-size: 12.5px; font-weight: 600; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); padding: 6px 12px; border-radius: 99px; text-align: center; max-width: 92%; animation: iv-in .35s var(--spring); }
.kn-insight.agreed { border-left-color: var(--ok); }
.kn-discuss.done { opacity: 1; border-color: color-mix(in srgb, var(--ok) 50%, transparent); color: var(--ok); }
.kn-discussed.agreed { background: color-mix(in srgb, var(--ok) 10%, transparent); }
.kn-discussed.agreed .kn-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.rv-revised { display: inline-block; margin-left: 6px; vertical-align: 2px; font-size: 9.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); padding: 0 6px; border-radius: 99px; cursor: help; }
.rv-learn.is-revised { border-left: 3px solid var(--ok); padding-left: 10px; }
@media (max-width: 600px) { .kn-prop-cols { grid-template-columns: 1fr; } }

/* The coach button's container also reserves room for its menu: it must not catch clicks itself (it sat invisibly
   over the bottom-right of every page, e.g. the habit circles). Only the button, and the menu while open, are clickable. */
.coach-fab-wrap { pointer-events: none; }
.coach-fab-wrap .coach-fab { pointer-events: auto; }

.kn-reach { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; font-size: 12.5px; line-height: 1.4; }
.kn-reach-bar { flex: none; width: 70px; height: 6px; border-radius: 6px; background: var(--track); overflow: hidden; }
.kn-reach-bar i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.kn-reach.over .kn-reach-bar i { background: var(--warn); }

/* =====================================================================
   Design pass: hierarchy, calmer Today, one scale, softer surfaces
   ===================================================================== */

/* 8. One scale: spacing, radii and type used across every page */
:root { --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --r-card: 16px; --r-inner: 12px; --r-ctl: 10px; --t-label: 11.5px; }
.page-head { margin-bottom: var(--sp-5); }
.section { margin-top: var(--sp-6); }
.section-head { margin-bottom: var(--sp-3); }
.card, .review-card, .routine-card, .next-up, .before-start, .morning, .prio-card { border-radius: var(--r-card); }
.kn-entry, .kn-insight, .kn-line, .iv-card, .rv-note, .fp-row { border-radius: var(--r-inner); }
.btn, .chip-btn, .filter-chip, .seg { border-radius: var(--r-ctl); }

/* 9. Section headers as small labels, so page titles and content carry the weight */
.section > .section-head h2, .section-head > h2 { font-size: var(--t-label); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.section-head h2 .i { color: var(--muted); }
.focus-section .section-head h2, .focus-section .section-head h2 .i { color: var(--accent); }

/* 9. Softer surfaces with depth: a faint top highlight and a soft shadow instead of flat grey on grey */
:root[data-mode="dark"] .card, :root[data-mode="dark"] .next-up, :root[data-mode="dark"] .before-start, :root[data-mode="dark"] .review-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--text) 4%, var(--surface)), var(--surface) 60%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent), 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .6);
}
:root[data-mode="light"] .card, :root[data-mode="light"] .next-up, :root[data-mode="light"] .before-start {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 6%, transparent), 0 1px 2px rgba(15, 15, 15, .05), 0 10px 28px -16px rgba(15, 15, 15, .18);
}

/* 0. Bug: the "quiet for a week" label belongs on its goal card, not the window corner */
.goal-card.is-quiet { position: relative; }

/* 1. Next up: the one thing to do now */
.next-up { position: relative; margin: 0 0 var(--sp-4); padding: 16px 18px 16px 20px; background: var(--surface); overflow: hidden; animation: iv-in .45s var(--spring); }
.next-up::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gc, var(--accent)); }
.nu-k { display: flex; align-items: center; gap: 8px; font-size: var(--t-label); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.nu-k .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.nu-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: nu-pulse 2.2s ease-out infinite; }
@keyframes nu-pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.nu-row { display: flex; align-items: center; gap: 14px; }
.nu-check .check { width: 34px; height: 34px; border-radius: 11px; }
.nu-check .check .i { width: 18px; height: 18px; }
.nu-body { flex: 1; min-width: 0; cursor: pointer; }
.nu-body .goal-ribbon { margin-bottom: 4px; }
.nu-title { font-size: 19px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.nu-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.nu-meta span { display: inline-flex; align-items: center; gap: 4px; }
.nu-focus { flex: none; }
/* the old "Start here" treatment on the first focus task would double up with Next up */
.today-page .zone-focus > .item.task:first-child:not(.done)::after { content: none; }
.today-page .zone-focus > .item.task:first-child:not(.done), .today-page .zone-focus > .task-wrap:first-child > .item.task:not(.done) { box-shadow: none; background: transparent; border: 0; padding: 10px 12px; margin: 0; }
.today-page .zone-focus > .item.task:first-child:not(.done) .item-title, .today-page .zone-focus > .task-wrap:first-child > .item.task .item-title { font-size: inherit; font-weight: 600; }
.today-page .zone-focus > .item.task:first-child:not(.done) .check, .today-page .zone-focus > .task-wrap:first-child > .item.task .check { width: 22px; height: 22px; border-radius: 7px; }

/* 2. Before you start: one slim row instead of two banners */
.before-start { margin: 0 0 var(--sp-4); background: var(--surface); }
.before-start > summary { display: flex; align-items: center; gap: 10px; padding: 11px 16px; cursor: pointer; list-style: none; user-select: none; }
.before-start > summary::-webkit-details-marker { display: none; }
.bs-k { font-size: var(--t-label); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); flex: none; }
.bs-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.bs-chips span { font-size: 12.5px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.bs-n { flex: none; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 750; }
.before-start > summary > .i { flex: none; color: var(--muted); transform: rotate(90deg); transition: transform .25s var(--spring); }
.before-start[open] > summary > .i { transform: rotate(-90deg); }
.bs-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; animation: iv-in .3s var(--spring); }
.bs-body > .morning, .bs-body > section { margin: 0; box-shadow: none; background: var(--surface-2); }

/* 3. Progress ring in the header */
.day-line { flex-direction: row; align-items: center; gap: 12px; padding: 6px 12px 6px 6px; border-radius: 99px; width: auto; max-width: 100%; transition: background .15s; }
.day-line:hover, .day-line.open { background: var(--hover); }
.dl-ring svg { display: block; }
.dl-ring text { font-weight: 700; fill: var(--text); }
.dl-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dl-text b { font-size: 14.5px; }
.dl-text > span { font-size: 12.5px; color: var(--muted); }
.dl-streak { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, #ff8a3c 16%, transparent); color: var(--text); white-space: nowrap; }
.dl-open { color: var(--faint); display: grid; }
.dl-bar { display: none; }

/* 4. An empty focus: pick from your most pressing tasks */
.focus-picks { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--r-card); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent); margin-bottom: 8px; }
.fp-k { font-size: var(--t-label); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 2px 4px; }
.fp-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: var(--surface); border: 1px solid var(--border-soft); }
.fp-row.has-goal { box-shadow: inset 3px 0 0 var(--gc); }
.fp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fp-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-meta { font-size: 12px; color: var(--muted); }

/* 5. Task rows: the title leads, details step back */
.item { padding: 11px 12px; }
.item.task .item-title { font-size: 14.5px; font-weight: 550; line-height: 1.35; }
.item.task .item-meta { font-size: 12px; color: var(--muted); margin-top: 3px; gap: 3px 10px; }
.item.task .item-meta .i { opacity: .75; }
@media (hover: hover) { .item.task:hover { background: color-mix(in srgb, var(--text) 5%, transparent); } .item.task:hover .item-title { color: var(--text); } }

/* 6. Goal cards: next step, momentum, a bar you can compare at a glance */
.goal-card .bar { height: 8px; }
.goal-card .pct { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.goal-next { display: flex; align-items: baseline; gap: 8px; font-size: 13px; line-height: 1.35; padding: 8px 10px; border-radius: var(--r-ctl); background: var(--surface-2); min-width: 0; }
.goal-next.none { color: var(--faint); }
.gn-k { flex: none; font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--c, var(--accent)); }
.gn-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mom { font-size: 12px; font-weight: 650; white-space: nowrap; }
.mom.up { color: var(--ok); }
.mom.down { color: var(--danger); }
.mom.flat { color: var(--faint); }
.goal-foot { flex-wrap: wrap; }

/* 7. Habit week: today's column as a soft band, circles with a little depth, help folded away */
.habit-table .ht-cell.is-today, .habit-table .ht-head .ht-day.is-today { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.habit-table .ht-row:not(.ht-head) .ht-cell.is-today { align-self: stretch; margin: -7px 0; padding: 7px 0; }
.dot.on { box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 35%, transparent), 0 2px 6px -2px color-mix(in srgb, var(--c) 70%, transparent); }
.dot.part { box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 18%, transparent); }
.ht-help { margin-top: 10px; font-size: 13px; color: var(--muted); }
.ht-help summary { cursor: pointer; display: inline-flex; align-items: center; gap: 7px; list-style: none; }
.ht-help summary::-webkit-details-marker { display: none; }
.ht-q { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); font-size: 11px; font-weight: 700; }
.ht-help[open] p { margin: 8px 0 0; animation: iv-in .25s var(--spring); }

/* 10. Phone: a taller frosted tab bar with a clear active pill, and an obvious sheet handle */
@media (max-width: 760px) {
  .tabbar { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .tab { min-height: 54px; border-radius: 14px; gap: 3px; position: relative; transition: color .2s; }
  .tab.on { color: var(--accent); }
  .tab.on::before { content: ''; position: absolute; inset: 4px 10px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 13%, transparent); z-index: -1; animation: iv-in .3s var(--spring); }
  .tab .i { width: 22px; height: 22px; }
  .modal .sheet-grip { width: 44px; height: 5px; background: color-mix(in srgb, var(--text) 25%, transparent); margin: -6px auto 12px; }
  .next-up { padding: 14px 14px 14px 16px; }
  .nu-row { flex-wrap: wrap; }
  .nu-focus { margin-left: 48px; }
  .nu-title { font-size: 17px; }
  .bs-chips { display: none; }
  .before-start > summary { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) { .nu-pulse, .next-up, .bs-body { animation: none; } }

@media (max-width: 760px) { .tab { isolation: isolate; } }

@media (max-width: 760px) { .nu-body { flex: 1 1 calc(100% - 52px); } .nu-focus { flex: 0 0 auto; margin-left: 48px; } }

/* Next up: subtasks unfold inside the card */
.nu-subs { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; margin: -2px 0; border-radius: 99px; border: 1px solid var(--border-soft); background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.nu-subs:hover, .nu-subs.open { color: var(--text); border-color: var(--border); background: var(--hover); }
.nu-subs > .i:last-child { transition: transform .25s var(--spring); }
.nu-subs.open > .i:last-child { transform: rotate(90deg); }
.nu-sublist { margin: 12px 0 0 48px; display: flex; flex-direction: column; gap: 2px; animation: iv-in .3s var(--spring); }
.nu-sub { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; }
.nu-sub:hover { background: var(--hover); }
.nu-sub .check { width: 20px; height: 20px; border-radius: 6px; flex: none; }
.nu-sub-t { flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.nu-sub.done .nu-sub-t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.nu-sub.in-slice .nu-sub-t { font-weight: 600; }
.nu-sub .slice-btn { opacity: .5; }
.nu-sub .slice-btn.on, .nu-sub:hover .slice-btn { opacity: 1; }
.nu-more { align-self: flex-start; margin: 4px 0 2px 6px; }
.nu-sublist .subtask-add { margin-top: 4px; }
@media (max-width: 760px) { .nu-sublist { margin-left: 0; } }

.next-up { animation: none; }
.next-up.enter { animation: iv-in .45s var(--spring); }
.nu-sublist { animation: none; }


/* =====================================================================
   Polish pass: alignment, calmer buttons, one feel, readability, nav
   ===================================================================== */

/* 1. Every list row starts at the same edge: rows without a drag handle get the handle's room */
#main .item.task:not(:has(> .drag-handle)) { padding-left: 25px; }
#main .task-wrap > .item.task:not(:has(> .drag-handle)) { padding-left: 25px; }

/* 2. Main buttons in dark mode: your accent, softer than a white block */
:root[data-mode="dark"] .btn.primary { background: var(--accent-btn, var(--accent)); border-color: transparent; color: var(--on-accent); box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 18%, transparent), 0 2px 8px -3px color-mix(in srgb, var(--accent) 60%, transparent); }
:root[data-mode="dark"] .btn.primary:hover { opacity: 1; background: var(--accent); }

/* 3. One feel for everything you can tap: a gentle tint, a tiny press */
@media (hover: hover) {
  .item:hover, .fp-row:hover, .rv-goal:hover, .tree-row:hover, .fg-row:hover, .entry:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
  .card[role="button"]:hover, .card[role="link"]:hover, .goal-card:hover, .entry:hover { box-shadow: var(--shadow-hover); }
}
.item:active, .fp-row:active, .fg-row:active, .tree-row:active, .entry:active, .goal-card:active, .card[role="button"]:active, .card[role="link"]:active, .nav-link:active { transform: scale(.992); transition: transform .08s; }
.goal-card:hover { transform: translateY(-1px); }
.goal-card:active { transform: translateY(0) scale(.99); }

/* 4. Numbers that don't jiggle as they change */
body { font-variant-numeric: tabular-nums; }

/* 5. Small grey text one notch brighter in dark mode */
:root[data-mode="dark"] .item-meta, :root[data-mode="dark"] .muted, :root[data-mode="dark"] .eyebrow, :root[data-mode="dark"] .gb-meta, :root[data-mode="dark"] .nu-meta, :root[data-mode="dark"] .fp-meta, :root[data-mode="dark"] .goal-foot { color: color-mix(in srgb, var(--muted) 82%, var(--text)); }

/* 6. A clear focus ring for keyboard use (not shown on mouse clicks) */
:focus:not(:focus-visible) { outline: none; }
:where(a, button, [role="button"], [role="link"], input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.item:focus-visible, .card:focus-visible, .goal-card:focus-visible { outline-offset: -2px; }

/* 7. A tidier sidebar: the active page as a soft pill, More's items grouped by a guide line */
.nav-link.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); }
.nav-link.on .i { color: var(--accent); }
.nav-more { position: relative; gap: 0; padding-left: 14px; margin: 2px 0 4px 10px; }
.nav-more::before { content: ''; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 1.5px; border-radius: 2px; background: var(--border-soft); }
.nav-more .nav-link { padding-top: 6px; padding-bottom: 6px; font-size: 13.5px; }
.nav-more .nav-link .i { width: 16px; height: 16px; }

/* 8. Small count badges */
.nav-count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.nav-count.warn { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.nav-more-toggle .nav-count { margin-left: 8px; }
.nav-more-toggle .nav-count + .nm-chev { margin-left: auto; }
.tab { position: relative; }
.tab-count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; display: grid; place-items: center; border-radius: 99px; font-size: 10px; font-weight: 750; background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--surface); }
.tab-count.warn { background: var(--danger); color: var(--on-danger); }

/* Habit day notes */
.has-note { position: relative; }
.has-note::after { content: ''; position: absolute; top: 1px; right: 1px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn, #f5a524); box-shadow: 0 0 0 1.5px var(--surface); pointer-events: none; }
.hd-day { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: var(--sp-3, 12px); }
.hd-status { margin-left: auto; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2, rgba(127,127,127,.12)); }
.hd-status.done { color: var(--c); }
.hd-status.miss { color: var(--danger); }
.hd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--sp-3, 12px); }
.hd-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.hd-reason { padding: 6px 11px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.hd-reason.on { border-color: var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 16%, transparent); }
.hw-card { display: grid; gap: 14px; }
.hw-insights p { margin: 0 0 4px; }
.hw-bars { display: grid; gap: 6px; }
.hw-bar { display: grid; grid-template-columns: 130px 1fr 24px; align-items: center; gap: 8px; font-size: 13.5px; }
.hw-track { height: 8px; border-radius: 99px; background: var(--surface-2, rgba(127,127,127,.15)); overflow: hidden; }
.hw-track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.hw-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hw-list { display: grid; gap: 6px; }
.hw-note { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: start; text-align: left; padding: 9px 11px; border-radius: var(--r-inner, 12px); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.hw-date { display: grid; font-weight: 600; font-size: 13.5px; }
.hw-date small { color: var(--muted); font-weight: 500; font-size: 12px; }
.hw-body { display: grid; gap: 2px; font-size: 14px; }
.hw-reason { font-weight: 600; }
.hw-note.miss .hw-st { color: var(--danger); }
.hw-note.done .hw-st { color: var(--accent); }

.hm-cell.has-note::after { top: -1px; right: -1px; width: 5px; height: 5px; box-shadow: none; }

/* Design pass 3: simple and sweet */
/* On your plate filters: one tidy row (scrolls sideways if it ever runs out of room). */
.chip-row.plate-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chip-row.plate-filter::-webkit-scrollbar { display: none; }
.plate-filter .chip-btn { flex-shrink: 0; }
.plate-filter .chip-select { max-width: 130px; padding-right: 22px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
/* Subtask count now sits in the meta line under the title. */
.item-meta .sub-toggle { padding: 1px 6px; margin: -1px 0 -1px -4px; font-size: 12.5px; }
/* Goal card with nothing planned: a quiet button to add the next step. */
button.goal-next.none { width: 100%; border: 1px dashed var(--border); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; align-items: center; gap: 6px; text-align: left; }
button.goal-next.none:hover { color: var(--text); border-color: var(--muted); }
@media (max-width: 760px) {
  /* Habits on phone: the + button already adds a habit, and goal tags only got cut to "Run…". */
  .hb-new { display: none; }
  .hb-break { padding: 6px 11px; font-size: 13px; }
  .ht-name .goal-ribbon { display: none; }
}
.chip-row.plate-filter { flex-wrap: wrap; overflow: visible; }
.plate-filter .chip-select { width: auto; field-sizing: content; }
@media (max-width: 760px) {
  .ht-row { grid-template-columns: minmax(0, 1fr) repeat(7, 30px); gap: 1px; }
  .ht-row .dot { width: 26px; height: 26px; }
  .ht-name .item-meta { font-size: 12px; }
}

/* Design pass 4 */
/* Goal page */
.plan-add { display: inline-flex; align-items: center; gap: 5px; margin: 10px 0 2px; padding: 4px 10px; border: 1px dashed var(--border); border-radius: 99px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; }
.plan-add:hover { color: var(--text); border-color: var(--muted); }
.ns-empty { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.ns-empty:hover { color: var(--text); }
.ns-empty .i { transform: rotate(90deg); }
.hp-done { margin-top: 4px; font-size: 13.5px; font-weight: 650; color: #cb912f; }
/* Habit page */
.kpi-more { margin: 10px 2px 0; line-height: 1.6; }
.kpi-more b { color: var(--text); font-weight: 650; }
.files-add-line { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: var(--sp-5, 24px); padding: 12px 14px; border: 1px dashed var(--border); border-radius: var(--r-inner, 12px); background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 550; text-align: left; cursor: pointer; }
.files-add-line:hover { border-color: var(--muted); }
.files-add-line .muted { font-weight: 400; }
/* Journal mood strip */
.mood-strip-card { margin-top: 14px; padding: 12px 12px 10px; }
.mood-strip-card .mood-strip { margin: 0; padding: 0; background: none; border: 0; box-shadow: none; }
.msc-k { font-size: var(--t-label, 11px); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 2px 6px; }
.mood-strip-card .md-emoji { font-size: 24px; line-height: 1.3; height: 32px; display: grid; place-items: center; }
.md-none { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--border); opacity: .7; }
.mood-day.no-mood small { opacity: .6; }
.mood-day.is-today .md-none { background: var(--accent); opacity: .5; }
@media (max-width: 760px) { .mood-strip-card .md-emoji { font-size: 18px; height: 26px; } }
@media (max-width: 760px) {
  .habit-today { flex-wrap: wrap; row-gap: 10px; }
  .habit-today .grow { flex: 1 1 calc(100% - 56px); }
}

/* Today: make the daily list the visual anchor and keep its companion list quiet. */
.today-page .today-top > .focus-section {
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border-soft));
  border-radius: var(--r-card);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.today-page .today-top > .focus-section + .section {
  padding-block-start: clamp(14px, 2vw, 22px);
}
.today-page .zone-plate { border-color: var(--border-soft); }
.today-page .today-top .item.task .item-title { font-weight: 600; line-height: 1.45; }
.today-page .today-top .item-meta { margin-top: 4px; }
.today-page .today-top .item-meta .danger { font-weight: 650; }
.today-page .zone-focus > .item.task:first-child:not(.done),
.today-page .zone-focus > .task-wrap:first-child > .item.task:not(.done) {
  padding-block: 16px;
}
@media (max-width: 600px) {
  .today-page .today-top .section-head,
  .today-page .today-top .head-btns { flex-wrap: wrap; }
  .today-page .today-top .item.task:has(> .drag-handle) {
    display: grid;
    grid-template-columns: 14px 24px minmax(0, 1fr) auto;
    align-items: start;
    gap: 6px 10px;
  }
  .today-page .today-top .item.task > .check { position: relative; margin-top: 1px; }
  .today-page .today-top .item.task > .check::after {
    content: ''; position: absolute; inset: -10px;
  }
  .today-page .today-top .item.task > .item-body { grid-column: 3 / -1; }
  .today-page .today-top .item.task > :is(.prio, .day-done-btn, .focus-btn) {
    grid-row: 2; justify-self: end;
  }
  .today-page .today-top .item.task > .focus-btn { grid-column: 4; }
  .today-page .today-top .item.task > .day-done-btn { grid-column: 3; }
  .today-page .today-top .item.task > .prio { grid-column: 2; justify-self: center; }
}

.today-actions { margin: -4px 0 10px; color: var(--muted); font-size: 13px; }
.today-actions summary { width: fit-content; padding: 5px 6px 5px 0; cursor: pointer; }
.today-actions[open] > div { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 4px 0 8px; }
.today-actions :is(.sort-pick, button, a) { min-height: 30px; display: inline-flex; align-items: center; }
.today-page .zone-focus > .item.task:first-child:not(.done),
.today-page .zone-focus > .task-wrap:first-child > .item.task:not(.done) { border-radius: var(--r-inner); background-color: var(--surface); }
.today-page .zone-focus > .item.task:first-child:not(.done) .item-title,
.today-page .zone-focus > .task-wrap:first-child > .item.task:not(.done) .item-title { font-weight: 650; font-size: 16px; }
.goals-page .goal-card { gap: 10px; padding: clamp(14px, 2vw, 20px); border-color: var(--border-soft); }
.goals-page .goal-next:not(.none) { background: color-mix(in srgb, var(--c) 7%, var(--surface)); }
.goals-page .goal-next .gn-t { white-space: normal; overflow-wrap: anywhere; }
.goal-board > .gb-list > .gb-card { box-shadow: none; }
.gb-card.active-branch { border-color: color-mix(in srgb, var(--c) 55%, var(--border-soft)); }
.goal-hero .next-step { border-color: color-mix(in srgb, var(--c) 23%, var(--border-soft)); }
.goal-hero .ns-row { flex-wrap: wrap; }
.goal-hero .ns-body { flex: 1 1 12rem; }
.goal-board :is(button, summary):focus-visible, .today-actions :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) {
  .goal-board .gb-toggle { width: 32px; height: 40px; }
  .goal-board .gb-row > .check { min-width: 24px; min-height: 24px; }
  .goal-board .gb-row > .check::after { inset: -5px 0; }
  .goal-board .gb-open::after { inset: -3px 0; }
  .goal-board .gb-focus.btn, .goal-hero .ns-row .btn { min-height: 40px; }
  .today-page .today-top .item.task > .check::after { inset: -8px -3px; }
}
@media (prefers-reduced-motion: no-preference) {
  .goal-board .branch-opened { animation: branch-reveal .18s ease-out; }
  .goal-board .gb-row.done .check.pop { animation: check-pop .28s ease-out; }
}
@keyframes branch-reveal { from { opacity: .35; transform: translateY(-3px); } }

.today-board-path { display: inline-block; margin-block: 4px 2px; padding-block: 3px; max-width: 100%; color: var(--muted); font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; text-decoration: none; }
.today-board-path:hover, .today-board-path:focus-visible { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.today-handoff { box-sizing: border-box; min-inline-size: 100px; min-block-size: 36px; justify-content: center; white-space: nowrap; }
.today-handoff.confirmed { cursor: default; background: color-mix(in srgb, var(--ok) 10%, var(--surface)); color: var(--text); border-color: color-mix(in srgb, var(--ok) 30%, var(--border-soft)); }
.today-handoff.confirmed .i { color: var(--ok); }
.goal-pinned { display: none; }
@media (max-width: 760px) {
  .goal-pinned:not([hidden]) { position: fixed; inset: 0 0 auto; z-index: 15; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 4px) 16px 4px; background: var(--surface); border-bottom: 1px solid var(--border-soft); }
  .goal-pinned .back { display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: 0; font-size: 0; gap: 0; }
  .goal-pinned strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
  @supports (backdrop-filter: blur(12px)) {
    .goal-pinned:not([hidden]) { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); }
  }
}
@media (prefers-reduced-motion: no-preference) {
  .today-handoff.just-confirmed .i { animation: check-pop .24s ease-out; }
  .gb-row.next-arrived { animation: next-arrived .32s ease-out; }
  .goal-pinned:not([hidden]) { animation: branch-reveal .15s ease-out; }
}
@keyframes next-arrived { from { background-color: color-mix(in srgb, var(--c) 22%, var(--surface)); } }

.miss-label, .miss-run, .miss-mark { color: color-mix(in srgb, var(--warn) 70%, var(--text)); }
.miss-label, .miss-run { font-size: 12px; }
button.miss-label { cursor: pointer; background: transparent; border: 0; padding: 2px 0; text-decoration: underline; text-underline-offset: 3px; }
.miss-mark { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
:is(.item.habit, .hcard, .ht-row):has(.miss-run) { border-inline-start: 3px solid color-mix(in srgb, var(--warn) 65%, var(--border)); }
.mc-day.missed i, .hm-cell.missed, .hc-cells i.missed, .hk-month i.missed { background: color-mix(in srgb, var(--warn) 35%, var(--surface)); }
.dot.missed, .hc-check.missed { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-color: var(--warn); color: color-mix(in srgb, var(--warn) 70%, var(--text)); }
.habit-miss-btn { font-size: 12px; }
@media (max-width: 600px) {
  .today-habits .item.habit { flex-wrap: wrap; }
  .today-habits .item-body { flex: 1 1 45%; }
}

/* Review of the Nov 18 changes */
/* Goal path under a task: one line in the goal's colour, shortened with … */
.today-board-path { display: flex; align-items: center; gap: 5px; width: fit-content; max-width: 100%; margin: 4px 0 2px; padding: 2px 9px 2px 7px; border-radius: 99px; background: color-mix(in srgb, var(--gc, var(--accent)) 14%, transparent); color: color-mix(in srgb, var(--gc, var(--accent)) 75%, var(--text)); font-size: 12px; font-weight: 600; line-height: 1.5; text-decoration: none; white-space: nowrap; overflow: hidden; }
.today-board-path .tbp-ic { flex: none; font-size: 11px; }
.today-board-path .tbp-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.today-board-path .i { flex: none; opacity: .7; }
.today-board-path:hover, .today-board-path:focus-visible { color: var(--text); text-decoration: none; background: color-mix(in srgb, var(--gc, var(--accent)) 22%, transparent); }
/* Quiet "mark missed" in habit lists */
.habit-miss-btn.quiet { color: var(--faint); }
.habit-miss-btn.quiet:hover { color: var(--warn); }
@media (max-width: 600px) {
  .today-habits .item.habit { flex-wrap: nowrap; }
  .today-habits .item-body { flex: 1 1 auto; min-width: 0; }
}

/* Daily check-in: the meaningful-work question */
.dc-work { display: grid; gap: 8px; }
.dc-work-q { font-weight: 650; font-size: 14.5px; }
.dc-work .verdict-opts { margin-bottom: 0; }
.dc-work .verdict.on { box-shadow: 0 0 0 1px var(--vc) inset; border-color: var(--vc); background: color-mix(in srgb, var(--vc) 24%, var(--surface)); }
.dc-work .verdict.real { --vc: var(--ok); }
.dc-work .verdict.not { --vc: var(--warn); }
.dc-work .verdict.on b::after { content: ' ✓'; color: var(--vc); }
.entry-work { flex: none; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.entry-work.real { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.entry-work.not { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* Links in notes */
.rt-body a, .rt-view a, .hw-body a, .entry-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; overflow-wrap: anywhere; }
.rt-body a:hover, .rt-view a:hover, .hw-body a:hover, .entry-text a:hover { text-decoration-thickness: 2px; }
.habit-notes .rt-body { min-height: 80px; }

/* Habit groups (js/habitgroups.js) */
.habit-table.grouped { padding: 6px 6px 8px; }
.hg-list { display: grid; gap: 8px; margin-top: 4px; }
.hg { border-radius: 12px; background: color-mix(in srgb, var(--gc, var(--muted)) 7%, transparent); box-shadow: inset 3px 0 0 var(--gc, var(--border)); padding: 0 2px 4px 6px; -webkit-touch-callout: none; }
.hg.hg-loose { background: transparent; box-shadow: none; margin-top: 8px; }
.hg-head { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 6px 4px 4px; cursor: pointer; user-select: none; -webkit-user-select: none; border-radius: 10px; }
.hg-head.plain { cursor: default; }
.hg-head:not(.plain):hover .hg-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--gc) 50%, transparent); }
.hg-chev { display: grid; place-items: center; width: 18px; color: var(--muted); transition: transform .18s var(--spring, ease); transform: rotate(90deg); }
.hg.collapsed .hg-chev { transform: rotate(0deg); }
.hg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gc); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gc) 22%, transparent); }
.hg-name { font-size: 14.5px; font-weight: 700; color: color-mix(in srgb, var(--gc) 55%, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hg-loose .hg-name { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.hg-goal { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hg-count { margin-left: auto; flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hg-count.all { color: var(--ok); font-weight: 650; }
.hg-edit { flex: none; opacity: .6; }
.hg-head:hover .hg-edit { opacity: 1; }
.hg-handle { margin: 0 -4px 0 -2px; flex: none; }
.hg-rows .ht-row:first-child { border-top: 0; }
.hg-rows { min-height: 8px; border-radius: 8px; }
.hg-rows.drop-target { background: color-mix(in srgb, var(--gc, var(--accent)) 12%, transparent); }
.hg-empty { margin: 2px 8px 6px 30px; }
.hg.dragging { background: var(--surface); box-shadow: inset 3px 0 0 var(--gc), 0 12px 28px rgba(0, 0, 0, .25); position: relative; z-index: 6; }
.hg-plain { padding: 2px 6px 10px 10px; margin-top: 12px; }
.hg-plain > .hcards, .hg-plain > .hk-grid { margin-top: 4px; }
@media (max-width: 760px) {
  .hg { padding-left: 4px; }
  .hg-goal { display: none; }
  .hb-group { padding: 6px 11px; font-size: 13px; }
}
.hg-pick { display: grid; gap: 2px; max-height: 260px; overflow: auto; border: 1px solid var(--border-soft); border-radius: var(--r-inner, 12px); padding: 4px; }
.hg-pick-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.hg-pick-row:hover { background: var(--hover); }
.hg-pick-row input { position: absolute; opacity: 0; pointer-events: none; }
.hg-pick-row .box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border); display: grid; place-items: center; color: transparent; flex: none; }
.hg-pick-row input:checked + .box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.hg-pick-row small { margin-left: auto; }

/* ================= Simple & quiet (Nov 25) =================
   One calm layer on top of everything above: flat surfaces, no glows or pulses, goal labels as plain text,
   and the accent colour kept for main buttons and today. Every feature stays; only the noise goes. */

/* 1. Flat surfaces */
:root[data-mode="dark"] .card, :root[data-mode="dark"] .next-up, :root[data-mode="dark"] .before-start, :root[data-mode="dark"] .review-card { background: var(--surface); box-shadow: none; }
:root[data-mode="light"] .card, :root[data-mode="light"] .next-up, :root[data-mode="light"] .before-start { box-shadow: 0 0 0 1px var(--border-soft); }
:root[data-mode="dark"] .btn.primary { box-shadow: none; }
.today-page .today-top > .focus-section { padding: 0; border: 0; background: none; }
.today-page .today-top > .focus-section + .section { padding-block-start: 0; }
.focus-section .section-head h2, .focus-section .section-head h2 .i { color: var(--text); }
#main .item.has-goal::before, .card.entry.has-goal::before { display: none; }
#main .item.task.is-overdue:not(.done) { animation: none; }
.today-page .zone-focus > .item.task:first-child:not(.done)::after { display: none; } /* no "Start here" badge */
.today-page .zone-focus > .item.task:first-child:not(.done), .today-page .zone-focus > .task-wrap:first-child > .item.task:not(.done) { background-color: transparent; }
.today-page .zone-focus > .item.task:first-child:not(.done) .item-title, .today-page .zone-focus > .task-wrap:first-child > .item.task:not(.done) .item-title { font-size: inherit; }
.drop-zone, .drop-zone.small { border: 1px dashed var(--border-soft); background: transparent; color: var(--muted); }
.drop-zone .i { color: var(--muted); }

/* Next up: a slim row, not a big card */
.next-up { padding: 12px 14px; border: 1px solid var(--border-soft); background: var(--surface); }
.next-up::before { display: none; }
.next-up .nu-k { font-size: 11px; color: var(--muted); }
.next-up .nu-title { font-size: 16px; }
.nu-pulse { display: none; }

/* 2. Goal labels: a small coloured dot and the goal's name in grey */
.goal-ribbon { padding: 0; border: 0; background: none; color: var(--muted); font-weight: 500; font-size: 12px; gap: 6px; }
.goal-ribbon:hover { background: none; color: var(--text); }
.goal-ribbon .gr-icon { display: none; }
.goal-ribbon::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.today-board-path { padding: 0; background: none; color: var(--muted); font-weight: 500; }
.today-board-path .tbp-ic { display: none; }
.today-board-path::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--gc, var(--accent)); flex: none; }
.today-board-path:hover, .today-board-path:focus-visible { background: none; color: var(--text); }

/* 3. Lean task rows: size letters only inside the task */
#main .item.task .effort-tag { display: none; }

/* 6. Filters behind one button */
.plate-filter-wrap { margin: -2px 0 8px; }
.plate-filter-wrap > summary { list-style: none; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 2px 0; }
.plate-filter-wrap > summary::-webkit-details-marker { display: none; }
.plate-filter-wrap > summary b { color: var(--text); font-weight: 600; }
.plate-filter-wrap[open] > .plate-filter { margin-top: 6px; }

/* 8. Plainer sidebar level line and coach button */
.level-bar { background: none; border-color: transparent; padding: 6px 8px; }
.level-bar:hover { background: var(--hover); border-color: transparent; }
.lb-level { color: var(--muted); font-weight: 700; }
.coach-fab { width: 44px; height: 44px; font-size: 19px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
:root[data-theme="ink"] .coach-fab, :root[data-theme="ink-dark"] .coach-fab { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
@media (max-width: 760px) { .fab { box-shadow: 0 4px 12px rgba(0, 0, 0, .25); } }

/* Habit tags: one, and quiet */
.miss-twice, button.miss-twice, button.miss-run { border: 0; font: inherit; font-size: 12px; cursor: pointer; }
button.miss-run { background: color-mix(in srgb, var(--warn) 12%, transparent); color: color-mix(in srgb, var(--warn) 75%, var(--text)); padding: 2px 8px; border-radius: 99px; font-weight: 650; }
.routine-link { display: block; margin: 10px 2px 0; color: var(--muted); }
.routine-link:hover { color: var(--text); }

/* ================= Minimal (Nov 29) ================= */
/* One font everywhere: headings use the same clean sans-serif as the text, a little smaller. */
:root, :root[data-theme] { --serif: var(--sans); }
h1 { font-weight: 700; letter-spacing: -.02em; }
.page-head h1, .today-head h1 { font-size: clamp(24px, 3vw, 30px); }
.today-head h1.today-date { font-size: clamp(22px, 2.6vw, 26px); }
.hp-summary, .goal-hero h1, .habit-hero h1 { font-weight: 700; letter-spacing: -.015em; }
.kpi b { font-weight: 700; }

/* Several measurements per habit */
.metric-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.metric-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, .9fr) 32px; gap: 8px; align-items: center; }
.metric-row:first-child { grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, .9fr) 32px; }
.metric-row:first-child::after { content: ''; }
.metric-row input { min-width: 0; }
.metric-help { margin: 6px 0 0; }
.amount-block + .amount-block { margin-top: 14px; }
.amount-label { font-weight: 650; font-size: 14px; margin-bottom: 6px; text-align: center; }
.metric-switch { margin: 18px 0 -6px; }
form:has(input[name=hasMetric]:checked) .cond-metric { display: block !important; }
.cond-metric { margin-top: -4px; }
@media (max-width: 760px) {
  .metric-row, .metric-row:first-child { grid-template-columns: minmax(0, 1fr) 72px 72px 28px; gap: 6px; }
}

/* ================= Today, straight to the point (Nov 29) ================= */
/* Fold the sidebar away (laptop) */
.brand-row { display: flex; align-items: center; justify-content: space-between; }
.brand-row .brand { flex: 1; min-width: 0; }
.nav-collapse-btn { margin: -10px 0 0; color: var(--faint); }
.nav-collapse-btn:hover { color: var(--text); }
.nav-open-btn { display: none; position: fixed; top: 14px; left: 14px; z-index: 40; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--muted); cursor: pointer; place-items: center; }
.nav-open-btn:hover { color: var(--text); border-color: var(--border); }
@media (min-width: 761px) {
  body.nav-collapsed .sidebar { display: none; }
  body.nav-collapsed .nav-open-btn { display: grid; }
}

/* The day's progress: a bigger card that says what's left, by name */
.day-line { width: 100%; padding: 14px 16px; gap: 14px; border-radius: var(--r-card); }
.day-line .dl-text b { font-size: 17px; }
.dl-left { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dl-left i { font-style: normal; font-size: 12.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-soft); padding: 2px 9px; border-radius: 99px; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-left i.more { color: var(--muted); background: none; }

/* Plan your week, and what's left from before: out in the open */
.before-start-open { display: grid; gap: 10px; margin: 0 0 var(--sp-4, 18px); }
.before-start-open:empty { display: none; }
.week-nudge.big { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-card); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border-soft)); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); color: var(--text); text-decoration: none; }
.week-nudge.big:hover { border-color: var(--accent); }
.wn-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); flex: none; }
.wn-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wn-text b { font-size: 16px; }
.wn-text span { font-size: 13px; color: var(--muted); }
.week-nudge.big .btn { flex: none; pointer-events: none; }
.before-start-open .morning { margin: 0; padding: 16px 18px; border-radius: var(--r-card); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border-soft)); background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.mc-title-big { display: block; font-size: 16px; margin-bottom: 2px; }

/* Overdue bar: one action, the rest behind ⋯ */
.ob-more { position: relative; }
.ob-more > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 30px; height: 30px; font-size: 18px; line-height: 1; }
.ob-more > summary::-webkit-details-marker { display: none; }
.ob-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 24px rgba(0, 0, 0, .25); white-space: nowrap; }
@media (max-width: 760px) {
  .week-nudge.big { flex-wrap: wrap; }
  .week-nudge.big .btn { width: 100%; justify-content: center; }
  .dl-left i { max-width: 180px; }
}
.week-nudge.big > .wn-ic { flex: 0 0 42px; }
.week-nudge.big > .wn-text { flex: 1 1 auto; }
.today-page .week-nudge.big { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
@media (max-width: 760px) {
  .dl-left { gap: 5px; }
  .dl-left i { max-width: calc(50% - 3px); font-size: 12px; padding: 2px 8px; }
  .day-line .dl-text { min-width: 0; flex: 1; }
}
@media (max-width: 760px) { .dl-left i { max-width: 100%; } }
