/* Planora: shared styles for the sign-in page and the app.

   The idea is the school day in an indigo-violet family: one hue range (indigo ~245 to
   violet ~265) carries the whole interface, so it reads as calm and focused, and the only
   colours outside that family are the two marks that mean something:
   highlighter yellow means "today / now", red pen means "overdue". Yellow is the complement of
   indigo, so "today" is always the highest-contrast mark on the page.
   Proportion is roughly 60/30/10: ~60% soft lavender ground and white sheets (or navy in dark),
   ~30% ink and the deep indigo rail, ~10% saturated indigo/violet for pressable things.
   Subjects are colour-coded like exercise-book covers, in a fixed, colour-blind-checked order.

   One typeface, Archivo, uses its width axis by job: expanded for page titles, normal for
   reading, condensed for times and numbers (the timetable voice).

   Everything is drawn like a stamped exercise book: 2px ink outlines and hard offset shadows,
   no blur and no glass. Buttons press down into their shadow. The focus timer and test
   countdown are split-flap tiles, like a station departure board. */

:root {
  /* Light mode: a lavender-tinted ground (not stark white) so white sheets lift off it, slate
     ink, a deep indigo rail and outlines, indigo #4f46e5 for pressable things, and soft
     periwinkle hard shadows. All text colours pass WCAG AA on --ground, --paper and --paper-2. */
  --ground: #eef0fb;
  --paper: #ffffff;
  --paper-2: #f5f6fd;
  --rule: #e0e4f5;
  --rule-strong: #b3b9dc;
  --ink: #1f2937;
  --ink-2: #4b5563;
  --ink-3: #5f6577;

  --rail: #1e1b4b;
  --rail-2: #312e81;
  --rail-ink: #f8fafc;
  --rail-ink-2: #c7d2fe;

  --hl: #ffd84a;
  --hl-ink: #1f2937;
  --pen: #c0322a;
  --pen-soft: #fde4e1;
  --ok: #1f7a4d;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --on-primary: #ffffff;
  --seg-on: #ffffff;
  --focus: #4f46e5;
  --ring: rgba(79, 70, 229, 0.22);
  --scrim: rgba(17, 24, 39, 0.45);
  /* Outlines and hard shadows: --edge draws the line, --drop is the solid shadow under it */
  --edge: #1e1b4b;
  --drop: #bcc3f3;
  --shadow-sm: 2px 2px 0 var(--drop);
  --shadow: 3px 3px 0 var(--drop);
  --edge-panel: var(--edge); /* panels; dark mode makes it quieter than the outline on controls */
  --lift: 4px 4px 0 var(--drop);
  --lift-lg: 8px 8px 0 var(--drop);
  --flap: #1e1b4b;
  --flap-ink: #f8fafc;
  --hl-blend: multiply;

  /* Subject colours: the validated categorical order (blue, orange, aqua, yellow, pink, green, violet, red) plus a neutral */
  --c-blue: #2a78d6;
  --c-orange: #eb6834;
  --c-aqua: #1baf7a;
  --c-yellow: #eda100;
  --c-magenta: #e87ba4;
  --c-green: #008300;
  --c-violet: #6250d6;
  --c-red: #e34948;
  --c-slate: #7a8399;
  /* Extra covers for bigger timetables. They come after the validated eight, so the defaults stay
     distinguishable; light-dark() picks the variant for the active color-scheme. */
  --c-sky: light-dark(#2f9bd6, #4cb0e6);
  --c-coral: light-dark(#e2685a, #ec7f71);
  --c-teal: light-dark(#0f8a8a, #26a6a6);
  --c-gold: light-dark(#b8901a, #d1a832);
  --c-rose: light-dark(#cc4470, #e06b90);
  --c-lime: light-dark(#6f9a12, #8fbb2a);
  --c-indigo: light-dark(#3b4cc0, #7b88ea);
  --c-brown: light-dark(#8a5a3b, #b5835f);
  --c-plum: light-dark(#8e3f8c, #bb72b8);
  --c-mint: light-dark(#3fb592, #55c9a5);
  --c-olive: light-dark(#6b7a2a, #9aaa4c);
  --c-navy: light-dark(#1d2a52, #6d84c8);

  --font: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --wide: 125%;
  --semi-wide: 112%;
  --narrow: 75%;

  --rail-w: 244px;
  --r-sm: 3px;
  --r: 4px;
  --r-lg: 6px;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Dark mode: indigo-navy (lifted from #0f172a so it is not near-black; the rail keeps the
   deepest navy), near-white text, violet #7c3aed buttons (the lighter #8b5cf6 fails AA with
   white text), lavender #a78bfa focus, and indigo #6366f1 outlines. Text passes AA everywhere. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #141b34;
    --paper: #1c2441;
    --paper-2: #232c4d;
    --rule: #2e3860;
    --rule-strong: #4a5585;
    --ink: #f8fafc;
    --ink-2: #cbd5e1;
    --ink-3: #94a3b8;
    --rail: #0f172a;
    --rail-2: #222a4d;
    --rail-ink: #f8fafc;
    --rail-ink-2: #b4bce0;
    --hl: #e8d84e;
    --pen: #ff7d70;
    --pen-soft: #44211e;
    --ok: #4cc58a;
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --on-primary: #ffffff;
    --seg-on: #3b3577;
    --focus: #a78bfa;
    --ring: rgba(167, 139, 250, 0.3);
    --scrim: rgba(2, 6, 23, 0.62);
    --edge: #6366f1;
    --edge-panel: #3d4775;
    --drop: #0a0f1f;
    --flap: #0f172a;
    --hl-blend: normal;
    --c-blue: #3987e5;
    --c-orange: #d95926;
    --c-aqua: #199e70;
    --c-yellow: #c98500;
    --c-magenta: #d55181;
    --c-green: #008300;
    --c-violet: #9085e9;
    --c-red: #e66767;
    --c-slate: #7883a0;
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #141b34;
  --paper: #1c2441;
  --paper-2: #232c4d;
  --rule: #2e3860;
  --rule-strong: #4a5585;
  --ink: #f8fafc;
  --ink-2: #cbd5e1;
  --ink-3: #94a3b8;
  --rail: #0f172a;
  --rail-2: #222a4d;
  --rail-ink: #f8fafc;
  --rail-ink-2: #b4bce0;
  --hl: #e8d84e;
  --pen: #ff7d70;
  --pen-soft: #44211e;
  --ok: #4cc58a;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --on-primary: #ffffff;
  --seg-on: #3b3577;
  --focus: #a78bfa;
  --ring: rgba(167, 139, 250, 0.3);
  --scrim: rgba(2, 6, 23, 0.62);
  --edge: #6366f1;
  --edge-panel: #3d4775;
  --drop: #0a0f1f;
  --flap: #0f172a;
  --hl-blend: normal;
  --c-blue: #3987e5;
  --c-orange: #d95926;
  --c-aqua: #199e70;
  --c-yellow: #c98500;
  --c-magenta: #d55181;
  --c-green: #008300;
  --c-violet: #9085e9;
  --c-red: #e66767;
  --c-slate: #7883a0;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* Subject colour classes: set --sub, components read it */
.c-blue { --sub: var(--c-blue); }
.c-orange { --sub: var(--c-orange); }
.c-aqua { --sub: var(--c-aqua); }
.c-yellow { --sub: var(--c-yellow); }
.c-magenta { --sub: var(--c-magenta); }
.c-green { --sub: var(--c-green); }
.c-violet { --sub: var(--c-violet); }
.c-red { --sub: var(--c-red); }
.c-slate { --sub: var(--c-slate); }
.c-sky { --sub: var(--c-sky); }
.c-coral { --sub: var(--c-coral); }
.c-teal { --sub: var(--c-teal); }
.c-gold { --sub: var(--c-gold); }
.c-rose { --sub: var(--c-rose); }
.c-lime { --sub: var(--c-lime); }
.c-indigo { --sub: var(--c-indigo); }
.c-brown { --sub: var(--c-brown); }
.c-plum { --sub: var(--c-plum); }
.c-mint { --sub: var(--c-mint); }
.c-olive { --sub: var(--c-olive); }
.c-navy { --sub: var(--c-navy); }
[class*="c-"] { --sub-soft: color-mix(in oklab, var(--sub) 15%, var(--paper)); --sub-edge: color-mix(in oklab, var(--sub) 72%, var(--ink)); }

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* Phones: no 300ms wait for a double-tap zoom on controls, and holding a button doesn't select its label.
   Content text stays selectable. */
button, a, summary, label, select, [role="button"], [data-action] { touch-action: manipulation; }
button, summary, [role="button"], .btn, .tab, .seg-buttons button { -webkit-user-select: none; user-select: none; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
/* A screen's title names the screen; it isn't a poster. 26px on a phone, 32px on a desk. */
h1 {
  font-size: clamp(1.6rem, 1.3rem + 0.8vw, 2rem);
  font-weight: 800;
  font-stretch: var(--wide);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
h2 { font-size: 1.06rem; font-weight: 700; font-stretch: var(--semi-wide); letter-spacing: -0.01em; line-height: 1.25; }
h3 { font-size: 0.92rem; font-weight: 650; line-height: 1.3; }
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
time, .num, kbd, output { font-stretch: var(--narrow); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ic { width: 18px; height: 18px; flex: none; }
.ic-xs { width: 13px; height: 13px; vertical-align: -2px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: var(--r); }
.skip:focus { top: 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.hint { font-size: 13px; color: var(--ink-3); }
.pad { padding: 12px 0; }
.pad-x { padding-inline: 0; }
.grow { flex: 1; }
.inline { display: inline-flex; align-items: center; gap: 8px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; font-family: inherit; font-size: 12px; text-align: center;
  color: var(--ink-2); background: var(--paper); border: 1.5px solid var(--edge); border-radius: 3px; box-shadow: 1px 1px 0 var(--drop);
}

/* The two meaningful marks */
.hl {
  padding: 0 0.22em;
  margin: 0 -0.08em;
  color: var(--hl-ink);
  background: linear-gradient(100deg, transparent 0 1.5%, var(--hl) 3% 96%, transparent 98%);
  border-radius: 0.25em 0.5em 0.3em 0.55em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.pen { color: var(--pen); text-decoration: underline wavy var(--pen) 1px; text-underline-offset: 3px; text-decoration-skip-ink: none; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px;
  font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none;
  border: 2px solid transparent; border-radius: var(--r); background: none;
  transition: background-color 0.15s, color 0.15s, transform 0.08s ease-out, box-shadow 0.08s ease-out;
}
/* Outlined buttons sit on a hard shadow, lift a pixel on hover and press flat when clicked */
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--edge); box-shadow: var(--shadow-sm); }
.btn.line { border-color: var(--edge); background: var(--paper); box-shadow: var(--shadow-sm); }
@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover:not(:disabled), .btn.line:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: var(--shadow); }
}
.btn.primary:active:not(:disabled), .btn.line:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }
.btn.quiet { color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) { .btn.quiet:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); } }
.btn.danger { color: var(--pen); }
/* Touch gets its feedback on press, the instant the finger lands (hover is mouse-only above). */
.btn.quiet:active:not(:disabled), .icon-btn:active:not(:disabled), .task-row:active, .ma-row:active, .ahead-task:active { background: var(--paper-2); }
@media (hover: hover) and (pointer: fine) { .btn.danger:hover:not(:disabled) { background: var(--pen-soft); color: var(--pen); } }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; gap: 6px; }
.btn.sm .ic { width: 16px; height: 16px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; padding: 0;
  color: var(--ink-2); background: none; border: 0; border-radius: var(--r);
  transition: background-color 0.15s, color 0.15s;
}
@media (hover: hover) and (pointer: fine) { .icon-btn:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); } }
.icon-btn.sm { width: 28px; height: 28px; border-radius: var(--r-sm); }
.icon-btn.sm .ic { width: 15px; height: 15px; }

/* ============================================================
   Form fields: the label sits above, plain and readable
   ============================================================ */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field > .label, .seg-field > legend { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > label output { float: right; font-weight: 600; color: var(--ink); }
input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), select, textarea {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px;
  background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r);
  transition: border-color 0.15s, box-shadow 0.1s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 34px; background: var(--paper) var(--chev) no-repeat right 10px center / 16px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 0.85; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--edge); box-shadow: var(--shadow); }
.field.invalid input, .field.invalid select, input.invalid { border-color: var(--pen); }
.field-error { font-size: 13px; color: var(--pen); }
.field.big input { height: 48px; font-size: 1.1rem; font-weight: 600; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }
input[type="range"] { width: 100%; accent-color: var(--primary); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 14px; cursor: pointer; }
.check-row input { flex: none; width: 18px; height: 18px; margin: 0; }
@media (pointer: coarse) { .check-row { min-height: 40px; } .check-row input { width: 22px; height: 22px; } }
.check-row.small { font-size: 13px; color: var(--ink-2); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }
.input-wrap .icon-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.search { position: relative; }
.search > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 38px; }
.filter-toggle { display: none; }
.inline-form { display: flex; align-items: end; gap: 10px; }

/* Segmented choices: radios (.seg label) and toggle buttons (.seg-buttons button) share one look */
.seg-field { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 6px; }
.seg-field > legend { padding: 0; margin-bottom: 6px; }
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r);
}
.seg label { position: relative; flex: 1; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.seg label span, .seg-buttons button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; font-size: 13.5px; font-weight: 500; white-space: nowrap;
  color: var(--ink-2); background: none; border: 0; border-radius: var(--r-sm);
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg input:checked + span, .seg-buttons [aria-pressed="true"] {
  color: var(--on-primary); font-weight: 650; background: var(--primary);
}
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) { .seg label:hover input:not(:checked) + span, .seg-buttons button[aria-pressed="false"]:hover { color: var(--ink); background: var(--paper-2); } }
.icon-seg button { width: 36px; padding: 0; }

/* Tabs: an underlined row for filters */
.tabs { display: flex; gap: 22px; overflow-x: auto; border-bottom: 2px solid var(--rule); margin-bottom: 18px; scrollbar-width: none; }
.tabs button {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  min-width: 32px; justify-content: center; padding: 9px 2px 10px; font-size: 14px; font-weight: 500; color: var(--ink-3);
  background: none; border: 0; box-shadow: inset 0 -2px 0 transparent;
}
@media (hover: hover) and (pointer: fine) { .tabs button:hover { color: var(--ink); } }
.tabs [aria-pressed="true"] { color: var(--ink); font-weight: 650; box-shadow: inset 0 -3px 0 var(--ink); }
.count { font-size: 12.5px; font-weight: 500; color: var(--ink-3); font-stretch: var(--narrow); font-variant-numeric: tabular-nums; }

/* ============================================================
   App shell: indigo rail with index-tab navigation
   ============================================================ */
.app { min-height: 100vh; min-height: 100dvh; }
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--rail-w);
  display: flex; flex-direction: column;
  padding: 18px 0 16px 14px;
  background: var(--rail); color: var(--rail-ink);
  overflow-y: auto; scrollbar-width: none;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 22px; color: inherit; text-decoration: none;
  font-size: 1.2rem; font-weight: 800; font-stretch: var(--wide); letter-spacing: -0.02em;
}
.logo { width: 30px; height: 30px; flex: none; }
.rail-nav, .rail-foot { display: grid; gap: 2px; }
/* Menu groups: a small heading over each set of pages, so the menu reads as three jobs, not ten links. */
.rail-group + .rail-group { margin-top: 14px; }
.rail-group-head {
  margin: 0; padding: 0 12px 6px;
  font-size: 11px; font-weight: 700; font-stretch: var(--semi-wide); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--rail-ink-2); opacity: 0.8;
}
.rail-nav a, .rail-foot a, .rail-btn {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px;
  font-size: 14.5px; font-weight: 500; text-decoration: none;
  color: var(--rail-ink-2); background: none; border: 0; border-radius: var(--r) 0 0 var(--r);
  transition: color 0.15s, background-color 0.15s;
}
/* A hover highlight fills the whole row up to the rail's edge, and its right-hand corners are rounded with the
   same 12px curve as the current tab's flared corners, so beside the tab the two curves fit into each other
   instead of a square end poking out. No gap between rows (they're 2px taller instead): a highlight's corner then
   lines up exactly with the tab's curve. */
