:root { color-scheme: light dark; --bg: #f6f5f1; --card: #fff; --ink: #1d1f23; --muted: #646870; --line: #e4e2dc; --accent: #4d1821; --accent-ink: #fff; --fill: #4d1821; --fill-ink: #fff; --now: #FBF0D9; --nowline: #8A5A00; --ok: #2F6B3A; --late: #B3261E; --soon: #8A5A00; }
@media (prefers-color-scheme: dark) { :root { --bg: #16181c; --card: #20232a; --ink: #eceae6; --muted: #9aa0a8; --line: #30343c; --accent: #f0a3b3; --accent-ink: #1f0a10; --fill: #a34a60; --fill-ink: #fff; --now: #3A3020; --nowline: #E8C27A; --ok: #8FCB98; --late: #F28B82; --soon: #E8C27A; } }
:root { --fs-s: 0.8125rem; --fs-m: 1rem; --fs-l: 1.25rem; --fs-xl: 1.5rem; --fs-brand: 2.125rem;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --r-input: 10px; --r-btn: 12px; --r-card: 16px; --r-round: 999px; --tap: 2.75rem;
  --chosen-bg: #F0DCE0; --chosen-line: var(--accent); --chosen-border: 2px; }
@media (prefers-color-scheme: dark) { :root { --chosen-bg: #4A2631; --sd-bg: var(--bg); } }
/* Sizes (wide layouts, agreed 8 Nov 2026): text in rem, so it follows the browser's and the phone's text size; the column,
   side bar, toast and tab widths are tokens, changed at 600px and 1024px (in em) by LAYOUT_CSS in src/layout.ts. */
:root { --col: 27.5rem; --gutter: 16px; --side: 0px; --tab-max: 4.75rem; --toast: 25.5rem; }
html { scroll-padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.0625rem/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
main { max-width: var(--col); margin: 0 auto; padding: 48px max(var(--gutter), env(safe-area-inset-right, 0px)) 48px max(var(--gutter), env(safe-area-inset-left, 0px)); }
nav#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; gap: var(--sp-1); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
nav#tabs[hidden] { display: none; }
#top-btns { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px), calc((100% - var(--side) - var(--col)) / 2 + 16px)); z-index: 10; display: flex; gap: 6px; }
#top-btns[hidden] { display: none; }
#top-btns button { width: 44px; height: 44px; margin: 0; padding: 0; display: grid; place-items: center; border-radius: var(--r-round); background: var(--card); border: 1px solid var(--line); color: var(--accent); }
#top-btns button[hidden], nav#tabs #refresh-side[hidden] { display: none; }
#top-btns svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#toast { position: fixed; left: calc(50% + var(--side) / 2); transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 12; width: min(var(--toast), calc(100% - var(--side) - 32px)); box-sizing: border-box; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 0.9375rem; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#toast[hidden] { display: none; }
#offline-line { position: sticky; top: 0; z-index: 11; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; background: var(--card); border-bottom: 1px solid var(--line); color: var(--ink); font-size: 0.9375rem; text-align: center; }
#offline-line[hidden] { display: none; }
#preview-bar { position: sticky; top: 0; z-index: 11; display: flex; gap: var(--sp-2); align-items: center; justify-content: center; flex-wrap: wrap; padding: 8px 12px; background: #b3541e; color: #fff; font-size: 0.875rem; }
#preview-bar[hidden] { display: none; }
#preview-bar button { width: auto; margin: 0; padding: 6px 12px; font-size: 0.875rem; background: #fff; color: #1c1b1f; border: 0; }
nav#tabs button { flex: 1; max-width: var(--tab-max); min-height: 44px; margin: 0; padding: 9px 2px; font-size: var(--fs-s); border: 0; background: none; color: var(--muted); border-radius: var(--r-input); }
nav#tabs button.on { color: var(--accent); font-weight: 700; }
nav#tabs button.add { background: var(--fill); color: var(--fill-ink); font-weight: 600; }
body.has-tabs main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
h1 { font-size: var(--fs-xl); margin: 0 0 6px; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; margin-top: 18px; }
button { display: block; width: 100%; font: inherit; padding: 13px 16px; margin-top: 10px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
button.primary { background: var(--fill); color: var(--fill-ink); border-color: var(--fill); font-weight: 600; }
/* Sign in with Apple, Apple's style: black with white logo and words on light pages, white with black on dark ones. */
button.apple { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; background: #000; color: #fff; border-color: #000; font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif; font-weight: 600; }
button.apple svg { width: 15px; height: 18px; flex: none; }
.weather-line { margin: 8px 0 12px; }
.weather-mark { height: 14px; width: auto; vertical-align: -2px; }
@media (prefers-color-scheme: dark) { button.apple { background: #fff; color: #000; border-color: #fff; } }
.msg { margin-top: 12px; min-height: 1.4em; }
.msg .msg-close { display: inline-block; width: auto; min-width: 44px; min-height: 44px; margin: 0 0 0 var(--sp-2); padding: var(--sp-1) var(--sp-3); font-size: var(--fs-s); }
.skip { position: absolute; left: var(--sp-2); top: -100px; z-index: 20; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-input); background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none; }
.skip:focus { top: calc(var(--sp-2) + env(safe-area-inset-top, 0px)); }
.ai-note { font-size: var(--fs-s); color: var(--muted); margin: 10px 0 0; }
ul.flags { list-style: none; padding: 0; margin: 8px 0; }
ul.flags li { padding: 6px 0 6px 10px; border-left: 3px solid var(--line); margin: 4px 0; }
ul.flags li.late { border-left-color: var(--late); }
ul.flags li.soon { border-left-color: var(--soon); }
label.f { display: block; margin-top: 12px; font-weight: 600; font-size: 0.9375rem; }
select, textarea, input.f { display: block; width: 100%; box-sizing: border-box; font: inherit; margin-top: 6px; padding: 10px 12px; border-radius: var(--r-input); border: 1px solid var(--muted); background: var(--card); color: var(--ink); }
textarea { min-height: 110px; }
details.faq { margin-top: 10px; }
details.faq summary { cursor: pointer; font-weight: 600; }
.report { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.report .when { font-size: var(--fs-s); color: var(--muted); }
.desk-detail.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kinds label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); font-weight: 400; }
.kinds label:first-child { border-top: 0; }
.kinds small { display: block; color: var(--muted); font-size: 0.875rem; }
a { color: var(--accent); }   /* readable in dark mode everywhere (Learn links were dark blue on dark) */
a.btn { display: block; text-align: center; text-decoration: none; font: inherit; padding: 13px 16px; margin-top: 10px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--card); color: var(--ink); }
button.danger { background: transparent; color: var(--accent); border: 2px solid var(--accent); font-weight: 600; }   /* outlined burgundy, never a solid red fill (Chris, 10 Nov 2026: the solid red read as red, not burgundy) */
.sd-head { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 6px; font-size: var(--fs-brand); }
.sd-head .sd-icon { width: 40px; height: 40px; }
/* A screen's Tools row (docs/archive/18-design/audit-navigation.md): icon + label buttons under the title, always showing.
   They wrap onto a second line on a narrow screen or with large text, so a label is never cut off. */
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.tools button.tool { position: relative; flex: 1 1 calc(25% - 6px); min-width: 4.8em; width: auto; margin: 0; padding: 9px 4px 8px; border-radius: var(--r-btn); font-size: var(--fs-s); line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.tools .tool svg { display: block; width: 22px; height: 22px; margin: 0 auto 4px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tools .tool .n { position: absolute; top: -7px; right: -4px; min-width: 1.5em; box-sizing: border-box; padding: 1px 6px; border-radius: var(--r-round); background: var(--fill); color: var(--fill-ink); font-size: 0.75rem; font-weight: 700; }
.tools .tool:focus-visible, .srows .srow:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* One-line rows that open their own small screen (Settings). */
.srows { padding-top: 4px; padding-bottom: 4px; }
.srows button.srow { display: flex; align-items: center; gap: 10px; margin: 0; padding: 13px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; text-align: left; }
.srows button.srow:first-child { border-top: 0; }
.srows .srow small { display: inline; margin: 0 0 0 auto; color: var(--muted); font-size: 0.875rem; text-align: right; }
.srows .srow::after { content: "›"; color: var(--muted); font-size: var(--fs-l); line-height: 1; }
.srows .srow span { flex: 1 1 auto; }
button[aria-busy="true"] { position: relative; cursor: progress; opacity: .75; }
button[aria-busy="true"]::after { content: ""; position: absolute; top: 50%; right: 12px; width: 12px; height: 12px; margin-top: -8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sd-busy .7s linear infinite; }
button.link[aria-busy="true"]::after, button.chip[aria-busy="true"]::after { right: 0; }   /* never past the edge of the screen */
nav#tabs button[aria-busy="true"]::after { top: 4px; right: 4px; width: 8px; height: 8px; margin-top: 0; }
@keyframes sd-busy { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button[aria-busy="true"]::after { animation: none; border-right-color: currentColor; opacity: .5; } }
button:active:not(:disabled) { filter: brightness(.92); }

nav#tabs button { white-space: nowrap; }
nav#tabs.measuring button { flex: none; max-width: none; width: auto; }   /* buttons are full width elsewhere in the app */
nav#tabs button[hidden], #more-btn[hidden] { display: none; }
#more-btn.on { color: var(--accent); font-weight: 700; }
body.typing nav#tabs { visibility: hidden; }   /* hidden, not removed: layoutTabs still measures it */
#more-sheet { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); width: min(440px, 100%); box-sizing: border-box; background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; padding: 12px 14px 10px; box-shadow: 0 -8px 24px rgba(0,0,0,.12); }
#more-sheet[hidden] { display: none; }
.more-head { margin: 0 0 8px; font-size: 0.875rem; color: var(--muted); font-weight: 600; }
.more-grid { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.more-grid button { width: auto; flex: 1 1 40%; margin: 0; padding: 12px; background: var(--bg); font-size: var(--fs-m); }
.more-grid button.on { color: var(--accent); font-weight: 700; border-color: var(--accent); }
#more-backdrop { position: fixed; inset: 0; z-index: 9; background: rgba(0,0,0,.25); }
#more-backdrop[hidden] { display: none; }
ul.tab-order { list-style: none; padding: 0; margin: 8px 0 0; }
ul.tab-order li { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.tab-order li:last-child { border-bottom: 0; }
ul.tab-order .row { gap: 6px; }
ul.tab-order button.chip { margin: 0; min-width: 44px; min-height: 44px; }
ul.tab-order button[disabled] { opacity: .35; }


.row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.row > button { width: auto; flex: 1 1 auto; }
.row > button.chip { flex: 0 0 auto; margin-top: 0; }
.copy { font-size: 0.875rem; }
.ev label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.spread { justify-content: space-between; }
.chip { display: inline-block; width: auto; padding: 8px 12px; margin: 6px 6px 0 0; border-radius: var(--r-round); font-size: 0.9375rem; }
.link { background: none; border: 0; color: var(--accent); width: auto; padding: 6px 0; text-align: left; }
.now h2 { font-size: 1.375rem; margin: 4px 0; }
.tight { margin: 4px 0; }
.small { font-size: 0.875rem; }
.lrow { display: flex; gap: var(--sp-3); text-align: left; border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; padding: 10px 0; background: none; }
.lrow:first-child { border-top: 0; }
.lrow small { display: block; color: var(--muted); }
.when { min-width: 74px; color: var(--muted); font-size: 0.875rem; }
.agenda { list-style: none; padding: 0; margin: 6px 0 0; }
.agenda li { display: flex; gap: var(--sp-3); padding: 4px 0; }
.agenda b { min-width: 52px; }
.steps label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.steps label:first-child { border-top: 0; }
.steps small { display: block; color: var(--muted); }
input, select, textarea { font: inherit; width: 100%; box-sizing: border-box; padding: 10px; border-radius: var(--r-input); border: 1px solid var(--line); background: var(--card); color: var(--ink); margin-top: 4px; }
input[type=checkbox], input[type=radio] { width: auto; flex: none; margin-top: 4px; }
label.f { display: block; margin-top: 12px; font-size: 0.9375rem; color: var(--muted); }
.first { border-left: 4px solid var(--accent); padding-left: 12px; }
.stepedit { border-top: 1px solid var(--line); padding: 6px 0; }
.stepedit:first-child { border-top: 0; }
.stepedit .row label.f { margin-top: 4px; }
input.days { width: 90px; flex: 0 0 auto; }

.flip { min-height: 150px; display: flex; flex-direction: column; justify-content: center; }
.flip .front { font-size: 1.3125rem; font-weight: 600; }
.flip .back { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.grades { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.grades button { margin-top: 0; }
.setrow { display: flex; justify-content: space-between; gap: var(--sp-3); text-align: left; }
.setrow small { display: block; color: var(--muted); }
.pill { display: inline-block; font-size: var(--fs-s); padding: 2px 8px; border-radius: var(--r-round); border: 1px solid var(--line); color: var(--muted); }
.scheme { margin: 8px 0 0; padding-left: 20px; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.75rem; font-weight: 700; text-align: center; margin-top: 8px; }
.checkline { border-left: 4px solid var(--accent); padding-left: 10px; margin-top: 8px; }
button.bigbtn { font-size: 1.1875rem; padding: 16px; margin-top: 14px; }
.center { text-align: center; }
.subj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.subj-grid button { margin-top: 0; }
.picked { justify-content: space-between; margin: 8px 0; }
.setrow.nextnew { border-color: var(--accent); }
details.card summary { cursor: pointer; }
.wrongform { margin-top: 6px; }
button.link.small { font-size: 0.875rem; margin-top: 8px; }
.answer { margin-top: 8px; }
.match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-2); }
.match button { text-align: left; margin-top: 6px; overflow-wrap: anywhere; }

.hello { font-size: 1.375rem; font-weight: 700; margin: 6px 0 0; }
.hello.date { font-size: 1.125rem; }
.wins-line { display: block; font-size: 0.9375rem; }
/* The day as a timeline (rule 7): time on the left, a bar whose height follows the length. Never wider than the column. */
ul.tl { list-style: none; margin: 14px 0 0; padding: 0; }
ul.tl li { display: grid; grid-template-columns: 3.4em minmax(0, 1fr); gap: 10px; align-items: stretch; }
ul.tl time { font-size: var(--fs-s); color: var(--muted); padding-top: 6px; font-variant-numeric: tabular-nums; }
.tl-blk { min-width: 0; border-left: 4px solid var(--line); padding: 6px 10px; margin: 0 0 6px; border-radius: 0 10px 10px 0; background: var(--card); min-height: 34px; box-sizing: border-box; overflow-wrap: anywhere; }
.tl-blk.study { border-left-color: var(--accent); }
.tl-blk.anchor { background: transparent; border-left-style: dotted; color: var(--muted); font-size: 0.875rem; }
.tl-blk.done { opacity: .55; }
.tl-blk.on { background: var(--now); border-left-color: var(--nowline); }
.tl-blk .t { font-weight: 600; }
.tl-blk .s { font-size: var(--fs-s); color: var(--muted); }
.tl-tick { color: var(--ok); }
.tl-blk.part .s { color: var(--soon); }
@keyframes sd-pop { from { transform: scale(.4); opacity: .2; } 60% { transform: scale(1.18); } to { transform: scale(1); opacity: 1; } }
.tl-tick.pop { display: inline-block; animation: sd-pop 320ms cubic-bezier(.2,.8,.2,1) 1; }
@media (prefers-reduced-motion: reduce) { .tl-tick.pop { animation: none; } }
.due-late { color: var(--late); font-weight: 600; }
.due-soon { color: var(--soon); font-weight: 600; }
li.tl-now { display: block; border-top: 2px solid var(--nowline); position: relative; margin: 2px 0 10px; }
li.tl-now span { position: absolute; right: 0; top: -11px; font-size: 0.6875rem; font-weight: 700; color: var(--nowline); background: var(--bg); padding: 0 4px; letter-spacing: .06em; }
details.tl-fold { margin: 0 0 6px; }
details.tl-fold summary { cursor: pointer; color: var(--accent); font-size: 0.875rem; padding: 6px 0; }
details.more-today summary { font-weight: 600; cursor: pointer; }
details.more-today .card { margin-top: 12px; }
.card.next .big, .card .big { font-size: var(--fs-l); font-weight: 700; margin: 6px 0; }
button.card.wins { text-align: left; }
.wins-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
details.earlier summary { cursor: pointer; font-weight: 600; }
details.earlier .first { margin-top: 14px; }
details.pack { margin-top: 10px; }
details.pack summary { cursor: pointer; font-weight: 600; }
details.pack ul { margin: 8px 0; padding-left: 20px; }
details.pack li { margin: 4px 0; }
details.plan ul { list-style: none; padding: 0; margin: 8px 0 0; }
details.plan li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
details.plan li:last-child { border-bottom: 0; }
details.plan li > span:nth-child(2) { flex: 1; min-width: 0; }
details.plan .t { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 3.2em; }
.tick { font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.tick.done { color: var(--accent); font-weight: 600; }
details.week .first { margin-top: 12px; }
.part-pick button { flex: 1 1 70px; }
.center { text-align: center; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row > button { flex: 1 1 140px; width: auto; }
.tabs { margin-top: 10px; }
ul.chosen, ul.todo { list-style: none; padding: 0; margin: 10px 0 0; }
ul.chosen li { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.chosen li button.link, ul.todo li button.link { width: auto; margin: 0; }
ul.todo li { padding: 4px 0; }
.small { font-size: 0.875rem; }
.task { white-space: pre-wrap; }
ol.steps-i { margin: 8px 0; padding-left: 22px; }
ol.steps-i li { margin: 6px 0; }
input[type=file] { display: block; margin-top: 8px; font: inherit; }
details.fold { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
details.fold summary, details.more summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
details.more { margin-top: 10px; }
.row.quick > button { flex: 1 1 90px; margin-top: 6px; }
.card.sent .setrow { margin-top: 8px; }
.card.sent.flagged { outline: 2px solid var(--accent); outline-offset: 2px; }
.reply { border-left: 3px solid var(--accent); padding-left: 10px; margin: 8px 0; }
button[hidden] { display: none; }
.row[hidden] { display: none; }
.card.check .ck { border-top: 1px solid var(--line); padding-top: 10px; }
.card.check .ck:first-of-type { border-top: 0; }


label.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
button small { display: block; font-weight: 400; color: var(--muted); font-size: 0.875rem; margin-top: 2px; }
button.link.inline { display: inline; width: auto; padding: 0; margin: 0; }
/* Findable Settings (8 Nov 2026): the search box, its results, the group headings, the Premium badge, a greyed switch
   and the part a line or a result opened. Sizes in rem, so the phone's and the browser's text size reach them. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.s-find { display: flex; align-items: center; gap: var(--sp-2); margin: 12px 0 0; padding: 0 12px; border: 1px solid var(--muted); border-radius: var(--r-btn); background: var(--card); }
.s-find:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.s-find svg { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.s-find input { flex: 1; min-width: 0; min-height: 2.75rem; margin: 0; padding: 10px 0; border: 0; background: none; font: inherit; color: var(--ink); outline: none; }
.s-find-n:empty { margin: 0; }
.s-hits { list-style: none; margin: 8px 0 0; padding: 0; }
.s-hits button.s-hit { margin: 0 0 8px; text-align: left; }
.s-hit b { font-weight: 600; }
/* The matched words: dark on amber in both themes (text 5.4:1 light, 10.5:1 dark; 5.9:1 and 9.3:1 against the card). */
mark { background: var(--nowline); color: var(--bg); border-radius: 3px; padding: 0 2px; }
.badge { display: inline-block; font-style: normal; font-size: 0.75rem; font-weight: 600; line-height: 1.4; padding: 0 8px; border-radius: var(--r-round); background: var(--now); color: var(--nowline); border: 1px solid var(--nowline); vertical-align: 1px; }
h2.s-group, h2.s-sub { font-size: var(--fs-s); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 4px 6px; }
.s-groups .card.srows, h2.s-sub + .card { margin-top: 0; }
.settings-split.searching .s-groups, .settings-split.home.searching > .settings-page { display: none; }
label.check.off { color: var(--muted); }
.s-found { outline: 3px solid var(--nowline); outline-offset: 3px; }


:root[data-colour="deep"] { --accent: #4d1821; --fill: #4d1821; }
:root[data-colour="burgundy"] { --accent: #6E1A2B; --fill: #6E1A2B; }
:root[data-colour="green"] { --accent: #1f5a43; --fill: #1f5a43; --chosen-bg: #DCEBE3; }
@media (prefers-color-scheme: dark) { :root[data-colour="green"] { --accent: #8fd3b4; --fill: #2d7a5b; --chosen-bg: #1E3A2E; } :root[data-colour="burgundy"], :root[data-colour="deep"] { --accent: #f0a3b3; --fill: #a34a60; } }
[data-sub="yellow"] { --sub: #FFE066; } [data-sub="orange"] { --sub: #FFB35C; } [data-sub="red"] { --sub: #F4736B; } [data-sub="pink"] { --sub: #FFA6D9; }
[data-sub="purple"] { --sub: #C5A8F5; } [data-sub="blue"] { --sub: #8EC5FF; } [data-sub="teal"] { --sub: #6FD6C8; } [data-sub="green"] { --sub: #A5DC86; }
.pill[data-sub] { background: var(--sub); border-color: var(--sub); color: #1d1f23; font-weight: 600; }
div.tl-blk[data-sub] { border-left-color: var(--sub); }
.subj-grid button[data-sub] { border-left: 8px solid var(--sub); }
.sc-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); margin-top: 8px; }
.sc-row select { width: auto; flex: 0 0 auto; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 10px 0; }
.stats div { background: var(--bg); border-radius: var(--r-btn); padding: 12px; }
.stat { display: block; font-size: var(--fs-xl); font-weight: 700; }
.stats small { color: var(--muted); }
.bubble { padding: 12px 14px; border-radius: var(--r-card); margin-top: 10px; white-space: pre-wrap; max-width: 92%; }
.bubble.me { background: var(--fill); color: var(--fill-ink); margin-left: auto; }
.bubble.claude { background: var(--card); border: 1px solid var(--line); }
.clock { font-size: 3.5rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; padding: 18px 0; }
.win-line { margin: 8px 0 0; font-weight: 600; }
ul.miles { list-style: none; padding: 0; margin: 6px 0 0; }
ul.miles li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.miles li:last-child { border-bottom: 0; }
.bar { height: 8px; background: var(--bg); border-radius: 8px; overflow: hidden; margin: 6px 0 12px; }
.bar span { display: block; height: 100%; width: 0; background: var(--fill); border-radius: 8px; }
button.listen { display: inline-block; width: auto; padding: 6px 12px; margin: 6px 0 0; font-size: 0.9375rem; }


.reveal { width: auto; display: inline-block; margin: 8px 8px 0 0; }
.reveal.gap { padding: 2px 10px; margin: 0; }
.revealed { margin-top: 6px; }
ul.tl { list-style: none; padding: 0; } ul.tl li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.opts { display: flex; flex-direction: column; gap: var(--sp-2); } .opts button { margin: 0; text-align: left; }
:root { --ok-bg: #e3f2e8; --late-bg: #f8e3e3; --late-line: #8f1d2c; }
@media (prefers-color-scheme: dark) { :root { --ok-bg: #1E3A2E; --late-bg: #3A2022; --late-line: #F28B82; } }
.opts button.right { background: var(--ok-bg); border-color: var(--ok); } .opts button.wrong { background: var(--late-bg); border-color: var(--late-line); }
.cornell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--sp-3); }
.caption { color: var(--muted); }
.slide { min-height: 180px; display: flex; flex-direction: column; justify-content: center; }
.slide.title .big { font-size: 1.4em; }
.slide .answer { font-weight: 600; }
progress.watch-bar { width: 100%; height: 6px; accent-color: var(--accent); }
.watch-ctl { justify-content: space-between; }
.watch-ctl button { flex: 0 0 auto; width: auto; min-width: 56px; }
.watch-ctl button.primary { flex: 1; }


.mm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mm-seg { display: flex; gap: 6px; margin: 12px 0 6px; }
.mm-seg button { flex: 1; margin: 0; min-height: 44px; padding: 6px 8px; font-size: 0.9375rem; }
.mm-seg button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.mm-hd { margin: 2px 0; }
.mm-centre { display: inline-block; background: var(--fill); color: var(--fill-ink); border-radius: var(--r-card); padding: 0.6rem 1rem; font-weight: 700; font-size: 1.1rem; margin: 10px 0 6px; overflow-wrap: anywhere; }
.mm-tree, .mm-tree ul { list-style: none; margin: 0; padding: 0; }
.mm-li { outline: none; }
.mm-box { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; box-sizing: border-box; padding: 0.4rem 0.8rem; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--card); cursor: pointer; overflow-wrap: anywhere; }
.mm-kid { min-height: 40px; font-size: 0.95rem; }
.mm-n { font-size: 0.8rem; color: var(--muted); min-width: 1rem; }
.mm-q { font-size: 1.1rem; margin-left: auto; }
.mm-box { flex-wrap: wrap; }
.mm-l { flex: 1 1 7rem; min-width: 0; }
.mm-tag { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.hid > .mm-box { color: var(--muted); border: 1px dashed var(--muted); background: var(--bg); font-weight: 700; }
.part > .mm-box { border-style: dashed; }
.notyet > .mm-box { background: var(--now); border-color: var(--nowline); }
.notyet > .mm-box .mm-tag { color: var(--nowline); }
.sel > .mm-box { border: 2px solid var(--accent); }
.mm-li:focus-visible > .mm-box { outline: 3px solid var(--accent); outline-offset: 2px; }
.mm-status { margin: 14px 0 0; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-btn); }
.mm-status button { margin-top: 8px; }
.mm-panel { margin-top: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.mm-panel .mm-ph { font-weight: 700; font-size: 1.15rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.mm-close { float: right; width: auto; margin: 0; min-height: 44px; padding: 0 4px; }
.mm-two { display: flex; gap: var(--sp-2); }
.mm-two button { flex: 1; margin-top: 6px; min-height: 44px; }
.mm-two button.ok { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.mm-cardlink { width: auto; min-height: 44px; padding: 8px 0; text-align: left; }
.mm-card { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.mm-front { font-weight: 700; margin: 4px 0; }
.mm-blank { padding-left: 1.4rem; }
.mm-blank li { margin: 6px 0 10px; }
.mm-wrote { margin-top: 0; }
.mm-had span { overflow-wrap: anywhere; }
.mm-had .mm-yours { display: block; }
.mm-lines { display: none; }

/* The outline (phones, and any shape that can't fit): the lines are CSS borders, as in the sketch. */
.mm-outline .mm-tree > li { position: relative; margin-left: 12px; padding: 5px 0 5px 22px; border-left: 2px solid var(--muted); }
.mm-outline .mm-tree > li:last-child { border-left-color: transparent; }
.mm-outline .mm-tree > li::before { content: ""; position: absolute; left: -2px; top: 0; width: 20px; height: 27px; border-left: 2px solid var(--muted); border-bottom: 2px solid var(--muted); border-bottom-left-radius: 12px; }
.mm-outline .mm-group { margin: 6px 0 2px 8px; }
.mm-outline .mm-group > li { position: relative; padding: 2px 0 2px 18px; border-left: 2px solid var(--muted); margin-left: 6px; }
.mm-outline .mm-group > li:last-child { border-left-color: transparent; }
.mm-outline .mm-group > li::before { content: ""; position: absolute; left: -2px; top: 0; width: 14px; height: 24px; border-left: 2px solid var(--muted); border-bottom: 2px solid var(--muted); border-bottom-left-radius: 8px; }
/* The panel stays in sight above the tab bar while she scrolls the outline. */
.mm-outline .mm-panel { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 2; box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08); }

/* The two wider shapes: every box is placed from script (--x, --y), the lines drawn under them. */
.mm-side .mm-stage, .mm-radial .mm-stage { position: relative; height: var(--mm-h, auto); margin: 8px 0; }
.mm-side .mm-stage > *, .mm-radial .mm-stage > * { transform-origin: 0 0; }
.mm-side .mm-lines, .mm-radial .mm-lines { display: block; position: absolute; left: 0; top: 0; overflow: visible; transform: scale(var(--mm-s, 1)); transform-origin: 0 0; }
.mm-edge { fill: none; stroke: var(--muted); stroke-opacity: 0.7; stroke-width: 2; }
.mm-edge.dash { stroke-dasharray: 5 5; }
.mm-side .mm-centre, .mm-radial .mm-centre, .mm-side .mm-box, .mm-radial .mm-box { position: absolute; left: 0; top: 0; margin: 0; transform: scale(var(--mm-s, 1)) translate(var(--x, 0), var(--y, 0)); transform-origin: 0 0; }
.mm-side .mm-tree, .mm-radial .mm-tree, .mm-side .mm-tree li, .mm-radial .mm-tree li { position: static; }
.mm-side .mm-centre { width: 8rem; box-sizing: border-box; }
.mm-side .mm-br { width: 12rem; }
.mm-side .mm-kid { width: 16rem; }
.mm-radial .mm-centre { max-width: 11rem; box-sizing: border-box; text-align: center; }
.mm-radial .mm-box { width: 9rem; justify-content: center; text-align: center; line-height: 1.2; flex-wrap: wrap; gap: 2px 8px; }
.mm-radial .mm-l { flex: 0 1 auto; min-width: 0; }
.mm-radial .mm-br .mm-n { min-width: 0; }
/* Sideways: Got it / Not yet in a bar along the bottom, as in the sketch. */
body:has(#view .mm-side) { --col: 60rem; }
/* Sideways the height is short: the panel is one slim bar (her answer buttons and the card link), kept in sight. */
.mm-side .mm-panel { position: sticky; bottom: 0; z-index: 2; margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; padding: 4px 12px; box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08); }
.mm-side .mm-panel > * { margin: 0; }
.mm-side .mm-panel .mm-ph { order: 1; font-size: var(--fs-m); }
.mm-side .mm-panel > .muted { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mm-side .mm-panel .mm-two { order: 2; flex: 1 1 14rem; max-width: 22rem; }
.mm-side .mm-panel .mm-two button { margin: 4px 0; }
.mm-side .mm-panel .mm-cardlink { order: 3; }
.mm-side .mm-panel .mm-close { order: 4; float: none; margin-left: auto; }
.mm-side .mm-panel .mm-card { order: 5; flex-basis: 100%; }
.mm-side .mm-hd + p { display: none; }
@media (min-width: 64em) { .mm-outline .mm-panel { bottom: 16px; } }
/* Wide: the map and the panel side by side, the panel kept in sight. */
body:has(#view .mm-radial) { --col: 90rem; }
.mm-radial:not(.mm-stack) .mm-body { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 0 24px; align-items: start; }
.mm-radial:not(.mm-stack) .mm-panel { position: sticky; top: 16px; margin-top: 8px; }
/* Not quite room beside it (about 1024px with the side bar): the panel sits under the map, kept in sight. */
.mm-stack .mm-panel { position: sticky; bottom: 16px; z-index: 2; box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08); }
.mm-stack .mm-panel-hint { display: none; }
@media (prefers-reduced-motion: no-preference) { .mm-box { transition: background-color 150ms, border-color 150ms; } }


.wo-row { display: flex; gap: var(--sp-2); align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.wo-row:last-child { border-bottom: 0; }
.wo-row.done .wo-text { color: var(--muted); text-decoration: line-through; }
.wo-act { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.wo-act button { width: auto; margin: 0; }


/* Refresh (installed app on a computer only; html.desk-app is set by src/pages.ts): top right on narrow screens, the foot of the side bar on wide ones. */
html.desk-app #top-btns #refresh-top { display: grid; }
nav#tabs #refresh-side { display: none; }
.nav-brand, .today-side, .settings-split:not(.home) > .settings-list { display: none; }
/* Medium: the column grows to about 35em; prose stays under about 75 characters. */
@media (min-width: 37.5em) {
  :root { --col: 37rem; --gutter: 24px; }
}
/* Screens that stay narrow at every width: a card session (focused, as on a phone) and Add (one form column). */
body:has(#view .card.flip) { --col: 27.5rem; }
body:has(#view #a-send) { --col: 35rem; }

/* Wide: the side bar, and two parts side by side. */
@media (min-width: 64em) {
  :root:not(.text-big) { --side: 13rem; }
  :root:not(.text-big) body.has-tabs { padding-left: var(--side); }
  :root:not(.text-big) body.has-tabs main { padding-bottom: 48px; }
  :root:not(.text-big) body:has(#view .today-side), :root:not(.text-big) body:has(#view .subj-grid) { --col: 60rem; }
  :root:not(.text-big) nav#tabs { top: 0; right: auto; width: var(--side); box-sizing: border-box; flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 12px 16px max(12px, env(safe-area-inset-left, 0px)); border-top: 0; border-right: 1px solid var(--line); }
  :root:not(.text-big) nav#tabs .nav-brand { display: flex; align-items: center; gap: var(--sp-2); padding: 4px 8px 18px; font-size: 1.75rem; color: var(--ink); }
  :root:not(.text-big) .nav-brand .sd-icon { width: 1.15em; height: 1.15em; }
  :root:not(.text-big) nav#tabs button { flex: none; width: 100%; max-width: none; text-align: left; font-size: var(--fs-m); padding: 10px 12px; }
  :root:not(.text-big) body.typing nav#tabs { visibility: visible; }
  :root:not(.text-big).desk-app #top-btns #refresh-top { display: none; }
  :root:not(.text-big).desk-app nav#tabs #refresh-side { display: flex; align-items: center; gap: 10px; margin-top: auto; color: var(--muted); }
  :root:not(.text-big).desk-app nav#tabs #refresh-side svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  /* More opens in place, under More, in the side bar itself. */
  :root:not(.text-big) #more-sheet { position: static; transform: none; width: 100%; margin-top: 6px; border-bottom: 1px solid var(--line); border-radius: 14px; box-shadow: none; padding: 10px; }
  :root:not(.text-big) #more-sheet .more-grid button { flex-basis: 100%; text-align: left; }
  :root:not(.text-big) #toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  /* The side bar carries the wordmark, so Today's own heading is kept for screen readers only. */
  :root:not(.text-big) body.has-tabs main .sd-head { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  :root:not(.text-big) #view p { max-width: 75ch; }
  :root:not(.text-big) #view p.center { margin-left: auto; margin-right: auto; }
  /* Today: the card she acts on beside the day she can see (design rule 7). */
  :root:not(.text-big) .today-grid:has(> .today-side) { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 0 28px; align-items: start; }
  :root:not(.text-big) .today-side { display: block; }
  :root:not(.text-big) .today-grid:has(> .today-side) .tl-inline { display: none; }
  :root:not(.text-big) .subj-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Plan my week: the chat on the left, the plan beside it, kept in sight while she scrolls the chat. */
  :root:not(.text-big) body:has(#view .plan-side) { --col: 60rem; }
  :root:not(.text-big) .plan-grid:has(> .plan-side) { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); grid-template-rows: auto 1fr;
    grid-template-areas: "turns side" "input side"; gap: 0 28px; align-items: start; }
  :root:not(.text-big) .plan-grid > .plan-turns { grid-area: turns; }
  :root:not(.text-big) .plan-grid > .plan-input { grid-area: input; }
  :root:not(.text-big) .plan-grid > .plan-side { grid-area: side; position: sticky; top: 16px; }
  /* Settings: the list on the left, the page on the right. */
  :root:not(.text-big) body:has(#view .settings-split) { --col: 60rem; }
  :root:not(.text-big) .settings-split { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); grid-template-areas: "list page"; gap: 0 28px; align-items: start; }
  :root:not(.text-big) .settings-split > .settings-list { display: block; grid-area: list; }
  :root:not(.text-big) .settings-split > .settings-page { grid-area: page; min-width: 0; }
  /* The face: the title, search and groups on the left, the Tools row and any new timetable on the right, kept in sight
     while she searches (the search hides only the groups). */
  :root:not(.text-big) .settings-split.home { grid-template-areas: "head page" "list page"; grid-template-rows: auto 1fr; }
  :root:not(.text-big) .settings-split > .settings-head { grid-area: head; }
  :root:not(.text-big) .settings-split.home.searching > .settings-page { display: block; }
  :root:not(.text-big) .settings-split:not(.home) > .settings-list .srows { margin-top: 0; }
  :root:not(.text-big) .settings-split .srow[aria-current="page"] span { color: var(--accent); font-weight: 700; }
}

/* A phone turned sideways: a slim rail on the left (the notch side gets its safe area), one column, no panes. */
@media (max-height: 31em) and (min-width: 37.5em) and (max-width: 63.99em) {
  :root { --side: calc(5.5rem + env(safe-area-inset-left, 0px)); --gutter: 20px; }
  body.has-tabs { padding-left: var(--side); }
  body.has-tabs main { padding-top: 24px; padding-bottom: 32px; }
  nav#tabs { top: 0; right: auto; width: var(--side); box-sizing: border-box; flex-direction: column; justify-content: center; gap: 2px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 6px calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); border-top: 0; border-right: 1px solid var(--line); }
  nav#tabs button { flex: none; width: 100%; max-width: none; padding: 6px 2px; }
  #more-sheet { left: calc(100% + 8px); bottom: 8px; transform: none; width: 18rem; border-bottom: 1px solid var(--line); border-radius: var(--r-card); }
  #toast { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
