/* ==========================================================================
   GENERATED FILE -- do not edit directly.
   Built from the partials in public/assets/css/ by bin/build-css.php.
   Edit those files, then run `php bin/build-css.php` to regenerate this one.
   ========================================================================== */

/* ---- 01-tokens.css ---- */
/* ==========================================================================
   Journal -- a bound logbook, not a dashboard.
   Palette: no pure white/black, chroma spent only on state, one ink-violet
   accent kept apart from every status hue so "clickable" never reads as
   "warning". Ported from the ergonomic oklch theme -- same variable names
   as before so no template changes; values recomputed underneath.
   ========================================================================== */

:root {
  --paper:        oklch(97.2% 0.006 150);
  --paper-raised: oklch(99.5% 0.003 150);
  --paper-sunk:   oklch(92.5% 0.009 150);
  --paper-alt:    oklch(94.5% 0.008 150);  /* masthead, table heads, neutral chip fill */
  --ink:          oklch(26.5% 0.022 265);  /* 14.15:1 AAA */
  --ink-soft:     oklch(47.0% 0.018 265);  /*  6.31:1 AA  */
  --ink-faint:    oklch(54.5% 0.014 265);  /*  4.58:1 AA  */
  --rule:         oklch(91.5% 0.008 150);
  --rule-strong:  oklch(62.0% 0.012 150);  /* >=3:1 against surfaces, for real borders */
  --accent:       oklch(47.0% 0.130 275);  /* ink violet -- interactive, only this means "click" */
  --accent-hover: oklch(41.0% 0.140 275);
  --accent-wash:  oklch(93.5% 0.030 275);
  --focus-ring:   oklch(48.0% 0.190 275);

  --s-open:     oklch(60.5% 0.014 265);
  --s-wip:      oklch(48.0% 0.090 230);
  --s-waiting:  oklch(54.5% 0.115 70);
  --s-question: oklch(50.0% 0.140 310);
  --s-done:     oklch(45.0% 0.105 150);
  --s-dropped:  oklch(64.0% 0.012 265);

  --overdue-fg: oklch(50.5% 0.170 25); --overdue-bg: oklch(95.0% 0.020 25); --overdue-line: oklch(76.0% 0.110 25);
  --due-fg:     oklch(54.5% 0.115 70); --due-bg:     oklch(96.5% 0.028 75); --due-line:     oklch(78.0% 0.090 75);
  --added-fg:   oklch(40.0% 0.120 150); --added-bg:  oklch(94.0% 0.045 150); --added-line:   oklch(72.0% 0.100 150);

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-prose: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --leading-prose: 1.65;

  --margin-rule: 1.55rem;   /* x-position of the ledger rule */
  --indent: 2.7rem;         /* per-depth indent step for subtasks; shrinks on phones */
  --radius: 8px;
  --radius-lg: 14px;
  --radius-full: 999px;
  --line-width: 1px;
  --shadow-sm: 0 1px 2px oklch(26.5% 0.022 265 / .06), 0 1px 1px oklch(26.5% 0.022 265 / .04);
  --shadow: 0 2px 4px oklch(26.5% 0.022 265 / .07), 0 4px 12px oklch(26.5% 0.022 265 / .06);
  --shadow-lg: 0 8px 28px oklch(26.5% 0.022 265 / .14);
  --ease: cubic-bezier(.2, .7, .3, 1);
}

[data-theme="dark"] {
  --paper:        oklch(20.5% 0.010 160);
  --paper-raised: oklch(24.5% 0.011 160);
  --paper-sunk:   oklch(17.5% 0.009 160);
  --paper-alt:    oklch(29.0% 0.012 160);
  --ink:          oklch(92.5% 0.008 150);  /* 14.36:1 AAA, not pure white -- avoids halation */
  --ink-soft:     oklch(74.5% 0.010 150);
  --ink-faint:    oklch(63.0% 0.012 150);
  --rule:         oklch(30.5% 0.012 160);
  --rule-strong:  oklch(54.5% 0.016 160);
  --accent:       oklch(78.0% 0.100 275);
  --accent-hover: oklch(86.0% 0.065 275);
  --accent-wash:  oklch(31.0% 0.045 275);
  --focus-ring:   oklch(79.0% 0.105 275);

  --s-open:     oklch(63.0% 0.012 150);
  --s-wip:      oklch(78.0% 0.085 230);
  --s-waiting:  oklch(81.5% 0.105 75);
  --s-question: oklch(80.0% 0.095 310);
  --s-done:     oklch(78.0% 0.100 150);
  --s-dropped:  oklch(52.0% 0.014 150);

  --overdue-fg: oklch(74.0% 0.135 25); --overdue-bg: oklch(30.0% 0.055 25); --overdue-line: oklch(47.0% 0.100 25);
  --due-fg:     oklch(81.5% 0.105 75); --due-bg:     oklch(31.0% 0.045 75); --due-line:     oklch(48.0% 0.075 75);
  --added-fg:   oklch(72.0% 0.110 150); --added-bg:  oklch(28.0% 0.055 150); --added-line:   oklch(45.0% 0.090 150);

  --shadow-sm: 0 1px 2px oklch(0% 0 0 / .30);
  --shadow: 0 2px 6px oklch(0% 0 0 / .36), 0 6px 16px oklch(0% 0 0 / .24);
  --shadow-lg: 0 10px 32px oklch(0% 0 0 / .48);
}

/* Push text/border tokens to full strength on request -- see forced-colors
   below for the Windows High Contrast case. */
@media (prefers-contrast: more) {
  :root:not([data-theme="dark"]) {
    --ink: oklch(18% 0.020 265); --ink-soft: oklch(34% 0.018 265); --ink-faint: oklch(40% 0.016 265);
    --rule-strong: oklch(42% 0.014 150); --accent: oklch(38% 0.150 275);
  }
  [data-theme="dark"] {
    --ink: oklch(98% 0.004 150); --ink-soft: oklch(86% 0.008 150); --ink-faint: oklch(76% 0.010 150);
    --rule-strong: oklch(68% 0.016 160); --accent: oklch(88% 0.050 275);
  }
}

@media (forced-colors: active) {
  :root {
    --paper: Canvas; --paper-raised: Canvas; --paper-sunk: Canvas; --paper-alt: Canvas;
    --ink: CanvasText; --ink-soft: CanvasText; --ink-faint: GrayText;
    --rule: CanvasText; --rule-strong: CanvasText;
    --accent: LinkText; --accent-hover: LinkText; --focus-ring: Highlight;
    --shadow-sm: none; --shadow: none; --shadow-lg: none;
  }
}

/* ---- 02-base.css ---- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.6 var(--font-ui);
  font-feature-settings: "cv05" 1, "ss01" 1;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: var(--accent-wash); color: var(--ink); }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.012em; }

/* moved from app.css:1097-1099 -- global motion-preference override, kept with base styles */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* ---- 03-rail.css ---- */
/* --- running-time rail: the one piece of ambient motion ------------------ */

.rail {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60;
  background: var(--accent);
}
.rail::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  animation: sweep 3.2s linear infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .rail::after { animation: none; }
}

/* ---- 04-masthead.css ---- */
/* --- masthead ----------------------------------------------------------- */

.masthead {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.25rem;
  padding: .6rem clamp(1rem, 4vw, 2.5rem);
  padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left));
  padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 8px 24px -20px rgba(27, 36, 48, .35);
}
.masthead__mark {
  font: 600 .78rem/1 var(--font-mono);
  letter-spacing: .2em; text-transform: uppercase;
  padding-right: 1.25rem; border-right: 1px solid var(--rule);
}
.masthead nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.masthead nav a {
  padding: .32rem .7rem; border-radius: var(--radius-full);
  font-size: .85rem; color: var(--ink-soft);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.masthead nav a:hover { background: var(--paper-alt); text-decoration: none; color: var(--ink); }
.masthead nav a[aria-current="page"] { color: var(--ink); background: var(--paper-raised); box-shadow: var(--shadow-sm); font-weight: 500; }
.masthead__end { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.masthead__user {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; flex: 0 0 2rem;
  border: 1px solid var(--rule); border-radius: 50%;
  color: var(--ink-soft); font: 600 .72rem/1 var(--font-mono);
  letter-spacing: .04em; text-transform: uppercase;
}

/* The hamburger <details> (phone/tablet only, see the breakpoint below) is
   a second copy of the nav links, hidden above that width -- a closed
   <details>'s content can't be forced visible with CSS regardless of
   specificity (Chromium enforces it outside the normal cascade, confirmed
   even with !important), so reusing the nav above by overriding its
   display at wide widths doesn't work. Two copies, one always shown per
   width, sidesteps that entirely. */
.nav-toggle { display: none; }
.nav-toggle summary { list-style: none; }
.nav-toggle summary::-webkit-details-marker { display: none; }
.nav-toggle summary::marker { content: ""; }

/* the live timer chip -- the running task, in the accent's quiet register */
.chip-timer {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .3rem .6rem .3rem .55rem;
  border: 1px solid var(--accent); border-radius: var(--radius-full);
  background: var(--accent-wash); color: var(--accent);
  font: 500 .8rem/1 var(--font-mono);
}
.chip-timer__dot {
  width: .45rem; height: .45rem; background: var(--accent); border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .chip-timer__dot { animation: none; } }
.chip-timer form { display: contents; }

/* ---- 05-shell.css ---- */
/* --- shell -------------------------------------------------------------- */

.shell {
  max-width: 100rem; margin: 0 auto;
  padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 4vw, 2.5rem) 6rem;
  padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left));
  padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right));
  padding-bottom: calc(6rem + env(safe-area-inset-bottom));
}
.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: clamp(1.75rem, 4vw, 3.25rem); align-items: start; }
@media (max-width: 62rem) { .columns { grid-template-columns: minmax(0, 1fr); } }

/* ---- 06-datehead.css ---- */
/* --- the date, as hero -------------------------------------------------- */

.datehead { margin-bottom: 1.75rem; }
/* A quiet pill, same family as .btn--quiet -- it needs to read as a
   control on its own row, not a stray leftover form field. The active
   look is driven by aria-pressed, toggled by 27-focus-mode.js. */
.datehead__focus-row { display: flex; justify-content: flex-end; margin-bottom: .6rem; }
.datehead__focus-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-full);
  background: var(--paper-raised); color: var(--ink-faint);
  font: 500 .78rem/1.3 var(--font-ui); white-space: nowrap; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.datehead__focus-toggle:hover { background: var(--paper-sunk); color: var(--ink); }
.datehead__focus-toggle[aria-pressed="true"] {
  background: var(--accent-wash); border-color: var(--accent); color: var(--ink);
}
.datehead__row { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.datehead__date {
  font: 560 clamp(2rem, 5.5vw, 2.9rem)/1 var(--font-mono);
  letter-spacing: -.04em;
}
.datehead__date .dim { color: var(--ink-faint); }
.datehead__meta {
  font: .72rem/1.4 var(--font-mono);
  letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint);
  padding-bottom: .3rem;
}
.datehead__nav { margin-left: auto; display: flex; gap: .3rem; padding-bottom: .25rem; }