.rail-nav { gap: 0; }
.rail-nav a { height: 42px; }
.rail-nav a:not([aria-current="page"]) { border-radius: var(--r) 12px 12px var(--r); }
@media (hover: hover) and (pointer: fine) { .rail-nav a:hover, .rail-foot a:hover, .rail-btn:hover { color: var(--rail-ink); background: var(--rail-2); } }
/* The current page is an index tab that joins the page, with inverted corners above and below */
.rail-nav a[aria-current="page"], .rail-foot a[aria-current="page"] { color: var(--ink); background: var(--ground); font-weight: 650; }
.rail-nav a[aria-current="page"]::before, .rail-nav a[aria-current="page"]::after,
.rail-foot a[aria-current="page"]::before, .rail-foot a[aria-current="page"]::after {
  content: ""; position: absolute; right: 0; width: 12px; height: 12px; pointer-events: none;
}
.rail-nav a[aria-current="page"]::before, .rail-foot a[aria-current="page"]::before { top: -12px; background: radial-gradient(circle at 0 0, transparent 11.5px, var(--ground) 12px); }
.rail-nav a[aria-current="page"]::after, .rail-foot a[aria-current="page"]::after { bottom: -12px; background: radial-gradient(circle at 0 100%, transparent 11.5px, var(--ground) 12px); }
.rail .badge {
  margin-left: auto; margin-right: 6px; min-width: 22px; padding: 0 6px; height: 20px;
  display: grid; place-items: center; font-size: 12px; font-weight: 600; font-stretch: var(--narrow);
  color: var(--rail-ink); background: var(--rail-2); border-radius: 10px;
}
.rail .badge.late { color: #fff; background: #c43a30; }
.rail a[aria-current="page"] .badge { color: var(--ink); background: var(--paper); }
.rail a[aria-current="page"] .badge.late { color: #fff; background: var(--pen); }
.rail-foot { margin-top: auto; padding-top: 18px; padding-right: 14px; }
.rail-foot a, .rail-btn { border-radius: var(--r); font-size: 13.5px; height: 36px; }
.rail-foot a[aria-current="page"] { border-radius: var(--r) 0 0 var(--r); margin-right: -14px; }
.profile {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; padding: 8px;
  text-align: left; color: inherit; background: var(--rail-2); border: 0; border-radius: var(--r);
}
@media (hover: hover) and (pointer: fine) { .profile:hover { background: color-mix(in oklab, var(--rail-2) 80%, white); } }
.profile-text { display: grid; min-width: 0; line-height: 1.25; }
.profile-text b { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-text small { font-size: 12px; color: var(--rail-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; object-fit: cover; }
.avatar.default {
  display: grid; place-items: center; font-weight: 800; font-stretch: var(--wide); font-size: 15px;
  color: var(--rail); background: var(--hl); box-shadow: inset 0 0 0 2px var(--rail);
}
.avatar.xl { width: 76px; height: 76px; font-size: 30px; }

.main { margin-left: var(--rail-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: 60px; padding: 0 40px;
  background: transparent; border-bottom: 2px solid transparent;
  transition: background-color 0.2s, border-color 0.2s;
}
.topbar.scrolled { background: var(--ground); border-color: var(--edge); }
.menu-btn, .crumb { display: none; }
.crumb { font-weight: 650; }
.search-btn {
  display: flex; align-items: center; gap: 10px;
  width: min(300px, 40vw); height: 38px; padding: 0 8px 0 12px;
  color: var(--ink-3); font-size: 14px; text-align: left;
  background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm);
}
@media (hover: hover) and (pointer: fine) { .search-btn:hover { color: var(--ink-2); } }
.search-text { flex: 1; }
.timer-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  font-size: 13.5px; font-weight: 600; font-stretch: var(--narrow); font-variant-numeric: tabular-nums;
  color: var(--on-primary); background: var(--primary); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm);
}
.timer-chip .ic { width: 16px; height: 16px; }
.timer-chip.paused { color: var(--ink); background: var(--paper); }
.timer-chip.on-break:not(.paused) { color: #fff; background: var(--c-aqua); }
.timer-chip[hidden] { display: none; }
.sync { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.sync.error { color: var(--pen); }

.content { max-width: 1200px; padding: 12px 40px 96px; outline: none; }
/* A new page lands in pieces: header first, then each sheet a beat later (see Motion below) */
.scrim { display: none; }

/* ============================================================
   Page structure
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin: 12px 0 26px; }
.lede { margin-top: 10px; max-width: 64ch; color: var(--ink-2); font-size: 15.5px; }
.lede b { color: var(--ink); }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-search { width: 280px; }

.sheet { background: var(--paper); border: 2px solid var(--edge-panel); border-radius: var(--r-lg); padding: 18px 22px; box-shadow: var(--lift); }
.sheet + .sheet { margin-top: 24px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; min-height: 32px; }
.sheet-head h2 { display: flex; align-items: baseline; gap: 10px; }
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.sheet-head h2 .muted { font-size: 13.5px; font-weight: 500; font-stretch: 100%; }
.sheet-head:not(:first-child) { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--rule); }
.list-head {
  display: flex; align-items: center; gap: 8px;
  margin: 16px 0 2px; padding-bottom: 6px;
  font-size: 13px; font-weight: 650; color: var(--ink-2);
}
.list-head:first-child, .sheet-head + .list-head { margin-top: 4px; }
.pen-head { color: var(--pen); }
.empty { padding: 32px 12px; text-align: center; }
.empty p { max-width: 46ch; margin: 0 auto 14px; color: var(--ink-2); }
.empty p:last-child { margin-bottom: 0; }

/* Tags, priority and status */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.tag i { width: 9px; height: 9px; border-radius: 2px; background: var(--sub); }
.prio { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; flex: none; }
.prio i { width: 3px; border-radius: 1px; background: var(--rule-strong); }
.prio i:nth-child(1) { height: 5px; }
.prio i:nth-child(2) { height: 9px; }
.prio i:nth-child(3) { height: 13px; }
.prio.p-low i:nth-child(1), .prio.p-medium i:nth-child(-n+2) { background: var(--ink-2); }
.prio.p-high i { background: var(--pen); }
.status {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 26px; padding: 0 10px 0 8px; font-size: 12.5px; font-weight: 550; white-space: nowrap;
  color: var(--ink-2); background: var(--paper); border: 1.5px solid var(--rule-strong); border-radius: var(--r);
}
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; }
.status.s-doing::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.status.s-done { color: var(--ok); }
.status.s-done::before { background: currentColor; }
@media (hover: hover) and (pointer: fine) { .status:hover { border-color: var(--edge); color: var(--ink); } }

/* Task rows: a subject-coloured tab, a check, the task, its priority */
.task-row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 6px 4px 6px 14px;
  border-top: 1px solid var(--rule);
}
.list-head + .task-row, .sheet-head + .task-row, .task-row:first-child { border-top-color: transparent; }
.task-row::before, .plan-row::before, .card-task::before, .ahead-task::before, .next-test::before, .log li::before, .effort-list li::before, .mini-blocks li::before, .ai-changes li::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 2px; background: var(--sub); box-shadow: inset 0 0 0 1.5px var(--sub-edge);
}
@media (hover: hover) and (pointer: fine) { .task-row:hover { background: var(--paper-2); } }
.task-main {
  flex: 1; min-width: 0; display: grid; gap: 1px; padding: 4px 0;
  text-align: left; background: none; border: 0; border-radius: var(--r-sm);
}
.task-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 0 2px; font-size: 13px; color: var(--ink-3); }
.task-sub .sep, .ahead-task small .sep { margin: 0 6px; color: var(--rule-strong); }
.meta-bit { display: inline-flex; align-items: center; gap: 3px; margin-left: 10px; font-stretch: var(--narrow); }
.is-done .task-name { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--rule-strong); }
.check {
  display: grid; place-items: center; flex: none;
  width: 24px; height: 24px; padding: 0;
  color: transparent; background: var(--paper); border: 2px solid var(--edge); border-radius: 50%;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.check .ic { width: 14px; height: 14px; stroke-width: 2.6; }
@media (hover: hover) and (pointer: fine) { .check:hover { border-color: var(--ink); color: var(--ink-3); } }
.check[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ============================================================
   Today
   ============================================================ */
/* Today is the one home screen with a greeting, so its date stays the largest title in the app (32-46px). */
.date-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 0.3em; font-size: clamp(2rem, 1.5rem + 1.6vw, 2.9rem); }
.dt-day { font-weight: 850; font-stretch: var(--wide); }
.dt-date { font-weight: 300; font-stretch: var(--narrow); letter-spacing: -0.01em; color: var(--ink-2); }
.today-head { display: block; }

.quick {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 10px;
  margin-bottom: 20px; padding: 6px 6px 6px 14px;
  background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r-lg); box-shadow: var(--shadow);
  transition: box-shadow 0.1s, transform 0.1s;
}
.quick:focus-within { transform: translate(-1px, -1px); box-shadow: var(--lift); }
.quick-ic { color: var(--ink-3); display: grid; }
.quick input:not([type]) { height: 40px; padding: 0; border: 0; background: none; box-shadow: none; font-size: 15.5px; }
.quick-preview {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  min-height: 30px; padding: 6px 0 4px; border-top: 1px dashed var(--rule); font-size: 13px; color: var(--ink-2);
}
.quick-preview > span { display: inline-flex; align-items: center; gap: 5px; }
/* Empty: examples to tap. Typing: "Will be added as:" and the parts Planora picked out. */
.quick-preview { gap: 6px 12px; }
.quick-preview .qp-try { font-weight: 650; color: var(--ink-3); }
.qp-example {
  min-height: 28px; padding: 2px 10px; font: inherit; font-size: 13px; color: var(--ink);
  background: var(--paper-2); border: 1.5px solid var(--rule-strong); border-radius: 999px; cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
@media (hover: hover) and (pointer: fine) { .qp-example:hover { background: var(--hl); border-color: var(--edge); color: var(--hl-ink); } }
.qp-example:active { transform: translateY(1px); }
.quick-preview .link-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; min-height: 28px; }
.qp-help { margin-left: auto; }
.qp-details { margin-left: auto; }
@media (pointer: coarse) { .qp-example, .quick-preview .link-btn { min-height: 36px; } }
/* "How it works" for quick add */
.qh-rows { display: grid; gap: 0; margin: 14px 0; }
.qh-rows > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.qh-rows > div:first-child { border-top: 0; }
.qh-rows dt { font-weight: 700; font-stretch: var(--semi-wide); }
.qh-rows dd { margin: 0; }
.qh-rows dd b { display: block; font-weight: 600; }
.qh-rows dd small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.qh-example kbd { white-space: normal; }

/* The day ribbon */
.ribbon-sheet { padding: 16px 22px 14px; overflow-x: auto; margin-bottom: 20px; scrollbar-width: thin; }
.ribbon {
  position: relative; min-width: 780px; margin-left: 66px;
  background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px);
  background-size: calc(100% / var(--hours)) calc(100% - 22px);
  background-position: 0 22px;
  background-repeat: repeat-x;
}
.rb-hours { position: relative; height: 22px; }
.rb-hours span { position: absolute; top: 0; transform: translateX(-50%); font-size: 12px; color: var(--ink-3); font-stretch: var(--narrow); font-variant-numeric: tabular-nums; }
.rb-lane { position: relative; height: 46px; border-top: 1px solid var(--rule); }
/* Lane names stay pinned to the left edge while the ribbon scrolls sideways on small screens. */
.rb-label {
  position: sticky; left: 0; z-index: 3; display: flex; align-items: center; width: 62px; height: 100%; margin-left: -66px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3); background: var(--paper);
  box-shadow: -24px 0 0 var(--paper); /* covers the gap to the edge, so scrolled text can't peek out beside the name */
}
.rb-none { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--ink-3); }
.rb {
  position: absolute; top: 6px; bottom: 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  min-width: 6px; padding: 0 8px 0 7px; overflow: hidden;
  font-size: 12.5px; font-weight: 600; text-align: left; color: var(--ink);
  background: var(--sub-soft); border: 1.5px solid var(--sub-edge); border-radius: var(--r-sm); box-shadow: 2px 2px 0 var(--sub-edge);
}
.rb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The start time gives way to the name whenever the block is too narrow for both. */
.rb { container-type: inline-size; }
@container (max-width: 104px) { .rb time { display: none; } }
/* Today: finished blocks step back, the one happening now gets the highlighter. */
.rb.past { opacity: 0.5; box-shadow: none; }
.rb.is-now { box-shadow: 3px 3px 0 var(--hl); border-color: var(--ink); }
.rb time { font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.hatched, .rb.planned, .wk-block.planned {
  background-color: var(--paper);
  background-image: repeating-linear-gradient(135deg, var(--sub-soft) 0 5px, transparent 5px 9px);
}
.rb.planned, .wk-block.planned { border-style: dashed; box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .rb.planned:hover { background-color: var(--sub-soft); } }
.rb-pin {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center;
  padding: 0 0 0 9px; margin-left: -1px; max-width: 200px;
  font-size: 12.5px; font-weight: 600; color: var(--ink); background: none; border: 0;
  border-left: 2px solid var(--ink); border-radius: 0;
}
.rb-pin span { padding: 2px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--paper); border-radius: 4px; }
/* Two rows of labels (see dueLayout in views-plan.js); LABEL there matches this max-width. */
.rb-pin { max-width: 22%; }
.rb-lane.rb-due { height: 56px; }
.rb-pin.row-0 { bottom: 50%; }
.rb-pin.row-1 { top: 50%; }
/* Shrunken marker: centred on its time whichever side the label would have gone (beats .flip below). */
.rb-pin.mini, .rb-pin.mini.flip { top: 30%; bottom: 30%; padding: 0; width: 24px; margin-left: -12px; border: 0; justify-content: center; transform: none; }
.rb-pin.mini::before { content: ''; width: 3px; height: 100%; background: currentColor; border-radius: 2px; }
.rb-pin.mini span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* A timetable study block with planned sessions inside: a quiet band behind them. */
.rb.band { z-index: 0; padding: 0; background-color: transparent; border-style: dashed; box-shadow: none; opacity: 0.6; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .rb-pin:hover span { background: var(--paper-2); } }
.rb-pin.late { border-color: var(--pen); color: var(--pen); }
.rb-pin.flip { padding: 0 9px 0 0; border-left: 0; border-right: 2px solid var(--ink); transform: translateX(-100%); margin-left: 1px; justify-content: flex-end; }
.rb-pin.flip.late { border-right-color: var(--pen); }
.rb-pin.flip.done { border-right-color: var(--rule-strong); }
.rb-pin.done { border-color: var(--rule-strong); color: var(--ink-3); }
.rb-pin.done span { text-decoration: line-through; }
.rb-now {
  position: absolute; top: 18px; bottom: 0; z-index: 2; width: 3px; margin-left: -1.5px; pointer-events: none;
}
/* The line is its own layer so it can breathe while the time chip above it stays solid. */
.rb-now::before { content: ""; position: absolute; inset: 0; background: var(--hl); border-radius: 2px; }
.rb-now span {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  padding: 0 5px; font-size: 11.5px; font-weight: 700; font-stretch: var(--narrow); color: var(--hl-ink); background: var(--hl); border-radius: 3px;
}

/* A day with nothing on it: one line with the two ways to fill it, instead of an empty 200px grid. */
.day-free { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 12px 14px 12px 22px; margin-bottom: 20px; }
.day-free p { font-size: 14.5px; color: var(--ink-2); }
.day-free p b { color: var(--ink); font-weight: 650; }

