/* Tempo: shared design tokens + the planner app.
   Look: warm paper, ink, one vermilion accent. Serif display type, grotesk for UI, mono for times. */
:root {
  --bg: #f5f2ea; --card: #fffdf8; --sunk: #efebe1; --ink: #1b1a17; --ink-2: #3a3833; --muted: #6e695e; --line: #e2ddd0; --line-2: #d2ccbc;
  --brand: #d9461e; --brand-ink: #fffdf8; --brand-soft: #fbe6dc;
  --ok: #2f6f4f; --ok-soft: #e3efe6; --warn: #94600a; --warn-soft: #f8ecd2; --err: #b3261e; --err-soft: #f9e1dd;
  --info-soft: #ebe7dc; --act: #8b8577; --act-soft: #ebe7dd;
  --radius: 10px; --radius-s: 6px; --shadow: 0 1px 0 rgba(27, 26, 23, .04);
  --fs: 16px; --lh: 1.5; --ls: normal; --ws: normal;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14130f; --card: #1c1b17; --sunk: #191813; --ink: #eee9dd; --ink-2: #d6d0c2; --muted: #a29b8b; --line: #2e2c25; --line-2: #3d3a31;
    --brand: #ff7a4d; --brand-ink: #14130f; --brand-soft: #3a2219;
    --ok: #7cc79c; --ok-soft: #1c2d23; --warn: #e7b65c; --warn-soft: #33281a; --err: #ff8f80; --err-soft: #3a1d19;
    --info-soft: #24221c; --act: #8f887a; --act-soft: #25231d; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14130f; --card: #1c1b17; --sunk: #191813; --ink: #eee9dd; --ink-2: #d6d0c2; --muted: #a29b8b; --line: #2e2c25; --line-2: #3d3a31;
  --brand: #ff7a4d; --brand-ink: #14130f; --brand-soft: #3a2219;
  --ok: #7cc79c; --ok-soft: #1c2d23; --warn: #e7b65c; --warn-soft: #33281a; --err: #ff8f80; --err-soft: #3a1d19;
  --info-soft: #24221c; --act: #8f887a; --act-soft: #25231d; --shadow: none; color-scheme: dark;
}
:root[data-contrast="high"] { --muted: var(--ink); --line: var(--ink); --line-2: var(--ink); }
:root[data-readable="on"] { --ls: .03em; --ws: .12em; --lh: 1.75; }

* { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: var(--lh); letter-spacing: var(--ls); word-spacing: var(--ws); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1rem; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 30; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: -.01em; }
.display { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.eyebrow { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.tight { gap: .25rem; flex-wrap: nowrap; }
svg.i { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .55rem 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand img { display: block; }
.brand span { font-family: var(--serif); font-size: 1.6rem; line-height: 1; letter-spacing: -.01em; }
.topbar-actions { margin-left: auto; display: flex; gap: .4rem; align-items: center; }
.topbar select { max-width: 11rem; padding: .4rem 1.8rem .4rem .65rem; min-height: 36px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background-color: var(--card); font-size: .875rem; }
.engine { position: relative; display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; padding: 0 0 0 .7rem; border-radius: 99px; border: 1px solid var(--line-2); background: var(--card); color: var(--muted); min-height: 34px; }
.engine .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--line-2); flex: none; }
.engine.on { color: var(--ink); }
.engine.on .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.engine.busy .dot { background: var(--brand); animation: pulse .8s infinite alternate; }
@keyframes pulse { to { opacity: .25; } }
.engine select { font-size: .8rem; border: 0; background-color: transparent; color: inherit; max-width: 14rem; min-height: 32px; padding: 0 1.7rem 0 0; border-radius: 99px; }
.nav-link { font-size: .875rem; color: var(--muted); text-decoration: none; padding: .35rem .5rem; border-radius: 6px; }
.nav-link:hover { color: var(--ink); }

/* ---------- layout: sidebar + views (desktop), tab bar (phone) ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); max-width: 1480px; margin: 0 auto; min-height: calc(100vh - 53px); }
#main { padding: 24px 28px 48px; min-width: 0; outline: none; }
.view { display: flex; flex-direction: column; gap: 20px; }
.view[hidden] { display: none; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; padding: 4px 2px 0; }
.view-head h1 { font-size: clamp(2rem, 3.2vw, 2.6rem); line-height: 1.05; margin: .15rem 0 0; outline: none; }
.view-head .eyebrow { margin: 0; }

.sidenav { position: sticky; top: 53px; align-self: start; height: calc(100vh - 53px); display: flex; flex-direction: column; gap: 4px; padding: 20px 12px 16px 16px; border-right: 1px solid var(--line); overflow-y: auto; }
.navlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.navlist a, .navlist button { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink-2); text-decoration: none; font-size: .92rem; font-weight: 500; cursor: pointer; text-align: left; }
.navlist a:hover, .navlist button:hover { background: var(--card); border-color: var(--line); color: var(--ink); }
.navlist a[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.navlist a[aria-current="page"] kbd { color: color-mix(in srgb, var(--bg) 60%, transparent); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.navlist .i { font-size: 1.1rem; }
.navlist span:not(.i) { flex: 1; }
.navlist.secondary a, .navlist.secondary button { font-size: .85rem; color: var(--muted); padding: .45rem .7rem; }
.navlist .serif.i { font-family: var(--serif); font-size: 1.05rem; width: 1.1rem; text-align: center; line-height: 1; }
.navsep { height: 1px; background: var(--line); margin: 14px 8px; }
.navhome { margin-top: auto; display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); text-decoration: none; padding: .5rem .7rem; border-radius: 8px; }
.navhome:hover { color: var(--ink); background: var(--card); }
kbd { font-family: var(--mono); font-size: .68rem; color: var(--muted); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 .32rem; line-height: 1.4; }
.badge { min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; border-radius: 99px; background: var(--err); color: #fff; font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.badge.neutral { background: var(--sunk); color: var(--ink-2); border: 1px solid var(--line-2); }
.dot-badge { min-width: 0; width: .55rem; height: .55rem; padding: 0; background: var(--brand); }
.badge[hidden] { display: none; }
.icon-btn.mobile-only { display: none; }

.tabbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; min-height: 0; }
  .sidenav { display: none; }
  #main { padding: 16px 16px calc(92px + env(safe-area-inset-bottom)); }
  .icon-btn.mobile-only { display: inline-grid; }
  .topbar { gap: .5rem; padding: .5rem 12px; }
  .topbar select { max-width: 7.5rem; }
  .engine select { max-width: 8.5rem; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line-2); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; min-height: 52px; font-size: .7rem; font-weight: 500; color: var(--muted); text-decoration: none; border-radius: 10px; }
  .tabbar a .i { width: 1.7rem; height: 1.7rem; padding: 3px; }
  .tabbar a[aria-current="page"] { color: var(--ink); background: var(--sunk); }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -7px; left: 30%; right: 30%; height: 2px; background: var(--brand); border-radius: 2px; }
  .tabbar .tab-add .i { background: var(--ink); color: var(--bg); border-radius: 50%; padding: 5px; }
  .tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .hide-touch { display: none; }
}
@media (max-width: 520px) { .brand span { display: none; } .view-head .row { width: 100%; } }

/* add view */
.add-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.add-side { display: flex; flex-direction: column; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: .5rem; margin-top: .7rem; }
.stack .btn { justify-content: flex-start; }
.tips { margin: .4rem 0 0; padding-left: 1.1rem; color: var(--ink-2); display: flex; flex-direction: column; gap: .45rem; }
/* tasks view */
.tasks-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.group-h { display: flex; justify-content: space-between; align-items: baseline; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1.1rem 0 .2rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.group-h:first-child { margin-top: 0; }
.group-h.warn { color: var(--warn); }
.list li.row-btn { border-top: 0; border-bottom: 1px solid var(--line); padding: .7rem .25rem; }
.list li.row-btn:last-child { border-bottom: 0; }
.list .chev { color: var(--line-2); flex: none; }
.list li:hover .chev { color: var(--ink); }
@media (max-width: 1100px) { .add-grid, .tasks-grid { grid-template-columns: 1fr; } }
/* coach view */
#coachCard .chat { max-height: none; min-height: 280px; height: calc(100vh - 380px); }
@media (max-width: 900px) { #coachCard .chat { height: calc(100vh - 420px); min-height: 220px; } }
#coachForm { margin-top: .75rem; }
/* dialog close button */
.dlg-x { position: absolute; top: 12px; right: 12px; }
dialog { position: fixed; }
dialog form { position: relative; }
dialog h2 { padding-right: 2.5rem; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; align-items: center; font-size: .92rem; margin: 0; }
.keys dt { text-align: right; } .keys dd { margin: 0; color: var(--ink-2); }
.link-row { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; font-weight: 500; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.link-row:hover { border-color: var(--ink); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }
.card-head h2 { margin: 0; }
.card h2 { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.card .lede { font-family: var(--serif); font-size: 1.55rem; line-height: 1.15; margin: 0 0 .35rem; color: var(--ink); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--line-2); background: var(--card); padding: .5rem .9rem; border-radius: var(--radius-s); cursor: pointer; font-weight: 500; font-size: .9rem; min-height: 38px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.accent { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunk); border-color: var(--line); }
.btn.small { padding: .28rem .6rem; min-height: 32px; font-size: .82rem; }
.btn.danger { color: var(--err); }
.btn[disabled] { opacity: .65; cursor: progress; }
.icon-btn { border: 1px solid transparent; background: transparent; width: 36px; height: 36px; border-radius: var(--radius-s); cursor: pointer; display: inline-grid; place-items: center; color: var(--ink-2); font-size: 1.05rem; }
.icon-btn:hover { background: var(--card); border-color: var(--line-2); color: var(--ink); }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.icon-btn .serif { font-family: var(--serif); font-size: 1.25rem; line-height: 1; }

textarea, input, select { width: 100%; border: 1px solid var(--line-2); background: var(--card); border-radius: var(--radius-s); padding: .6rem .7rem; }
textarea:focus, input:focus, select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236e695e' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .55rem center; background-size: 12px; padding-right: 1.9rem; }
input[type="checkbox"] { width: auto; accent-color: var(--ink); }
input[type="range"] { accent-color: var(--brand); padding: 0; border: 0; background: none; box-shadow: none; }
.input-wrap { position: relative; }
textarea { resize: vertical; margin-bottom: .75rem; background: var(--sunk); border-color: var(--line); line-height: 1.5; padding: .8rem .9rem 2.6rem; }
textarea::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
.mic { position: absolute; right: 8px; bottom: 20px; background: var(--card); border-color: var(--line-2); }
.mic.rec { background: var(--err-soft); border-color: var(--err); color: var(--err); }
.kbd { font-family: var(--mono); font-size: .72rem; color: var(--muted); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; gap: .75rem; align-items: center; padding: .7rem .25rem; border-top: 1px solid var(--line); cursor: pointer; }
.list li:first-child { border-top: 0; padding-top: .2rem; }
.list li:hover .t { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { font-size: .8rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.kind { font-family: var(--mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 .25rem; margin-left: .35rem; vertical-align: .1em; }
.tag { font-size: .72rem; font-weight: 500; padding: .12rem .5rem; border-radius: 99px; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; border: 1px solid transparent; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.tight { background: var(--warn-soft); color: var(--warn); }
.tag.at-risk { background: var(--err-soft); color: var(--err); } .tag.info { background: var(--info-soft); color: var(--ink-2); }
.tag.assumed { background: var(--warn-soft); color: var(--warn); }
.tag.plain::before { display: none; }
.empty { color: var(--muted); font-size: .9rem; padding: .5rem 0; }
.list li.empty, .list li.foot { cursor: default; border-top: 0; }
.list li.foot { font-size: .8rem; color: var(--muted); padding-top: .6rem; }

/* ---------- review of AI-extracted items (human in the loop) ---------- */
.review { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.review-head { display: flex; flex-direction: column; gap: .2rem; }
.review-head strong { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; }
.rv { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .75rem; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; background: var(--card); }
.rv .full { grid-column: 1 / -1; }
.rv label { font-size: .72rem; color: var(--muted); display: flex; flex-direction: column; gap: .2rem; }
.rv input, .rv select { padding: .38rem .5rem; font-size: .875rem; }
.rv .assumedField { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background-color: var(--warn-soft); }
.rv-head { display: flex; justify-content: space-between; align-items: center; grid-column: 1 / -1; }
.rv-head label { flex-direction: row; align-items: center; gap: .4rem; color: var(--ink); font-size: .85rem; font-weight: 500; }
.q { display: flex; gap: .5rem; align-items: flex-start; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .55rem .7rem; font-size: .875rem; }
.q > svg { color: var(--brand); margin-top: .2rem; }
label.q { cursor: pointer; }
.note { font-size: .8rem; color: var(--muted); border-left: 2px solid var(--line-2); padding-left: .6rem; }

/* ---------- today ---------- */
.today { padding: 0; overflow: hidden; }
.today-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 20px 22px 0; }
.today-top .display { font-size: 2.1rem; line-height: 1.05; margin: .25rem 0 0; }
.next { display: grid; grid-template-columns: auto 1fr auto; gap: 1.1rem; align-items: center; margin: 18px 22px; padding: 16px 18px; border-radius: var(--radius); background: var(--ink); color: var(--bg); }
.next .eyebrow { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.next-time { font-family: var(--mono); font-size: 1.35rem; line-height: 1; padding-right: 1.1rem; border-right: 1px solid color-mix(in srgb, var(--bg) 22%, transparent); }
.next-time small { display: block; font-size: .7rem; margin-top: .35rem; color: color-mix(in srgb, var(--bg) 60%, transparent); }
.next-title { font-family: var(--serif); font-size: 1.6rem; line-height: 1.1; margin: .1rem 0; }
.next-sub { font-size: .85rem; color: color-mix(in srgb, var(--bg) 72%, transparent); display: flex; align-items: center; gap: .45rem; }
.next-sub i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.next .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.next .btn:hover { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.next.free { grid-template-columns: 1fr; background: var(--sunk); color: var(--ink); border: 1px solid var(--line); }
.next.free .next-sub { color: var(--muted); }
.stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr; border-top: 1px solid var(--line); }
.stat { padding: 14px 22px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat b { display: block; font-weight: 600; font-size: 1.45rem; line-height: 1.15; margin-top: .2rem; letter-spacing: -.025em; font-feature-settings: "tnum"; }
.stat b small { font-family: var(--font); font-size: .8rem; color: var(--muted); }
.meter { height: 4px; background: var(--sunk); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.energy-row { display: flex; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; padding: 12px 22px 16px; border-top: 1px solid var(--line); background: var(--sunk); }
.energy-row .label { font-size: .85rem; font-weight: 500; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-s); overflow: hidden; background: var(--card); }
.seg .btn { border: 0; border-radius: 0; border-left: 1px solid var(--line-2); min-height: 32px; background: transparent; }
.seg .btn:first-child { border-left: 0; }
.seg .btn:hover { background: var(--sunk); color: var(--ink); }
.seg .btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.energy-row .spacer { flex: 1; }
@media (max-width: 640px) {
  .today-top { padding: 16px 16px 0; } .today-top .display { font-size: 1.7rem; }
  .next { margin: 14px 16px; grid-template-columns: 1fr auto; } .next-time { grid-column: 1 / -1; border-right: 0; padding: 0; font-size: 1.05rem; }
  .stats { grid-template-columns: 1fr 1fr; } .stat { padding: 12px 16px; } .stat:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .stat:nth-child(2) { border-left: 0; } .energy-row { padding: 12px 16px; } .energy-row .spacer { display: none; }
}

/* ---------- alerts ---------- */
#alerts:empty { display: none; }
.alert { border-radius: var(--radius); padding: 14px 16px 14px 18px; margin-bottom: 10px; border: 1px solid var(--line); background: var(--card); position: relative; overflow: hidden; }
.alert::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--muted); }
.alert.error::before { background: var(--err); } .alert.warn::before { background: var(--warn); }
.alert.error { background: color-mix(in srgb, var(--err-soft) 55%, var(--card)); border-color: color-mix(in srgb, var(--err) 25%, var(--line)); }
.alert .row { margin-top: .6rem; }
.alert strong.k { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; margin-bottom: .15rem; }
.alert.error strong.k { color: var(--err); } .alert.warn strong.k { color: var(--warn); }
.alert-foot { color: var(--muted); font-size: .8rem; margin: -2px 0 10px 2px; }

/* ---------- week ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--line); gap: 1px; }
@media (max-width: 900px) { .week { grid-template-columns: 1fr; } }
.day { background: var(--card); padding: 10px 8px 12px; min-height: 210px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.day.is-today { background: color-mix(in srgb, var(--brand-soft) 35%, var(--card)); }
.day-h { display: flex; align-items: baseline; gap: .35rem; padding: 0 2px 6px; }
.day-h .dow { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.day-h .dnum { font-size: 1.35rem; font-weight: 600; line-height: 1; letter-spacing: -.03em; font-feature-settings: "tnum"; }
.day.is-today .dow { color: var(--brand); }
.day-h .load { margin-left: auto; font-family: var(--mono); font-size: .65rem; color: var(--muted); }
.day-bar { height: 2px; background: var(--sunk); margin: -2px 2px 4px; border-radius: 2px; overflow: hidden; }
.day-bar i { display: block; height: 100%; background: var(--ink-2); }
.day.is-today .day-bar i { background: var(--brand); }
.sess { text-align: left; border: 0; border-left: 3px solid var(--c, var(--ink)); background: color-mix(in srgb, var(--c, var(--ink)) 9%, var(--card)); border-radius: 3px 6px 6px 3px; padding: 6px 8px; cursor: pointer; font-size: .78rem; line-height: 1.3; width: 100%; color: var(--ink); display: flex; flex-direction: column; gap: 1px; }
.sess:hover { background: color-mix(in srgb, var(--c, var(--ink)) 16%, var(--card)); }
.sess .tm { font-family: var(--mono); font-size: .66rem; color: var(--muted); display: flex; justify-content: space-between; gap: .25rem; }
.sess .st { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sess .sl { color: var(--muted); font-size: .72rem; }
.sess.done { opacity: .6; } .sess.done .st { text-decoration: line-through; }
.sess.exam .sl::before { content: "Exam prep · "; color: color-mix(in srgb, var(--c) 75%, var(--ink)); font-weight: 600; }
#weekLabel { font-family: var(--font); font-weight: 600; font-size: 1.3rem; letter-spacing: -.02em; margin-top: .1rem !important; }
.act-dot { width: 10px; height: 10px; border-radius: 2px; flex: none; border: 1px dashed var(--act); background: repeating-linear-gradient(135deg, var(--act-soft) 0 2px, transparent 2px 4px); }
.commit { font-size: .74rem; color: var(--muted); border-radius: 4px; padding: 5px 8px; background: repeating-linear-gradient(135deg, var(--act-soft) 0 6px, transparent 6px 12px); border: 1px dashed var(--line-2); }
.commit .mono { font-size: .64rem; display: block; }
.due-flag { font-size: .7rem; font-weight: 600; color: var(--brand); display: flex; gap: .3rem; align-items: flex-start; line-height: 1.25; padding: 0 2px; }
.due-flag svg { margin-top: .1rem; }
.day .empty { font-size: .75rem; padding: 2px; color: color-mix(in srgb, var(--muted) 70%, transparent); }
.legend { margin: .75rem 0 0; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.legend .sw { display: inline-block; width: 18px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: .35rem; }

/* ---------- coach ---------- */
.chat { display: flex; flex-direction: column; gap: .6rem; max-height: 360px; overflow-y: auto; margin-bottom: .75rem; padding-right: 2px; }
.msg { padding: .6rem .85rem; border-radius: 12px; max-width: 88%; white-space: pre-wrap; font-size: .92rem; }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--sunk); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .src { display: block; font-size: .68rem; color: var(--muted); margin-top: .35rem; font-family: var(--mono); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.chip { border: 1px solid var(--line-2); border-radius: 99px; padding: .28rem .7rem; font-size: .8rem; cursor: pointer; background: var(--card); color: var(--ink-2); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
#coachForm { flex-wrap: nowrap; }
#coachForm input { flex: 1; min-width: 0; width: auto; }

/* ---------- toast + dialogs ---------- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: var(--radius); max-width: min(92vw, 520px); box-shadow: 0 12px 40px rgba(0, 0, 0, .22); z-index: 40; font-size: .88rem; }
.toast ul { margin: .3rem 0 0; padding-left: 1.1rem; }
dialog { border: 1px solid var(--line-2); border-radius: 14px; padding: 0; width: min(580px, 94vw); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(20, 19, 15, .45); backdrop-filter: blur(2px); }
dialog form { padding: 22px; display: flex; flex-direction: column; gap: .8rem; max-height: 86vh; overflow-y: auto; }
dialog h2 { font-family: var(--serif); font-weight: 400; font-size: 1.85rem; line-height: 1.1; margin: 0; text-transform: none; letter-spacing: -.01em; }
dialog label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
dialog label.check { flex-direction: row; align-items: center; gap: .55rem; color: var(--ink); font-size: .9rem; }
dialog .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
dialog .why { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .8rem .9rem; font-size: .9rem; }
dialog .why strong:first-child { display: block; margin-bottom: .2rem; }
dialog .why strong:first-child + br { display: none; }
dialog fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .7rem .9rem .8rem; margin: 0; }
dialog legend { font-size: .8rem; color: var(--muted); padding: 0 .3rem; }
dialog details summary { cursor: pointer; font-size: .875rem; color: var(--ink-2); }
dialog .actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; margin-top: .4rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.slider-row { display: grid; grid-template-columns: 3rem 1fr 4.5rem; align-items: center; gap: .6rem; font-size: .88rem; }
.slider-row output { font-family: var(--mono); font-size: .8rem; text-align: right; }
.days-pick { display: flex; gap: .3rem; flex-wrap: wrap; }
.days-pick label { flex-direction: row; align-items: center; gap: .3rem; border: 1px solid var(--line-2); border-radius: 6px; padding: .22rem .5rem; color: var(--ink); font-size: .8rem; cursor: pointer; }
.days-pick label:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.days-pick input { width: auto; }
.conf { font-size: .8rem; }
.sess-meta { font-family: var(--mono); font-size: .78rem; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="off"]) .sess, :root:not([data-motion="off"]) .btn, :root:not([data-motion="off"]) .chip { transition: background-color .15s, border-color .15s, color .15s; }
  :root:not([data-motion="off"]) .toast { animation: rise .25s ease-out; }
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Netlify adds a "Powered by Netlify" badge on the hosted site. On phones it sat on top of
   the Coach tab, so keep it visible but lift it above the tab bar. */
@media (max-width: 900px) { body.app #nl-badge-frame { bottom: calc(84px + env(safe-area-inset-bottom)) !important; } }