/* the day meter: estimated vs logged against the target */
.meter { margin-top: 1.25rem; }
.meter__scale {
  position: relative; height: .5rem; background: var(--paper-sunk);
  border-radius: 4px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(27,36,48,.08);
}
.meter__fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); opacity: .8; border-radius: 4px; transition: width .3s var(--ease); }
.meter__fill--over { background: var(--overdue-fg); opacity: 1; }
.meter__target {
  position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--rule-strong);
}
.meter__legend {
  display: flex; gap: 1.15rem; flex-wrap: wrap;
  margin-top: .55rem; font: .76rem/1 var(--font-mono); color: var(--ink-soft);
}
.meter__legend b { font-weight: 500; color: var(--ink); }

/* ---- 07-capture.css ---- */
/* --- quick add ---------------------------------------------------------- */

/* "Add task" and the filter menu sit on one row -- flex-start so opening
   the capture form (which grows tall) doesn't stretch or re-centre the
   filter button next to it. */
.task-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; margin: 0 0 1.85rem; }
.task-actions .filter-bar__toggle-label {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
}
/* .btn--icon (the collapse-subtrees and hide-completed buttons) is shorter
   than a text .btn like the filter toggle beside it, since it only pads
   for a bare icon -- pin both to the same height here so the row doesn't
   zig-zag. */
.task-actions .btn--icon, .task-actions .filter-bar__toggle { min-height: 2.15rem; }

/* Closed by default -- the capture form (and its shorthand hint) only
   shows up once "Add task" is clicked, same disclosure pattern as
   .subtask-add below, just with a visible label instead of a hidden one
   since there's no separate icon button standing in for it here. Margin
   lives on .task-actions now, shared with the filter button beside it. */
.capture-add { margin: 0; flex: 1; min-width: 0; }
.capture-add__trigger { list-style: none; }
.task-actions > .capture-add__trigger { margin-right: auto; }
.capture-add__trigger::-webkit-details-marker { display: none; }
.capture-add[open] .capture-add__trigger { margin-bottom: .6rem; }

.capture {
  margin: 0 0 1.85rem;
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper-raised); box-shadow: var(--shadow);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.capture--highlight { animation: capture-highlight 1.1s var(--ease); }
@keyframes capture-highlight {
  0%, 100% { box-shadow: var(--shadow); }
  35% { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent); }
}
.capture:focus-within { border-color: var(--rule-strong); box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.capture__row { display: flex; align-items: center; }
.capture__prompt {
  padding: 0 .35rem 0 .9rem; color: var(--accent);
  font: 500 1rem/1 var(--font-mono); user-select: none;
}
.capture textarea {
  flex: 1; min-width: 0; border: 0; background: none; color: var(--ink);
  padding: .85rem .5rem; font: 15px/1.4 var(--font-mono);
  display: block; resize: none; overflow-y: auto; max-height: 12rem;
}
.capture textarea:focus { outline: none; }
.capture__hint {
  margin: 0; padding: .3rem; border-top: 1px solid var(--rule);
  font: .72rem/1.5 var(--font-mono); color: var(--ink-faint);
  list-style: none; max-height: 11rem; overflow-y: auto;
}
.capture__hint li {
  padding: .3rem .6rem; border-radius: var(--radius);
  cursor: pointer;
}
.capture__hint li.is-active { background: var(--accent-wash); color: var(--ink); }
.capture__hint kbd { color: var(--ink-soft); }
.capture__hint li.is-active kbd { color: inherit; }

.capture__status {
  margin: .55rem .75rem 0;
  font-size: .78rem;
  box-shadow: none;
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.capture__status--visible { opacity: 1; }

.capture__preview {
  margin: .3rem 0 0; padding: .4rem .75rem;
  font: .78rem/1.4 var(--font-mono); color: var(--ink-soft);
  background: var(--accent-wash); border-radius: var(--radius);
}
.subtask-add__form .capture__preview { margin-top: .3rem; }

/* ---- 08-filters.css ---- */
/* --- filter bar -----------------------------------------------------------
   A row of criteria (state, tag, hide-completed) that opens below the
   toolbar, full width of the ledger, rather than a small anchored dropdown --
   several independent multi-select groups don't fit a narrow menu column the
   way the old single-select quick filters did. Closed by default and purely
   manual to open/close (see 18-filter-bar.js) -- it does not force itself
   open just because a filter is active, that would cost a permanent row of
   space. Instead the toggle button itself is the "something is active"
   indicator: accent colour plus a count in its label. */
.filter-bar__toggle.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-wash); }

.filter-bar {
  display: flex; flex-direction: column; gap: .7rem;
  margin: 0 0 1.85rem; padding: .8rem 1rem;
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.filter-bar[hidden] { display: none; }

/* Each group (state, priority, tag, ...) is its own row -- keeps one
   criterion's chips from wrapping into the next criterion's line, where
   the group label would otherwise be the only thing telling them apart. */
.filter-bar__group { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.filter-bar__group[hidden] { display: none; }
.filter-bar__group--end { margin-left: 0; gap: .9rem; padding-top: .3rem; border-top: 1px solid var(--rule); }
.filter-bar__group-label {
  font: 600 .72rem/1 var(--font-ui); text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-faint); margin-right: .15rem;
}

.filter-bar__chip {
  padding: .35rem .75rem; border: 1px solid var(--rule); border-radius: var(--radius-full);
  background: var(--paper); cursor: pointer;
  font: 500 .8rem/1.2 var(--font-ui); color: var(--ink-soft);
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.filter-bar__chip:hover { background: var(--paper-alt); color: var(--ink); }
.filter-bar__chip[aria-pressed="true"] {
  color: var(--accent); background: var(--accent-wash); border-color: var(--accent);
}
/* Done/Dropped while "hide completed & dropped" is on -- see 03-hide-completed.js.
   Filtering to a state the toggle immediately hides again would always show
   nothing, so the chip is inert; the title attribute carries the reason. */
.filter-bar__chip:disabled {
  cursor: not-allowed; opacity: .45;
}
.filter-bar__chip:disabled:hover { background: var(--paper); color: var(--ink-soft); }

/* Hide completed & dropped: a standalone always-visible toggle button in
   the task-actions toolbar (not the filter menu above) -- same is-active
   accent treatment as the filter toggle, so both read as "on" the same way. */
[data-toggle-completed].is-active {
  color: var(--accent); border-color: var(--accent); background: var(--accent-wash);
}

/* ---- 09-ledger.css ---- */
/* --- the ledger: signature element -------------------------------------- */

.ledger { position: relative; }
/* the continuous margin rule top-level state marks sit on; nested marks
   indent along with their row, past the rule */
.ledger::before {
  content: ""; position: absolute; left: var(--margin-rule); top: 0; bottom: 0;
  width: var(--line-width); background: var(--rule); z-index: 0;
}
.ledger--flush::before { display: none; }
/* "Hide completed" (app.js persists this in localStorage) -- a Done or
   Dropped task hides as a whole, subtasks included, whatever state those
   subtasks are in themselves: marking a task Done/Dropped no longer forces
   its children into that state too (see TaskRepository::setState()), so a
   closed-out task can very well still have open work underneath it, and
   hiding it needs to take that along rather than leave it stranded with no
   visible parent above it. */
.ledger--hide-done .entry--closed,
.ledger--hide-done .entry--dropped { display: none; }
/* The child-count toggle ("N subtasks"), the whole subtree under it, and
   the "+ subtask" control are all siblings of .entry, not descendants of
   it, so hiding the row above doesn't hide them on its own. */
.ledger--hide-done .entry--closed + .subtree,
.ledger--hide-done .entry--closed + .subtask-add,
.ledger--hide-done .entry--closed + .subtree + .subtask-add,
.ledger--hide-done .entry--dropped + .subtree,
.ledger--hide-done .entry--dropped + .subtask-add,
.ledger--hide-done .entry--dropped + .subtree + .subtask-add {
  display: none;
}

/* Quick filters (app.js) work the same way, one level up: a top-level entry
   is marked --filtered-out only when neither it nor anything in its own
   subtree matches, so a matching subtask always keeps its parent in view
   instead of surfacing without the context of what it belongs to.
   Compound selector, not just .entry--filtered-out: .entry itself sets
   display: grid further down this file, same specificity, later in
   source order -- it would otherwise win the cascade and this would have
   no visible effect at all. */
.entry.entry--filtered-out,
.entry.entry--filtered-out + .subtree,
.entry.entry--filtered-out + .subtask-add,
.entry.entry--filtered-out + .subtree + .subtask-add {
  display: none;
}

/* ---- 10-entry.css ---- */
.entry {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr) auto;
  align-items: start; gap: 0 .5rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--rule);
  transition: background .15s var(--ease);
}
.entry[hidden] { display: none; }
.entry:first-child { border-top: 1px solid var(--rule-strong); }
/* Subtasks read as grouped under their parent through indent + the
   subtree's own left rule, not a full-width line under every row -- fewer
   repeated dividers, same legibility. Only the last child in a run keeps a
   (lighter) line, closing off the group before the next sibling/parent. */
.entry--child { padding-left: 0; grid-template-columns: 3.1rem minmax(0, 1fr) auto; border-bottom-color: transparent; padding-block: .35rem; }
.entry--child:last-child { border-bottom-color: var(--rule); }
.entry:has(.entry__note) { padding-bottom: .35rem; }
.entry--child:has(.entry__note) { padding-bottom: .15rem; }
.entry:hover { background: color-mix(in srgb, var(--paper-raised) 70%, transparent); }
.entry--running { background: transparent; }
/* A parent task carries its own group visually -- title reads slightly
  larger/heavier than a plain row, while the subtree remains visually
  grouped through indentation and its guide line. */
.entry--parent .entry__title { font-size: 1.02em; font-weight: 600; }
.entry--parent { border-radius: var(--radius) var(--radius) 0 0; }
.entry--parent + .subtree { border-radius: 0 0 var(--radius) var(--radius); padding-bottom: .25rem; }
/* Lighter styling for subtasks -- smaller, softer ink, so the eye lands on
   parents first and reads children as detail rather than equal siblings. */
.entry--child .entry__title { font-size: .95em; color: var(--ink-soft); }
.entry--child.entry--parent .entry__title { color: var(--ink); }
.entry--future {
  border: 1px dashed var(--accent); border-radius: var(--radius);
  margin-bottom: .65rem;
  background: color-mix(in srgb, var(--accent-wash) 55%, transparent);
  color: var(--ink-soft);
  pointer-events: none;
}
.entry--future .entry__mark {
  width: 1.65rem; height: 1.65rem; margin-left: .6rem;
  display: grid; place-items: center;
  border: 1px dashed var(--accent); border-radius: 50%;
  color: var(--accent); font: 600 .8rem/1 var(--font-mono);
}
.entry--future .entry__mark i { display: block; }
.entry--future .entry__title { color: var(--ink); font-style: italic; }
.entry--future .entry__sub { color: var(--accent); }
/* Pinning a top-level task to the top of the day (the "thumbtack" toggle in
   entry__actions) highlights it and its whole subtree as one continuous
   block -- tinting the .subtree container itself (same sibling technique as
   entry--parent above) rather than each descendant .entry individually, so
   the fold/toggle bar and padding between child rows carry the tint too
   instead of leaving untinted gaps that make each child look separately
   highlighted. */