.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 28px; align-items: start; }
.plan-row {
  position: relative; display: flex; align-items: center; gap: 14px;
  min-height: 54px; padding: 6px 4px 6px 14px; border-top: 1px solid var(--rule);
}
.list-head + .plan-row, .plan-day > div > .plan-row:first-child { border-top-color: transparent; }
.plan-row time { flex: none; min-width: 44px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.done-today { margin-top: 10px; border-top: 1px solid var(--rule); }
.done-today summary, .disclose summary {
  display: flex; align-items: center; gap: 8px; padding: 12px 0; list-style: none;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.done-today summary::-webkit-details-marker, .disclose summary::-webkit-details-marker, .faq summary::-webkit-details-marker { display: none; }
.chev { margin-left: auto; transition: transform 0.2s; }
details[open] > summary .chev { transform: rotate(180deg); }

.today-side { display: grid; gap: 0; }
.side-block { padding: 16px 0 18px; border-top: 2px solid var(--edge-panel); }
.side-block:first-child { padding-top: 2px; border-top: 0; }
.side-block h2 { font-size: 13.5px; font-weight: 600; font-stretch: 100%; color: var(--ink-2); letter-spacing: 0; }
.figure { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; margin: 2px 0 10px; font-size: 1.9rem; font-weight: 800; font-stretch: var(--wide); letter-spacing: -0.02em; line-height: 1.15; }
.figure span { font-size: 14px; font-weight: 500; font-stretch: 100%; letter-spacing: 0; color: var(--ink-2); }
.bar { height: 12px; background: var(--paper); border: 2px solid var(--edge-panel); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.bar i { display: block; height: 100%; background: var(--ink); }
.next-test {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 8px; padding: 6px 8px 6px 14px;
  text-align: left; background: none; border: 2px solid transparent; border-radius: var(--r);
}
@media (hover: hover) and (pointer: fine) { .next-test:hover { background: var(--paper); border-color: var(--edge); } }
.countdown { display: grid; justify-items: center; gap: 3px; min-width: 46px; font-size: 1.7rem; font-weight: 800; line-height: 1; }
.countdown small { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.countdown.is-now { font-size: 1.15rem; font-stretch: var(--semi-wide); color: var(--hl-ink); background: var(--hl); padding: 4px 6px; border-radius: 4px 8px 4px 9px; }
.next-test b { display: block; font-weight: 650; }
.next-test small { color: var(--ink-3); font-size: 13px; }
.streak-dots { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; max-width: 280px; }
.streak-dots span { aspect-ratio: 1; border-radius: 3px; background: var(--rule); }
.streak-dots .on { background: var(--ink); }
.streak-dots .is-today { box-shadow: 0 0 0 2px var(--ground), 0 0 0 4px var(--hl); }

/* Left column of Today: the day's list, then what's coming, so it runs as long as the progress column */
.today-main { display: grid; gap: 24px; min-width: 0; }
.today-main > .sheet + .sheet { margin-top: 0; }

/* Coming up: an agenda, each day marked by a tear-off calendar date */
.ahead .sheet-head .count { font-size: 13px; font-weight: 500; color: var(--ink-3); font-stretch: 100%; }
.ahead-day { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px 0; border-top: 1px solid var(--rule); }
.sheet-head + .ahead-day { border-top: 0; padding-top: 4px; }
.tear { display: grid; overflow: hidden; text-align: center; background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.tear span { padding: 2px 0 1px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--rail-ink); background: var(--rail); }
.tear b { padding: 2px 0 3px; font-size: 20px; font-weight: 800; font-stretch: var(--narrow); line-height: 1.15; }
.is-tomorrow .tear span { color: var(--hl-ink); background: var(--hl); }
.ahead-list { display: grid; gap: 6px; min-width: 0; }
.ahead-task {
  position: relative; display: grid; gap: 1px; width: 100%; padding: 7px 10px 7px 26px;
  text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--paper-2); border: 2px solid transparent; border-radius: var(--r);
}
@media (hover: hover) { .ahead-task:hover { background: var(--paper); border-color: var(--edge); box-shadow: var(--shadow-sm); } }
.ahead-task::before { left: 9px; }
.at-name { font-size: 14.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ahead-task small { font-size: 12.5px; color: var(--ink-3); }
.ahead-study { display: flex; align-items: center; gap: 6px; margin: 0; padding-left: 10px; font-size: 12.5px; color: var(--ink-3); }
.ahead-free { margin: 0; padding: 6px 0 4px; color: var(--ink-3); }

/* ============================================================
   Tasks
   ============================================================ */
.toolbar { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(3, minmax(130px, 1fr)); gap: 12px; align-items: end; margin-bottom: 14px; }
.toolbar .field > label:not(.sr-only) { font-size: 12.5px; }
.list-sheet { padding-top: 10px; padding-bottom: 10px; }
.task-row .status { margin-left: 4px; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.board-col {
  min-height: 320px; padding: 12px;
  background: color-mix(in oklab, var(--paper) 45%, var(--ground)); border: 2px dashed var(--rule-strong); border-radius: var(--r-lg);
  transition: background-color 0.15s, border-color 0.15s;
}
.board-col h2 { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-size: 0.95rem; }
.board-cards { display: grid; gap: 8px; }
.card-task {
  position: relative; display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 12px 8px 22px; background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r);
  box-shadow: var(--shadow-sm); cursor: grab;
}
.card-task::before { left: 6px; }
.card-task .prio { margin-top: 8px; }
.card-task .task-name { white-space: normal; }
@media (hover: hover) { .card-task:hover { box-shadow: var(--shadow); transform: translate(-1px, -1px); } }
[data-drag-task] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.dragging { opacity: 0.4; }
.drop-over { background: color-mix(in oklab, var(--hl) 28%, var(--paper)) !important; border-color: var(--ink-3) !important; }
.board-empty { padding: 16px 6px; font-size: 13px; color: var(--ink-3); text-align: center; }

/* ============================================================
   Calendar
   ============================================================ */
.stepper { display: flex; align-items: center; gap: 2px; padding: 2px; background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; align-items: start; }
.month { background: var(--paper); border: 2px solid var(--edge-panel); border-radius: var(--r-lg); box-shadow: var(--lift); overflow: hidden; }
.month-dow, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-dow span { padding: 10px 10px 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid var(--edge); }
.day-cell { position: relative; min-height: 112px; padding: 32px 6px 6px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); transition: background-color 0.12s; }
.day-cell:nth-child(7n) { border-right: 0; }
.month-grid .day-cell:nth-last-child(-n+7) { border-bottom: 0; }
.day-cell.out { background: var(--paper-2); }
.day-cell.out .day-num { color: var(--ink-3); font-weight: 400; }
.day-hit { position: absolute; inset: 0; display: flex; align-items: flex-start; padding: 7px 9px; text-align: left; background: none; border: 0; border-radius: 0; }
@media (hover: hover) and (pointer: fine) { .day-hit:hover { background: color-mix(in oklab, var(--paper-2) 70%, transparent); } }
.day-cell.selected .day-hit { box-shadow: inset 0 0 0 2px var(--ink); }
.day-num { font-size: 13.5px; font-weight: 650; font-stretch: var(--narrow); font-variant-numeric: tabular-nums; }
.is-today .day-num { padding: 0 6px; margin-left: -4px; color: var(--hl-ink); background: var(--hl); border-radius: 4px 7px 4px 8px; }
.day-items { position: relative; display: grid; gap: 3px; pointer-events: none; }
.day-chip {
  pointer-events: auto; display: block; padding: 2px 6px 2px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-weight: 550; background: var(--sub-soft); border: 1.5px solid var(--sub-edge); border-radius: 3px; cursor: grab;
}
.day-chip.done { color: var(--ink-3); text-decoration: line-through; }
.day-chip.late { color: var(--pen); }
.day-more { padding-left: 6px; font-size: 12px; color: var(--ink-3); }
.day-study {
  justify-self: start; padding: 1px 6px; font-size: 11.5px; font-weight: 600; font-stretch: var(--narrow); color: var(--ink-2);
  border: 1.5px dashed var(--sub-edge); border-radius: 3px;
}
.day-panel .plan-row time { min-width: 86px; font-size: 13px; }
.plan-row.is-done .task-name { color: var(--ink-3); text-decoration: line-through; }
.day-dots { display: none; }
/* The side column: the chosen day, then what's still due this month. It stays in view beside a tall month. */
.cal-side { display: grid; gap: 20px; position: sticky; top: 76px; }
.cal-side .sheet { margin: 0; }
.ma-list { list-style: none; margin: 4px 0 0; padding: 0; }
.ma-row {
  position: relative; display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  width: 100%; min-height: 40px; padding: 8px 4px 8px 14px; text-align: left; color: var(--ink);
  background: none; border: 0; border-top: 1px solid var(--rule); border-radius: 0; cursor: pointer;
}
.ma-list li:first-child .ma-row { border-top-color: transparent; }
.ma-row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 2px; background: var(--sub); }
.ma-row time { font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ma-row.late time { color: var(--pen); }
.ma-name { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ma-kind { flex: none; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.ma-more { padding: 6px 0 0 14px; font-size: 13px; color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) { .ma-row:hover .ma-name { text-decoration: underline; text-underline-offset: 3px; } }
.day-panel .task-row { padding-right: 0; }
.mini-blocks { list-style: none; margin: 0; padding: 0; }
.mini-blocks li { position: relative; display: flex; gap: 10px; align-items: baseline; padding: 6px 0 6px 14px; font-size: 14px; }
.mini-blocks time { font-size: 13px; color: var(--ink-2); min-width: 82px; }
.mini-blocks .muted { margin-left: auto; font-size: 12.5px; }

/* Week grid: the calendar's week view and the timetable */
.week-sheet { padding: 0; overflow-x: auto; }
.week { min-width: 760px; }
.week-head, .week-body { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); }
.week-head { position: sticky; top: 0; border-bottom: 2px solid var(--edge); }
.wk-day {
  display: grid; justify-items: center; gap: 0; padding: 10px 4px 8px;
  background: none; border: 0; border-left: 1px solid var(--rule); border-radius: 0;
}
.wk-day span { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.wk-day b { font-size: 1.3rem; font-weight: 800; font-stretch: var(--semi-wide); line-height: 1.2; padding: 0 6px; }
.wk-day small { font-size: 12px; color: var(--ink-3); font-stretch: var(--narrow); }
.wk-day.is-today b { color: var(--hl-ink); background: var(--hl); border-radius: 4px 8px 4px 9px; }
.timetable .wk-day.is-today span { color: var(--ink); }
.timetable .wk-day.is-today { box-shadow: inset 0 -3px 0 var(--hl); }
@media (hover: hover) and (pointer: fine) { button.wk-day:hover { background: var(--paper-2); } }
.week-body { height: calc(var(--rows) * 50px); }
.wk-axis { display: grid; grid-template-rows: repeat(var(--rows), 1fr); }
.wk-axis span { padding: 2px 8px 0 0; font-size: 11.5px; text-align: right; color: var(--ink-3); font-stretch: var(--narrow); font-variant-numeric: tabular-nums; transform: translateY(-8px); }
.wk-axis span:first-child { transform: none; }
.wk-col {
  position: relative; border-left: 1px solid var(--rule);
  background-image: linear-gradient(to bottom, var(--rule) 1px, transparent 1px);
  background-size: 100% calc(100% / var(--rows));
}
.wk-col.is-today { background-color: color-mix(in oklab, var(--hl) 9%, var(--paper)); }
.timetable .wk-col { cursor: cell; }
.wk-block {
  position: absolute; left: 4px; right: 4px; min-height: 18px;
  display: grid; align-content: start; gap: 0; padding: 4px 7px; overflow: hidden;
  font-size: 12.5px; font-weight: 650; text-align: left; line-height: 1.3; color: var(--ink);
  background-color: var(--sub-soft); border: 1.5px solid var(--sub-edge); border-radius: var(--r-sm); box-shadow: 2px 2px 0 var(--sub-edge);
}
.wk-block span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-block time, .wk-block small { font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
button.wk-block { cursor: pointer; }
@media (hover: hover) { button.wk-block:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--sub-edge); } }
/* The chosen study plan, pencilled in: dashed and inset so a timetable block underneath still shows its edge */
.wk-block.planned { left: 12px; z-index: 1; }
@media (hover: hover) and (pointer: fine) { button.wk-block.planned:hover { background-color: var(--sub-soft); box-shadow: none; transform: none; } }
/* Too short for two lines: name and time share one, the name giving way first */
.wk-block.short { display: flex; align-items: center; gap: 6px; padding-block: 0; }
.wk-block.short span { min-width: 0; }
.wk-block.short time { flex: none; }
.wk-block.planned.done { color: var(--ink-3); }
.wk-block.planned.done span { text-decoration: line-through; }
.wk-task {
  position: absolute; left: 6px; right: 6px; z-index: 2; transform: translateY(-50%);
  display: flex; align-items: center; gap: 5px; padding: 2px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 12px; font-weight: 600; text-align: left; color: var(--ink);
  background: var(--paper); border: 2px solid var(--sub-edge); border-radius: 3px; box-shadow: 2px 2px 0 var(--drop); cursor: grab;
}
.wk-task time { font-size: 11px; color: var(--ink-3); }
.wk-task.done { color: var(--ink-3); text-decoration: line-through; border-color: var(--rule-strong); box-shadow: none; }
.wk-task.late { color: var(--pen); border-color: var(--pen); }
/* Deadlines for each day, in a row of their own under the day names */
.week-due { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); border-bottom: 2px solid var(--edge); background: var(--paper-2); }
.wk-due-label { padding: 8px 8px 0 0; font-size: 11.5px; font-weight: 600; text-align: right; color: var(--ink-3); }
.wk-due-col { display: grid; align-content: start; gap: 4px; min-width: 0; min-height: 36px; padding: 6px 4px; border-left: 1px solid var(--rule); }
.week-due .wk-task { position: static; transform: none; min-height: 26px; }
.wk-task span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wk-more { justify-self: start; min-height: 24px; padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.wk-now { position: absolute; left: 0; right: 0; height: 3px; margin-top: -1px; background: var(--hl); z-index: 3; pointer-events: none; }
.wk-now::before { content: ""; position: absolute; left: -5px; top: -3.5px; width: 10px; height: 10px; border-radius: 50%; background: var(--hl); }
.legend { display: inline-flex; align-items: center; gap: 8px; margin-right: 6px; font-size: 13px; color: var(--ink-2); }
.legend .key { width: 18px; height: 14px; border-radius: 3px; --sub: var(--ink-3); --sub-soft: color-mix(in oklab, var(--ink-3) 30%, var(--paper)); border: 1.5px solid var(--ink-2); }
.legend .key.solid { background: var(--sub-soft); }
.legend .key.planned { border-style: dashed; }
.legend .key + .key, .legend .key:not(:first-child) { margin-left: 8px; }

/* ============================================================
   Planner
   ============================================================ */
/* Two boxes with different jobs: the habits (tinted, flat: settings you set once in a while) above the plan
   (white, lifted: what you read every day), each with room of its own. */
.planner { display: grid; gap: 28px; }
.planner > .sheet + .sheet { margin-top: 0; }
.sub-h { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--rule); }
.habits { background: var(--paper-2); box-shadow: none; }
.habits-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 22px; margin-top: 6px; }
.habits-grid .field.range { align-content: start; gap: 12px; }
.habits-opts { display: flex; flex-wrap: wrap; gap: 4px 28px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.plan-sheet { padding-top: 20px; padding-bottom: 8px; }
.plan-sheet .plan-total .muted { margin-left: 4px; }
/* Card titles keep one line; when the buttons beside them don't fit (a phone, or Today's extra evening
   "Review your day" button), the buttons move underneath instead. */
.plan-sheet .sheet-head, .today-main .sheet-head { flex-wrap: wrap; }
.plan-sheet .sheet-head h2, #todoTitle { white-space: nowrap; }
.short-more summary { display: inline-flex; gap: 6px; min-height: 28px; align-items: center; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; list-style: none; }
.short-more summary::-webkit-details-marker { display: none; }
.short-more summary::after { content: ""; width: 6px; height: 6px; margin-top: -3px; border: solid currentColor; border-width: 0 2px 2px 0; rotate: 45deg; }
.short-more[open] summary::after { margin-top: 3px; rotate: 225deg; }
.short-more[open] summary { margin-bottom: -4px; }
.notice-short .notice-actions { margin-top: 8px; }
.effort-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.effort-list li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 10px; align-items: center; padding-left: 20px; }
.effort-name { display: grid; min-width: 0; line-height: 1.3; }
.effort-name b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.effort-name small { font-size: 12px; color: var(--ink-3); }
.effort-list select { height: 34px; font-size: 13px; }
.plan-total { padding-bottom: 14px; color: var(--ink-2); }
.plan-total b { color: var(--ink); font-weight: 700; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; padding: 12px 14px;
  font-size: 14px; background: var(--paper-2); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm);
}
.notice > .ic { flex: none; box-sizing: content-box; padding: 4px; margin-top: -2px; color: var(--hl-ink); background: var(--hl); border-radius: var(--r-sm); }
.notice > div { flex: 1; min-width: 0; }
.short-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 8px 0 12px; padding: 0; list-style: none; }
.short-list li { display: flex; justify-content: space-between; gap: 12px; padding-top: 4px; border-top: 1px solid var(--rule); }
.short-list span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.short-list small { flex: none; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notice p { flex: 1; }
.notice .btn { flex: none; align-self: center; }
.plan-why { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; font-size: 13.5px; color: var(--ink-2); }
.plan-why .ic { flex: none; margin-top: 1px; color: var(--ink-3); }
.plan-why b { color: var(--ink); font-weight: 650; }
/* AI advice (js/ai.js): the button in "How you study", the notice over the plan and the dialog */
.ai-tips, .ai-sent { display: grid; gap: 4px; margin: 6px 0 10px; padding-left: 18px; font-size: 13.5px; }
.ai-sent { margin: -8px 0 0; font-size: 14px; }
.ai-h { font-size: 14px; font-weight: 700; }
.ai-body > p { margin: 0; }
.ai-wait { display: flex; gap: 10px; align-items: center; padding: 18px 0; }
.ai-wait .ic { animation: ai-pulse 1.2s ease-in-out infinite; }
@keyframes ai-pulse { 50% { opacity: .35; scale: .85; } }
@media (prefers-reduced-motion: reduce) { .ai-wait .ic { animation: none; } }
.ai-changes { display: grid; gap: 8px; margin: -8px 0 0; padding: 0; list-style: none; }
.ai-changes li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0 0 20px; border-top: 1px solid var(--rule); }
.ai-task { display: grid; min-width: 0; line-height: 1.3; }
.ai-task b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-task small { font-size: 12.5px; color: var(--ink-2); }
.ai-mins { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-mins s { margin-right: 4px; font-weight: 500; color: var(--ink-3); }
.plan-day { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 2px solid var(--edge); }
.plan-day h3 { display: grid; align-content: start; justify-items: start; padding-top: 14px; font-size: 15px; font-weight: 700; }
.plan-day h3 span { font-size: 13px; font-weight: 500; color: var(--ink-3); font-stretch: var(--narrow); }
.plan-day .plan-row time { min-width: 92px; }

/* ============================================================
   Focus
   ============================================================ */
.focus-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; align-items: start; margin-bottom: 20px; }
.focus-layout .sheet + .sheet { margin-top: 0; }
.focus-sheet { display: grid; gap: 18px; padding-top: 10px; }
.focus-sheet .tabs { margin-bottom: 0; }
.clock { display: flex; justify-content: center; margin-top: 8px; font-size: clamp(3.4rem, 2rem + 4.4vw, 6rem); font-weight: 800; line-height: 1; }
.clock-bar { height: 12px; background: var(--paper); border: 2px solid var(--edge); border-radius: 3px; overflow: hidden; }

/* Split-flap tiles: each digit is a card cut at the hinge into two halves (see setFlaps in
   common.js). On a change the old top leaf falls forward, then the new bottom leaf swings
   down and settles. Only transform and filter animate, on small layers, so it stays smooth. */
.flaps { display: inline-flex; align-items: center; gap: 0.06em; }
.flap {
  position: relative; display: inline-block; width: 0.74em; height: 1.12em; vertical-align: middle;
  color: var(--flap-ink); background: var(--flap); border: 1.5px solid var(--edge); border-radius: 0.07em; box-shadow: var(--shadow-sm);
  font-stretch: 100%; font-variant-numeric: tabular-nums; perspective: 3.4em;
}
.flap-h {
  position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; background: var(--flap);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.flap-t { top: 0; border-radius: 0.05em 0.05em 0 0; transform-origin: 50% 100%; }
.flap-b { bottom: 0; border-radius: 0 0 0.05em 0.05em; transform-origin: 50% 0; }
.flap-h b { position: absolute; left: 0; right: 0; height: 200%; display: grid; place-items: center; font-weight: inherit; line-height: 1; }
.flap-t b { top: 0; }
.flap-b b { bottom: 0; }
.flap-leaf { z-index: 1; will-change: transform; }
.flap::after { content: ""; position: absolute; z-index: 2; left: 0; right: 0; top: 50%; height: max(1px, 0.03em); transform: translateY(-50%); background: var(--paper); opacity: 0.9; pointer-events: none; }
.flap-sep { padding: 0 0.04em; color: var(--ink); }
.countdown .flap { box-shadow: 2px 2px 0 var(--drop); }
.clock-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; transition: transform 0.3s var(--out); will-change: transform; }
/* While running the bar gets a fresh target once a second, aligned to the tick, so a 1s linear
   transition makes it creep continuously instead of stepping. */
.clock-bar.ticking i { transition-duration: 1s; transition-timing-function: linear; }
.on-break .clock-bar i { background: var(--c-aqua); }
.clock-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clock-actions .btn.primary { min-width: 140px; }

/* Charts: thin marks, ink text, recessive grid */
.vbars { position: relative; display: flex; align-items: stretch; gap: 8px; height: 210px; padding: 22px 0 26px; margin: 4px 0 10px; border-bottom: 2px solid var(--edge); }
.vb { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.vb i { display: block; width: min(60%, 34px); min-height: 0; background: var(--c-blue); border: 2px solid var(--edge); border-bottom: 0; border-radius: 3px 3px 0 0; }
.vb-val { font-size: 11.5px; font-weight: 600; color: var(--ink-2); font-stretch: var(--narrow); margin-bottom: 3px; white-space: nowrap; }
.vb-day { position: absolute; bottom: -24px; font-size: 12px; color: var(--ink-3); }
.vb-day.is-today { color: var(--hl-ink); background: var(--hl); padding: 0 5px; border-radius: 3px; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .vb:hover i { filter: brightness(1.1); } }
.vb-layer { position: absolute; inset: 22px 0 26px; pointer-events: none; }
.vb-goal { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--ink-3); }
.vb-goal span { position: absolute; left: 0; top: -17px; font-size: 11.5px; color: var(--ink-3); background: var(--paper); padding-right: 6px; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: 150px minmax(0, 1fr) 56px; gap: 12px; align-items: center; }
.hb-label { overflow: hidden; }
.hb-track { height: 12px; background: var(--paper-2); border: 1.5px solid var(--edge); border-radius: 3px; overflow: hidden; }
.hb-track i { display: block; height: 100%; background: var(--sub); box-shadow: 1.5px 0 0 var(--edge); }
.hbars b { font-size: 13px; font-weight: 600; text-align: right; font-stretch: var(--narrow); }
.log { list-style: none; margin: 0; padding: 0; }
.log li { position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; min-height: 44px; padding-left: 14px; border-top: 1px solid var(--rule); }
.log li:first-child { border-top: 0; }
.log time { font-size: 13px; color: var(--ink-2); }
.log span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log b { font-stretch: var(--narrow); font-weight: 650; }

/* ============================================================
   Grades
   ============================================================ */
.gchart { --label: 150px; --val: 56px; --trend: 64px; display: grid; gap: 4px; padding: 6px 0 4px; }
.g-axis { position: relative; height: 18px; margin: 0 calc(var(--val) + var(--trend) + 28px) 0 calc(var(--label) + 14px); }
.g-axis .g-trend-h { left: auto; right: calc(-1 * (var(--val) + var(--trend) + 28px)); width: var(--trend); transform: none; text-align: center; font-stretch: 100%; }
.g-axis span { position: absolute; transform: translateX(-50%); font-size: 11.5px; color: var(--ink-3); font-stretch: var(--narrow); }
.g-row { display: grid; grid-template-columns: var(--label) minmax(0, 1fr) var(--val) var(--trend); gap: 14px; align-items: center; min-height: 36px; }
.g-label { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-track {
  position: relative; height: 26px;
  background-image: repeating-linear-gradient(to right, var(--rule) 0 1px, transparent 1px 25%);
  background-size: calc(100% + 1px) 100%;
  border-left: 1px solid var(--rule-strong);
}
.g-track i { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--sub); border: 1.5px solid var(--sub-edge); border-left: 0; border-radius: 0 3px 3px 0; }
.spark { display: block; width: var(--trend); height: 26px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--ink); stroke: var(--paper); stroke-width: 1.5; }
.g-val { font-size: 14px; font-weight: 700; text-align: right; font-stretch: var(--narrow); }
@media (hover: hover) and (pointer: fine) { .g-row:hover .g-label { text-decoration: underline; text-decoration-color: var(--rule-strong); } }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 8px 10px; font-size: 12.5px; font-weight: 600; text-align: left; color: var(--ink-3); border-bottom: 1px solid var(--rule-strong); }
td { padding: 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td b { font-weight: 600; }
.num { text-align: right; }
.row-actions { white-space: nowrap; text-align: right; width: 72px; }

/* ============================================================
   Settings, contact, help
   ============================================================ */
.settings { display: grid; gap: 20px; max-width: 900px; }
.settings .sheet + .sheet { margin-top: 0; }
.subject-list { list-style: none; margin: 12px 0 18px; padding: 0; }
.subject-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr) 130px 90px 28px; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--rule); }
.subject-list li:first-child { border-top: 0; }
.subject-list input, .subject-list select { height: 36px; }
.quiet-input:not(:focus) { border-color: transparent; background: transparent; font-weight: 550; }
@media (hover: hover) and (pointer: fine) { .quiet-input:not(:focus):hover { border-color: var(--rule); } }
.swatch { width: 16px; height: 16px; border-radius: 3px; background: var(--sub); box-shadow: inset 0 0 0 1.5px var(--sub-edge); }

/* Subject colour picker: a select-looking summary that opens a grid of covers */
.color-pick { position: relative; }
.color-pick summary {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px 0 12px; list-style: none;
  font-size: 14px; background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r); cursor: pointer;
}
.color-pick summary::-webkit-details-marker { display: none; }
.color-pick summary:focus-visible, .color-pick[open] summary { outline: none; box-shadow: var(--shadow); }
.cp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-panel {
  position: absolute; z-index: 20; right: 0; top: calc(100% + 6px); width: 232px; padding: 12px;
  background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r-lg); box-shadow: var(--lift);
}
.cp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cp-swatch {
  aspect-ratio: 1; padding: 0; border: 0; border-radius: 3px; background: var(--sub); cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--sub-edge);
}
@media (hover: hover) { .cp-swatch:hover { transform: scale(1.08); } }
.cp-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.cp-swatch:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--focus); }
.cp-custom { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.cp-custom input[type="color"] { flex: none; width: 30px; height: 30px; padding: 2px; border-radius: 6px; cursor: pointer; }

/* Subject select plus the "Which subject?" field that "Other" opens */
.subject-pick { display: grid; gap: 10px; align-content: start; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; align-items: end; margin: 10px 0 8px; }
.data-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: center; margin-top: 10px; }
.data-actions .hint { margin-top: 2px; }
.data-actions label.btn { cursor: pointer; }
.feed-link { display: flex; gap: 8px; }
.feed-link input { flex: 1; min-width: 0; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2); }
.feed-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (pointer: coarse) { .feed-link input { font-size: 16px; } }
.data-actions label.btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

.contact { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.form-sheet { display: grid; gap: 18px; padding: 22px; }
.form-foot { display: flex; justify-content: flex-end; }
.contact-side h2 { margin-bottom: 12px; }
.contact-side .hint { margin-top: 18px; }
.facts { display: grid; gap: 0; margin: 0; }
.facts > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 11px 0; border-top: 1px solid var(--rule); }
.facts > div:first-child { border-top: 0; }
.facts dt { font-size: 13px; color: var(--ink-3); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts dd.notes { white-space: pre-line; }
.facts dd .muted { margin-left: 6px; }
.facts .seg { margin-top: -4px; }
.ext { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }

.faq { padding-top: 4px; padding-bottom: 4px; }
.faq details { border-top: 1px solid var(--rule); }
.faq details:first-child { border-top: 0; }
.faq summary { display: flex; align-items: center; gap: 12px; padding: 16px 0; list-style: none; font-weight: 650; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .faq summary:hover { color: var(--ink-2); } }
.faq details p { max-width: 70ch; padding: 0 0 18px; color: var(--ink-2); }

/* ============================================================
   Dialogs, palette, toasts, tooltips
   ============================================================ */
.dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); padding: 0;
  color: var(--ink); background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r-lg); box-shadow: var(--lift-lg);
}
.dialog[open] { display: flex; flex-direction: column; animation: dialog-in 0.28s cubic-bezier(0.25, 1.3, 0.5, 1); }
.dialog::backdrop { background: var(--scrim); }
/* Dialogs are stamped down: they arrive offset toward their shadow and settle onto it */
@keyframes dialog-in { from { opacity: 0; transform: translate(6px, 10px); box-shadow: 0 0 0 var(--drop); } }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 10px; }
.dialog-head h2 { font-size: 1.35rem; font-weight: 800; font-stretch: var(--semi-wide); letter-spacing: -0.02em; }
.dialog-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; font-size: 13px; color: var(--ink-3); }
.dialog-kicker span { display: inline-flex; align-items: center; gap: 4px; }
.dialog-head .icon-btn { margin: -4px -8px 0 0; }
.dialog-body { display: grid; gap: 16px; padding: 6px 22px 20px; overflow-y: auto; }
.dialog-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 14px 22px; border-top: 2px solid var(--edge); background: var(--paper-2); }
.steps h3 { display: flex; gap: 10px; margin-bottom: 6px; }
.steps h3 .muted { font-weight: 500; }
.steps ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.steps li .check-row { padding: 6px 0; }
.steps input:checked + span { color: var(--ink-3); text-decoration: line-through; }
.steps-edit { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.steps-edit legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.steps-edit ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.steps-edit li { display: flex; align-items: center; gap: 6px; }
.steps-edit li input { height: 36px; }
.steps-edit .btn { justify-self: start; }
.file-pick {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; overflow: hidden;
  font-size: 14px; color: var(--ink-2); background: var(--paper); border: 2px dashed var(--edge); border-radius: var(--r); cursor: pointer;
}
.file-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick.has-file { color: var(--ink); border-style: solid; }
@media (hover: hover) and (pointer: fine) { .file-pick:hover { background: var(--paper-2); } }
.file-pick:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

.palette-dialog { margin-top: 12vh; width: min(600px, calc(100vw - 24px)); }
.pal-search { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 2px solid var(--edge); color: var(--ink-3); }
.pal-search input:not([type]) { height: 48px; padding: 0; font-size: 16px; border: 0; background: none; box-shadow: none; color: var(--ink); }
#paletteList { list-style: none; margin: 0; padding: 6px; max-height: min(420px, 60vh); overflow-y: auto; }
.pal-group { padding: 10px 10px 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r); cursor: pointer; color: var(--ink-2); }
.pal-item[aria-selected="true"] { background: var(--paper-2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--edge); }
.pal-label { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; font-weight: 550; }
.pal-label small { font-size: 12.5px; font-weight: 400; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 20px 12px; color: var(--ink-3); font-size: 14px; }
.keys { display: grid; margin: 0; }
.keys > div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--rule); }
.keys > div:first-child { border-top: 0; }
.keys dd { margin: 0; color: var(--ink-2); }

/* Profile */
.pfp-row { display: flex; align-items: center; gap: 18px; }
.pfp-pick { position: relative; cursor: pointer; border-radius: 50%; }
.pfp-pick:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
.pfp-cam { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 28px; height: 28px; color: var(--on-primary); background: var(--primary); border: 2px solid var(--paper); border-radius: 50%; }
.pfp-cam .ic { width: 14px; height: 14px; }
.pfp-name { font-size: 1.15rem; font-weight: 750; font-stretch: var(--semi-wide); }
.pfp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; padding: 14px 0; border-block: 1px solid var(--rule); }
.tally dt { font-size: 12.5px; color: var(--ink-3); }
.tally dd { margin: 2px 0 0; font-size: 1.3rem; font-weight: 800; font-stretch: var(--semi-wide); }
.disclose { border-top: 1px solid var(--rule); }
.stack-form { display: grid; gap: 12px; padding-bottom: 6px; }
.stack-form .btn { justify-self: start; }