.entry--active,
.entry--active + .subtree {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.entry--active:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}
.entry--closed .entry__title,
.entry--dropped .entry__title { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--ink-faint); }

.entry--dragging { opacity: .4; }
.entry--action-busy { outline: 2px solid var(--accent); outline-offset: -2px; opacity: .7; }
.entry--drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-wash); }

.inline-form.is-busy button { opacity: .55; }
.inline-form.is-success button { color: var(--accent); }
.inline-form.is-error button { color: var(--danger, var(--accent)); }

/* Briefly marks the entry a redirect just landed on -- see app.js. */
.entry--flash { animation: entry-flash 1.6s ease-out; }
@keyframes entry-flash {
  from { background: var(--accent-wash); }
  to   { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .entry--flash { animation: none; background: var(--accent-wash); }
}

/* Compound selector, not just [data-drag-handle]: the handle also carries
   .btn, whose own `cursor: pointer` has equal specificity and comes later
   in this file, so it was silently winning the cascade and leaving the
   handle showing a plain pointer instead of grab/grabbing -- looking like
   a dead button rather than something draggable. */
.btn[data-drag-handle] { cursor: grab; touch-action: none; }
.btn[data-drag-handle]:active { cursor: grabbing; }

/* The drag itself is driven from pointer events, not native HTML5 DnD, so
   nothing stops a text selection from starting under the cursor as it
   moves -- block it for the duration of the gesture. */
body.is-dragging-task { user-select: none; }

/* ---- 11-dragdrop.css ---- */
.promote-zone {
  display: none; align-items: center; justify-content: center;
  margin: 0 0 .85rem; padding: .65rem; border: 1px dashed var(--rule-strong); border-radius: var(--radius-lg);
  font: .78rem/1.4 var(--font-mono); color: var(--ink-faint);
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
body.is-dragging-task .promote-zone { display: flex; }
.promote-zone--drag-over { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }

/* The "insert here" hint line between siblings -- invisible with no footprint
   until a drag starts, then a thin strip (generously tall for an easy drop
   target) that only actually draws a line once dragged over. */
.drop-slot { display: none; }
body.is-dragging-task .drop-slot {
  display: block; position: relative; z-index: 2;
  height: .65rem; margin: -.35rem 0;
  padding-left: calc(var(--indent) * var(--depth, 0));
}
.drop-slot::before {
  content: ''; position: absolute; inset: 50% 0 auto calc(var(--indent) * var(--depth, 0));
  height: 2px; border-radius: 1px; background: transparent;
  transition: background .1s var(--ease), height .1s var(--ease);
}
.drop-slot--drag-over::before { background: var(--accent); height: 3px; }

/* ---- 12-entry-mark.css ---- */
/* the mark itself: a button on the rule, with paper behind it so the rule breaks */
.entry__mark { grid-column: 1; align-self: start; justify-self: start; }
.entry__mark button {
  width: 1.65rem; height: 1.65rem; margin-left: calc(var(--margin-rule) - .825rem);
  position: relative; display: grid; place-items: center;
  border: 1px solid var(--rule-strong); border-radius: 50%;
  background: var(--paper); color: var(--s-open);
  font: 600 1.05rem/1 var(--font-mono); cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.entry__mark button:hover { transform: scale(1.12); border-color: currentColor; box-shadow: 0 2px 8px -2px color-mix(in srgb, currentColor 45%, transparent); }
.entry__mark button:active { transform: scale(.96); }
/* Plain CSS shapes, not font-icon glyphs -- centered from the button's exact
  midpoint, without glyph-metric or transform offsets. */
.entry__mark button i { display: none; }
.entry__mark button::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}
.state-wip      .entry__mark button::after { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.state-waiting  .entry__mark button::after { width: .47rem; height: .55rem; border-radius: 1px; background: linear-gradient(to right, currentColor .15rem, transparent .15rem .32rem, currentColor .32rem); }
.state-done     .entry__mark button::after { width: .55rem; height: .3rem; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translate(-50%, -50%) rotate(-45deg); }
.state-dropped  .entry__mark button::after { width: .48rem; height: .48rem; background: currentColor; transform: translate(-50%, -50%) rotate(45deg); }
.state-open     .entry__mark button { color: var(--s-open); }
.state-wip      .entry__mark button { color: var(--s-wip);      border-color: var(--s-wip); }
.state-waiting  .entry__mark button { color: var(--s-waiting);  border-color: var(--s-waiting); }
.state-done     .entry__mark button { color: var(--s-done);     border-color: var(--s-done); }
.state-dropped  .entry__mark button { color: var(--s-dropped); }

/* ---- 13-entry-body.css ---- */
.entry__body { grid-column: 2; min-width: 0; }
.entry__title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.entry__title a:hover { text-decoration-color: var(--rule-strong); }
/* Its own line right under the title, not just another pill among many --
   a blocked task shouldn't be easy to miss while skimming the ledger. */
.entry__blocker {
  display: flex; align-items: center; gap: .2rem; flex-wrap: wrap;
  width: fit-content; max-width: 100%;
  margin-top: .2rem; padding: .18rem .65rem;
  border-left: var(--line-width) solid currentColor; border-radius: 0 var(--radius) var(--radius) 0;
  font: 600 .78rem/1.3 var(--font-ui);
}
.entry__blocker--waiting  { color: var(--s-waiting);  background: color-mix(in srgb, var(--s-waiting) 10%, transparent); }
/* Dropped keeps its blocker as a record of what it was stuck on -- shown
   the same way, just in the Dropped state's own colour. */
.entry__blocker--dropped  { color: var(--s-dropped);  background: color-mix(in srgb, var(--s-dropped) 10%, transparent); }
.entry__sub {
  display: flex; align-items: center; gap: .2rem; flex-wrap: wrap;
  margin-top: .1rem; margin-bottom: .1rem; font: .74rem/1.3 var(--font-mono); color: var(--ink-faint);
}
/* Parent-task completion, always visible (not just on expand) -- "3/5 done"
   plus a bar reads faster than opening the subtree to count checkmarks. */
.entry__progress {
  display: flex; align-items: center; gap: .5rem;
  margin-top: .3rem; font: .72rem/1 var(--font-mono); color: var(--ink-faint);
}
.entry__progress-bar {
  flex: 0 0 5rem; height: .32rem; border-radius: 2px;
  background: var(--paper-sunk); overflow: hidden;
  box-shadow: inset 0 1px 1px rgba(27,36,48,.08);
}
.entry__progress-bar span { display: block; height: 100%; background: var(--s-done); border-radius: 2px; transition: width .3s var(--ease); }
.entry__progress-blocked { color: var(--s-waiting); font-weight: 600; }
.subtree__progress { margin: .25rem 0 0; padding-left: calc(var(--indent) * var(--depth, 1)); }
.subtree__toggle .subtree__progress { margin: 0; padding-left: 0; }
.entry__note {
  grid-column: 2;
  min-height: 0; margin-top: 0.1rem; padding-left: .65rem;
  font-size: .82rem; line-height: 1.35; color: var(--ink-soft); position: relative;
}
.entry__note-content {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 10;
  overflow: hidden; white-space: pre-wrap;
}
.entry__note-more {
  display: none; position: absolute; right: .15rem; bottom: 0;
  padding: .05rem .35rem .05rem .7rem;
  background: linear-gradient(90deg, transparent, var(--paper) 35%);
  color: var(--ink-faint); font-size: .72rem; font-style: italic;
}
.entry__note--long .entry__note-more { display: block; }

.entry__side {
  grid-column: 3; align-self: start; display: flex; align-items: center; gap: .55rem;
  font: .78rem/1 var(--font-mono); color: var(--ink-soft); white-space: nowrap;
}
.entry__time b { font-weight: 500; color: var(--ink); }
.entry__time .over { color: var(--overdue-fg); }
/* Hidden above the phone breakpoint -- the actions row shows every icon
   inline there already, so a "more actions" button would be a redundant
   extra click. Below it (see phone layout section) this becomes the only
   way to reach those actions, and .entry__actions becomes its dropdown.
   Compound selector, not just .entry__menu-toggle: .btn sets its own
   display: inline-flex further down this file, same specificity, later in
   source order -- it would otherwise win the cascade and this button would
   show (doing nothing useful) at every width instead of only on phones. */
.btn.entry__menu-toggle { display: none; }
.entry__actions { align-self: start; display: flex; gap: .1rem; }
/* Icon-only inline on the row -- there's no room next to four icons packed
   into an "auto" grid column for a label on each. Below the phone
   breakpoint, where these same buttons stack full-width inside the "more
   actions" dropdown instead, there's plenty of width for a label, so this
   is switched back on there (see phone layout section). */
.entry__action-label { display: none; }
/* Hidden until the row is worth looking at -- hover, keyboard focus inside
   the row, or (since there's no hover on touch) any pointer that can't
   hover at all. A running timer's stop button stays visible regardless;
   losing track of a live timer because the row isn't hovered would be a
   real cost, not just noise reduction. */
.entry__actions .btn--quiet {
  color: var(--ink-soft); opacity: 0;
  transition: opacity .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.entry:hover .entry__actions .btn--quiet,
.entry:focus-within .entry__actions .btn--quiet,
.entry--running .entry__actions .btn--quiet {
  opacity: 1;
}
.entry__actions .btn--quiet:hover { color: var(--ink); background: var(--paper-sunk); }
/* Pinned stays visible at full strength even off-hover, unlike the other
   quiet icons -- it's showing state, not just offering an action. */
.entry__actions .btn--quiet.is-active { opacity: 1; color: var(--accent); }
.entry__actions .btn--quiet.is-active:hover { color: var(--accent-hover); }
.entry__actions .btn--quiet[disabled] { opacity: 0; }
.entry:hover .entry__actions .btn--quiet[disabled],
.entry:focus-within .entry__actions .btn--quiet[disabled] { opacity: .4; }
@media (hover: none) {
  .entry__actions .btn--quiet { opacity: 1; }
  .entry__actions .btn--quiet[disabled] { opacity: .4; }
}

/* ---- 14-buttons-pills.css ---- */
/* --- small parts -------------------------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .1rem .5rem; border-radius: var(--radius-full);
  font: 500 .7rem/1.5 var(--font-mono); letter-spacing: .02em;
  background: var(--paper-alt); color: var(--ink-soft);
}
.pill--project { border-left: 3px solid var(--project, var(--ink-faint)); }
.pill--tag { background: var(--paper-alt); border: 0; transition: background .15s var(--ease), color .15s var(--ease); }
.pill--tag:hover { background: var(--paper-sunk); color: var(--ink); }
/* Status chips carry fg + tinted bg + border, never colour alone. */
.pill--due { color: var(--due-fg); background: var(--due-bg); border: 1px solid var(--due-line); }
.pill--overdue { color: var(--overdue-fg); background: var(--overdue-bg); border: 1px solid var(--overdue-line); }
.pill--carried { color: var(--ink-faint); border: 1px dashed var(--rule-strong); background: none; }
/* A resource chip standing in for a raw URL -- hostname only, so a long
   querystring in a note doesn't turn the line into unreadable text. */
.pill--link {
  color: var(--accent); background: var(--accent-wash);
  border-radius: var(--radius); max-width: 100%; overflow-wrap: anywhere;
}
.pill--link:hover { text-decoration: none; background: color-mix(in srgb, var(--accent-wash) 70%, var(--accent) 15%); }
.pill--link i { font-size: .85em; flex: none; }
/* Priority is weight, not a rainbow -- only P1 gets chroma, and it borrows
   the overdue hue rather than the interactive accent's, so "urgent" never
   reads as "click here". */
.pill--prio1 { color: var(--overdue-fg); background: var(--overdue-bg); border: 1px solid var(--overdue-line); }
.pill--prio2 { color: var(--due-fg); background: var(--due-bg); border: 1px solid var(--due-line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .38rem .75rem; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--paper-raised); color: var(--ink);
  font: 500 .82rem/1.3 var(--font-ui); cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
}
.btn[hidden] { display: none; }
.btn[data-md-save-button] { display: none; }
.btn[data-md-save-button].is-dirty { display: inline-flex; }
.btn:hover { background: var(--paper-sunk); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--accent:hover { filter: brightness(1.1); background: var(--accent); }
.btn--quiet { border-color: transparent; background: none; color: var(--ink-faint); padding: .28rem .45rem; }
.btn--quiet:hover { background: var(--paper-sunk); color: var(--ink); }
.btn--icon { font-family: var(--font-mono); padding: .22rem .4rem; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ---- 15-panels.css ---- */
/* --- side column -------------------------------------------------------- */

.aside { display: grid; gap: 1.5rem; }
.aside > #day-notes { order: -1; }

/* --- Focus mode day view: only the task list and the day's notes stay
   visible -- everything else on the page (the masthead, the logged/planned
   meter, the time-recorded table, and every aside panel but Notes) is
   hidden. See public/assets/js/27-focus-mode.js. */
body.is-focus-mode .masthead,
body.is-focus-mode .meter,
body.is-focus-mode #day-time-recorded,
body.is-focus-mode .aside > *:not(#day-notes) {
  display: none;
}
.panel {
  border: 1px solid var(--rule); border-left: 3px solid var(--ink);
  border-radius: var(--radius-lg); background: var(--paper-raised);
  box-shadow: var(--shadow-sm); padding: .9rem 1rem 1rem;
}
.panel__head {
  display: flex; align-items: baseline; gap: .5rem; margin-bottom: .6rem;
}
.panel__title {
  font: 600 .72rem/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase;
}
.panel__count { font: .72rem/1 var(--font-mono); color: var(--ink-faint); margin-left: auto; }
.panel__empty { font-size: .84rem; color: var(--ink-faint); }
.panel--accent { border-left-color: var(--accent); }
.panel--accent .panel__title { color: var(--accent); }

.stack { display: grid; gap: .1rem; }
.stack__item {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .5rem;
  padding: .45rem 0; border-bottom: 1px solid var(--rule);
  font-size: .86rem;
}
.stack__item:last-child { border-bottom: 0; }
.stack__meta { font: .72rem/1.4 var(--font-mono); color: var(--ink-faint); }
.stack__age { font: .72rem/1 var(--font-mono); color: var(--s-waiting); white-space: nowrap; }
.stack__age--hot { color: var(--accent); font-weight: 600; }
/* the row's trailing cell when it holds an action as well as the age */
.stack__actions { display: flex; align-items: center; gap: .25rem; }

.carry { display: grid; gap: .35rem; }
/* The row, not the label, carries the rule -- the send-to-backlog button has
   to sit outside the label or clicking it would toggle the carry checkbox. */
.carry__row {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .25rem;
  align-items: start; border-bottom: 1px solid var(--rule);
}
.carry__row:last-child { border-bottom: 0; }
.carry label {
  display: grid; grid-template-columns: auto minmax(0,1fr); gap: .5rem;
  align-items: start; font-size: .86rem; cursor: pointer;
  padding: .3rem 0;
  transition: color .15s var(--ease);
}
.carry label:hover { color: var(--accent); }
.carry input { margin-top: .25rem; accent-color: var(--accent); }
.carry__row > .btn { margin-top: .2rem; }

/* sparkline of the last seven days */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 2.4rem; }
.spark__bar { flex: 1; background: var(--rule-strong); border-radius: 2px 2px 0 0; min-height: 2px; transition: height .25s var(--ease); }
.spark__bar--today { background: var(--ink); }
.spark__labels { display: flex; gap: 3px; margin-top: .25rem; font: .62rem/1 var(--font-mono); color: var(--ink-faint); }
.spark__labels span { flex: 1; text-align: center; }

/* ---- 16-tables.css ---- */
/* --- tables ------------------------------------------------------------- */

/* Wraps any .sheet table that has more columns than a phone can show at
   once (the week grid, estimate-vs-actual, etc.) -- scrolls horizontally
   instead of crushing every column unreadably thin. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.sheet { width: 100%; border-collapse: collapse; font-size: .88rem; }
.sheet th, .sheet td { padding: .58rem .65rem; text-align: left; border-bottom: 1px solid var(--rule); }
.sheet thead th {
  font: 600 .68rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); border-bottom: 1px solid var(--rule-strong); white-space: nowrap;
}
.sheet td.num, .sheet th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sheet tbody tr { transition: background .15s var(--ease); }
.sheet tbody tr:hover { background: var(--paper-raised); }
.sheet tfoot td { font-family: var(--font-mono); font-weight: 600; border-top: 2px solid var(--ink); border-bottom: 0; }
.sheet .zero { color: var(--ink-faint); }
.sheet .weekend { background: color-mix(in srgb, var(--paper-sunk) 55%, transparent); }
.sheet__swatch { display: inline-block; width: .55rem; height: .55rem; border-radius: 1px; margin-right: .45rem; }

/* Note history compare (templates/note_history_compare.php): one line per
   row of TextDiff::diffForDisplay(), coloured the same "fg + tinted bg +
   border" way the overdue/due chips are, not colour alone. */
.diff {
  font: .82rem/1.55 var(--font-mono); border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden; background: var(--paper-sunk);
}
.diff-line { padding: 0 .65rem; white-space: pre-wrap; word-break: break-word; border-left: 3px solid transparent; }
.diff-line--add { background: var(--added-bg); border-left-color: var(--added-line); color: var(--added-fg); }
.diff-line--del { background: var(--overdue-bg); border-left-color: var(--overdue-line); color: var(--overdue-fg); text-decoration: line-through; text-decoration-thickness: 1px; }

/* horizontal bar used in reports */
.bar { display: grid; grid-template-columns: 8.5rem minmax(0,1fr) 4.5rem; gap: .75rem; align-items: center; padding: .35rem 0; }
.bar__label { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__track { height: .7rem; background: var(--paper-sunk); border-radius: 4px; box-shadow: inset 0 1px 2px rgba(27,36,48,.08); }
.bar__fill { height: 100%; border-radius: 4px; background: var(--ink); transition: width .3s var(--ease); }
.bar__value { font: .78rem/1 var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }

/* estimate vs actual, drawn as two stacked hairlines */
.variance { display: grid; gap: 3px; }
.variance__row { display: grid; grid-template-columns: 3.4rem minmax(0,1fr); gap: .5rem; align-items: center; font: .7rem/1 var(--font-mono); color: var(--ink-faint); }
.variance__bar { height: .55rem; border-radius: 3px; }
.variance__bar--est { background: var(--rule-strong); }
.variance__bar--act { background: var(--s-wip); }
.variance__bar--act.over { background: var(--overdue-fg); }

/* ---- 17-forms.css ---- */
/* --- forms -------------------------------------------------------------- */

.field { display: grid; gap: .32rem; margin-bottom: .95rem; }
.field > label, .label {
  font: 600 .7rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft);
}
.field__help { font-size: .78rem; color: var(--ink-faint); }
input[type="text"], input[type="date"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; padding: .5rem .6rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--paper-raised); color: var(--ink);
  font: 14px/1.45 var(--font-ui);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type="text"]:focus, input[type="date"]:focus, input[type="password"]:focus,
input[type="search"]:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
textarea { font-family: var(--font-mono); font-size: 13px; resize: vertical; min-height: 7rem; }


input[type="color"] { width: 2.6rem; height: 2.1rem; padding: 2px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper-raised); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1rem; }
/* A form with many fields (the task edit page) reads as a wall of boxes at
   11rem -- wider columns settle it into fewer, evenly filled rows instead. */
.grid2--wide { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1.5rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.inline-form { display: inline; }

/* ---- 18-md-editor.css ---- */
/* The textarea remains the editable, accessible source of truth. The pre
   beneath it mirrors the text for syntax colour without changing submission,
   selection, copy/paste, or the no-JS experience. */
.md-editor {
  position: relative;
  overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper-raised); box-shadow: var(--shadow);
}
.md-editor:focus-within { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
/* Sits above the toolbar, outside it, so Edit <-> Preview (which hides the
   toolbar's own tools/status) never hides this too -- same warning, same
   position, in both modes, since leaving the page loses the edit either way. */
.md-editor__unsaved { display: flex; align-items: center; gap: .5rem; padding: .5rem .8rem; border-bottom: 1px solid var(--due-line); background: var(--due-bg); color: var(--due-fg); font: 600 .82rem/1.3 var(--font-ui); }
.md-editor__unsaved[hidden] { display: none; }
.md-editor__toolbar, .md-editor__status {
  display: flex; align-items: center; gap: .4rem; min-height: 2.5rem;
  padding: .3rem .7rem; background: var(--paper-alt); color: var(--ink-faint);
  font: .7rem/1 var(--font-mono);
}
.md-editor__toolbar { justify-content: space-between; border-bottom: 1px solid var(--rule); }
.md-editor__tools { display: flex; gap: .15rem; }
.md-editor__toolbar .btn { color: var(--ink-soft); }
.md-editor__toolbar .btn:hover { color: var(--accent); background: var(--accent-wash); }
.md-editor__mode { display: inline-flex; align-items: center; gap: .35rem; padding-right: .35rem; }
.md-editor__workspace { --md-line-height: 1.65; position: relative; display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); height: 28rem; min-height: 0; background: var(--paper-raised); overflow: hidden; }
.md-editor__gutter, .md-editor__highlight, .md-editor--enhanced .md-editor__workspace textarea {
  margin: 0; padding-top: 1rem; padding-bottom: 1rem;
  font: .86rem/var(--md-line-height) var(--font-mono); tab-size: 2; white-space: pre; overflow: auto;
}
.md-editor__gutter { grid-column: 1; z-index: 2; padding-right: .8rem; text-align: right; user-select: none; color: var(--ink-faint); border-right: 1px solid var(--rule); overflow: hidden; }
.md-editor__gutter span { display: block; height: calc(var(--md-line-height) * 1em); }
.md-editor__highlight { grid-column: 2; grid-row: 1; padding-left: 1rem; color: var(--ink); pointer-events: none; overflow: auto; }
/* Bold tokens (headings, priority markers) can stretch a text-only line's
   natural line box taller than its plain-weight neighbours even under a
   fixed line-height -- pinning each line to the gutter's own row height
   keeps the overlay from drifting out of alignment with the textarea the
   further down the document (and the more bold lines) you scroll past. */
.md-editor__highlight > div { width: max-content; min-width: 100%; height: calc(var(--md-line-height) * 1em); line-height: inherit; overflow: hidden; }
.md-editor--enhanced .md-editor__workspace textarea { grid-column: 2; grid-row: 1; z-index: 1; width: 100%; min-height: 0; padding-left: 1rem; padding-right: 1rem; border: 0; border-radius: 0; resize: none; overflow: auto; background: transparent; color: transparent; caret-color: var(--ink); -webkit-text-fill-color: transparent; }
.md-editor--enhanced .md-editor__workspace textarea:focus { outline: none; box-shadow: none; }
.md-token--heading { color: var(--accent); font-weight: 600; }
.md-token--bullet, .md-token--checkbox { color: var(--s-wip); }
.md-token--id { color: var(--s-done); }
.md-token--key { color: var(--s-waiting); }
.md-token--tag { color: var(--s-question); }
.md-token--priority { color: var(--overdue-fg); font-weight: 700; }
.md-token--note { color: var(--ink-faint); font-style: italic; }
.md-editor__status { justify-content: space-between; border-top: 1px solid var(--rule); background: var(--paper-alt); }
.md-editor__status span:last-child { margin-left: auto; }
.md-editor__preview { display: none; grid-column: 2; grid-row: 1; min-width: 0; min-height: 28rem; overflow: auto; padding: .65rem .8rem; background: var(--paper-raised); }
.md-editor__preview.prose { width: 100%; max-width: none; padding: .8rem .9rem; }
.md-editor__preview.prose h2,
.md-editor__preview.prose h3,
.md-editor__preview.prose h4,
.md-editor__preview.prose h5,
.md-editor__preview.prose h6 { font-family: var(--font-ui); letter-spacing: 0; }
.md-editor__preview.prose h2 { font-size: 1.45rem; }
.md-editor__preview.prose h3 { font-size: 1.2rem; }
.md-editor__preview.prose h4 { font-size: 1.05rem; }
.md-editor__preview:focus { outline: none;  }
.md-editor--view-split .md-editor__workspace { grid-template-columns: 3.25rem minmax(0, 1fr) minmax(0, 1fr); }
.md-editor--view-split .md-editor__preview { display: block; grid-column: 3; border-left: 1px solid var(--rule); }
.md-editor--view-preview .md-editor__gutter, .md-editor--view-preview .md-editor__highlight, .md-editor--view-preview .md-editor__workspace textarea { display: none; }
.md-editor--view-preview .md-editor__preview { display: block; grid-column: 1 / -1; cursor: text; }
/* Preview mode drops the formatting tools and the Ln/Col status bar --
   neither means anything while you're not editing -- but keeps the
   Source/Split/Preview view buttons visible: switching back to Source
   is only ever a deliberate button press, never a side effect of
   clicking the rendered text. */
.md-editor--view-preview .md-editor__tools, .md-editor--view-preview .md-editor__status { display: none; }
.md-editor--blurred.md-editor--view-source .md-editor__gutter, .md-editor--blurred.md-editor--view-source .md-editor__highlight, .md-editor--blurred.md-editor--view-source .md-editor__workspace textarea { display: none; }
.md-editor--blurred.md-editor--view-source .md-editor__preview { display: block; grid-column: 1 / -1; cursor: text; }
.md-editor__view-buttons { display: flex; gap: .1rem; margin-left: auto; }
.md-view-button { padding-inline: .55rem; color: var(--ink-faint); font-size: .7rem; }
.md-view-button.is-active { color: var(--accent); background: var(--accent-wash); }
.md-editor--drop { outline: 2px dashed var(--accent); outline-offset: 4px; }

.md-editor__guide {
  display: grid; gap: .7rem; margin-top: .85rem; padding: .85rem 1rem;
  border: 1px solid var(--rule); border-left: 3px solid var(--ink);
  border-radius: var(--radius-lg); background: var(--paper-raised); color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  font: .74rem/1.45 var(--font-mono);
}
.md-editor__guide-heading { display: flex; align-items: baseline; gap: .6rem; padding-bottom: .55rem; border-bottom: 1px solid var(--rule); }
.md-editor__guide-heading strong { color: var(--ink); font-size: .78rem; }
.md-editor__guide-heading span { color: var(--ink-faint); }
.md-editor__guide-row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .75rem; align-items: start; }
.md-editor__guide-label { color: var(--ink-faint); font-size: .66rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.md-editor__guide-statuses, .md-editor__guide-tokens { display: flex; flex-wrap: wrap; gap: .35rem .7rem; }
.md-editor__guide-item { white-space: nowrap; }
.md-editor__guide-item--open { color: var(--ink-soft); }
.md-editor__guide-item--wip { color: var(--s-wip); }
.md-editor__guide-item--blocked { color: var(--overdue-fg); }
.md-editor__guide-item--done { color: var(--s-done); }
.md-editor__guide-item--dropped { color: var(--ink-faint); }
.md-editor__guide kbd { padding: .1rem .28rem; border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--paper-sunk); color: var(--ink); font-size: .9em; }
.md-editor__guide-note { margin: 0; padding-top: .55rem; border-top: 1px solid var(--rule); color: var(--ink-faint); }
.md-editor__guide-note kbd { color: var(--ink-soft); }
.md-preview__code { position: relative; }
.md-preview__code button { position: absolute; top: .45rem; right: .45rem; z-index: 1; border: 1px solid var(--rule); border-radius: var(--radius); padding: .3rem .45rem; background: var(--paper-raised); color: var(--ink-soft); cursor: pointer; }
.md-preview__code button:hover { color: var(--accent); }
.hl-comment { color: var(--ink-faint); font-style: italic; }
.hl-string { color: var(--s-done); }
.hl-number, .hl-boolean { color: var(--s-waiting); }
.hl-keyword { color: var(--accent); font-weight: 600; }
.hl-function { color: var(--s-wip); }
.hl-type, .hl-tag { color: var(--s-question); }
.hl-attr { color: var(--s-wip); }
.hl-key { color: var(--s-waiting); }
.hl-null { color: var(--ink-faint); font-style: italic; }
.md-frontmatter { margin-bottom: 1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-sunk); }
.md-frontmatter summary { padding: .45rem .7rem; cursor: pointer; color: var(--ink-soft); font: .72rem/1 var(--font-mono); }
.md-frontmatter pre { margin: 0; border-top: 1px solid var(--rule); padding: .7rem; font: .78rem/1.5 var(--font-mono); white-space: pre-wrap; }
.md-empty { color: var(--ink-faint); font-style: italic; }
.md-editor__preview table { width: 100%; border-collapse: collapse; margin: .8rem 0; font-size: .88em; }
.md-editor__preview th, .md-editor__preview td { border: 1px solid var(--rule-strong); padding: .35rem .5rem; text-align: left; }
.md-editor__preview th { background: var(--paper-sunk); font-weight: 600; }
.md-editor__preview mark { padding: 0 .15em; background: var(--due-bg); color: var(--ink); }
.md-editor__preview input[type="checkbox"] { accent-color: var(--accent); }

/* ---- 19-task-editor.css ---- */
/* --- task editor ------------------------------------------------------- */

.task-page { grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem); gap: clamp(1.25rem, 3vw, 2.5rem); padding-bottom: 4.5rem; }
.task-main { min-width: 0; padding: clamp(1.25rem, 3vw, 2.5rem); border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper-raised); box-shadow: var(--shadow-sm); }
.task-header { margin: 0 0 1.4rem; }
.task-header .datehead__row { align-items: center; }
.task-breadcrumb { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--ink-soft); font-size: .82rem; }
.task-breadcrumb span { color: var(--ink-faint); }
.task-breadcrumb a:first-child { color: var(--accent); font-weight: 600; }
.task-kicker, .eyebrow { margin: .4rem 0 0; color: var(--ink-faint); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.task-editor { margin-bottom: 2.3rem; }

/* Blank notes start collapsed -- most tasks never get one, so showing the
   full toolbar/editor chrome for nothing wastes the vertical space this
   page needs most (the ledger sits right below it). Reuses the same
   hidden-marker chevron convention as .subtree__toggle/.nav-toggle. */
.note-disclosure__summary {
  display: inline-flex; align-items: center; gap: .4rem;
  cursor: pointer; list-style: none;
  font-size: .95rem; font-weight: 600; color: var(--ink);
  margin-bottom: .4rem;
}
.note-disclosure__summary::-webkit-details-marker { display: none; }
.note-disclosure__summary::after { content: "Add context, links, or the next step."; color: var(--ink-faint); font-size: .78rem; font-weight: 400; }
.note-disclosure__summary i { color: var(--ink-faint); font-size: .7em; transition: transform .15s var(--ease); }
.note-disclosure[open] > .note-disclosure__summary i { transform: rotate(90deg); }

/* Keeps "Save changes" reachable without scrolling back up, on the long
   note-and-history form -- floats above everything else on the task page
   (including inside the task modal's iframe, its own stacking context) at
   the bottom of the viewport rather than sitting wherever the form flow
   happens to end. */
.task-save-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 100rem; margin: 0 auto;
  padding: .85rem clamp(1rem, 4vw, 2.5rem);
  padding-bottom: max(.85rem, env(safe-area-inset-bottom));
  background: var(--paper-alt);
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 16px oklch(26.5% 0.022 265 / .08);
}
@media (prefers-contrast: more), (forced-colors: active) {
  .task-save-bar { border-top-width: 2px; }
}
.task-hero { margin-bottom: 2rem; }
.task-title-input { width: 100%; padding: 0; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; color: var(--ink); font-size: clamp(1.8rem, 3vw, 2.7rem) !important; font-weight: 650 !important; letter-spacing: -.035em; line-height: 1.12 !important; }
.task-title-input:focus { outline: none; }
.task-hero__meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.task-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: var(--radius-full); background: var(--paper-alt); color: var(--ink-soft); font-size: .76rem; font-weight: 600; }
.task-badge--wip { background: color-mix(in srgb, var(--s-wip) 14%, var(--paper-raised)); color: var(--s-wip); }
.task-badge--waiting { background: var(--due-bg); color: var(--due-fg); }
.task-badge--done { background: var(--added-bg); color: var(--added-fg); }
.task-badge--dropped { background: var(--paper-sunk); color: var(--ink-faint); }
.task-badge--priority-1 { background: var(--overdue-bg); color: var(--overdue-fg); }
.task-badge--priority-2 { background: var(--due-bg); color: var(--due-fg); }
.task-badge--priority-3 { background: var(--paper-sunk); color: var(--ink-faint); }
.task-badge--backlog { background: var(--paper-sunk); color: var(--ink-soft); }
.task-date { display: inline-flex; align-items: center; gap: .35rem; color: var(--ink-faint); font-size: .78rem; }
.task-backlog-toggle { display: flex; align-items: center; gap: .4rem; margin-top: .4rem; font-size: .78rem; color: var(--ink-soft); cursor: pointer; }
.task-backlog-toggle input { margin: 0; }
.task-section-heading { display: flex; align-items: baseline; gap: .7rem; margin: 0 0 1rem; }
.task-section-heading h2 { font-size: 1rem; }
.task-section-heading p { margin: 0; color: var(--ink-faint); font-size: .78rem; }
.task-meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.25rem; }
.task-meta-grid .field { min-width: 0; }
.task-meta-grid .field:nth-child(1), .task-meta-grid .field:nth-child(2) { grid-column: span 1; }
.task-meta-grid .field:has(#f-tags), .task-tags-field { grid-column: 1 / -1; }
.task-page .field > label { font: 500 .78rem/1.2 var(--font-ui); letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
.task-page input[type="text"], .task-page input[type="date"], .task-page select { border-color: var(--rule); border-radius: var(--radius); background: var(--paper); }
.task-page input[type="text"]:focus, .task-page input[type="date"]:focus, .task-page select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.select-badge { border-radius: var(--radius-full) !important; font-weight: 600 !important; cursor: pointer; }
/* :has(option:checked) is live -- it re-evaluates on every selection change
   with no JS, so the pill recolours the instant "Priority" is changed, same
   as the read-only .task-badge--priority-N above but for the editable
   control. */
.select-badge--priority { background: var(--paper-alt) !important; color: var(--ink-soft) !important; }
.select-badge--priority:has(option[value="1"]:checked) { background: var(--overdue-bg) !important; color: var(--overdue-fg) !important; }
.select-badge--priority:has(option[value="2"]:checked) { background: var(--due-bg) !important; color: var(--due-fg) !important; }
.select-badge--priority:has(option[value="3"]:checked) { background: var(--paper-sunk) !important; color: var(--ink-faint) !important; }
.task-note-field { margin-top: .75rem; }
.task-page .md-editor { border: 0; border-top: 1px solid var(--rule); border-radius: 0; box-shadow: none; background: transparent; }
.task-page .md-editor__toolbar { padding-inline: 0; background: transparent; border-bottom-color: var(--rule); }
.task-page .md-editor__workspace { grid-template-columns: 3.25rem minmax(0, 1fr); height: 28rem; background: transparent; }
.task-page .md-editor__gutter,
.task-page .md-editor__highlight,
.task-page .md-editor--enhanced .md-editor__workspace textarea {
  font: .86rem/var(--md-line-height) var(--font-mono);
}
.task-page .md-editor__gutter { padding-right: .8rem; }
.task-page .md-editor__highlight,
.task-page .md-editor--enhanced .md-editor__workspace textarea { padding-left: 1rem; }
.task-page .md-editor--enhanced .md-editor__workspace textarea { padding-right: 1rem; }
.task-page .md-editor__status { padding-inline: 0; background: transparent; border-top-color: var(--rule); }
.task-danger { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--ink-faint); font-size: .78rem; }
.task-danger div { display: grid; gap: .15rem; }
.task-danger strong { color: var(--ink-soft); font-size: .8rem; }
.task-danger__link { padding: 0; border: 0; background: none; color: var(--overdue-fg); font: 500 .78rem/1.3 var(--font-ui); cursor: pointer; }
.task-danger__link:hover { text-decoration: underline; }
.task-sidebar { position: sticky; top: 5.5rem; }
.task-sidebar .panel { border-left: 1px solid var(--rule); }
.task-sidebar .panel__title { font: 600 1rem/1.2 var(--font-ui); letter-spacing: 0; text-transform: none; }
.timer-widget { padding: 1.15rem; }
.timer-widget__summary { display: flex; gap: 1.5rem; margin: 1.15rem 0 .65rem; }
.timer-widget__summary div { display: grid; gap: .1rem; }
.timer-widget__summary strong { font: 600 1.45rem/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.timer-widget__summary span { color: var(--ink-faint); font-size: .72rem; }
.timer-widget__track { height: .4rem; overflow: hidden; border-radius: var(--radius-full); background: var(--paper-sunk); }
.timer-widget__track span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.timer-widget__amount { margin-top: 1.1rem; }
.quick-times { display: flex; gap: .35rem; margin-top: .35rem; }
.quick-time { padding: .3rem .55rem; border: 1px solid var(--rule); border-radius: var(--radius-full); background: var(--paper); color: var(--ink-soft); font: 500 .74rem/1 var(--font-ui); cursor: pointer; }
.quick-time:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }
.timer-widget__start { width: 100%; margin-top: .3rem; }
@media (max-width: 62rem) {
  .task-page { grid-template-columns: minmax(0, 1fr); }
  .task-sidebar { position: static; }
}
@media (max-width: 42rem) { .task-main { padding: 1rem; } .task-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap-inline: .75rem; } .task-meta-grid .field:has(#f-tags), .task-tags-field { grid-column: 1 / -1; } .task-danger { align-items: flex-start; flex-direction: column; } }

.field--project { position: relative; }
.add-project-popover {
  position: absolute; top: calc(100% + .3rem); left: 0; z-index: 20;
  display: grid; gap: .4rem; width: max(100%, 14rem); padding: .65rem;
  background: var(--paper-raised); border: 1px solid var(--rule-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.add-project-popover[hidden] { display: none; }
.add-project-popover input {
  width: 100%; padding: .35rem .5rem; border: 1px solid var(--rule); border-radius: var(--radius);
  font: 500 .82rem/1.3 var(--font-ui); background: var(--paper);
}
.add-project-popover__actions { display: flex; gap: .4rem; margin-top: .1rem; }
.add-project-popover__actions .btn { flex: 1; padding: .3rem .5rem; font-size: .78rem; }
.add-project-popover__error { margin: 0; color: var(--overdue-fg); font-size: .78rem; }

/* Searchable project picker -- see 30-project-combobox.js. */
.project-combobox { position: relative; }
.project-combobox__input { width: 100%; }
.project-combobox__list {
  position: absolute; top: calc(100% + .2rem); left: 0; right: 0; z-index: 25;
  max-height: 16rem; overflow-y: auto; margin: 0; padding: .25rem; list-style: none;
  background: var(--paper-raised); border: 1px solid var(--rule-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.project-combobox__list[hidden] { display: none; }
.project-combobox__list li {
  padding: .35rem .5rem; border-radius: calc(var(--radius) - 2px);
  font: 500 .85rem/1.3 var(--font-ui); cursor: pointer;
}
.project-combobox__list li[aria-selected="true"] { color: var(--accent); }
.project-combobox__list li.is-active { background: var(--accent-wash); }
.project-combobox__add { border-top: 1px solid var(--rule); margin-top: .15rem; color: var(--ink-soft); }

/* ---- 20-notes.css ---- */
/* --- notes -------------------------------------------------------------- */

.notecard {
  border: 1px solid var(--rule); border-left: 3px solid var(--kind, var(--ink-faint));
  border-radius: var(--radius-lg); background: var(--paper-raised);
  box-shadow: var(--shadow-sm);
  padding: .9rem 1.05rem; margin-bottom: .9rem;
}
.notecard--pinned { border-color: var(--rule-strong); box-shadow: var(--shadow); }
.notecard__head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
.notecard__title { font-size: 1rem; font-weight: 600; }
.notecard__pinned { color: var(--accent); font: 700 .68rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.notecard__meta { margin-left: auto; font: .72rem/1 var(--font-mono); color: var(--ink-faint); display: flex; gap: .5rem; align-items: center; }
.prose { font-family: var(--font-prose); font-size: 1rem; line-height: var(--leading-prose); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { margin: 1.1em 0 .4em; font-size: 1em; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: .55em 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li.md-task { list-style: none; margin-left: -1.3em; }
.prose code { font: .86em/1 var(--font-mono); background: var(--paper-sunk); padding: .1em .3em; border-radius: 3px; }
.prose pre.md-code {
  background: var(--paper-sunk); border-left: 2px solid var(--rule-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .75rem .85rem; overflow-x: auto; font: 12.5px/1.5 var(--font-mono);
}
.prose pre.md-code code { background: none; padding: 0; }
/* Light theme only: --paper-sunk reads as a visible gray box against the
   near-white card/preview it sits in -- the same "muddy" mismatch .md-editor
   itself works around above, so a code block flushes to the same
   --paper-raised its parent (.notecard, .md-editor__preview) already uses
   instead of standing out as a separate panel. Dark theme's --paper-sunk
   already reads as a proper recess against its darker parent, so it's
   untouched. */
:root:not([data-theme="dark"]) .prose pre.md-code { background: var(--paper-raised); }
/* The editor's live preview reuses the app's own .prose pre.md-code box
   (background/border/padding/font) so a code block looks identical whether
   it's mid-edit or already saved -- this only adds the extra right-hand
   room its copy button needs, at matching specificity so it wins despite
   coming later in a still-applicable .prose pre.md-code padding shorthand. */
.md-preview__code pre.md-code { padding-right: 3rem; }
.prose blockquote { border-left: 2px solid var(--accent); padding-left: .8rem; color: var(--ink-soft); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 1.2em 0; }
.prose .md-tag { font: .82em/1 var(--font-mono); color: var(--s-wip); }
.prose table.md-table { width: 100%; margin: .8em 0; border-collapse: collapse; font-size: .92em; }
.prose table.md-table th, .prose table.md-table td { border: 1px solid var(--rule); padding: .4em .6em; text-align: left; }
.prose table.md-table th { background: var(--paper-sunk); font-weight: 600; }
.prose a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--rule-strong); }

/* --- help page: heading index --------------------------------------------
   Stacked above the article by default (phone/tablet); at desktop width it
   becomes a sticky left sidebar instead, so long-scroll pages like help.md
   keep the index in view without repeating .prose's own two-column rules. */
.help-layout { display: flex; flex-direction: column; gap: 1.2rem; }
/* .masthead is `position: sticky; top: 0` (see 04-masthead.css) with no
   fixed height of its own -- it's padding + content, roughly 3.2rem tall.
   Without this, jumping to a .help-toc anchor lands the heading right at
   the viewport top, straight under that sticky bar. Scoped to .prose inside
   .help-layout specifically so it doesn't nudge unrelated in-page anchors
   (e.g. note-history diffs) that don't sit under this same TOC. */
.help-layout .prose h2,
.help-layout .prose h3,
.help-layout .prose h4,
.help-layout .prose h5 { scroll-margin-top: 4.5rem; }
.help-toc {
  border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper-raised);
  padding: .9rem 1.2rem;
}
.help-toc__title {
  margin: 0 0 .5rem; font: 600 .72rem/1 var(--font-mono); text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-faint);
}
.help-toc ul { list-style: none; margin: 0; padding: 0; }
.help-toc li { margin: 0; }
.help-toc a {
  display: block; padding: .3rem 0; font-size: .88rem; line-height: 1.4;
  text-decoration: none; color: var(--ink-soft);
}
.help-toc a:hover { color: var(--ink); text-decoration: underline; }
.help-toc .help-toc__level-3 a { padding-left: 1em; font-size: .84rem; color: var(--ink-faint); }

@media (min-width: 60rem) {
  .help-layout { flex-direction: row; align-items: flex-start; gap: 2rem; }
  .help-toc { flex: 0 0 15rem; position: sticky; top: 1.2rem; max-height: calc(100vh - 2.4rem); overflow-y: auto; }
  .help-layout__article { flex: 1 1 auto; min-width: 0; }
}

/* ---- 21-misc.css ---- */
/* --- misc --------------------------------------------------------------- */

.flashes { display: grid; gap: .45rem; margin-bottom: 1.3rem; }
.flash {
  padding: .55rem .8rem; border-radius: var(--radius); font-size: .88rem;
  border-left: 3px solid var(--s-done); background: var(--paper-raised);
  box-shadow: var(--shadow-sm);
}
.flash--warn { border-left-color: var(--s-waiting); }
.flashes--toast { position: fixed; inset: auto 1rem 1rem; z-index: 80; margin: 0; pointer-events: none; }
.flashes--toast .flash { opacity: 1; }
.flashes--toast .flash--dismissing { animation: toast-disappear .4s ease forwards; }
@keyframes toast-disappear {
  0%, 75% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(.35rem); }
}
@media (prefers-reduced-motion: reduce) {
  .flashes--toast .flash--dismissing { animation: none; opacity: 0; }
}

.empty {
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper-raised); box-shadow: var(--shadow-sm);
  padding: 2.1rem 1.4rem; text-align: center; color: var(--ink-soft);
}
.empty h3 { font-size: .95rem; margin-bottom: .3rem; }
.empty p { margin: 0; font-size: .86rem; }

.section { margin-bottom: 2.4rem; }
.section__head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: .8rem; padding-bottom: .4rem; border-bottom: 1px solid var(--rule); }
.section__head h2 { font: 600 .78rem/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; }
.section__head .spacer { margin-left: auto; }

.history-lazy__summary {
  cursor: pointer; list-style: none;
}
.history-lazy__summary::-webkit-details-marker { display: none; }
.history-lazy__summary i { color: var(--ink-faint); transition: transform .15s var(--ease); }
.history-lazy[open] > .history-lazy__summary i { transform: rotate(90deg); }
.history-lazy__body { padding-top: .2rem; }
.muted { color: var(--ink-faint); }
.mono { font-family: var(--font-mono); }
.nums { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.wrap { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.tabs { display: flex; gap: .2rem; flex-wrap: wrap; }
.tabs a { padding: .28rem .7rem; border: 1px solid transparent; border-radius: var(--radius-full); font: .8rem/1.4 var(--font-mono); color: var(--ink-soft); transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.tabs a:hover { background: var(--paper-sunk); text-decoration: none; }
.tabs a[aria-current] { border-color: var(--rule-strong); background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-sm); }

.helpsheet {
  position: fixed; inset: auto 1rem 1rem auto; z-index: 70;
  max-width: 24rem; padding: 1.1rem 1.2rem;
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper-raised); box-shadow: var(--shadow-lg);
  font-size: .84rem;
}
.helpsheet[hidden] { display: none; }
.helpsheet dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: .5rem 0 0; }
.helpsheet dt { font: .78rem/1.5 var(--font-mono); color: var(--accent); }
.helpsheet dd { margin: 0; color: var(--ink-soft); }

.login { max-width: 20rem; margin: 18vh auto; }

/* ---- 22-subtree.css ---- */
.subtree { padding-left: var(--indent); }
/* Each nested subtree contributes one indent step. Its body is already
  offset by every ancestor, so the rail only needs the state-mark position. */
.subtree__body { position: relative; }
.subtree__body::before {
  content: ""; position: absolute; z-index: 0;
  left: var(--margin-rule); top: 0; bottom: 0;
  width: var(--line-width); background: var(--rule);
}
.subtree__toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  margin: .3rem 0 .3rem calc(var(--margin-rule) - .25rem);
  cursor: pointer; list-style: none;
  font: .74rem/1.4 var(--font-mono); color: var(--ink-faint);
  transition: color .15s var(--ease);
}
.subtree__toggle::-webkit-details-marker { display: none; }
.subtree__toggle::before { content: '\f054'; font: 900 .68em/1 'Font Awesome 6 Free'; }
.subtree[open] > .subtree__toggle::before { content: '\f078'; }
.subtree__toggle:hover { color: var(--ink); }
/* A folded subtree still needs to say "something in here needs you" --
   this dot is the only signal of a blocked descendant once collapsed. */
.subtree__blocked-dot {
  width: .4rem; height: .4rem; border-radius: 50%;
  background: var(--s-waiting); flex: none;
}

.subtask-add { padding-left: var(--indent); margin: 0 0 .35rem; }
.subtask-add summary {
  display: inline-block; cursor: pointer; list-style: none;
  font: .74rem/1.4 var(--font-mono); color: var(--ink-faint);
  transition: color .15s var(--ease);
}
.subtask-add summary::-webkit-details-marker { display: none; }
.subtask-add summary:hover { color: var(--ink); }
.subtask-add[open] summary { margin-bottom: .3rem; }
.subtask-add__form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding-left: 3.1rem; }
.subtask-add__form textarea {
  flex: 1; min-width: 0; font: .82rem/1.3 var(--font-mono); color: var(--ink);
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: .32rem .55rem; resize: none; overflow-y: auto; max-height: 10rem;
}
.subtask-add__form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.subtask-add__form .capture__hint,
.subtask-add__form .capture__preview,
.subtask-add__form .capture__status { flex-basis: 100%; margin-left: 0; margin-right: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---- 23-responsive.css ---- */
/* --- tablet/phone masthead: hamburger nav --------------------------------
   Below 720px the section links (Day/Week/Reports/Notes/Settings) don't
   reliably fit next to search + the theme toggle + the account controls,
   so they move behind a hamburger button instead of wrapping or scrolling.
   The <details>/<summary> in layout.php makes this a native disclosure --
   no JavaScript involved, same pattern as the capture-add and subtask-add
   controls elsewhere in this stylesheet.
   -------------------------------------------------------------------------*/
@media (max-width: 45rem) {
  .masthead > nav { display: none; }
  .nav-toggle { display: inline-flex; position: relative; }
  .nav-toggle__panel {
    display: none;
    position: absolute; top: calc(100% + .5rem); left: 0; z-index: 55;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch;
    min-width: 11rem; padding: .35rem;
    background: var(--paper-raised); border: 1px solid var(--rule);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  }
  .nav-toggle[open] .nav-toggle__panel { display: flex; }
  .nav-toggle__panel a { padding: .55rem .8rem; border-radius: var(--radius); }
  .nav-toggle__divider { border: 0; border-top: 1px solid var(--rule); margin: .3rem .2rem; }
  .nav-toggle__panel form[role="search"] { padding: .2rem .5rem .35rem; }
  .nav-toggle__panel input[type="search"] { width: 100%; }
  .nav-toggle__theme {
    justify-content: flex-start; width: 100%;
    padding: .55rem .8rem; border-radius: var(--radius);
    border-color: transparent; background: none; color: var(--ink-soft);
  }
  .nav-toggle__theme:hover { background: var(--paper-alt); color: var(--ink); }

  /* The search box and theme toggle move into the panel above -- these are
     the same controls, just the always-visible masthead copies, hidden here
     the same way the plain nav is. */
  .masthead__end form[role="search"],
  .masthead__end [data-theme-toggle],
  .masthead__end form[action="/logout"] { display: none; }
  .masthead__end { flex-wrap: nowrap; gap: .4rem; }

  .md-editor__toolbar { align-items: flex-start; flex-wrap: wrap; row-gap: .25rem; }
  .md-editor__tools { flex-wrap: wrap; }
  .md-editor__view-buttons { margin-left: 0; }
  .md-editor--view-split .md-editor__workspace { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .md-editor--view-split .md-editor__preview { grid-column: 2; grid-row: 2; border-top: 1px solid var(--rule); border-left: 0; }
}

/* --- phone layout --------------------------------------------------------
   Below this width the ledger row's three-column grid no longer fits side
   by side without crushing the title down to a handful of characters, so
   it switches to stacking instead of shrinking.
   -------------------------------------------------------------------------*/
@media (max-width: 30rem) {
  :root { --indent: 1.32rem; --margin-rule: .9rem; }

  .shell { padding-inline: .75rem; padding-bottom: 4.5rem; }

  /* The title and search/filter access stay reachable while scrolling a
     long ledger, per the mobile spec's sticky-header rule -- just the
     masthead itself, not the per-day date header too, since that one's
     height isn't fixed enough to offset a second sticky bar under it
     without either a gap or an overlap. */
  .masthead { flex-wrap: wrap; row-gap: .5rem; padding-block: .5rem; position: sticky; top: 0; z-index: 60; background: var(--paper); }
  .masthead__mark { padding-right: .75rem; }

  .md-editor__workspace { grid-template-columns: 2.5rem minmax(0, 1fr); min-height: 24rem; }
  .md-editor__gutter, .md-editor__highlight, .md-editor--enhanced .md-editor__workspace textarea { font-size: .78rem; }
  .md-editor__gutter { padding-right: .55rem; }
  .md-editor__highlight, .md-editor--enhanced .md-editor__workspace textarea { padding-left: .75rem; padding-right: .75rem; }
  .md-editor__guide-row { grid-template-columns: 1fr; gap: .25rem; }
  .md-editor__guide-heading { align-items: flex-start; flex-direction: column; gap: .15rem; }

  .datehead__nav { flex-wrap: wrap; }

  /* 44px touch targets for the filter toggle and each chip in the bar,
     same rule of thumb as the mark and the per-row icon buttons below. */
  .filter-bar__toggle { min-height: 2.75rem; }
  .filter-bar__chip { min-height: 2.75rem; }
  .subtask-add__form > button[type="submit"] {
    min-width: 4.25rem; min-height: 2.75rem; padding: .55rem .8rem;
    border: 1px solid var(--rule-strong); background: var(--paper-raised); color: var(--ink);
  }

  /* Column widened from 2.5rem to fit a 44px (2.75rem) mark button flush
     against the left edge -- see .entry__mark button below. The row stays
     three columns here too: once the timer/subtask/pin/drag actions
     collapse behind the "more actions" button (below), the side column
     only has to fit a time badge plus that one icon button, which shares
     the row with the title fine -- giving it a full-width row of its own
     would waste a nearly-empty row for the sake of one small button. */
  .entry, .entry--child {
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    touch-action: pan-y;
  }
  .entry__mark { grid-column: 1; }
  .entry__body { grid-column: 2; }
  .entry__side {
    grid-column: 3;
    position: relative; /* anchors the .entry__actions dropdown below */
  }
  /* Extends through the side column instead of stopping at the body column's
     edge -- notes tend to run long (pasted links, multi-line context) and
     that space is otherwise empty on the note's own row. Left edge stays at
     column 2 so the note still lines up under its task's title rather than
     the checkbox. */
  .entry__note { grid-column: 2 / -1; }

    /* Keep the row mark compact on phones; action buttons in the menu retain
      their larger touch targets. */
  .btn--icon { min-width: 2.75rem; min-height: 2.75rem; padding: .32rem .48rem; }
    .entry__mark button { width: 2.25rem; height: 2.25rem; margin-left: max(0px, calc(var(--margin-rule) - 1.125rem)); font-size: .9rem; }
    .subtree__toggle {
      padding-left: 0;
      margin-left: calc(var(--margin-rule) - .25rem);
    }

  /* Rule 10/11: only the checkbox and the expand/collapse disclosure stay
     directly on the row. Everything else in .entry__actions (timer,
     add-subtask, pin, drag handle) moves behind this "more actions" button,
     which is otherwise display:none (see base rule above). */
  .btn.entry__menu-toggle { display: inline-flex; }
  .entry__actions {
    display: none;
    position: absolute; right: 0; top: 100%; z-index: 55;
    flex-direction: column; align-items: stretch; gap: .1rem;
    min-width: 10rem; margin-top: .3rem; padding: .35rem;
    background: var(--paper-raised); border: 1px solid var(--rule);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  }
  /* Every .entry is its own stacking context (position: relative, see base
     rule above), all at the same z-index, so paint order between rows
     falls back to DOM order -- the row below an open dropdown would
     otherwise paint over it and steal its clicks, since the dropdown
     hangs down past its own row's bottom edge. Raising the open row above
     that shared baseline fixes both painting and hit-testing. */
  .entry--menu-open { z-index: 60; }
  .entry--menu-open .entry__actions { display: flex; }
  .entry__actions .btn--quiet {
    opacity: 1; width: 100%; justify-content: flex-start; gap: .5rem;
    padding: .55rem .65rem; min-height: 2.75rem;
  }
  .entry__actions .btn--quiet.is-active { background: var(--accent-wash); }
  .entry__actions .btn--quiet[disabled] { opacity: .4; }
  /* Each dropdown row has a whole line to itself here, unlike the packed
     icon-only strip above the breakpoint -- show the label so "which icon
     was that again" isn't a tap-and-see guess. */
  .entry__actions .entry__action-label {
    display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 500 .84rem/1.3 var(--font-ui);
  }

  /* Rule 2/13: cap the badges shown by default to the ones that most affect
     what to do next -- priority and due/overdue. Ticket refs, "carried
     from", and tags are still on the task's own page, just not crowding
     the row here. */
  .entry__sub .pill--carried,
  .entry__sub .pill--tag,
  .entry__sub .pill:not([class*="pill--"]) { display: none; }

  /* Rule 4/15: touch-friendly padding and whitespace between rows instead
     of a divider line on every single one -- the parent/subtree tint and
     the ledger's own margin rule already carry the grouping. */
  .entry, .entry--child { padding-block: .6rem; border-bottom-color: transparent; }
  .entry--child:last-child { border-bottom-color: transparent; }

  /* Rule 3: the title is the largest text in the row, and blocked/pinned
     rows get extra weight so they don't just rely on colour to stand out. */
  .entry__title { font-size: 1.02rem; }
  .state-waiting .entry__title,
  .entry--active .entry__title { font-weight: 600; }

  .bar { grid-template-columns: 5.5rem minmax(0, 1fr) 3.4rem; gap: .5rem; }
  .bar__label { font-size: .78rem; }

  .helpsheet { max-width: calc(100vw - 2rem); }
}

/* ---- 24-multiselect.css ---- */
/* --- ledger multi-select: Ctrl+click a task to start, plain click to add
   more, floating toolbar for bulk actions. See 23-multiselect.js. -------- */

/* Selecting a task visually claims its whole block, progeny included --
   same sibling-tint technique as .entry--active + .subtree above (10-entry.css) --
   even though only the task itself is actually in the selection Set. Built
   from inset box-shadows rather than outline/border because a plain outline
   would draw its own line across the seam between the two boxes; each side
   only draws the shadow it owns, so the pair reads as one unbroken rectangle. */
.entry--selected,
.entry--selected + .subtree {
  background: var(--accent-wash);
}
.entry--selected {
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom-color: transparent;
  box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent), inset 0 2px 0 var(--accent);
}
.entry--selected + .subtree {
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent), inset 0 -2px 0 var(--accent);
}
.entry--selected:not(:has(+ .subtree)) {
  border-radius: var(--radius);
  border-bottom-color: var(--rule);
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Per-row hover actions (and, on phones, the "more actions" menu toggle)
   compete with click-to-select for the same clicks -- hide them for the
   whole selection session, not just the selected rows. Reappear once
   is-selecting-tasks comes off the body on exit. */
body.is-selecting-tasks .entry__actions,
body.is-selecting-tasks .entry__menu-toggle {
  display: none !important;
}

/* Fixed to the viewport, not any one row -- it has to stay reachable
   however far the selected tasks are scrolled apart. Sits one z-index
   above .helpsheet (70, the previous highest in the app, 21-misc.css) so
   it's never hidden behind the help sheet or a sticky masthead. One
   concise horizontal row -- with the date field now a plain icon (see
   below) instead of a wide input, every control comfortably fits on one
   line above phone width with room to spare, so there's no need for a
   scrollbar or a wrap here; see the phone override below for the one width
   where the full control set genuinely can't fit on one line. */
.selection-toolbar {
  position: fixed; inset: 1rem auto auto 50%; transform: translateX(-50%);
  z-index: 80;
  display: flex; flex-wrap: nowrap; align-items: center; gap: .35rem;
  max-width: calc(100vw - 2rem);
  padding: .4rem .55rem;
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper-raised); box-shadow: var(--shadow-lg);
  font-size: .82rem;
}
.selection-toolbar[hidden] { display: none; }
.selection-toolbar > * { flex-shrink: 0; }
.selection-toolbar__count { color: var(--ink-faint); padding-right: .15rem; white-space: nowrap; }
.selection-toolbar__state { font: inherit; width: 7.4rem; }
.selection-toolbar [data-selection-action][disabled] { opacity: .4; cursor: not-allowed; }

/* The real <input type="date"> stays off-screen (.visually-hidden) -- the
   calendar icon button next to it (plain .btn--icon, no extra CSS needed)
   is the only thing anyone sees or clicks; 23-multiselect.js opens the
   browser's own picker on it via showPicker(). Earlier versions of this
   tried to make the input itself visible -- as a custom pill with its own
   icon, then as a plain styled field -- and kept running into the same
   overlapping/doubled look, fighting the browser's own date-input chrome
   in ways plain CSS resets can't fully normalise (internal field padding,
   min-width, the picker-indicator's own box). Not rendering it at all
   sidesteps that instead of chasing it, and reads as one more icon button
   among the others rather than an oddly-shaped field. */

/* Same pointer-drag affordance as a single entry's handle (10-entry.css) --
   dragging this one moves the whole selection instead of just one row. */
[data-selection-drag-handle] { cursor: grab; touch-action: none; }
[data-selection-drag-handle]:active,
[data-selection-drag-handle].is-dragging { cursor: grabbing; }

.selection-toolbar.is-busy { opacity: .6; pointer-events: none; }

/* Phone: a floating centered pill has no good way to stay both reachable
   with a thumb and out of the way of the content above it once it's this
   wide -- pinned instead to the bottom edge, full width, same fixed-
   bottom-bar shape as .task-save-bar (19-task-editor.css) already uses
   elsewhere in the app for exactly this "always reachable, thumb zone"
   reasoning, so there's one bottom-bar pattern in this app, not two
   competing ones. The full control set still doesn't fit on one line at
   this width even as icons only -- wraps to a second row instead of
   scrolling sideways, since every control stays visible and reachable
   without an extra swipe gesture to discover the ones that didn't fit;
   icon buttons are sized back down from the global phone tap-target bump
   (23-responsive.css) just enough to make that second row worth having,
   still a comfortable target, just not the full 44px every other icon on
   the page gets -- a deliberate trade against this toolbar needing to
   hold more controls at once than a single ledger row does. */
@media (max-width: 30rem) {
  .selection-toolbar {
    inset: auto 0 0 0; transform: none;
    max-width: none; width: 100%;
    flex-wrap: wrap; justify-content: flex-start;
    padding: .5rem .7rem;
    padding-bottom: max(.5rem, env(safe-area-inset-bottom));
    border-left: 0; border-right: 0; border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 16px oklch(26.5% 0.022 265 / .08);
  }
  .selection-toolbar .btn--icon { min-width: 2.3rem; min-height: 2.3rem; padding: .25rem; }
  .selection-toolbar__state { width: 6.6rem; }
}

/* ---- 25-print.css ---- */
@media print {
  .masthead, .task-actions, .entry__actions, .subtask-add, .promote-zone, .aside, .rail { display: none !important; }
  .subtree__toggle { display: none; }
  .subtree:not([open]) > .subtree__body { display: block !important; }
  body { background: #fff; }
  .entry { break-inside: avoid; }
}

/* ---- 26-task-modal.css ---- */
/* Full-screen modal that fetches a task's content as JSON (see
   25-task-modal.js) and injects it in place, so opening a task never
   navigates away from the list it was opened from. */
body.task-modal-open { overflow: hidden; }
body.task-modal-open > .masthead,
body.task-modal-open > .rail {
  display: none;
}

.task-modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: clamp(0px, 3vw, 2rem);
  background: oklch(20% 0.01 265 / .55);
  backdrop-filter: blur(2px);
  animation: task-modal-scrim-in .15s var(--ease);
}

.task-modal {
  position: relative;
  width: 100%; max-width: 960px;
  height: 100%; max-height: calc(100vh - 4rem);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: task-modal-pop-in .18s var(--ease);
}

@media (max-width: 640px) {
  .task-modal-overlay { padding: 0; }
  .task-modal { max-width: none; max-height: none; border-radius: 0; }
}

.task-modal__bar {
  flex: none;
  display: flex; align-items: center; justify-content: flex-end;
  padding: .5rem .75rem;
  background: var(--paper-alt);
  border-bottom: 1px solid var(--rule);
}

.task-modal__close {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--radius);
  padding: .4rem .6rem;
  cursor: pointer;
}

.task-modal__close:hover { background: var(--paper-sunk); color: var(--ink); }
.task-modal__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.task-modal__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  opacity: 0;
  transition: opacity .12s var(--ease);
}

/* The task page's own two-column grid (.task-page, main + sidebar) assumes
   the full page width; inside the modal there isn't room for a side rail
   next to it, so the main column takes the full width and the sidebar
   (timer, time entries, attached notes) stacks below it instead. */
.task-modal__body .task-page {
  grid-template-columns: minmax(0, 1fr);
}

.task-modal.is-loaded .task-modal__body { opacity: 1; }

.task-modal__error {
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--ink-soft);
}

.task-modal__error i { color: var(--s-waiting); }

.task-modal__spinner {
  position: absolute; top: 50%; left: 50%;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid var(--rule);
  border-top-color: var(--ink-soft);
  border-radius: var(--radius-full);
  animation: task-modal-spin .7s linear infinite;
}

.task-modal.is-loaded .task-modal__spinner { display: none; }

@keyframes task-modal-scrim-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes task-modal-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes task-modal-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .task-modal-overlay, .task-modal { animation: none; }
}