.toasts { position: fixed; left: 50%; bottom: 22px; z-index: 60; display: grid; gap: 8px; justify-items: center; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; pointer-events: auto;
  font-size: 14px; color: var(--paper); background: var(--ink); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--lift);
  animation: toast-in 0.34s cubic-bezier(0.25, 1.4, 0.5, 1);
}
.toast.tone-bad .ic { color: #ff9a8f; }
:root[data-theme="dark"] .toast.tone-bad .ic { color: var(--pen); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
.toast-btn { margin-left: 6px; padding: 4px 10px; font-size: 13.5px; font-weight: 650; color: var(--hl-ink); background: var(--hl); border: 0; border-radius: 3px; }
.remind-pop { align-items: flex-start; width: min(440px, calc(100vw - 24px)); }
.remind-pop > .ic { flex: none; margin-top: 2px; }
.remind-pop-text { display: grid; flex: 1; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.remind-pop-text b { font-weight: 650; line-height: 1.3; }
.remind-pop-text small { font-size: 13px; line-height: 1.35; opacity: 0.82; }
.remind-pop .toast-btn { flex: none; min-height: 32px; margin-left: 0; }
.remind-pop-x { display: grid; flex: none; place-items: center; width: 32px; height: 32px; padding: 0; color: inherit; background: none; border: 0; border-radius: 3px; }
@media (pointer: coarse) { .remind-pop .toast-btn, .remind-pop-x { min-width: 44px; min-height: 44px; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
.tip {
  position: fixed; z-index: 80; max-width: 260px; padding: 6px 9px; pointer-events: none;
  font-size: 12.5px; line-height: 1.4; color: var(--paper); background: var(--ink); border-radius: 3px;
  opacity: 0; transition: opacity 0.1s;
}
.tip.on { opacity: 1; }
.tip b { font-weight: 650; }

/* ============================================================
   Sign-in page
   ============================================================ */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art {
  display: flex; flex-direction: column; gap: 22px; padding: 40px 56px 48px;
  color: var(--rail-ink); background: var(--rail);
  --paper: var(--rail);
}
.auth-art .brand { padding: 0; }
.auth-title { margin-top: auto; max-width: 13ch; font-size: clamp(2.4rem, 1.4rem + 3vw, 3.9rem); font-weight: 850; font-stretch: var(--wide); line-height: 1; letter-spacing: -0.03em; }
.auth-lede { max-width: 44ch; color: var(--rail-ink-2); font-size: 16px; }
.auth-ribbon { position: relative; margin-top: 14px; padding-top: 22px; }
.ar-hours { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; font-size: 12px; color: var(--rail-ink-2); font-stretch: var(--narrow); }
.ar-lane { position: relative; height: 40px; border-top: 1px solid color-mix(in oklab, var(--rail-ink) 14%, transparent); }
.ar-block {
  position: absolute; top: 6px; bottom: 6px; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--rail-ink);
  background: color-mix(in oklab, var(--sub) 32%, var(--rail)); border: 1.5px solid var(--sub); border-radius: 3px; box-shadow: 2px 2px 0 var(--drop);
}
.ar-block.hatched { background: repeating-linear-gradient(135deg, color-mix(in oklab, var(--sub) 34%, var(--rail)) 0 5px, var(--rail) 5px 9px); border-style: dashed; box-shadow: none; }
.ar-pin { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding-right: 8px; font-size: 12px; font-weight: 600; border-right: 2px solid var(--rail-ink); transform: translateX(-100%); }
.ar-now { position: absolute; top: 18px; bottom: 0; width: 8px; margin-left: -4px; background: var(--hl); opacity: 0.85; border-radius: 3px; }
.ar-now span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); padding: 0 5px; font-size: 11px; font-weight: 700; font-stretch: var(--narrow); color: var(--hl-ink); background: var(--hl); border-radius: 3px; }
/* The Home link and theme switch sit in their own row above the form (never on top of it). */
.auth-panel { display: grid; grid-template-rows: auto 1fr; justify-items: center; gap: 24px; padding: 18px 24px 48px; background: var(--ground); }
.auth-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.auth-panel > .auth-form { align-self: center; }
.auth-form { display: grid; gap: 18px; width: min(380px, 100%); }
.auth-form h1 { font-size: 2.3rem; }
.auth-form .lede { margin-top: -8px; }
.auth-tabs { display: flex; }
.auth-tabs button { flex: 1; }
.form-alert { padding: 10px 12px; font-size: 14px; color: var(--pen); background: var(--pen-soft); border: 2px solid var(--pen); border-radius: var(--r); }
.auth-submit { width: 100%; margin-top: 4px; }
/* Forgot password, and the recovery code shown once after sign-up */
.forgot-link { justify-self: start; display: inline-flex; align-items: center; min-height: 32px; margin-top: 2px; font-size: 13.5px; font-weight: 600; }
@media (pointer: coarse) { .forgot-link { min-height: 40px; } }
.auth-back { justify-self: center; }
.recovery-code {
  display: block; padding: 16px 12px; text-align: center;
  font-size: clamp(1.25rem, 5.5vw, 1.6rem); font-weight: 750; font-stretch: var(--semi-wide); letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; user-select: all;
  color: var(--ink); background: var(--hl); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm);
}
.recovery-panel .btn.line { justify-self: start; }
.back-home { margin-left: -8px; }
.back-home .ic { transition: translate 0.2s; }
@media (hover: hover) { .back-home:hover .ic { translate: -3px 0; } }


/* ============================================================
   Motion
   One voice everywhere: things land like a stamp on paper. They drop a few pixels with a little
   overshoot and settle onto their hard shadow. Entrances run only when a page is opened fresh
   (.view.enter), never when it re-renders after an edit, so typing and ticking stay still.
   Keyframes use the `translate` property so they never fight a component's own transform, and
   `backwards` fill so nothing keeps a transform (and a new containing block) after it lands.
   ============================================================ */
:root { --land: cubic-bezier(0.25, 1.35, 0.5, 1); --out: cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise-in { from { opacity: 0; translate: 0 12px; } }
@keyframes drop-in { from { opacity: 0; translate: 0 -10px; } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes pop { 0% { scale: 0.6; } 60% { scale: 1.18; } 100% { scale: 1; } }
@keyframes draw-check { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
@keyframes bump { 40% { scale: 1.35; } }
@keyframes shake { 20%, 60% { translate: -5px 0; } 40%, 80% { translate: 5px 0; } }
@keyframes breathe { 50% { opacity: 0.45; } }
@keyframes sway { 0%, 100% { rotate: -8deg; } 50% { rotate: 8deg; } }
@keyframes spin-in { from { rotate: -120deg; scale: 0.4; opacity: 0; } }
@keyframes tab-in { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(-12px 0 -12px 0); } }
@keyframes slide-in { from { opacity: 0; translate: -14px 0; } }

/* Page sections arrive one after another */
.view.enter > * { animation: rise-in 0.42s var(--out) backwards; }
.view.enter > :nth-child(2) { animation-delay: 50ms; }
.view.enter > :nth-child(3) { animation-delay: 100ms; }
.view.enter > :nth-child(4) { animation-delay: 150ms; }
.view.enter > :nth-child(5) { animation-delay: 200ms; }
.view.enter > :nth-child(n+6) { animation-delay: 240ms; }

/* Rows inside a freshly opened page follow their sheet down */
.view.enter .task-row, .view.enter .plan-row { animation: rise-in 0.36s var(--out) backwards; animation-delay: 160ms; }
.view.enter .task-row:nth-child(2), .view.enter .plan-row:nth-child(2) { animation-delay: 190ms; }
.view.enter .task-row:nth-child(3), .view.enter .plan-row:nth-child(3) { animation-delay: 220ms; }
.view.enter .task-row:nth-child(4), .view.enter .plan-row:nth-child(4) { animation-delay: 250ms; }
.view.enter .task-row:nth-child(5), .view.enter .plan-row:nth-child(5) { animation-delay: 280ms; }
.view.enter .task-row:nth-child(n+6), .view.enter .plan-row:nth-child(n+6) { animation-delay: 310ms; }

/* Day ribbon: blocks drop into their lanes; the "now" highlighter breathes */
.view.enter .rb, .view.enter .rb-pin, .view.enter .wk-block { animation: drop-in 0.45s var(--land) backwards; animation-delay: 220ms; }
.view.enter .rb:nth-child(odd), .view.enter .wk-block:nth-child(odd) { animation-delay: 280ms; }
.view.enter .rb:nth-child(3n), .view.enter .wk-block:nth-child(3n) { animation-delay: 340ms; }
.rb-now::before { animation: breathe 2.8s ease-in-out infinite; }
.view.enter .rb-now { animation: rise-in 0.4s 0.45s var(--out) backwards; }

/* Charts grow from their baseline */
.view.enter .vb i { transform-origin: bottom; animation: grow-y 0.6s var(--out) backwards; animation-delay: 180ms; }
.view.enter .vb:nth-child(2) i { animation-delay: 220ms; }
.view.enter .vb:nth-child(3) i { animation-delay: 260ms; }
.view.enter .vb:nth-child(4) i { animation-delay: 300ms; }
.view.enter .vb:nth-child(5) i { animation-delay: 340ms; }
.view.enter .vb:nth-child(6) i { animation-delay: 380ms; }
.view.enter .vb:nth-child(n+7) i { animation-delay: 420ms; }
.view.enter .hb-track i, .view.enter .clock-bar i { transform-origin: left; animation: grow-x 0.6s 0.2s var(--out) backwards; }
.view.enter .hbars li:nth-child(even) .hb-track i { animation-delay: 0.26s; }

/* Ticking a task off: the circle pops and the tick is drawn in */
.check.pop { animation: pop 0.38s var(--land); }
.check.pop .ic path { stroke-dasharray: 24; animation: draw-check 0.3s 0.05s ease-out backwards; }
.status.pop { animation: pop 0.3s var(--land); }

/* Count badges bump when their number changes */
.rail .badge.bump { animation: bump 0.35s var(--land); }

/* The current page's index tab slides out of the rail */
@media (min-width: 861px) {
  .rail-nav a[aria-current="page"], .rail-foot a[aria-current="page"] { animation: tab-in 0.3s var(--out); }
}
.rail-nav a .ic, .rail-foot a .ic { transition: translate 0.2s var(--out); }
@media (hover: hover) { .rail-nav a:hover:not([aria-current]) .ic, .rail-foot a:hover:not([aria-current]) .ic { translate: 2px 0; } }

/* On phones the menu's links slide in after the rail */
@media (max-width: 860px) {
  .nav-open .rail-group { animation: slide-in 0.3s var(--out) backwards; animation-delay: 80ms; }
  .nav-open .rail-group:nth-child(2) { animation-delay: 120ms; }
  .nav-open .rail-group:nth-child(3) { animation-delay: 160ms; }
}

/* A running timer's stopwatch sways in the top bar */
.timer-chip:not(.paused) .ic { animation: sway 2s ease-in-out infinite; transform-origin: 50% 60%; }

/* The theme icon turns over when you switch */
.ic.spin-in { animation: spin-in 0.45s var(--land); }

/* Fields that fail validation shake once; the sign-in alert does too */
.field.invalid input, .field.invalid select { animation: shake 0.32s ease-in-out; }
.form-alert { animation: shake 0.32s ease-in-out; }

/* Sign-in page: the sample ribbon assembles and the form fields arrive in order */
.auth-art > * { animation: rise-in 0.5s var(--out) backwards; }
.auth-art > :nth-child(2) { animation-delay: 80ms; }
.auth-art > :nth-child(3) { animation-delay: 160ms; }
.auth-art > :nth-child(4) { animation-delay: 220ms; }
.ar-block, .ar-pin { animation: drop-in 0.45s var(--land) backwards; animation-delay: 420ms; }
.ar-block:nth-child(2) { animation-delay: 480ms; }
.ar-block:nth-child(3) { animation-delay: 540ms; }
.ar-block:nth-child(4) { animation-delay: 600ms; }
.ar-lane:nth-child(3) .ar-block:nth-child(1) { animation-delay: 680ms; }
.ar-lane:nth-child(3) .ar-block:nth-child(2) { animation-delay: 740ms; }
.ar-pin { animation-delay: 800ms; }
.ar-now { animation: ar-sweep 1.4s 0.5s var(--out) backwards, breathe 2.8s 2s ease-in-out infinite; }
@keyframes ar-sweep { from { left: 0; opacity: 0; } 10% { opacity: 0.85; } }
.auth-form > * { animation: rise-in 0.45s var(--out) backwards; }
.auth-form > :nth-child(2) { animation-delay: 50ms; }
.auth-form > :nth-child(3) { animation-delay: 100ms; }
.auth-form > :nth-child(n+4) { animation-delay: 150ms; }
.auth-form > .form-alert { animation: shake 0.32s ease-in-out; }

/* ============================================================
   Responsive
   ============================================================ */
/* Large monitors: let the pages use the extra width instead of leaving a blank strip */
@media (min-width: 1600px) {
  .content { max-width: 1440px; }
  .today-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (max-width: 1180px) {
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .today-side { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
  .side-block:nth-child(2) { padding-top: 2px; border-top: 0; }
  .cal-layout, .planner, .focus-layout { grid-template-columns: minmax(0, 1fr); }
  .cal-side { position: static; }
  .day-panel { position: static; max-height: none; }
  .habits-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .rail { transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: none; padding-right: 14px; }
  .nav-open .rail { transform: none; box-shadow: var(--lift-lg); }
  .rail-nav a, .rail-nav a:not([aria-current="page"]), .rail-foot a[aria-current="page"] { border-radius: var(--r); margin-right: 0; }
  .rail-nav a[aria-current="page"]::before, .rail-nav a[aria-current="page"]::after,
  .rail-foot a[aria-current="page"]::before, .rail-foot a[aria-current="page"]::after { display: none; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 0.25s; display: block; }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .topbar { padding: 0 12px; gap: 4px; }
  .menu-btn, .crumb { display: inline-grid; }
  .crumb { display: block; margin-right: auto; padding-left: 4px; }
  .search-btn { width: 38px; padding: 0; justify-content: center; border-color: transparent; background: none; box-shadow: none; }
  .search-text, .search-btn kbd, .topbar [data-action="shortcuts"] { display: none; }
  .sync { margin-left: 0; }
  .content { padding: 4px 16px 88px; }
  .grid-2, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: repeat(3, 82%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .board-col { scroll-snap-align: start; }
  .day-cell { min-height: 68px; padding: 30px 4px 6px; }
  .day-items { display: none; }
  .day-dots { display: flex; gap: 3px; position: relative; pointer-events: none; padding-left: 4px; }
  .day-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--sub); }
  .contact { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { padding: 28px 20px 30px; gap: 16px; }
  .auth-title { margin-top: 18px; }
  .auth-ribbon { display: none; }
  .auth-panel { padding: 14px 16px 56px; gap: 18px; }
  .auth-panel > .auth-form { align-self: start; }
  .plan-day { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .plan-day h3 { grid-auto-flow: column; justify-content: start; gap: 10px; align-items: baseline; padding-top: 4px; }
  .log li { grid-template-columns: minmax(0, 1fr) auto auto; }
  .log time { grid-column: 1 / -1; padding-top: 8px; margin-bottom: -10px; }
  .subject-list li { grid-template-columns: 16px minmax(0, 1fr) 110px 28px; }
  .subject-list li .small { display: none; }
}

@media (max-width: 560px) {
  /* Tasks: subject, type and sort fold behind a Filters button so the list starts higher up. */
  .toolbar .search { display: flex; gap: 8px; }
  .toolbar .search input { flex: 1; min-width: 0; }
  .filter-toggle { display: inline-flex; flex: none; height: auto; }
  .filter-toggle .count { min-width: 18px; padding: 0 5px; color: var(--hl-ink); background: var(--hl); border-radius: 9px; text-align: center; }
  .toolbar:not(.filters-open) > .field:not(.search) { display: none; }
  .filter-toggle[aria-expanded="true"] { translate: 2px 2px; box-shadow: none; background: var(--paper-2); }
  /* Grades: each result becomes a two-line row instead of a table that scrolls sideways. */
  .grades-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .grades-table tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; column-gap: 10px; align-items: center;
    grid-template-areas: "title title pct act" "sub date score act";
    padding: 10px 0; border-bottom: 1px solid var(--rule);
  }
  .grades-table tbody tr:last-child { border-bottom: 0; }
  .grades-table td { padding: 0; border: 0; }
  .grades-table td:nth-child(1) { grid-area: title; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grades-table td:nth-child(2) { grid-area: sub; font-size: 13px; }
  .grades-table td:nth-child(3) { grid-area: date; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
  .grades-table td:nth-child(4) { grid-area: score; font-size: 12.5px; color: var(--ink-3); }
  .grades-table td:nth-child(5) { grid-area: pct; font-size: 18px; }
  .grades-table td:nth-child(6) { grid-area: act; width: auto; }
  .today-side { grid-template-columns: minmax(0, 1fr); }
  .side-block:nth-child(2) { padding-top: 16px; border-top: 2px solid var(--edge-panel); }
  .page-head { align-items: stretch; }
  /* Only a page's header row spans the width; a card's header keeps its title and buttons side by side. */
  .page-head .head-actions { width: 100%; }
  .page-head .head-actions .btn.primary { margin-left: auto; }
  .head-search { width: 100%; }
  /* A phone shows one card at a time: give it the room the desktop spends on columns. */
  .sheet { padding: 20px 18px; }
  .today-main, .cal-side, .settings, .focus-layout { gap: 24px; }
  .page-head { margin: 8px 0 28px; gap: 18px; }
  .page-head .lede { margin-top: 10px; line-height: 1.55; }
  .sheet-head { margin-bottom: 12px; }
  .quick, .ribbon-sheet, .day-free { margin-bottom: 24px; }
  .day-free { padding: 16px 18px; }
  .task-row { min-height: 64px; padding-top: 10px; padding-bottom: 10px; }
  .ahead-day { padding: 16px 0; }
  .list-head { margin-top: 14px; }
  .set-head .hint, .sheet .hint { line-height: 1.55; }
  .side-block { padding: 20px 0 22px; }
  .task-row .status { display: none; }
  .hbars li, .gchart { --label: 96px; }
  .gchart { --trend: 0px; }
  .gchart .spark, .g-trend-h { display: none; }
  .hbars li { grid-template-columns: 96px minmax(0, 1fr) 48px; }
  .facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dialog { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
  .dialog-foot .hint { display: none; }
  .tally { grid-template-columns: 1fr 1fr; }
  .keys > div { grid-template-columns: 1fr; gap: 4px; }
  .data-actions { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .data-actions > div:not(:first-child) { margin-top: 12px; }
}

/* Small phones: the subject name keeps the room; the swatch beside it already shows the colour */
@media (max-width: 600px) {
  .habits-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .subject-list li { grid-template-columns: 16px minmax(0, 1fr) 56px 36px; gap: 8px; }
  .color-pick .cp-name { display: none; }
  .color-pick summary { justify-content: center; padding: 0 8px; }
  .effort-list li { grid-template-columns: minmax(0, 1fr) 112px; }
}

/* Touch screens: fingers need bigger targets, iOS zooms into any field under 16px,
   and keyboard shortcuts mean nothing without a keyboard */
@media (pointer: coarse) {
  :root input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), :root select, :root textarea { font-size: 16px; }
  .btn.sm { height: 38px; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn.sm { width: 36px; height: 36px; }
  .seg label span, .seg-buttons button { height: 38px; }
  .check { width: 26px; height: 26px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .kbd-only, .search-btn kbd, .pal-item kbd, .topbar [data-action="shortcuts"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

@media (forced-colors: active) {
  .task-row::before, .rb, .wk-block, .day-chip { border: 1px solid CanvasText; }
  .hl, .rb-now { forced-color-adjust: none; }
}

/* "What do I need?" result: a paper slip; the highlighter marks a reachable target, red pen an impossible one. */
.target-result { display: grid; gap: 4px; padding: 14px 16px; background: var(--paper-2); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.target-result > b { font-size: 30px; font-weight: 800; font-stretch: var(--wide, 112%); line-height: 1.1; justify-self: start; padding: 0 6px; color: var(--hl-ink); background: var(--hl); border-radius: var(--r-sm); }
.target-result > span { font-size: 14px; color: var(--ink-2); }
.target-result.out > b, .target-result.safe > b { font-size: 16px; padding: 0; color: var(--ink); background: none; }
.target-result.out > b { color: var(--pen); }

/* "Open on your phone" */
.phone-dialog { width: min(440px, calc(100vw - 32px)); }
.phone-qr { justify-self: center; padding: 12px; background: #fff; border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.phone-qr img, .phone-qr canvas { display: block; width: 184px; height: 184px; }
.phone-dialog .dialog-body { grid-template-columns: minmax(0, 1fr); }
.phone-cmd { margin: 8px 0; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; font-size: 12.5px; line-height: 1.5; color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--r-sm); }
/* Already on a phone: the top-bar shortcut has nothing to offer, Settings still has it. */
@media (pointer: coarse), (max-width: 560px) { .phone-btn { display: none; } }

/* Evening review */
.review { gap: 18px; }
.review-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.review-stats div { display: grid; gap: 2px; padding: 10px 12px; background: var(--paper-2); border: 2px solid var(--edge); border-radius: var(--r); }
.review-stats b { font-size: 24px; font-weight: 800; font-stretch: var(--wide); line-height: 1.1; }
.review-stats span { font-size: 12.5px; color: var(--ink-2); }
.review-done { display: flex; flex-wrap: wrap; gap: 6px; }
.review-done span { padding: 2px 8px; font-size: 13px; text-decoration: line-through; text-decoration-color: var(--ink-3); background: var(--sub-soft); border: 1.5px solid var(--sub-edge); border-radius: var(--r-sm); }
.review-row { display: flex; align-items: center; gap: 12px; padding: 10px 0 10px 14px; border-top: 1px solid var(--rule); position: relative; }
.review-row::before { content: ''; position: absolute; left: 0; top: 18px; width: 8px; height: 8px; background: var(--sub); border-radius: 2px; }
.review-row .task-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.review-seg { flex: none; }
.review-seg button { padding: 0 10px; font-size: 13px; }
.review-warn { display: flex; align-items: center; gap: 6px; color: var(--pen); font-size: 14px; font-weight: 600; }
.today-grid .sheet-head .head-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
@media (max-width: 560px) {
  .review-row { flex-wrap: wrap; }
  .review-seg { width: 100%; }
  .review-seg button { flex: 1; }
  .review-stats b { font-size: 20px; }
}

/* Backups and account deletion */
.btn-pair { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.backup-list { display: grid; margin: 0; padding: 0; list-style: none; }
.backup-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rule); }
.backup-list li:first-child { border-top: 0; }
.backup-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.backup-main b { font-weight: 600; }
.backup-main small { font-size: 12.5px; color: var(--ink-2); }
.link-btn { padding: 0; font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.btn.danger-fill { color: #fff; background: var(--pen); border-color: var(--pen); }
@media (max-width: 560px) { .data-actions .btn-pair { justify-content: flex-start; } }

/* Offline fallback page */
.offline-page { display: grid; justify-items: start; gap: 16px; max-width: 480px; margin: 0 auto; padding: max(15vh, 48px) 24px 48px; }
.offline-page h1 { font-size: clamp(2rem, 7vw, 3rem); font-weight: 800; font-stretch: var(--wide); letter-spacing: -0.02em; }

/* Reminders dialog: one section per channel */
.rem-channel { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--rule); }
.rem-channel h3 { font-size: 15px; font-weight: 700; }
/* WhatsApp, offered first while it isn't set up: a marked card above the settings. */
.rem-wa-first { padding: 14px; border: 2px solid var(--edge); border-radius: var(--r); background: var(--paper); box-shadow: var(--shadow-sm); }
.rem-wa-first h3 { display: flex; align-items: center; gap: 8px; }
.rem-wa-first h3 .ic { width: 18px; height: 18px; padding: 3px; box-sizing: content-box; color: var(--hl-ink); background: var(--hl); border-radius: 50%; }
.rem-wa-first .btn { justify-self: start; }
.rem-row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 860px) { .rem-row-actions { justify-content: flex-start; } }
.rem-channel > .btn { justify-self: start; }

/* Admin page */
.admin-state { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--rule); }
.admin-state:first-of-type { border-top: 0; }
.admin-state > .ic { flex: none; box-sizing: content-box; padding: 4px; border-radius: var(--r-sm); }
.admin-state.ok > .ic { color: var(--hl-ink); background: var(--hl); }
.admin-state.bad > .ic { color: #fff; background: var(--pen); }
.admin-state b { font-weight: 650; }
.admin-state > div { min-width: 0; }
.admin-state .hint { overflow-wrap: anywhere; } /* long folder paths */
.admin-storage { padding-top: 10px; border-top: 1px solid var(--rule); }
.admin-numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.admin-numbers div { display: grid; gap: 2px; padding: 12px; background: var(--paper-2); border: 2px solid var(--edge); border-radius: var(--r); }
.admin-numbers b { font-size: 26px; font-weight: 800; font-stretch: var(--wide); line-height: 1.1; }
.admin-numbers span { font-size: 12.5px; color: var(--ink-2); }
.admin-msg { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--rule); }
.admin-msg:first-child { border-top: 0; }
.admin-msg header { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.admin-msg.unread header b::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; background: var(--hl); border-radius: 2px; }
.admin-msg p { white-space: normal; overflow-wrap: anywhere; }
.admin-badge { padding: 0 6px; font-size: 11.5px; font-weight: 700; color: var(--hl-ink); background: var(--hl); border-radius: 3px; }
.temp-pass code { display: inline-block; padding: 8px 14px; font-size: 22px; letter-spacing: 0.08em; background: var(--paper-2); border: 2px solid var(--edge); border-radius: var(--r); user-select: all; }

/* Several files and links per task */
.att-list { display: grid; gap: 4px; }
.att-list a { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.att-list a > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#linkList, .file-list { display: grid; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
#linkList li { display: flex; gap: 6px; align-items: center; }
#linkList input { flex: 1; min-width: 0; }
.file-list li { display: flex; gap: 8px; align-items: center; min-height: 36px; padding: 4px 4px 4px 10px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r-sm); }
.file-list .file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-list .muted { flex: none; font-size: 12.5px; }
.file-add { cursor: pointer; }
.file-add:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
legend .muted { font-weight: 400; font-size: 12.5px; }

/* Flashcards */
.card-list small { overflow-wrap: anywhere; }

/* Flashcards page: every card in one list, its subject as a coloured tag */
.cards-search { max-width: 420px; margin-bottom: 14px; }
.card-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 6px 8px 18px; border-top: 1px solid var(--rule); }
.card-row:first-child { border-top: 0; }
.card-row::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 5px; background: var(--sub); border-radius: 0 3px 3px 0; }
.card-main { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 4px 0; text-align: left; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.card-main b { font-size: 15px; overflow-wrap: anywhere; }
.card-main small { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .card-main:hover b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; } }
.card-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 40%; }
.subj-tag, .test-tag { display: inline-block; max-width: 100%; padding: 2px 8px; font-size: 12px; font-weight: 650; color: var(--ink); border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-tag { background: color-mix(in srgb, var(--sub, var(--c-slate)) 20%, transparent); }
.test-tag { color: var(--hl-ink); background: var(--hl); }
/* Flashcard boxes: learning (outline), getting there (half fill), known (filled). */
.box-tag { display: inline-block; padding: 1px 8px; font-size: 12px; font-weight: 650; white-space: nowrap; color: var(--ink-2); border: 1.5px solid var(--rule-strong); border-radius: 999px; }
.box-tag.box-2 { color: var(--ink); background: var(--paper-2); }
.box-tag.box-3 { color: var(--on-primary); background: var(--ok); border-color: var(--ok); }

/* Practising: a progress line, the card (tap it to turn it over), and Previous / Next */
.study { padding-block: 6px 22px; }
.practice-bar { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.practice-bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.flashcard {
  display: grid; gap: 14px; align-content: center; justify-items: center; width: 100%; min-height: 240px; padding: 22px; font: inherit; color: var(--ink); text-align: center; cursor: pointer;
  background: var(--paper-2); border: 2px solid var(--edge); border-top: 10px solid var(--sub, var(--edge)); border-radius: var(--r-lg); box-shadow: 5px 5px 0 var(--sub, var(--drop));
}
.flashcard .subj-tag { font-size: 11.5px; }
.fc-front { font-size: clamp(1.25rem, 4.5vw, 1.7rem); font-weight: 750; overflow-wrap: anywhere; }
.fc-back { justify-self: stretch; padding-top: 14px; font-size: 1.1rem; color: var(--ink-2); border-top: 2px dashed var(--rule-strong); overflow-wrap: anywhere; }
.fc-tap { font-size: 13px; color: var(--ink-3); }
.practice-foot { gap: 8px; }
.practice-foot .btn:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 560px) {
  .card-row { flex-wrap: wrap; }
  .card-main { flex-basis: calc(100% - 90px); }
  .card-tags { order: 3; flex-basis: 100%; max-width: none; justify-content: flex-start; margin-top: -4px; }
  .flashcard { min-height: 210px; }
}

/* First-run setup guide */
.onboard { gap: 16px; }
.ob-progress { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.ob-progress i { height: 5px; background: var(--rule); border-radius: 3px; }
.ob-progress i.on { background: var(--primary); }
.ob-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ob-chip { min-height: 36px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); background: var(--paper); border: 2px solid var(--rule-strong); border-radius: 999px; cursor: pointer; }
.ob-chip[aria-pressed="true"] { color: var(--ink); background: var(--sub-soft); border-color: var(--sub-edge); box-shadow: 2px 2px 0 var(--sub-edge); }
.ob-days { width: 100%; }
.ob-days button { flex: 1; }
.ob-days .count { margin-left: 4px; }
.ob-rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ob-rows li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.ob-rows li.hint { display: block; }
.ob-added { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ob-added li { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.inline-form .grow { flex: 1; }
/* The reminders step: two big choices, WhatsApp first with the highlighter marking it. */
.ob-remind { display: grid; gap: 10px; }
.ob-remind-opt {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; width: 100%; min-height: 44px;
  padding: 14px; font: inherit; text-align: left; color: var(--ink); background: var(--paper);
  border: 2px solid var(--rule-strong); border-radius: var(--r); cursor: pointer; touch-action: manipulation;
  transition: transform 0.16s var(--out, ease-out), box-shadow 0.16s var(--out, ease-out);
}
.ob-remind-opt b { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 700; }
.ob-remind-opt small { display: block; margin-top: 3px; font-size: 13.5px; color: var(--ink-2); }
.ob-remind-ic { display: grid; place-items: center; width: 40px; height: 40px; color: var(--ink-2); background: var(--paper-2); border-radius: 50%; }
.ob-remind-opt.is-featured { border-color: var(--edge); box-shadow: var(--shadow-sm); }
.ob-remind-opt.is-featured .ob-remind-ic { color: var(--hl-ink); background: var(--hl); }
.ob-remind-tag { padding: 1px 8px; font-size: 11.5px; font-weight: 700; color: var(--hl-ink); background: var(--hl); border-radius: 999px; }
@media (hover: hover) and (pointer: fine) { .ob-remind-opt:hover { border-color: var(--edge); } }
.ob-remind-opt:active { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) { .ob-remind-opt { transition: none; } .ob-remind-opt:active { transform: none; } }
@media (max-width: 560px) {
  .ob-rows li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .ob-rows li select { grid-column: 1 / -1; }
}

/* Language switches */
.lang-seg { width: 100%; max-width: 420px; }
.lang-seg button { flex: 1; }
.auth-bar-end { display: flex; align-items: center; gap: 4px; }
.lang-switch { white-space: nowrap; }
@media (max-width: 560px) { .lp-top .lang-switch { padding-inline: 8px; font-size: 13px; } }
.lang-switch .ls-short { display: none; }
@media (max-width: 560px) { .lp-top .lang-switch .ls-long { display: none; } .lp-top .lang-switch .ls-short { display: inline; } }

/* ============================================================
   Card maker: one card on the table that turns over, a dropdown for the subject, and a pile
   ============================================================ */
.maker { gap: 16px; }
.maker-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.mk-write { display: grid; gap: 12px; }

/* The card: both sides share one spot; turning it over rotates the pair, and the side facing away is hidden */
.flip { display: grid; perspective: 1200px; }
.flip-face {
  grid-area: 1 / 1; display: grid; grid-template-rows: auto 1fr auto; min-height: 210px; padding: 14px 18px 12px;
  background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r-lg); box-shadow: 5px 5px 0 var(--sub, var(--drop));
  backface-visibility: hidden; cursor: text;
  transition: transform 0.45s cubic-bezier(0.3, 1.25, 0.5, 1), visibility 0s 0.2s;
}
.flip-front { border-top: 10px solid var(--sub, var(--edge)); }
.flip-back { transform: rotateY(-180deg); visibility: hidden; border-style: dashed; }
.flip.turned .flip-front { transform: rotateY(180deg); visibility: hidden; }
.flip.turned .flip-back { transform: rotateY(0deg); visibility: visible; transition-delay: 0s, 0s; }
.flip:not(.turned) .flip-front { transition-delay: 0s, 0s; }
.cb-tag { justify-self: start; padding: 1px 8px; margin-bottom: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); background: color-mix(in srgb, var(--sub, var(--hl)) 22%, transparent); border-radius: var(--r-sm); }
.flip-face textarea {
  width: 100%; min-height: 96px; padding: 0; resize: none; font: inherit; font-size: 1.3rem; font-weight: 700; line-height: 1.35; text-align: center;
  color: var(--ink); background: transparent; border: 0; outline: 0; box-shadow: none; overflow-wrap: anywhere; align-self: center;
}
.flip-back textarea { font-size: 1.1rem; font-weight: 500; }
.flip-face textarea::placeholder { color: var(--ink-3); opacity: 0.6; font-weight: 500; }
.flip-hint { justify-self: center; font-size: 12.5px; color: var(--ink-3); }
.mk-buttons { display: flex; align-items: center; gap: 8px; }
.mk-buttons .btn .ic { width: 17px; height: 17px; }

/* The pile: one line with a little stack of cards and a count; opens into the list */
.pile-empty { margin: 0; font-size: 13.5px; color: var(--ink-3); text-align: center; }
.pile {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 12px; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--paper-2); border: 2px solid var(--rule-strong); border-radius: var(--r-lg);
}
@media (hover: hover) and (pointer: fine) { .pile:hover { border-color: var(--edge); } }
.pile-cards { position: relative; flex: none; width: 42px; height: 32px; }
.pile-cards::before, .pile-cards::after, .pile-cards .count {
  position: absolute; inset: 0; border: 2px solid var(--edge); border-radius: 5px; background: var(--paper);
}
.pile-cards::before, .pile-cards::after { content: ''; display: none; }
.pile.many .pile-cards::before { display: block; transform: rotate(-9deg) translate(-3px, 1px); }
.pile.many .pile-cards::after { display: block; transform: rotate(6deg) translate(3px, 0); }
.pile-cards .count { display: grid; place-items: center; z-index: 1; font-size: 13px; font-weight: 800; font-stretch: var(--narrow); border-left: 5px solid var(--sub, var(--edge)); }
.pile.bump .pile-cards .count { animation: pile-bump 0.45s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes pile-bump { from { transform: translateY(-14px) rotate(-8deg); } }
.pile-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pile-text b { font-size: 14.5px; }
.pile-text small { font-size: 12.5px; color: var(--ink-3); }
.pile-chev { flex: none; transition: transform 0.2s; }
.pile[aria-expanded="true"] .pile-chev { transform: rotate(180deg); }
.pile-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow-y: auto; }
.mini-card { display: flex; align-items: center; min-width: 0; background: var(--paper); border: 2px solid var(--rule-strong); border-radius: var(--r); }
.mini-card.editing { border-color: var(--edge); outline: 3px solid var(--hl); outline-offset: 1px; }
.mc-main { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 8px 6px 8px 12px; text-align: left; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.mc-main b, .mc-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-main b { font-size: 14px; }
.mc-main small { font-size: 12.5px; color: var(--ink-2); }
.mini-card .icon-btn { flex: none; margin-right: 6px; }

/* Studying: the answer turns over like a real card */
.flashcard.shown { animation: card-turn 0.36s cubic-bezier(0.3, 1.3, 0.5, 1); }
@keyframes card-turn { from { transform: perspective(900px) rotateX(-70deg); opacity: 0.4; } }

@media (max-width: 560px) {
  .flip-face { min-height: 180px; }
  .flip-face textarea { font-size: 1.15rem; min-height: 80px; }
}
@media (pointer: coarse) {
  .mini-card .icon-btn { width: 36px; height: 36px; }
}

/* Settings → Google and Apple Calendar: the direct sync */
.cal-intro { margin-top: 8px; }
.cal-state { display: inline-flex; align-items: flex-start; gap: 6px; margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.cal-state .ic { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.cal-state.ok .ic { color: var(--ok); }
.cal-state.warn, .cal-state.bad { color: var(--pen); }
.data-actions .hint code, .cal-linked code { font-size: 12px; overflow-wrap: anywhere; }
.howto { display: grid; gap: 8px; margin: 0 0 4px; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.howto a { display: inline-block; padding: 5px 0; color: inherit; font-weight: 600; }
.push-result { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
#pushResult .notice { margin-top: 12px; }
#pushResult .howto { margin-top: 8px; }
.push-help { margin-top: 12px; }
.push-help .howto { margin-bottom: 12px; }

/* Settings → Calendars: one row per place Planora can write to, plus the subscription link */
.cal-list { list-style: none; margin: 12px 0 0; padding: 0; }
.cal-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; padding: 14px 0; border-top: 1px solid var(--rule); }
.cal-main { min-width: 0; }
.cal-main b { font-size: 15px; }
.cal-main small { margin-left: 8px; font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.cal-main .hint { margin-top: 2px; }
.cal-main .cal-state { display: flex; }
.cal-item.is-on .cal-main b::before { content: ''; display: inline-block; width: 8px; height: 8px; margin: 0 8px 2px 0; border-radius: 50%; background: var(--ok); }
.cal-more { grid-column: 1 / -1; display: grid; gap: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
@media (max-width: 560px) {
  .cal-item { grid-template-columns: 1fr; }
  .cal-item > .btn { justify-self: start; }
}

/* Settings: one box per feature, a title with one line under it, and "How it works" folded away */
@media (max-width: 560px) {
  .clock-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
  .clock-actions .btn { width: 100%; min-width: 0; padding-inline: 8px; white-space: nowrap; }
  .clock-actions .btn.lg, .clock-actions .btn.primary { min-width: 0; padding-inline: 8px; }
}
.settings-jump { display: flex; flex-wrap: wrap; gap: 6px; max-width: 900px; margin: -6px 0 18px; }
.jump-title { display: none; }
/* On a wide screen the section list moves into its own column on the right and stays in view, so the boxes
   and the list together run the full width instead of stopping 280px short of the edge. */
@media (min-width: 1280px) {
  .settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 208px; gap: 28px; align-items: start; }
  .settings-layout .settings { max-width: none; grid-column: 1; grid-row: 1; }
  .settings-jump {
    grid-column: 2; grid-row: 1; position: sticky; top: 84px;
    display: grid; gap: 2px; max-width: none; margin: 0;
  }
  .jump-title { display: block; padding: 0 10px 6px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
  .settings-jump .btn {
    justify-content: flex-start; min-height: 34px; padding: 0 10px; font-weight: 500; color: var(--ink-2);
    background: none; border-color: transparent; box-shadow: none; border-radius: var(--r-sm);
  }
  .settings-jump .btn:hover { color: var(--ink); background: var(--paper-2); transform: none; }
}
.set-head { margin-bottom: 6px; }
.set-head h2 { font-size: 1.15rem; }
.set-head .hint { margin-top: 4px; max-width: 62ch; }
.how-to { margin: 6px 0 4px; }
.how-to summary { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; list-style: none; font-size: 13.5px; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.how-to summary::-webkit-details-marker { display: none; }
.how-to summary .ic { width: 16px; height: 16px; }
.how-to summary .chev { margin-left: 2px; }
.how-to ol { display: grid; gap: 6px; margin: 4px 0 8px; padding: 10px 14px 10px 32px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); background: var(--paper-2); border-radius: var(--r-sm); }
.settings-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-pair .sheet { margin: 0; }
.settings-stack { display: grid; gap: 14px; margin: 12px 0 4px; }
.settings .sheet { scroll-margin-top: 80px; }
@media (max-width: 760px) { .settings-pair { grid-template-columns: 1fr; } }

/* Calendar page: the sync button next to Month/Week */
.cal-chip .ic { width: 16px; height: 16px; }
.cal-chip.is-on .ic { color: var(--ok); }
.cal-chip.is-bad { color: var(--pen); }
@media (max-width: 560px) { .cal-chip { order: 3; } }

/* Guided tour (js/tour.js). Above the app and its menu, below toasts. The shade is clipped to leave a hole over
   the real element; only that hole takes clicks. Moving between targets is on-screen movement: strong ease-in-out. */
.tour { position: fixed; inset: 0; z-index: 55; pointer-events: none; }
.tour-shade {
  position: absolute; inset: 0; pointer-events: auto; background: rgba(14, 12, 40, 0.55);
  transition: clip-path 0.34s cubic-bezier(0.77, 0, 0.175, 1);
  animation: tour-fade 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}
/* The ring doesn't travel (that would animate its size): it appears at the new spot as the spotlight arrives. */
/* One even 2px line traced exactly on the edge of the cut-out (same box, same corners). No glow: over the dark
   shade it read as a muddy grey band. */
/* Menu items run flush to the menu's right edge (the tab look). While the tour points at one, it steps in from
   that edge and rounds all its corners, so its fill sits wholly inside the ring with even space all round. */
.rail-nav a.tour-target, .rail-foot a.tour-target { margin-right: 14px; border-radius: var(--r); }
.rail-nav a.tour-target::before, .rail-nav a.tour-target::after, .rail-foot a.tour-target::before, .rail-foot a.tour-target::after { display: none; }
.tour-ring { position: fixed; box-sizing: border-box; border: 2px solid var(--hl); pointer-events: none; }
@keyframes tour-fade { from { opacity: 0; } }
.tour-card {
  position: fixed; left: 0; top: 0; width: min(372px, calc(100vw - 32px)); padding: 16px 18px 14px; pointer-events: auto;
  background: var(--paper); border: 2px solid var(--edge); border-radius: var(--r-lg); box-shadow: var(--lift-lg);
  transition: transform 0.34s cubic-bezier(0.77, 0, 0.175, 1);
  animation: tour-card-in 0.28s cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes tour-card-in { from { opacity: 0; scale: 0.97; } }
.tour-card.docked { left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; transform: none; transition: none; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.tour-progress { display: flex; gap: 4px; margin-bottom: 12px; }
.tour-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--rule); transition: background-color 0.25s; }
.tour-progress i.is-done { background: var(--ink-3); }
.tour-progress i.is-now { background: var(--hl); }
.tour-count { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.tour-card h2 { margin: 4px 0 6px; font-size: 1.15rem; outline: none; }
.tour-card p { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.tour-try { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 10px; font-weight: 650; color: var(--ink) !important; background: color-mix(in srgb, var(--hl) 35%, transparent); border-radius: var(--r-sm); }
.tour-try .ic { width: 15px; height: 15px; flex: none; }
.tour-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 14px; }
/* Longer labels (Indonesian) wrap the buttons onto a second line instead of pushing past the card. */
.tour-actions .btn { white-space: nowrap; }
.tour-actions [data-tour="skip"] { margin-right: auto; }
.tour.leaving { opacity: 0; transition: opacity 0.2s cubic-bezier(0.23, 1, 0.32, 1); }
.tour-bit { position: fixed; z-index: 58; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .tour-shade, .tour-card { transition: none; }
  .tour-card { animation: tour-fade 0.2s ease; }
}

/* ============================================================
   Phones: tab bar, floating +, bottom sheets, swipe rows, one-day timetable (js/mobile.js)
   ============================================================ */
.tabbar, .fab { display: none; }
@media (max-width: 860px) {
  /* The main screens one tap away. Below the menu's scrim, so opening More dims it like the page. */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 24;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--paper); border-top: 2px solid var(--edge-panel);
  }
  .tabbar a, .tabbar button {
    position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 52px; padding: 0;
    font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-decoration: none; background: none; border: 0; cursor: pointer;
  }
  /* The current screen: its icon sits on a highlighter stroke, the label goes to full ink. */
  .tabbar .ic { width: 22px; height: 22px; padding: 3px 14px; box-sizing: content-box; border-radius: 14px; transition: background-color 0.15s, color 0.15s; }
  .tabbar [aria-current="page"] { color: var(--ink); }
  .tabbar [aria-current="page"] .ic { color: var(--hl-ink); background: var(--hl); }
  .tabbar a:active .ic, .tabbar button:active .ic { background: var(--paper-2); }
  .tab-badge {
    position: absolute; top: 2px; left: calc(50% + 10px); min-width: 18px; height: 18px; padding: 0 5px;
    font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; color: var(--on-primary); background: var(--ink-3); border-radius: 9px;
  }
  .tab-badge.late { background: var(--pen); }
  /* More opens the menu: it lists only what the tab bar doesn't already have. */
  .rail-nav a:is([data-route="today"], [data-route="tasks"], [data-route="calendar"], [data-route="focus"]) { display: none; }
  .menu-btn { display: none; }
  .crumb { padding-left: 8px; }
  .content { padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .tour-card.docked { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

  /* New task, on the screens where adding is the next thing to do. */
  body[data-page="tasks"] .fab, body[data-page="calendar"] .fab {
    position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 24;
    display: grid; place-items: center; width: 56px; height: 56px;
    color: var(--on-primary); background: var(--primary); border: 2px solid var(--edge); border-radius: 16px; box-shadow: var(--lift);
    transition: transform 0.12s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.12s;
  }
  .fab .ic { width: 24px; height: 24px; }
  .fab:active { transform: translate(3px, 3px); box-shadow: none; }
  /* Toasts move up out of its way on those screens. */
  body[data-page="tasks"] .toasts, body[data-page="calendar"] .toasts { bottom: calc(152px + env(safe-area-inset-bottom, 0px)); }
}

/* Bottom sheets: every dialog except the search palette rises from the bottom edge on a phone. The handle
   and the header can be dragged down to close it (js/mobile.js). */
@media (max-width: 560px) {
  .dialog:not(.palette-dialog) {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: calc(100dvh - 28px);
    border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: none;
  }
  .dialog:not(.palette-dialog)[open] { animation: sheet-up 0.34s cubic-bezier(0.32, 0.72, 0, 1); }
  .dialog:not(.palette-dialog)::before { content: ""; flex: none; align-self: center; width: 40px; height: 5px; margin-top: 8px; border-radius: 3px; background: var(--rule-strong); }
  .dialog:not(.palette-dialog) .dialog-head { padding-top: 12px; touch-action: none; }
  .dialog:not(.palette-dialog) .dialog-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .dialog:not(.palette-dialog) > .dialog-body:last-child { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

/* Swipe a task row: the row's contents slide, and what the swipe will do shows underneath. */
.task-row { touch-action: pan-y; }
.task-row.swiping { overflow: hidden; background: var(--paper-2); }
.task-row.swiping::after {
  content: attr(data-swipe-label); position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 18px;
  font-size: 14px; font-weight: 700; color: var(--ink-2);
}
.task-row[data-swipe="done"]::after, .task-row[data-swipe="reopen"]::after { left: 0; }
.task-row[data-swipe="later"]::after { right: 0; }
.task-row.armed[data-swipe="done"], .task-row.armed[data-swipe="reopen"] { background: color-mix(in srgb, var(--ok) 24%, var(--paper)); }
.task-row.armed[data-swipe="later"] { background: color-mix(in srgb, var(--hl) 50%, var(--paper)); }
.task-row.armed::after { color: var(--ink); }

/* Timetable on a phone: a strip of days, and only the chosen day's column. */
.tt-days { display: none; }
@media (max-width: 560px) {
  .tt-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 14px; }
  .tt-days button {
    display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 54px; padding: 0;
    font-size: 13px; font-weight: 600; color: var(--ink-2); background: none; border: 2px solid transparent; border-radius: var(--r);
  }
  .tt-days small { min-height: 14px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
  .tt-days [aria-pressed="true"] { color: var(--ink); background: var(--paper); border-color: var(--edge); box-shadow: var(--shadow-sm); }
  .tt-days .is-today span { box-shadow: inset 0 -3px 0 var(--hl); }
  .week { min-width: 0; }
  .week-head, .week-body { grid-template-columns: 52px minmax(0, 1fr); }
  .timetable .wk-day:not(.is-sel), .timetable .wk-col:not(.is-sel) { display: none; }
  .week-sheet { overflow-x: visible; }
}

/* Settings on a phone: the section buttons stay under the top bar while the boxes scroll. */
@media (max-width: 560px) {
  .settings-jump {
    position: sticky; top: 60px; z-index: 15; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: -6px -16px 18px; padding: 8px 16px; background: var(--ground);
  }
  .settings-jump .btn { flex: none; }
  .settings .sheet { scroll-margin-top: 130px; }
  .day-panel { scroll-margin-top: 72px; }
}

/* Loading: shown only until the first render replaces it. */
.skeleton { display: grid; gap: 16px; padding-top: 28px; }
.skeleton i { display: block; background: var(--paper-2); border-radius: var(--r); animation: sk-pulse 1.4s ease-in-out infinite; }
.skeleton .sk-title { width: 55%; height: 36px; }
.skeleton .sk-line { width: 80%; height: 16px; }
.skeleton .sk-card { height: 120px; }
.skeleton .sk-card.tall { height: 240px; }
@keyframes sk-pulse { 50% { opacity: 0.55; } }

/* ============================================================
   Notification inbox (js/mobile.js)
   ============================================================ */
.inbox-btn { position: relative; }
.inbox-dot {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; color: #fff; background: var(--pen); border-radius: 9px;
}
.inbox { padding-top: 0; }
.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 60px; padding: 10px 2px;
  color: var(--ink); text-decoration: none; border-top: 1px solid var(--rule);
}
.inbox-list li:first-child .inbox-item { border-top-color: transparent; }
.inbox-item b { display: block; font-weight: 650; }
.inbox-item small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.inbox-ic { display: grid; place-items: center; width: 36px; height: 36px; color: var(--ink-2); background: var(--paper-2); border-radius: 50%; }
.inbox-item.tone-bad .inbox-ic { color: var(--pen); background: var(--pen-soft); }
.inbox-item .chev { color: var(--ink-3); }
/* The help menu's rows that run something rather than go somewhere. */
button.inbox-item { width: 100%; font: inherit; text-align: left; background: none; border: 0; border-top: 1px solid var(--rule); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .help-list .inbox-item:hover .inbox-ic { color: var(--hl-ink); background: var(--hl); } }
.inbox-item:active { background: var(--paper-2); }
@media (hover: hover) and (pointer: fine) { .inbox-item:hover b { text-decoration: underline; text-underline-offset: 3px; } }
.inbox-empty { display: flex; align-items: center; gap: 10px; padding: 18px 2px 8px; color: var(--ink-2); }
.inbox-empty .ic { color: var(--ok); }

/* ============================================================
   Today: Sunday's weekly review banner, and the next test within two weeks
   ============================================================ */
.week-banner {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-bottom: 20px; padding: 12px 16px;
  color: var(--hl-ink); text-decoration: none; background: var(--hl); border: 2px solid var(--edge); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.week-banner b { display: block; }
.week-banner small { display: block; font-size: 13px; opacity: 0.8; }
.week-banner:active { transform: translate(2px, 2px); box-shadow: none; }

.exam-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 22px; align-items: center; margin-bottom: 20px; border-left: 8px solid var(--sub); }
.exam-count { display: grid; justify-items: center; gap: 4px; min-width: 76px; font-size: 2.3rem; font-weight: 800; line-height: 1; }
.exam-count small { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.exam-count .flap { box-shadow: 2px 2px 0 var(--drop); }
.exam-now { padding: 6px 10px; font-size: 1.15rem; font-stretch: var(--semi-wide); color: var(--hl-ink); background: var(--hl); border-radius: 4px 8px 4px 9px; }
.exam-kind { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.exam-main h2 { margin: 2px 0; font-size: 1.25rem; }
.exam-main h2 button { padding: 0; font: inherit; color: inherit; text-align: left; background: none; border: 0; cursor: pointer; }
.exam-sub { font-size: 14px; color: var(--ink-2); }
.exam-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 13px; color: var(--ink-3); }
.exam-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.exam-card.is-close .exam-kind { color: var(--pen); }
@media (hover: hover) and (pointer: fine) { .exam-main h2 button:hover { text-decoration: underline; text-underline-offset: 4px; } }
@media (max-width: 560px) {
  .exam-card { grid-template-columns: auto minmax(0, 1fr); gap: 14px 16px; }
  .exam-actions { grid-column: 1 / -1; flex-direction: row; }
  .exam-actions .btn { flex: 1; justify-content: center; }
  .exam-count { min-width: 60px; font-size: 1.9rem; }
}

/* ============================================================
   Weekly review (js/views-week.js)
   ============================================================ */
.wr-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 24px; padding: 0; }
.wr-figures > div { padding: 18px 22px; }
.wr-figures > div + div { border-left: 1px solid var(--rule); }
.wr-figures h2 { font-size: 13.5px; font-weight: 600; font-stretch: 100%; letter-spacing: 0; color: var(--ink-2); }
.wr-fig { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 6px; font-size: 1.9rem; font-weight: 800; font-stretch: var(--wide); letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wr-fig span { font-size: 14px; font-weight: 500; font-stretch: 100%; letter-spacing: 0; color: var(--ink-2); }
.wr-delta { font-size: 13px; color: var(--ink-3); }
.wr-delta.up { color: var(--ok); }
.wr-delta.down { color: var(--pen); }
.wr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.wr-grid .sheet { margin: 0; }
.wr-bars, .wr-list, .wr-grades, .wr-day ul { list-style: none; margin: 0; padding: 0; }
.wr-bars li { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 40px; }
.wr-bar-name { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wr-bar-track { height: 12px; }
.wr-bar-track i { display: block; height: 100%; background: var(--sub); border-radius: 3px; }
.wr-bar-val { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.wr-list li button, .wr-day li button {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; width: 100%; padding: 9px 4px 9px 14px;
  text-align: left; color: var(--ink); background: none; border: 0; border-top: 1px solid var(--rule); cursor: pointer;
}
.wr-list li:first-child button, .wr-day li:first-child button { border-top-color: transparent; }
.wr-list li button::before, .wr-day li button::before, .wr-grades li::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 2px; background: var(--sub); }
.wr-name { overflow: hidden; font-size: 14.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wr-list small, .wr-day small, .wr-grades small { grid-column: 1; font-size: 13px; color: var(--ink-3); }
.wr-list time { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 13px; color: var(--ink-3); }
.wr-more { padding: 6px 0 0 14px; font-size: 13px; color: var(--ink-3); }
.wr-grades li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 10px 4px 10px 14px; border-top: 1px solid var(--rule); }
.wr-grades li:first-child { border-top-color: transparent; }
.wr-avg { grid-row: 1 / span 2; grid-column: 2; align-self: center; display: grid; justify-items: end; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.wr-avg em { font-size: 12.5px; font-style: normal; font-weight: 600; color: var(--ink-3); }
.wr-avg em.up { color: var(--ok); }
.wr-avg em.down { color: var(--pen); }
.wr-day { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule); }
.sheet-head + .wr-day { border-top: 0; padding-top: 0; }
.wr-day > time { padding-top: 10px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.wr-test { grid-column: 2; grid-row: 1; align-self: center; padding: 1px 7px; font-size: 12px; font-weight: 650; color: var(--hl-ink); background: var(--hl); border-radius: 4px; }
@media (hover: hover) and (pointer: fine) { .wr-list li button:hover .wr-name, .wr-day li button:hover .wr-name { text-decoration: underline; text-underline-offset: 3px; } }
@media (max-width: 860px) { .wr-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  /* One figure per row on a phone: name and number on one line, the change under them. */
  .wr-figures { grid-template-columns: minmax(0, 1fr); }
  .wr-figures > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px; padding: 14px 18px; }
  .wr-figures > div + div { border-left: 0; border-top: 1px solid var(--rule); }
  .wr-fig { margin: 0; font-size: 1.5rem; }
  .wr-figures .wr-delta { grid-column: 1 / -1; }
  .wr-bars li { grid-template-columns: minmax(0, 6.5rem) minmax(0, 1fr) auto; }
}

/* ============================================================
   Focus: study heatmap
   ============================================================ */
.heat-facts { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 14px; font-size: 14px; color: var(--ink-2); }
.heat-facts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.heat-wrap { overflow-x: auto; scrollbar-width: thin; }
.heat { display: grid; grid-template-columns: 30px minmax(0, 1fr); grid-template-rows: auto auto; gap: 4px 6px; min-width: calc(var(--weeks) * 16px + 36px); }
.heat-months { grid-column: 2; display: grid; grid-template-columns: repeat(var(--weeks), minmax(0, 1fr)); font-size: 11.5px; color: var(--ink-3); }
.heat-months span { white-space: nowrap; }
.heat-days { display: grid; grid-template-rows: repeat(7, minmax(0, 1fr)); gap: 3px; font-size: 11px; color: var(--ink-3); }
.heat-days span { display: flex; align-items: center; }
.heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, minmax(0, 1fr)); grid-template-columns: repeat(var(--weeks), minmax(0, 1fr)); gap: 3px; }
.heat-grid i, .heat-key i { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--rule); }
.heat-grid i.future { background: none; }
.heat-grid .l1, .heat-key .l1 { background: color-mix(in srgb, var(--primary) 28%, var(--paper)); }
.heat-grid .l2, .heat-key .l2 { background: color-mix(in srgb, var(--primary) 52%, var(--paper)); }
.heat-grid .l3, .heat-key .l3 { background: color-mix(in srgb, var(--primary) 76%, var(--paper)); }
.heat-grid .l4, .heat-key .l4 { background: var(--primary); }
.heat-grid .is-today { outline: 2px solid var(--hl); outline-offset: 1px; }
.heat-key { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.heat-key i { width: 12px; }

/* School calendar import (Settings) */
.feed-form { margin-top: 12px; }
.feed-row { display: flex; gap: 8px; }
.feed-row input { flex: 1 1 auto; min-width: 0; } /* auto, not 0: stacked on a phone it keeps its own height */
.feed-row .btn { flex: none; }
@media (max-width: 420px) { .feed-row { flex-direction: column; } .feed-row .btn { justify-content: center; } }
.import-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); background: var(--paper-2); border-radius: var(--r-sm); }
.import-note .ic { flex: none; margin-top: 2px; }

/* ============================================================
   Get started (Today): a numbered list ticked off as the student sets Planora up (views-plan.js)
   ============================================================ */
.starter-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.starter-list li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--rule);
}
.starter-list li:first-child { border-top: 0; padding-top: 2px; }
.starter-n {
  display: grid; place-items: center; width: 30px; height: 30px;
  font-weight: 750; font-stretch: var(--semi-wide); font-size: 14px;
  color: var(--ink); background: var(--paper); border: 2px solid var(--edge); border-radius: 50%;
}
.starter-n .ic { width: 16px; height: 16px; }
.starter-text b { display: block; font-weight: 650; }
.starter-text small { display: block; margin-top: 1px; font-size: 13px; color: var(--ink-3); }
.starter-list li.is-done .starter-n { color: var(--on-primary); background: var(--ok); border-color: var(--ok); }
.starter-list li.is-done .starter-text b { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--hl); }
.pen-text { color: var(--pen); font-weight: 600; }
/* Install tip on Today (phones and tablets) */
.install-tip { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 12px; align-items: start; }
.install-tip h2 { font-size: 1rem; margin: 0; }
.install-tip .hint { margin: 2px 0 0; }
.install-tip .head-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
/* WhatsApp card on Today: the install tip's layout, with the highlighter on the icon so it reads as an offer. */
.wa-card { border-color: var(--edge); }
.wa-card .inbox-ic { color: var(--hl-ink); background: var(--hl); }

/* Phones: Today's progress becomes one row of three small tiles (this week, focus, streak) instead of four
   tall blocks at the bottom of a long page. Bars, dots and the Focus button go: the tab bar has Focus. */
@media (max-width: 560px) {
  .today-side { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .today-side .side-block, .today-side .side-block:nth-child(2), .today-side .side-block:first-child {
    padding: 10px 10px 12px; border: 2px solid var(--edge-panel); border-radius: var(--r); background: var(--paper);
  }
  .today-side .side-block:has(.next-test) { grid-column: 1 / -1; }
  .today-side .side-block h2 { font-size: 12px; }
  .today-side .figure { display: block; margin: 2px 0 0; font-size: 1.35rem; }
  .today-side .figure span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.3; }
  .today-side .bar, .today-side .side-block > .btn, .today-side .streak-dots { display: none; }
  /* With the Get started list showing, "Nothing scheduled today" only repeats its links. */
  .starter ~ .day-free { display: none; }
}
/* Sample week: a banner over every page while the sample is in */
.sample-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 18px; padding: 10px 14px;
  font-size: 14px; color: var(--hl-ink); background: var(--hl); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow-sm);
}
.sample-banner > span { flex: 1 1 220px; min-width: 0; }
.sample-banner .btn { background: var(--paper); color: var(--ink); }
.starter-sample { margin: -4px 0 10px; font-size: 14px; color: var(--ink-2); }
/* Phones: the two answers share the row equally; Previous shrinks to its arrow. */
@media (max-width: 560px) {
  .practice-foot { flex-wrap: nowrap; gap: 8px; }
  .practice-foot .grow, .practice-foot .prev-text { display: none; }
  .practice-foot [data-action="card-prev"] { flex: none; padding: 0 10px; }
  .practice-foot [data-action="card-rate"], .practice-foot [data-action="card-flip"] { flex: 1; justify-content: center; }
}

/* Sync with ManageBac (timetable): steps to get the link, then the classes found, by day. */
.tt-sync > p:first-child { margin-top: 0; }
.tt-steps { margin: 4px 0 16px; padding-left: 22px; display: grid; gap: 6px; color: var(--ink-2); }
.tt-steps b { color: var(--ink); }
.tt-sync-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.tt-sync-day { margin: 10px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.tt-sync-day:first-child { margin-top: 0; }
.tt-sync-row { align-items: flex-start; padding: 8px 10px 8px 12px; border: 1.5px solid var(--rule); border-left: 4px solid var(--sub, var(--edge)); border-radius: 8px; background: var(--paper); }
.tt-sync-row input { margin-top: 2px; }
.tt-sync-row span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.tt-sync-row b { overflow-wrap: anywhere; }
.tt-sync-row time { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tt-sync-row small { flex-basis: 100%; font-size: 12.5px; }
.tt-sync-row:has(input:disabled) { opacity: .7; cursor: default; }
.tt-sync-sub { margin: 18px 0 6px; font-size: 15px; }
.tt-sync-sub.first { margin-top: 0; }
.tt-sync .cal-state { margin-top: 0; }
.tt-sync-btn .short { display: none; }
@media (max-width: 560px) {
  .tt-sync-btn .full { display: none; }
  .tt-sync-btn .short { display: inline; }
  .tt-sync-btn { padding-inline: 12px; }
  .tt-sync-btn .ic { display: none; }
}
.tt-sync-more { margin: 14px 0 0; font-size: 13.5px; }
/* A picture of ManageBac's own button, so students know what to look for. */
.tt-shot { display: block; width: 208px; max-width: 100%; height: auto; margin: 8px 0 2px; border-radius: 6px; box-shadow: 0 0 0 1.5px var(--rule); }

/* Leaving a task out of the study plan (tasks you don't need to study for). */
.effort-list li { grid-template-columns: minmax(0, 1fr) auto; }
.effort-ctrl { display: flex; align-items: center; gap: 4px; }
.effort-ctrl select { width: 156px; }
.effort-list li.left-out .effort-name b { color: var(--ink-3); text-decoration: line-through; }
.effort-list li.left-out::before { opacity: .35; }
.effort-ctrl .icon-btn[aria-pressed="true"] { color: var(--ink); background: var(--hl); }
.plan-row .quiet-btn { color: var(--ink-3); }
.plan-row .quiet-btn:hover, .plan-row .quiet-btn:focus-visible { color: var(--ink); }
.left-out-box { margin-top: 18px; border-top: 1.5px dashed var(--rule); padding-top: 12px; }
.left-out-box summary { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.left-out-box summary .ic { width: 16px; height: 16px; }
.left-out-box ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.left-out-box li { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-left: 16px; }
.left-out-box li::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 2px; background: var(--sub, var(--edge)); }
.left-out-box li span { display: grid; min-width: 0; }
.left-out-box li b { font-size: 14px; overflow-wrap: anywhere; }
.left-out-box li small { font-size: 12.5px; color: var(--ink-2); }
.no-plan { margin-top: -4px; }
@media (max-width: 560px) { .effort-ctrl select { width: 152px; padding-right: 30px; } }
/* A short study session (15 minutes) still gets a block wide enough to tap. */
button.rb { min-width: 24px; }
