/* ---------- tokens ---------- */
:root {
  /* Page, list (--col) and card (--surface) each sit a clear step apart, so
     the layers read at a glance. Muted text stays above 4.5:1 on all three. */
  --bg: #f6f5f2;
  --surface: #ffffff;
  --col: #e1ded6;
  --text: #1d1f23;
  --muted: #5c6067;
  --line: #d3cfc6;
  --line-soft: #ebe9e3;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --danger: #c92a2a;
  /* Text on a filled red button, and --ok-ink the tick on green: white on
     the light theme's deep colours, near-black on the dark theme's pale ones. */
  --danger-ink: #ffffff;
  --warn: #b35c00;
  --ok: #2b8a3e;
  --ok-ink: #ffffff;
  /* Done cells on the Map: the tick's green, toned down in dark mode so a big area is not glaring. */
  --done-fill: var(--ok);
  --done-ink: #ffffff;
  --shadow: 0 1px 2px rgb(20 20 30 / 0.08), 0 1px 1px rgb(20 20 30 / 0.04);
  --shadow-lg: 0 12px 32px rgb(20 20 30 / 0.22);
  --radius: 10px;
  /* The type scale (docs/DESIGN.md, "Type scale"): every size in the app is one of these. */
  --fs-title: 22px;
  --fs-bar: 17px;
  --fs-body: 15px;
  --fs-meta: 13px;
  --fs-caps: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111216;
    --surface: #2d3038;
    --col: #1e2027;
    --text: #e9e9ec;
    --muted: #a3a6ae;
    --line: #3d4048;
    --line-soft: #2a2c32;
    --accent: #748ffc;
    --accent-ink: #10121a;
    --danger: #ff8787;
    --danger-ink: #10121a;
    --warn: #ffa94d;
    --ok: #69db7c;
    --ok-ink: #10121a;
    --done-fill: color-mix(in srgb, var(--ok) 42%, var(--surface));
    --done-ink: var(--text);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #111216;
  --surface: #2d3038;
  --col: #1e2027;
  --text: #e9e9ec;
  --muted: #a3a6ae;
  --line: #3d4048;
  --line-soft: #2a2c32;
  --accent: #748ffc;
  --accent-ink: #10121a;
  --danger: #ff8787;
  --danger-ink: #10121a;
  --warn: #ffa94d;
  --ok: #69db7c;
  --ok-ink: #10121a;
  --done-fill: color-mix(in srgb, var(--ok) 42%, var(--surface));
  --done-ink: var(--text);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

/* Board colours. --tint is a soft fill, --ink readable text on it. */
.c-blue { --c: #3b82f6; }
.c-teal { --c: #0d9488; }
.c-green { --c: #2f9e44; }
.c-amber { --c: #d99a06; }
.c-orange { --c: #ea580c; }
.c-red { --c: #dc2626; }
.c-pink { --c: #db2777; }
.c-violet { --c: #7c3aed; }
.c-slate { --c: #64748b; }
[class*='c-'] {
  --tint: color-mix(in srgb, var(--c) 18%, var(--surface));
  --ink: color-mix(in srgb, var(--c) 45%, var(--text));
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--fs-body)/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#root { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.icon { flex: none; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-meta); }
.pad { padding: 12px; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

input[type='text'], input[type='password'], input[type='email'], input[type='url'], input[type='date'], input[type='time'], input:not([type]), select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  min-height: 34px;
}
textarea { resize: none; display: block; width: 100%; overflow: hidden; }
input[type='checkbox'] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
/* The open list of every select. Chrome and Edge on Windows draw it from the
   options' own colours, not the page theme, and a picker's select has a
   see-through background, so without this the list is white with the dark
   theme's pale text. Every select gets these, so no dropdown can miss them. */
select option, select optgroup { background-color: var(--surface); color: var(--text); }
select option:disabled { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  white-space: nowrap;
}
.btn:hover { background: color-mix(in srgb, var(--text) 5%, var(--surface)); }
.btn.ghost { border-color: transparent; background: transparent; padding: 6px 8px; }
.btn.ghost:hover { background: color-mix(in srgb, var(--text) 9%, transparent); }
.btn.ghost:disabled { color: var(--muted); opacity: 0.55; cursor: default; background: transparent; }
.btn.small { min-height: 28px; padding: 4px 6px; }
.btn.subtle { border-color: transparent; background: color-mix(in srgb, var(--text) 6%, transparent); }
.btn.subtle:hover { background: color-mix(in srgb, var(--text) 11%, transparent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:disabled { opacity: 0.5; cursor: default; }
.btn.danger-text { border-color: transparent; background: transparent; color: var(--danger); }
/* A toggle button that is on (Cards on the calendar, All gates on the Map). */
.btn[aria-pressed='true'] { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--text); }
.btn.danger-text:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; display: inline-block; }
.swatch.big { width: 14px; height: 14px; border-radius: 4px; }

.segmented { display: inline-flex; background: color-mix(in srgb, var(--text) 7%, transparent); border-radius: 9px; padding: 2px; }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 0; background: transparent; border-radius: 7px; padding: 5px 10px; min-height: 30px; color: var(--muted);
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }

.tick {
  width: 18px; height: 18px; flex: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--muted); border-radius: 50%; background: transparent; color: var(--ok-ink);
}
.tick:hover { border-color: var(--ok); }
.tick.on { background: var(--ok); border-color: var(--ok); }
.tick.large { width: 22px; height: 22px; margin-top: 6px; }
/* Comes after unfinished cards: a dashed ring that cannot be ticked yet. */
.tick.locked,
.box-btn.locked .box { border-style: dashed; cursor: not-allowed; }
.tick.locked:hover { border-color: var(--muted); }
.box-btn.locked { cursor: not-allowed; }

.editable { border: 0; background: transparent; padding: 2px 4px; border-radius: 6px; text-align: left; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editable:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
input.editable-input { font-weight: 600; min-height: 28px; padding: 2px 4px; min-width: 0; flex: 1; }

/* ---------- menu ---------- */
.menu-wrap { position: relative; flex: none; }
.menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 60; min-width: 200px; max-width: calc(100vw - 16px); max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px;
}
.menu.left { right: auto; left: 0; }
/* The same menu opened where a card was right-clicked (ContextMenu). */
.menu.at-point { position: fixed; right: auto; max-width: calc(100vw - 16px); }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; text-align: left; white-space: nowrap; }
.menu-item:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.menu-item.danger { color: var(--danger); }
.menu-check { width: 14px; display: inline-flex; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
/* An item that opens a submenu: a caret at its right-hand end, and lit
   while its submenu is open beside it. */
.menu-caret { display: inline-flex; margin-left: 12px; color: var(--muted); }
.menu-item.sub-open { background: color-mix(in srgb, var(--text) 8%, transparent); }
.menu-item.has-sub .menu-hint { min-width: 0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.menu-back { font-weight: 600; }
.menu-back .menu-check { color: var(--muted); }

/* ---------- shell ---------- */
.app { height: 100dvh; display: flex; flex-direction: row; }
.topbar {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: calc(6px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 6px calc(10px + env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.board-switch > .btn { font-weight: 600; max-width: 42vw; }
.board-switch-name { overflow: hidden; text-overflow: ellipsis; }
.sync { font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; }
.sync.offline { color: var(--warn); font-weight: 600; }
/* Undo and Redo in the top bar, side by side before the gear. */
.undo-redo { display: inline-flex; gap: 2px; }

.splash, .signin { height: 100dvh; display: grid; place-content: center; gap: 12px; text-align: center; padding: 24px; }
.app > .splash { height: auto; flex: 1; justify-items: center; }
.signin form { display: grid; gap: 12px; justify-items: center; width: min(280px, 80vw); }
.signin input, .signin .btn { width: 100%; justify-content: center; }
.signin h1 { font-size: var(--fs-title); }
/* Connect: an app asking to use your boards, on the sign-in page's layout. */
.signin .row-list, .signin .segmented { width: 100%; text-align: left; }
.signin .segmented button { flex: 1; justify-content: center; }
.connect form { width: min(340px, 88vw); }
.connect .hint.signin-note { width: 100%; max-width: none; }
.error { color: var(--danger); }

/* ---------- board ---------- */
.board-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px 0; flex: none; }
.board-name { font-size: var(--fs-bar); }
.board {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  overflow-x: auto; overflow-y: hidden;
  padding: 10px calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
}
.list {
  flex: none; width: 280px; max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--col); border-radius: 12px;
}
.list-head { display: flex; align-items: center; gap: 4px; padding: 8px 6px 4px 8px; cursor: grab; touch-action: pan-x; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.list-name { flex: 0 1 auto; }
/* A column of a subtask board (To do, In progress, Done): the list name's
   type, as plain text, since it cannot be renamed or dragged. */
.step-col .list-head { cursor: default; }
.step-name { margin: 0; padding: 2px 4px; font-size: inherit; font-weight: 600; white-space: nowrap; }
.count { color: var(--muted); font-size: var(--fs-meta); flex: 1; }
/* A list folded sideways: a narrow strip, name written down it, the count and
   the chevron under it. The whole strip opens it again. */
.list.collapsed { width: auto; }
.list-fold { padding: 6px; }
.list-strip {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  flex: 0 1 auto; min-height: 0; width: 44px; padding: 12px 0 10px;
  border: 0; border-radius: 12px; background: transparent; color: var(--text);
  cursor: grab; touch-action: pan-x; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.list-strip:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.list-strip-name { writing-mode: vertical-rl; font-weight: 600; min-height: 0; max-height: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-strip .count { flex: none; }
.list.collapsed.drop-here { box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--col)); }
.list-cards { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 4px 8px; overflow-y: auto; min-height: 12px; overscroll-behavior-y: contain; }
.card {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow);
  padding: 8px 10px; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.card:hover { outline: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.card .tick { margin-top: 1px; }
.card-main { min-width: 0; flex: 1; }
.card-title { overflow-wrap: anywhere; }
.card.done .card-title { color: var(--muted); text-decoration: line-through; }
.badges { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; }
.badge.due.overdue { color: var(--danger); font-weight: 600; }
.badge.due.soon { color: var(--warn); font-weight: 600; }
.badge.complete { color: var(--ok); }
.card-gap { flex: none; border-radius: 8px; background: color-mix(in srgb, var(--text) 9%, transparent); }
.list-gap { flex: none; border-radius: 12px; background: color-mix(in srgb, var(--text) 7%, transparent); }
.add-card { display: flex; align-items: center; gap: 6px; margin: 4px 8px 8px; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; }
.add-card:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.composer { padding: 4px 8px 8px; }
.composer-input { box-shadow: var(--shadow); border-color: var(--accent); }
.hint { font-size: var(--fs-meta); color: var(--muted); margin-top: 4px; }
.hint.error { color: var(--danger); }
.add-list { flex: none; width: 280px; display: flex; align-items: center; gap: 6px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; background: transparent; color: var(--muted); }
.add-list:hover { color: var(--text); border-color: var(--muted); }
.add-list.open { border-style: solid; background: var(--col); padding: 8px; }
.add-list.open input { width: 100%; }

/* labels */
.label {
  /* A chip of the label's colour (--c) at a fifth strength, its name in a tint that stays
     at 4.5:1 or better in both themes, and a swatch of the colour (--on is text on it). */
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-height: 22px;
  padding: 1px 8px 1px 3px; border: 0; border-radius: 5px; font-size: var(--fs-meta); font-weight: 600; line-height: 1.3;
  background: color-mix(in srgb, var(--c) 18%, var(--surface));
  color: color-mix(in srgb, var(--c) 35%, var(--text));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 50%, transparent);
}
.label-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-symbol { flex: none; }
.label-swatch {
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 1px;
  border-radius: 3px; background: var(--c); color: var(--on); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15);
}
.label.large { min-height: 30px; padding: 2px 12px 2px 5px; gap: 8px; font-size: var(--fs-body); border-radius: 6px; }
.label.large .label-swatch { min-width: 22px; height: 22px; border-radius: 4px; }
.label.strip { width: 46px; min-height: 18px; height: 18px; padding: 0; justify-content: center; background: var(--c); color: var(--on); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); }
button.label:hover { filter: brightness(0.93); }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.label-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.label-panel { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.label-panel > .btn { align-self: flex-start; }
.label-opt { display: flex; align-items: center; gap: 8px; }
.label-opt label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 3px 0; cursor: pointer; }
.label-form { display: flex; flex-direction: column; gap: 12px; }
.label-preview { display: flex; align-items: center; gap: 10px; min-height: 24px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.color-swatch, .symbol-swatch {
  min-width: 40px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-meta); font-weight: 700; position: relative; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15);
}
.symbol-swatch { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); box-shadow: none; }
.color-swatch.custom { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.color-swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; min-height: 0; }
.color-swatch.on, .symbol-swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.symbol-note { display: flex; align-items: center; gap: 10px; line-height: 1.35; }
.symbol-big { flex: none; display: inline-flex; padding: 6px; border-radius: 8px; background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.label-form-foot { display: flex; align-items: center; gap: 8px; }

/* checklist shown on a board card */
button.badge { border: 0; background: transparent; padding: 0; font-weight: inherit; }
.badge.toggle { padding: 1px 5px; margin: -1px -5px; border-radius: 5px; }
.badge.toggle:hover { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); }
.badge.toggle.complete:hover { color: var(--ok); }
.tile-checks { display: flex; flex-direction: column; margin-top: 6px; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.tile-check-title { font-size: var(--fs-caps); font-weight: 700; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.tile-check { display: flex; align-items: flex-start; gap: 7px; border: 0; background: transparent; padding: 3px 4px; margin: 0 -4px; border-radius: 5px; text-align: left; font-size: var(--fs-meta); }
.tile-check:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.tile-check .box { flex: none; width: 14px; height: 14px; margin-top: 2px; border: 1.5px solid var(--muted); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; color: var(--ok-ink); }
.tile-check.done .box { background: var(--ok); border-color: var(--ok); }
.tile-check.done .tile-check-text { color: var(--muted); text-decoration: line-through; }
.tile-check-text { overflow-wrap: anywhere; }

/* list sorting */
.sort-tag { display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: var(--fs-meta); font-weight: 600; color: var(--muted); padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.menu-heading { padding: 6px 10px 2px; font-size: var(--fs-caps); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
/* Each group of choices starts with its heading, with a line above it. */
.menu-heading:not(:first-child) { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.menu-sep + .menu-heading { border-top: 0; margin-top: 0; padding-top: 6px; }

/* ---------- drag ---------- */
.card.drag-src, .list.drag-src { position: absolute; opacity: 0; pointer-events: none; }
.block.drag-src, .chip.drag-src { opacity: 0.35; }
.drag-ghost {
  z-index: 1000; pointer-events: none; rotate: 2deg; opacity: 0.95;
  box-shadow: var(--shadow-lg) !important; transition: none !important;
}
.is-dragging, .is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.is-dragging .board { scroll-snap-type: none; }

/* ---------- modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; background: rgb(10 10 15 / 0.5);
}
.modal { width: min(640px, 100%); background: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg); }
/* A dialog holds focus as it opens (ui/modal.js); the ring is for its controls, not its frame. */
.modal:focus { outline: none; }
.event-modal { width: min(440px, 100%); }
/* "on SPECTER ⌄ for 3.11.0 - Nov 27 ⌄" under a calendar entry's title, like a card's "in Doing ⌄". */
.event-where { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; padding-left: 7px; font-size: var(--fs-body); min-width: 0; max-width: 100%; }
.event-hint { margin-top: 8px; }
.event-card-btn { margin-top: 8px; }
.modal-head { display: flex; align-items: flex-start; gap: 8px; padding: 14px 12px 4px 16px; }
.modal-title { flex: 1; min-width: 0; font-size: var(--fs-title); font-weight: 650; border-color: transparent; background: transparent; padding: 4px 6px; }
.modal-title:hover, .modal-title:focus { border-color: var(--line); background: var(--surface); }
.modal-title.struck { text-decoration: line-through; color: var(--muted); }
.modal-title-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.modal-title-col .modal-title { flex: none; align-self: stretch; }
/* The card's list, as a line under the title: "in Hiring". */
.modal-where { display: inline-flex; align-items: center; gap: 2px; padding-left: 7px; font-size: var(--fs-body); min-width: 0; max-width: 100%; }
.modal-body { padding: 8px 16px 12px; display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.modal-body > .btn { align-self: flex-start; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.field-row { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: var(--fs-meta); font-weight: 600; color: var(--muted); }
.field select { max-width: 240px; }
.due-inputs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.due-inputs.overdue input { border-color: var(--danger); color: var(--danger); }
.due-inputs.soon input { border-color: var(--warn); }
.section { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.section > .btn { align-self: flex-start; }
.section-head { display: flex; align-items: center; gap: 8px; }
.section-title { font-weight: 650; font-size: var(--fs-body); }
.section-head .muted { flex: 1; font-size: var(--fs-meta); }
.desc { min-height: 56px; }
/* Specs with a value: one line each, icon and name like a section head. */
.spec-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
/* ---------- folds, pickers and toggles ----------
   One pattern for everything that opens and closes (see docs/DESIGN.md).
   A fold's heading is a filled row: icon, bold title, muted summary and the
   chevron at the far right. The fill reaches 10px past the section on both
   sides, so the icon stays in the same column as every other section's. */
.fold-head {
  display: flex; align-items: center; gap: 8px; width: calc(100% + 20px); min-height: 40px;
  margin: 0 -10px; padding: 6px 10px;
  border: 0; border-radius: 8px; text-align: left; color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.fold-head:hover { background: color-mix(in srgb, var(--text) 11%, transparent); }
.fold-sum { flex: 1; min-width: 0; font-size: var(--fs-meta); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { display: inline-flex; flex: none; color: var(--muted); transition: rotate 0.15s; }
.chev.open { rotate: 180deg; }
.fold-body { display: flex; flex-direction: column; gap: 16px; padding-top: 4px; }
/* A picker: the value in bold, the chevron after it, no box until hovered. */
.picker { position: relative; display: inline-flex; align-items: center; min-width: 0; color: var(--muted); }
.picker select {
  appearance: none; -webkit-appearance: none; min-height: 28px; max-width: 100%;
  padding: 2px 22px 2px 4px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text); font-weight: 600; font-size: var(--fs-body); text-overflow: ellipsis; cursor: pointer;
  field-sizing: content;
}
.picker select:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.picker .chev { position: absolute; right: 4px; pointer-events: none; }
.picker.none select { color: var(--muted); font-weight: 400; }
/* A picker beside a heading ("Subtask of", "Part of"): same row as a section head. */
.pick-head { min-width: 0; }
.pick-head .section-title { flex: none; white-space: nowrap; }
.pick-head .picker { flex: 0 1 auto; }
/* Rows inside a fold that sits in Path start where "Add a subtask" does. */
.section-body { display: flex; flex-direction: column; gap: 8px; margin-left: 30px; }
.spec-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sched-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.sched-row.past { opacity: 0.6; }
.time-range { display: inline-flex; align-items: center; gap: 4px; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.checklist { display: flex; flex-direction: column; gap: 6px; }
.progress { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); transition: width 0.15s; }
.progress-bar.full { background: var(--ok); }
.check-item { display: flex; align-items: flex-start; gap: 8px; }
.check-item .tick { margin-top: 8px; }
.check-text { flex: 1; border-color: transparent; background: transparent; }
.check-text:hover, .check-text:focus { border-color: var(--line); background: var(--surface); }
.check-item.done .check-text { text-decoration: line-through; color: var(--muted); }
.check-add { margin-left: 26px; }

/* ---------- nesting ---------- */
/* Zoomed into a card: a trail back out, then the card's children as a board. */
.board-bar.zoomed { flex-wrap: wrap; gap: 4px 12px; padding-top: 10px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; max-width: 260px;
  border: 0; background: transparent; padding: 4px 6px; border-radius: 6px;
  color: var(--muted); font-size: var(--fs-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 650; font-size: var(--fs-bar); }
.crumb-sep { color: var(--muted); font-size: var(--fs-body); }
.zoom-progress { font-size: var(--fs-meta); white-space: nowrap; }
.modal-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 12px 16px 0 20px; color: var(--muted); }
.modal-crumbs .crumb { font-size: var(--fs-meta); max-width: 220px; }
.modal-crumbs + .modal-head { padding-top: 2px; }

/* Subtasks on a board card: round ticks, so they never read as checklist items. */
.tile-sub { display: flex; align-items: center; gap: 4px; margin: 0 -4px; padding: 1px 4px; border-radius: 5px; font-size: var(--fs-meta); }
.tile-sub:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.box-btn { flex: none; border: 0; background: transparent; padding: 3px; margin: 0 2px 0 -3px; display: inline-flex; }
.box { flex: none; width: 14px; height: 14px; border: 1.5px solid var(--muted); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; color: var(--ok-ink); }
.box.round { border-radius: 50%; }
.tile-sub.done .box { background: var(--ok); border-color: var(--ok); }
.tile-sub-title { flex: 1; min-width: 0; border: 0; background: transparent; padding: 2px 0; text-align: left; overflow-wrap: anywhere; }
.tile-sub.done .tile-sub-title { color: var(--muted); text-decoration: line-through; }
.tile-sub-list { flex: none; max-width: 40%; font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-zoom { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin: 4px -4px 0; padding: 3px 6px; border: 0; border-radius: 5px; background: transparent; font-size: var(--fs-meta); font-weight: 600; color: var(--accent); }
.tile-zoom:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.badge.due.clash { color: var(--warn); font-weight: 600; }

/* Subtasks in the card editor. */
.sub-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 0; }
.sub-title { flex: 1 1 160px; min-width: 0; border: 0; background: transparent; padding: 4px 6px; margin-left: -6px; border-radius: 6px; text-align: left; overflow-wrap: anywhere; }
.sub-title:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.sub-row.done .sub-title { color: var(--muted); text-decoration: line-through; }
.sub-list { font-size: var(--fs-meta); color: var(--muted); padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--text) 7%, transparent); white-space: nowrap; }
.note { display: flex; align-items: center; gap: 6px; font-size: var(--fs-meta); }
.note.warn { color: var(--warn); font-weight: 600; }
.note.ok { color: var(--ok); font-weight: 600; }
/* An action that is not about changing the card sits at the far end. */
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); font-weight: 600; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }

/* ---------- dependencies ---------- */
/* Waiting and ready are pills, so they stand apart from the plain badges. */
.badge.pill { padding: 1px 7px 1px 5px; border-radius: 999px; font-weight: 600; }
.badge.blocked { color: var(--text); background: color-mix(in srgb, var(--text) 10%, transparent); }
.badge.ready { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.badge.slow { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
/* Dim the words, not the labels: label colours and textures stay full strength. */
.card.dim > .tick,
.card.dim .card-title,
.card.dim .badges > :not(.blocked),
.card.dim .tile-checks { opacity: 0.5; transition: opacity 0.12s; }
.card.dim { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.card.dim:hover > .tick,
.card.dim:hover .card-title,
.card.dim:hover .badges > *,
.card.dim:hover .tile-checks { opacity: 1; }
/* Gates, as a timeline: earlier cards, this card, later cards.
   Side by side when there is room, stacked top to bottom when not. */
.deps-side-title { font-weight: 600; font-size: var(--fs-meta); }
.link-picker { display: flex; flex-direction: column; gap: 4px; margin-left: 30px; }
.link-matches { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 4px; box-shadow: var(--shadow); }
.link-match { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; text-align: left; }
.link-match:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.link-match.refused { opacity: 0.5; }
.link-match-title { overflow-wrap: anywhere; }
.early-mark { display: inline-flex; vertical-align: -1px; margin-right: 3px; color: var(--warn); }
.block.early { box-shadow: inset 0 0 0 1.5px var(--warn); }

/* ---------- calendar ---------- */
.cal-view { flex: 1; min-height: 0; display: flex; }
.cal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; flex: none; }
.cal-title { font-size: var(--fs-bar); font-weight: 650; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-toggle, .tray-close { display: none; }

.tray { width: 272px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--col); min-height: 0; }
.tray-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 12px 6px; }
.tray-filters { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 12px 10px; border-bottom: 1px solid var(--line); }
.pick-line { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.tray-body { flex: 1; overflow-y: auto; padding: 4px 8px calc(12px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.tray-list { display: flex; align-items: center; gap: 6px; font-size: var(--fs-meta); font-weight: 600; color: var(--muted); padding: 10px 4px 4px; }
.tray-card {
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); border-left: 3px solid var(--c);
  padding: 7px 10px; margin-bottom: 6px; cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.tray-title { overflow-wrap: anywhere; }

.tg { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.tg-head, .tg-allday, .tg-body { display: grid; }
.tg-head { flex: none; }
.tg-day { border: 0; background: transparent; padding: 6px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; border-left: 1px solid var(--line-soft); }
.tg-day .dow { font-size: var(--fs-caps); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tg-day .num { font-size: var(--fs-bar); font-weight: 600; width: 32px; height: 32px; line-height: 32px; border-radius: 50%; }
.tg-day.today .num { background: var(--accent); color: var(--accent-ink); }
.tg-day.today .dow { color: var(--accent); font-weight: 700; }
.tg-allday { flex: none; border-bottom: 1px solid var(--line); max-height: 30vh; overflow-y: auto; scrollbar-width: none; }
.tg-gutter-label { font-size: var(--fs-meta); color: var(--muted); text-align: right; padding: 5px 6px 0 0; }
.tg-allday-cell { min-height: 28px; padding: 2px 3px 4px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line-soft); min-width: 0; cursor: cell; }
.tg-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; background: var(--surface); }
.tg-scroll::-webkit-scrollbar, .tg-allday::-webkit-scrollbar { display: none; }
.tg-body { position: relative; }
.tg-gutter { position: relative; }
.tg-hour { position: absolute; right: 6px; translate: 0 -50%; font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; }
.tg-col {
  position: relative; border-left: 1px solid var(--line-soft); min-width: 0; cursor: cell;
  background-image: linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 100% 48px;
}
.tg-col.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.block {
  position: absolute; overflow: hidden; border-radius: 6px; padding: 2px 6px;
  background: var(--tint); color: var(--ink); border-left: 3px solid var(--c);
  font-size: var(--fs-meta); line-height: 1.25; cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.block-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.block-time { opacity: 0.8; white-space: nowrap; }
.block.short { display: flex; gap: 6px; align-items: center; padding-top: 0; padding-bottom: 0; }
.block.short .block-title { white-space: nowrap; flex: 0 0 auto; max-width: 100%; }
/* In a narrow column the time gives way first, so the title always shows. */
.block.short .block-time { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.block.done { opacity: 0.55; }
.block.done .block-title { text-decoration: line-through; }
.block-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; touch-action: none; }
.block.preview {
  left: 1px; right: 3px; pointer-events: none; z-index: 5;
  background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text);
  border: 1.5px dashed var(--accent);
}
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); pointer-events: none; z-index: 4; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

.chip {
  display: flex; align-items: center; gap: 4px; min-width: 0; flex: none;
  padding: 1px 6px; border-radius: 4px; font-size: var(--fs-meta); line-height: 1.45;
  background: var(--tint); color: var(--ink); cursor: grab; white-space: nowrap;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.chip-title { overflow: hidden; text-overflow: ellipsis; }
.chip-time { opacity: 0.75; flex: none; }
.chip.due { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }
.chip.due.overdue { color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.chip.done { opacity: 0.55; }
/* Another calendar's event: the surface colour with an outline and the
   arrow-out icon, never a board's colour, and read-only (no grab cursor). */
.block.outside, .chip.outside {
  background: var(--surface); color: var(--text); cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
}
.block.outside { border-left: 3px solid var(--muted); }
.block-title .icon { display: inline-block; vertical-align: -1px; margin-right: 4px; }
.chip .icon { flex: none; }
.block.outside .icon, .chip.outside .icon { flex: none; color: var(--muted); }
.agenda-row.outside .icon { color: var(--muted); }
.agenda-from { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.done .chip-title { text-decoration: line-through; }
.drop { background: color-mix(in srgb, var(--accent) 14%, transparent) !important; box-shadow: inset 0 0 0 2px var(--accent); }

.month { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
/* One hidden entry, measured to work out how many fit in a day. */
.month-probe { position: absolute; left: 0; top: 0; visibility: hidden; pointer-events: none; }
.month-dows { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: none; border-bottom: 1px solid var(--line); }
.month-dows div { padding: 4px 6px; font-size: var(--fs-caps); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.month-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); }
.month-cell { min-width: 0; min-height: 0; overflow: hidden; padding: 2px 3px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); cursor: cell; }
.month-cell.other { background: color-mix(in srgb, var(--text) 4%, transparent); }
.month-cell.other .month-num { color: var(--muted); }
.month-num { align-self: flex-start; flex: none; border: 0; background: transparent; width: 24px; height: 24px; border-radius: 50%; padding: 0; font-size: var(--fs-meta); font-weight: 600; }
.month-num:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.month-cell.today .month-num { background: var(--accent); color: var(--accent-ink); }
.more { border: 0; background: transparent; padding: 0 6px; font-size: var(--fs-meta); color: var(--muted); text-align: left; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more:hover { color: var(--text); }

.agenda { flex: 1; overflow-y: auto; padding: 4px 16px calc(24px + env(safe-area-inset-bottom)); width: 100%; max-width: 720px; }
.agenda.empty { display: grid; place-content: center; max-width: none; }
.agenda-day { padding: 12px 0 4px; border-bottom: 1px solid var(--line-soft); }
.agenda-day h3 { font-size: var(--fs-body); margin-bottom: 6px; }
.agenda-day h3 .muted { font-weight: 400; margin-left: 6px; }
.agenda-day.today h3 { color: var(--accent); }
.agenda-row { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 7px 6px; border-radius: 6px; text-align: left; }
.agenda-row:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.agenda-time { width: 132px; flex: none; color: var(--muted); font-size: var(--fs-meta); }
.agenda-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.agenda-row .icon { color: var(--c); }
.agenda-row.done .agenda-title { text-decoration: line-through; color: var(--muted); }

/* ---------- plan from text ---------- */
.plan-btn { margin-left: auto; }
.board-bar .plan-btn { flex: none; }
.head-actions { margin-left: auto; display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.plan-modal { width: min(1040px, 100%); display: flex; flex-direction: column; max-height: 88vh; }
.plan-head { align-items: center; padding-bottom: 8px; }
.plan-head > .icon { color: var(--accent); flex: none; }
.plan-title { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-bar); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-title .muted { font-weight: 500; }
.plan-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 4px 16px 12px; min-height: 0; flex: 1; }
.plan-input { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.plan-modal textarea.plan-text {
  min-height: 300px; flex: 1; overflow: auto; resize: vertical; white-space: pre; tab-size: 2;
  font: var(--fs-meta)/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
/* "How to write it" folds like Path; the plan box keeps its 10px edge room. */
.plan-help-fold { margin: 4px 10px 0; }
/* Claude mode: Type a plan / Ask Claude, then the brief, questions and cost. */
.plan-mode { align-self: flex-start; }
.claude-ask { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.plan-modal textarea.claude-brief { min-height: 160px; white-space: pre-wrap; font: inherit; font-size: var(--fs-body); line-height: 1.5; }
.claude-questions { display: flex; flex-direction: column; gap: 8px; }
.claude-q { color: var(--text); font-weight: 600; font-size: var(--fs-meta); }
.claude-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.claude-row .muted { flex: 1; min-width: 160px; }
.plan-tools { display: flex; flex-direction: column; gap: 6px; }
/* Wraps to a second row when it runs out of room, so no button hides. */
.plan-toolbar { display: flex; flex-wrap: wrap; gap: 4px; }
.tool-btn {
  flex: none; display: inline-flex; flex-direction: column; align-items: center; gap: 1px; min-width: 52px;
  padding: 5px 6px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
  font-size: var(--fs-caps); font-weight: 600; line-height: 1.1; cursor: pointer; touch-action: manipulation;
}
@media (hover: hover) { .tool-btn:hover { background: color-mix(in srgb, var(--text) 6%, var(--surface)); } }
.tool-btn:active { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.plan-suggest { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.plan-suggest::-webkit-scrollbar { display: none; }
.suggest-chip {
  flex: none; display: inline-flex; align-items: center; min-height: 32px; padding: 3px 12px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  color: var(--text); font-size: var(--fs-meta); font-weight: 600; cursor: pointer; touch-action: manipulation; white-space: nowrap;
}
.suggest-chip.has-label { padding: 3px 4px; background: var(--surface); }
.plan-help { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; font-size: var(--fs-meta); color: var(--muted); }
.plan-help dt { margin: 0; }
.plan-help dd { margin: 0; }
.plan-help code { font-size: var(--fs-meta); color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); padding: 0 4px; border-radius: 4px; white-space: pre; }
.plan-preview { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 10px; overflow-y: auto; min-height: 0; max-height: 64vh; }
.pv-heading { font-size: var(--fs-caps); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.pv-list { list-style: none; margin: 0; padding: 0; }
.pv-group + .pv-group { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.pv-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; cursor: pointer; min-width: 0; }
.pv-row .icon { color: var(--muted); flex: none; }
.pv-list-row .pv-title { font-weight: 700; }
.pv-title { min-width: 0; overflow-wrap: anywhere; }
.pv-title.struck { text-decoration: line-through; color: var(--muted); }
.pv-tag { font-size: var(--fs-meta); font-weight: 600; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.pv-tag.existing { color: var(--muted); border-color: var(--line); }
/* A Claude suggestion: dashed, so it reads apart from a tag the brief or board gave. */
.pv-tag.suggested { border-style: dashed; }
.pv-card.off > .pv-row .pv-title, .pv-group.off > .pv-row .pv-title { color: var(--muted); text-decoration: line-through; }
.pv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding-bottom: 3px; }
/* Long key and Context names wrap inside their pill instead of running off a phone. */
.pv-meta .badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.pv-items { list-style: none; margin: 0 0 3px; display: flex; flex-direction: column; gap: 1px; font-size: var(--fs-meta); color: var(--muted); }
.pv-items li { display: flex; align-items: center; gap: 6px; }
.pv-items li.struck { text-decoration: line-through; }
.pv-box { width: 12px; height: 12px; border: 1.5px solid var(--muted); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pv-box.on { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }
.label.new-label { padding: 1px 8px; background: transparent; color: var(--text); box-shadow: none; border: 1.5px dashed var(--muted); font-weight: 600; }
.badge.missing { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.plan-foot .muted { flex: 1; min-width: 160px; font-size: var(--fs-meta); }
/* Cancel and Create stay together at the right, even when the footer wraps.
   With Start over as well, a narrow footer puts what will be made on a row
   of its own, then Start over at the left. */
.foot-actions { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 720px) {
  .plan-foot:has(.start-over) .muted { order: -1; flex-basis: 100%; }
  /* New board: Start over and Skip the rest, then Back and Next at the right. */
  .setup-modal .modal-foot:has(.start-over) .spacer { flex-basis: 100%; }
  .setup-modal .modal-foot:has(.start-over) .spacer + .btn { margin-left: auto; }
}
/* Auto schedule: the Plan dialog's look in one column, its options as pickers. */
.auto-modal { width: min(680px, 100%); }
.auto-body { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 12px; min-height: 0; flex: 1; }
.auto-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; }
.auto-opts > .pick-line { gap: 4px 10px; flex-wrap: wrap; }
.auto-how { margin: 0; }
/* The two date boxes share the row and shrink to fit a phone. */
.auto-dates { gap: 6px; min-width: 0; }
.auto-dates input { flex: 1 1 0; min-width: 0; }
.auto-preview { flex: 1; max-height: none; }
.auto-meta { padding-left: 46px; }
.auto-sub { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.auto-planned { display: flex; align-items: center; gap: 6px; margin: 10px 0 2px; }
.pv-tag .swatch { margin-right: 4px; vertical-align: 0; }
.composer .hint code, .account-modal .hint code, .connect .hint code { font-size: var(--fs-meta); overflow-wrap: anywhere; background: color-mix(in srgb, var(--text) 7%, transparent); padding: 0 3px; border-radius: 3px; }
.plan-vs { margin-left: auto; font-size: var(--fs-meta); }
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200;
  display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: var(--fs-body);
}
.toast .btn { color: var(--bg); }
.toast .btn.subtle { background: color-mix(in srgb, var(--bg) 18%, transparent); font-weight: 700; }
@media (max-width: 720px) {
  .plan-modal { height: 100dvh; max-height: none; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .plan-body { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
  .plan-input, .plan-preview { flex: none; }
  .auto-body { overflow-y: auto; overscroll-behavior: contain; }
  .auto-preview { flex: none; }
  .plan-modal textarea.plan-text { min-height: 150px; height: 30dvh; flex: none; }
  .plan-modal textarea.claude-brief { min-height: 110px; height: 18dvh; }
  /* Above the box on phones, so the keyboard never covers the shortcuts. */
  .plan-tools, .md-edit .md-tools { order: -1; }
  .plan-preview { max-height: none; overflow: visible; }
}

/* ---------- phones ---------- */
@media (max-width: 720px) {
  input, select, textarea { font-size: 16px !important; } /* stops iOS zooming in on focus */
  .modal-where, .event-where { font-size: 16px; }
  .toast { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .board { padding-bottom: 12px; }
  /* The board's name already shows in the switcher above. */
  .board-bar > .swatch, .board-bar > .editable.board-name, .map-trail.root { display: none; }
  .board-bar .plan-btn { margin-left: auto; }
  .board-bar > .menu-wrap { order: 2; }
  .board-bar > .menu-wrap .menu.left { left: auto; right: 0; }
  .board { scroll-snap-type: x proximity; gap: 10px; }
  .list, .add-list { width: min(84vw, 320px); scroll-snap-align: center; }
  /* Strips snap by their start, so a run of them at the left shows whole. */
  .board { scroll-padding-inline: 12px; }
  .list.collapsed { width: auto; scroll-snap-align: start; }
  /* Dialogs become bottom sheets; the card editor fills the screen and scrolls inside. */
  .overlay { padding: 0; flex-direction: column; align-items: stretch; justify-content: flex-start; }
  .modal { width: 100%; margin-top: auto; border-radius: 16px 16px 0 0; }
  .card-modal { height: 100dvh; border-radius: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
  .card-modal .modal-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .card-modal .sched-row { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .cal-bar { flex-wrap: wrap; padding: 6px 8px; }
  .cal-title { font-size: var(--fs-body); order: 5; width: 100%; margin: 0 4px; }
  .tray-toggle, .tray-close { display: inline-flex; }
  .tray-head .muted { flex: 1; }
  .tray {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; width: auto; height: 62dvh;
    border: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(105%); transition: transform 0.2s ease;
  }
  .tray.shown { transform: none; }
  /* Slide out of the way while a card is dragged so the calendar is reachable. */
  .tray.shown.dragging { transform: translateY(105%); }
  .agenda-time { width: 104px; }
  .tg-day .num { font-size: var(--fs-body); width: 28px; height: 28px; line-height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- project setup ----------
   The new-board flow and Project settings. Built from shared pieces: the
   label panel's tick list, a Picker for the type, the segmented control for
   plan detail, Plan's preview for the notes, and Folds when editing. */
.setup-modal { width: min(600px, 100%); display: flex; flex-direction: column; max-height: 88vh; }
.setup-progress { display: flex; flex-direction: column; gap: 8px; padding: 4px 16px 4px; }
.setup-progress .section-head .muted { flex: 1; text-align: right; }
.setup-body { overflow-y: auto; min-height: 0; flex: 1; }
.setup-step { display: flex; flex-direction: column; gap: 16px; }
.setup-step .field input { width: 100%; }
.setup-hint { line-height: 1.45; }
.setup-add { display: flex; gap: 6px; padding-top: 4px; }
.setup-add input { flex: 1; min-width: 0; }
.setup-seg { align-self: flex-start; }
.setup-step-text { overflow-wrap: anywhere; }
.setup-modal textarea.setup-spec {
  min-height: 150px; height: 26vh; overflow: auto; resize: vertical; white-space: pre-wrap; tab-size: 2;
  font: var(--fs-meta)/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.setup-preview { max-height: none; }
.setup-spec-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.setup-pv-text { font-size: var(--fs-meta); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.setup-foot-note { flex: 1; }
@media (max-width: 720px) {
  .setup-modal { height: 100dvh; max-height: none; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .setup-modal textarea.setup-spec { height: 22dvh; }
}

/* ---------- passkeys ---------- */
h2.modal-title { padding: 4px 6px; }
.signin .hint { font-size: var(--fs-meta); max-width: 280px; }

/* ---------- dropping a card on another ---------- */
.card { position: relative; }
/* Fade the held card so the choices under it stay readable. */
.drop-on-card .drag-ghost { opacity: 0.35; }
.card.drop-target { outline: 2px solid var(--accent); outline-offset: 1px; }
.drop-pads {
  position: absolute; left: -2px; right: -2px; top: calc(100% + 5px); z-index: 5; display: flex; gap: 4px; padding: 4px;
  min-height: 42px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-lg);
}
.drop-pads.above { top: auto; bottom: calc(100% + 5px); }
.drop-pad {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 6px; border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent); font-size: var(--fs-meta); font-weight: 650; white-space: nowrap; overflow: hidden;
}
.drop-pad span { overflow: hidden; text-overflow: ellipsis; }
.drop-pad .icon { flex: none; }
.drop-pad.on { border-style: solid; border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.drop-pad.refused { border-color: color-mix(in srgb, var(--muted) 50%, transparent); color: var(--muted); text-decoration: line-through; }
.drop-pad.refused.on { background: color-mix(in srgb, var(--muted) 18%, var(--surface)); border-style: solid; border-color: var(--muted); color: var(--text); }
.drop-why {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 6;
  display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: var(--fs-meta); line-height: 1.35; box-shadow: var(--shadow-lg);
}
.drop-why .icon { flex: none; margin-top: 1px; }
.drop-pads.above .drop-why { top: auto; bottom: calc(100% + 4px); }
.toast.warn > .icon { color: var(--warn); flex: none; }
.badge.ignored { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }

.link-state.ignored { color: var(--warn); }

/* ---------- map ---------- */
.map-view {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  /* The Map uses the app's own colours, not the board's: cells are card
     tiles, lists are list columns, done is the green of a ticked card, and
     the focused card is ringed in the accent, like a focused control. */
  --c: var(--done-fill); --c-ink: var(--done-ink);
  --cell: var(--surface); --cell-list: color-mix(in srgb, var(--text) 9%, var(--col));
}
.map-bar { flex-wrap: wrap; gap: 6px 14px; padding-bottom: 6px; }
.map-trail { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
.map-crumb { border: 0; background: transparent; padding: 2px 4px; border-radius: 6px; font: inherit; font-size: var(--fs-body); color: var(--muted); cursor: pointer; }
.map-crumb:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 7%, transparent); }
.map-crumb.here { color: var(--text); font-weight: 600; font-size: var(--fs-bar); cursor: default; }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-meta); color: var(--muted); }
.map-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-zoom { margin-left: auto; display: inline-flex; gap: 4px; }
.map-replay { display: flex; align-items: center; gap: 8px; font-size: var(--fs-meta); }
.map-replay input[type='range'] { width: 180px; min-width: 0; accent-color: var(--accent); }
.map-when { min-width: 52px; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-when.past { color: var(--text); font-weight: 600; }
.map-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.map-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-svg:active { cursor: grabbing; }
.map-empty { position: absolute; inset: 0; display: grid; place-content: center; }

/* Cells: not done is a pale tint, done is solid, part done fills from the
   inside out, waiting is hatched. Shape and pattern carry the state as well
   as colour. */
.cell { fill: var(--cell); stroke: var(--bg); stroke-width: 2; transition: fill 0.5s; }
.cell.done, .map-cell.done > .cell { fill: var(--c); }
.cell-fill { fill: var(--c); opacity: 0.55; pointer-events: none; }
.cell-hatch { fill: url(#map-hatch); pointer-events: none; }
rect.cell-hatch { fill: none; stroke: var(--text); stroke-width: 0; }
.map-key rect.cell-hatch { fill: url(#map-hatch); }
.map-key rect.cell { stroke: var(--line); stroke-width: 1; }
#map-hatch line { stroke: color-mix(in srgb, var(--text) 30%, transparent); stroke-width: 1.6; }
.map-cell.k-list > .cell, .map-cell.k-other > .cell { fill: var(--cell-list); }
.map-cell.k-list.done > .cell { fill: var(--c); }
.map-cell.k-other > .cell { stroke-dasharray: 3 3; stroke: var(--muted); }
.map-cell.outside > .cell { stroke-dasharray: 3 3; stroke: var(--muted); stroke-width: 1; }
.map-cell { cursor: pointer; transition: opacity 0.2s; }
.map-cell:hover > .cell { fill-opacity: 0.82; }
.map-cells.dim .map-cell:not(.near), .map-labels.dim .map-label:not(.near) { opacity: 0.5; }
.map-labels { pointer-events: none; }
.map-label { transition: opacity 0.2s; }
.cell-arc { fill: none; }
/* A halo in the cell's own colour keeps names readable over hatching and links. */
.cell-label { fill: var(--text); font-weight: 500; paint-order: stroke; stroke: var(--cell); stroke-width: 3.5px; stroke-linejoin: round; }
.map-label.k-list .cell-label, .map-label.k-other .cell-label { stroke: var(--cell-list); }
.map-label.done .cell-label { fill: var(--c-ink); stroke: var(--c); font-weight: 600; }
/* List names as on the board's list headers; the focused card's name in bold. */
.map-label.k-list text, .map-label.k-other text { font-weight: 600; }
.map-label.active text { font-weight: 650; }
.map-labels.dim .map-label:not(.near) .cell-label { stroke-width: 0; }
.map-key-head { font-size: var(--fs-meta); margin-left: 4px; }
.cell-ring { fill: none; stroke: var(--accent); stroke-width: 3; pointer-events: none; }

/* Links: colour and pattern both say the state, so it reads without colour too. */
.ln, .ln-halo { fill: none; stroke-linecap: round; transition: opacity 0.15s; pointer-events: none; }
.ln-halo { stroke: var(--surface); stroke-width: 6; opacity: 0.85; }
.ln.waiting { stroke: var(--accent); stroke-width: 2.2; }
.ln.ready { stroke: var(--ok); stroke-width: 2.4; stroke-dasharray: 8 6; animation: map-flow 1.1s linear infinite; }
.ln.done { stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 3 4; }
.ln.ignored { stroke: var(--warn); stroke-width: 2.6; stroke-dasharray: 0.5 5; }
.map-head.waiting path { fill: var(--accent); }
.map-head.ready path { fill: var(--ok); }
.map-head.done path { fill: var(--muted); }
.map-head.ignored path { fill: var(--warn); }
.map-link.off { opacity: 0.15; }
.map-link.on .ln { stroke-width: 3; }
@keyframes map-flow { to { stroke-dashoffset: -14; } }
@media (prefers-reduced-motion: reduce) { .ln.ready { animation: none; } .cell { transition: none; } }
.map-key .ln.ready { animation: none; }

.map-hub { fill: var(--surface); filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.16)); }
.map-hub-track { fill: none; stroke: color-mix(in srgb, var(--text) 10%, transparent); stroke-width: 4; }
/* Like every progress bar: accent while under way, green when all done. */
.map-hub-progress { fill: var(--accent); }
.map-hub-progress.full { fill: var(--ok); }
.map-hub-name { font-size: var(--fs-body); font-weight: 650; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.map-hub-pct { font-size: 28px; font-weight: 650; fill: var(--text); font-variant-numeric: tabular-nums; }
.map-hub-count { font-size: var(--fs-meta); fill: var(--muted); }
.map-hub-back { font-size: var(--fs-meta); fill: var(--accent); font-weight: 600; }
.map-hub-group { pointer-events: none; }
.map-hub-group.can-zoom-out { pointer-events: auto; cursor: zoom-out; }

.map-panel {
  position: absolute; top: 10px; right: 12px; width: 300px; max-height: calc(100% - 20px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.map-panel-head { display: flex; align-items: flex-start; gap: 8px; margin-right: -4px; }
.map-panel-title strong { font-size: var(--fs-bar); font-weight: 650; }
.map-panel-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.map-panel-list { display: flex; flex-direction: column; gap: 2px; }
.map-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.map-row { display: flex; align-items: center; gap: 8px; min-height: 32px; border: 0; background: transparent; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; text-align: left; }
.map-row .link-state { flex: none; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent); }
.map-row .link-state.ok { color: var(--ok-ink); background: var(--ok); }
.map-row:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.map-row.done span:first-of-type { color: var(--muted); text-decoration: line-through; }
.map-panel .struck { text-decoration: line-through; color: var(--muted); }
@media (max-width: 720px) {
  .map-legend { order: 5; width: 100%; font-size: var(--fs-meta); gap: 4px 10px; }
  .map-hide { order: 7; }
  .map-replay { order: 8; flex: 1 1 220px; min-width: 0; }
  .map-replay input[type='range'] { flex: 1; width: auto; }
  /* The card sheet sits under the circle instead of over it, and the circle
     shrinks to fit above. */
  .map-stage { display: flex; flex-direction: column; }
  .map-svg { flex: 1; height: auto; min-height: 0; }
  .map-panel { position: static; flex: none; width: auto; max-height: 46%; border-radius: 16px 16px 0 0; border-bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* ---------- reasons on tap ---------- */
/* Pills and warnings show why when tapped, in place of hover-only tooltips. */
.tile-why {
  margin-top: 6px; padding: 6px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text); font-size: var(--fs-meta); line-height: 1.4; overflow-wrap: anywhere;
}
button.why-btn[aria-expanded='true'] { box-shadow: inset 0 0 0 1.5px currentColor; }
button.badge.due.why-btn { padding: 1px 5px; margin: -1px -5px; border-radius: 5px; }

/* ---------- Path trail ---------- */
.path-trail { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; color: var(--muted); }
.path-trail .crumb { font-size: var(--fs-meta); max-width: 220px; }
.path-trail .board-crumb { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.path-trail .board-crumb:hover { background: transparent; color: var(--muted); }
.path-trail .crumb.current { font-size: var(--fs-meta); font-weight: 600; cursor: default; }

/* ---------- tap areas ---------- */
/* Small controls keep their look but take taps from at least 32 by 32 px. */
.btn.small { min-height: 32px; }
.segmented button { min-height: 32px; }
.editable, .crumb, .map-crumb, .tile-zoom, .tile-sub-title { min-height: 32px; }
.tile-check, .tile-sub { min-height: 32px; align-items: center; }
.tile-check .box { margin-top: 0; }
.tick, .box-btn, button.label, button.badge, .link-state { position: relative; }
.tick::after, .box-btn::after, button.label::after, button.badge::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: max(100%, 32px); height: max(100%, 32px); translate: -50% -50%;
}

/* ---------- notes ---------- */
/* A note is information, not work: flat paper with an outline and a folded
   corner, a page mark where a task has its tick, and its first lines of text.
   Shape, mark and text all say "note", so it reads without colour too. */
/* Paper sits between the list and a task card; its outline (--edge) is what
   keeps it apart from the list, so it is stronger than --line. */
:root {
  --paper: color-mix(in srgb, var(--surface) 62%, var(--col));
  --edge: color-mix(in srgb, var(--text) 20%, var(--paper));
  --fold: color-mix(in srgb, var(--line) 70%, var(--surface));
}
.card.note-card {
  background: var(--paper); box-shadow: none; border: 1px solid var(--edge);
  border-top-right-radius: 0; padding-right: 16px;
}
.card.note-card::before {
  content: ''; position: absolute; top: -1px; right: -1px; width: 14px; height: 14px;
  background: linear-gradient(225deg, var(--col) 0 50%, var(--fold) 50% 100%);
  border-bottom-left-radius: 3px; box-shadow: -1px 1px 0 var(--edge);
  pointer-events: none;
}
.card.note-card .card-title { font-weight: 600; }
.note-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--muted); }
.card .note-mark { margin-top: 1px; }
.note-mark.small { width: 22px; height: 22px; }
.note-mark.large { width: 26px; height: 26px; margin-top: 5px; border-radius: 6px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); }
.note-snippet {
  margin-top: 3px; font-size: var(--fs-meta); line-height: 1.4; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.note-thumb { display: block; width: 100%; height: auto; max-height: 132px; object-fit: cover; border-radius: 6px; margin-top: 7px; background: color-mix(in srgb, var(--text) 6%, transparent); }
.img-missing {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 8px;
  border-radius: 6px; color: var(--muted); font-size: var(--fs-meta); background: color-mix(in srgb, var(--text) 6%, transparent);
}
.note-thumb.img-missing { height: 56px; }
.box.on { background: var(--ok); border-color: var(--ok); }
.row-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; color: var(--muted); }
.tile-context { gap: 0; }
.tile-context .tile-check-title { margin-top: 2px; }
.note-row .sub-title, .tile-open-row .tile-sub-title { font-weight: 500; }
.composer-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
.composer-foot .hint { margin-top: 0; }
.composer-kind button { font-size: var(--fs-meta); padding: 3px 9px; }
.composer.noting .composer-input { background: var(--paper); border-color: var(--muted); }
.note-modal .modal-title { font-size: var(--fs-title); }
.note-text { min-height: 120px; font-size: var(--fs-body); line-height: 1.5; }

/* Markdown in notes and descriptions (markdown.js). Formatted text in the
   editor sits where its box sits, with the box's padding, so clicking it to
   edit does not move the words. */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md hr { margin: 0 0 8px; }
.md ul, .md ol { padding-left: 22px; }
.md li > p { margin: 0; }
.md li > ul, .md li > ol { margin: 2px 0; }
.md .md-h { margin: 12px 0 4px; font-weight: 650; line-height: 1.3; }
.md .md-h1 { font-size: 1.25em; }
.md .md-h2 { font-size: 1.12em; }
.md .md-h3 { font-size: 1em; }
.md strong { font-weight: 650; }
.md code { font: 0.92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.md code { padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.md pre { padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, transparent); overflow-x: auto; white-space: pre; }
.md pre code { padding: 0; background: none; font-size: var(--fs-meta); line-height: 1.5; }
.md blockquote { padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md-view { padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; min-height: 0; }
.md-view.can-edit { cursor: text; }
@media (hover: hover) { .md-view.can-edit:hover { border-color: var(--line); } }
.md-view.desc { min-height: 0; }
.md-edit { display: flex; flex-direction: column; gap: 6px; }
/* The formatting buttons wrap; Preview stays at the end of the first row, past a line, since it changes the view, not the text. */
.md-tools { display: flex; align-items: flex-start; gap: 4px; }
.md-tools .plan-toolbar { flex: 1 1 0; min-width: 0; }
.md-preview-btn { margin-left: auto; position: relative; }
.md-preview-btn::before { content: ''; position: absolute; left: -5px; top: 4px; bottom: 6px; border-left: 1px solid var(--line); }
.tool-btn[aria-pressed='true'] { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tool-btn[aria-pressed='true'] .icon { color: var(--accent); }
.md-preview { max-height: none; overflow: visible; }
.md-preview .md { min-height: 0; }
/* On a tile or a note row the text is inside a button: each block is a line. */
.md.compact { white-space: normal; }
.md.compact .md-line { display: block; }
.md.compact .md-h { margin: 0; font-weight: 600; color: var(--text); font-size: 1em; }
.md.compact .md-li { padding-left: 1.1em; text-indent: -1.1em; }
.md.compact .md-bullet + .md-line { display: inline; }
.md.compact .md-bullet { display: inline-block; width: 1.1em; text-indent: 0; }
.md.compact .md-pre { font: 0.92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-line; }
.md.compact .md-quote { padding-left: 7px; border-left: 2px solid var(--line); }
.md.compact .md-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md.compact code { padding: 0 3px; }
.note-place { gap: 6px; }
.note-inside { display: flex; flex-direction: column; gap: 2px; }

/* Context: the cards a card links to both ways, with no order. */
.ctx-row .box.round { margin: 0 4px; }
.ctx-match-line { display: flex; align-items: center; gap: 6px; }
.ctx-match .box.round, .ctx-match .note-mark { flex: none; }
.ctx-new .link-match-title { color: var(--accent); font-weight: 600; }
.ctx-new .icon { color: var(--accent); }

/* Images in the card editor and the viewer. */
.file-btn { cursor: pointer; }
.file-btn input { display: none; }
.img-hint { align-self: center; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.img-cell { position: relative; aspect-ratio: 1; }
.img-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--text) 7%, transparent); }
.img-open .img-missing { height: 100%; }
.img-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.img-remove {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; background: rgb(0 0 0 / 0.6); color: #fff;
}
.img-remove::after { content: ''; position: absolute; inset: -4px; }
.img-viewer { width: min(1100px, 100%); }
.img-viewer-head { align-items: center; }
.img-viewer-body { display: grid; place-items: center; padding: 4px 12px 16px; }
.img-full { display: block; max-width: 100%; max-height: 78dvh; width: auto; height: auto; object-fit: contain; border-radius: 6px; }

/* The Notes tab: every note in one place, with search. */
.notes-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.notes-bar { flex-wrap: wrap; gap: 8px; padding: 10px 12px 6px; }
.notes-search {
  display: flex; align-items: center; gap: 6px; flex: 1 1 260px; max-width: 460px; min-height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted);
}
.notes-search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.notes-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 6px 0; min-height: 0; outline: none; color: var(--text); }
.notes-new { margin-left: auto; }
.notes-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px calc(16px + env(safe-area-inset-bottom)); }
.notes-count { margin: 2px 2px 8px; }
.notes-list { display: grid; gap: 8px; max-width: 780px; }
.note-row-big {
  position: relative; display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 16px 10px 12px;
  border: 1px solid var(--edge); border-radius: 10px; border-top-right-radius: 0; background: var(--paper); text-align: left;
}
.note-row-big::before {
  content: ''; position: absolute; top: -1px; right: -1px; width: 14px; height: 14px;
  background: linear-gradient(225deg, var(--bg) 0 50%, var(--fold) 50% 100%);
  border-bottom-left-radius: 3px; box-shadow: -1px 1px 0 var(--edge);
}
.note-row-big:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.note-row-big .note-mark { margin-top: 1px; }
.note-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.note-row-main .card-labels { margin-bottom: 2px; }
.note-row-title { font-weight: 650; overflow-wrap: anywhere; }
.note-row-where { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.note-row-context { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.note-row-context .icon { flex: none; }
.note-row-thumb { flex: none; width: 64px; height: 64px; min-height: 0; object-fit: cover; border-radius: 6px; }
.notes-empty { display: grid; justify-items: center; gap: 8px; max-width: 420px; margin: 10vh auto 0; text-align: center; }
.notes-none { padding: 12px 2px; }
mark { background: color-mix(in srgb, var(--accent) 32%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
@media (max-width: 720px) {
  .notes-bar { padding: 8px 10px 4px; }
  .notes-search { flex-basis: 100%; max-width: none; }
  .notes-body { padding: 4px 10px 16px; }
}

/* ---------- accounts and sharing ---------- */
.signin-sub { max-width: 280px; font-size: var(--fs-body); }
.signin-field { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; }
.signin-note { display: flex; gap: 6px; align-items: flex-start; text-align: left; }
/* A list of rows with an icon, a name over a muted line, and actions at the end
   (passkeys, signed-in devices, the people on a board). */
.row-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; }
.row-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px; }
.row-list li + li { border-top: 1px solid var(--line); }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name .muted { font-weight: 400; }
.row-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; }
.row-sub .btn { margin-left: auto; }
.account-who { display: flex; align-items: center; gap: 8px; margin: 0; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form > .btn { align-self: flex-start; }
.stack-form .segmented button { flex: 1; justify-content: center; }
.share-role { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.share-error { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.share-error .error { margin: 0; }
.signup-link { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; }
.signup-link input { min-width: 0; font-size: var(--fs-meta); }
.signup-link .hint { grid-column: 1 / -1; margin: 0; }
/* Sync on the calendar. */
.cal-sync .hint.cal-intro { margin: 0; font-size: var(--fs-meta); }
.cal-sync .hint.signin-note { margin: 0; font-size: var(--fs-meta); }
.cal-sync .hint.signin-note .icon { flex: none; margin-top: 1px; }
.cal-make { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.cal-make .btn { margin-left: auto; }
.cal-link .cal-link-apple { grid-column: 1 / -1; justify-self: start; color: var(--text); text-decoration: none; }
.cal-error { display: inline-flex; align-items: flex-start; gap: 4px; color: var(--warn); white-space: normal; }
.cal-error .icon { flex: none; margin-top: 1px; }
/* Under the calendar's bar: other calendars that may be out of date. */
.cal-stale { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 0 12px 8px; flex: none; }
.cal-stale .cal-error { flex: 1 1 320px; }
.cal-stale-acts { display: flex; gap: 6px; flex: none; }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.menu-hint { margin-left: 16px; font-size: var(--fs-meta); color: var(--muted); }
.menu-item:has(.menu-hint) { max-width: min(340px, 86vw); }
.badge.pill.view-only { color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent); }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.history-list li { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
/* A card on a board shared for viewing only: nothing that adds or removes. */
.card-modal.read-only .label-toggle { display: none; }
/* Nor the box that links a card to Context, and the × that unlinks one. */
.card-modal.read-only .link-picker, .card-modal.read-only .ctx-row > .btn { display: none; }
/* What stays is shown, not offered: a tick that cannot be pressed, and a
   title and checklist items as plain text in the place their boxes have. */
.tick:disabled, span.tick { cursor: default; }
.tick:disabled:not(.on):hover, span.tick:not(.on):hover { border-color: var(--muted); }
.card-modal.read-only h2.modal-title { margin: 1px; overflow-wrap: anywhere; }
.card-modal.read-only h2.modal-title:hover { background: transparent; }
.check-text.plain { padding: 7px 9px; overflow-wrap: anywhere; white-space: pre-wrap; }
.check-text.plain:hover { background: transparent; }
.picker select:disabled { opacity: 1; cursor: default; }
.picker select:disabled:hover { background: transparent; }
.view-note { display: flex; align-items: center; gap: 6px; margin: 0; }
/* Under Plan's box: what Tab does in it, and how the keyboard gets out. Not
   shown on a phone, which has no Tab key; a screen reader still reads it. */
.plan-keys { margin: 0; }
/* New block on the calendar: just its plus where the bar is short of room,
   so the title and the views keep theirs. */
@media (max-width: 1180px) {
  .new-block-word { display: none; }
}
@media (max-width: 720px) {
  .plan-keys { display: none; }
}

/* ---------- state strip, property rows, Path tree (docs/DESIGN.md) ---------- */
/* State strip: one row of chips that wraps rather than scrolls. Only the
   states that already have colours use them. */
.state-strip { position: relative; display: flex; flex-wrap: wrap; gap: 6px; }
.state-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
  font-size: var(--fs-meta); font-weight: 500; white-space: nowrap;
}
.state-chip svg { flex: none; color: var(--muted); }
button.state-chip:hover { background: color-mix(in srgb, var(--text) 6%, var(--surface)); }
button.state-chip[aria-expanded='true'] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.state-chip.overdue, .state-chip.overdue svg { color: var(--danger); font-weight: 600; }
.state-chip.soon, .state-chip.soon svg, .state-chip.warn, .state-chip.warn svg { color: var(--warn); font-weight: 600; }
.state-chip.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.state-chip.ok, .state-chip.ok svg { color: var(--ok); font-weight: 600; }
.state-chip.ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.state-chip.locked { background: color-mix(in srgb, var(--text) 8%, var(--surface)); font-weight: 600; }
.state-chip.locked svg { color: var(--text); }
/* The one offer: dashed, so it reads as something to add, not a value. */
.state-chip.dashed { border-style: dashed; border-color: var(--muted); background: transparent; color: var(--muted); }
/* What a chip opens: a popover under the strip, a bottom sheet on a phone. */
.strip-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; width: max-content; min-width: 240px; max-width: min(360px, calc(100vw - 32px));
  padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.strip-pop.sheet {
  position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 150; width: auto; max-width: none;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0;
}
.sheet-shade { position: fixed; inset: 0; z-index: 149; background: rgb(0 0 0 / 0.5); }
.strip-why { margin: 0; }
/* The due date and the calendar blocks, edited in a chip's popover. */
.strip-pop:has(.sched-row) { max-width: min(460px, calc(100vw - 32px)); }
.strip-pop .section { gap: 8px; }
.due-editor { display: flex; flex-direction: column; gap: 6px; }
.due-editor .due-inputs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* Property rows: a muted name in a 96px column, then the value as text. */
.prop-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 32px; }
.prop-name { color: var(--muted); font-size: var(--fs-meta); font-weight: 500; }
.prop-value { min-width: 0; font-size: var(--fs-body); font-weight: 500; overflow-wrap: anywhere; }
.prop-value .picker { color: var(--text); }
.prop-button { justify-self: start; padding: 3px 6px; margin-left: -6px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; text-align: left; }
.prop-button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.add-line > .btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; margin-left: -8px; color: var(--muted); font-weight: 500; }
.add-line > .btn:hover { color: var(--text); }

/* Path tree. Rows are a tick, the title, then muted words and a count. */
.path-tree { display: flex; flex-direction: column; gap: 2px; }
.pt-row { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 2px 8px; border-radius: 7px; }
.pt-title { flex: 1 1 auto; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; overflow-wrap: anywhere; }
button.pt-title:hover { text-decoration: underline; text-underline-offset: 2px; }
.pt-meta { flex: none; color: var(--muted); font-size: var(--fs-meta); }
.pt-row.done > .pt-title { color: var(--muted); text-decoration: line-through; }
.pt-row.ignored > .pt-title { color: var(--muted); text-decoration: line-through; }
.pt-parent { color: var(--muted); }
.pt-up { flex: none; display: inline-flex; width: 18px; justify-content: center; }
/* The card itself, tinted with the accent. */
.pt-self { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); font-weight: 600; }
.pt-dot { flex: none; width: 18px; height: 18px; border: 5px solid var(--accent); border-radius: 50%; }
/* Subtasks hang from the card on a tree line, one indent a level. */
.pt-kids { display: flex; flex-direction: column; gap: 2px; margin-left: 16px; padding-left: 10px; border-left: 1.5px solid var(--line); }
.pt-add-row { color: var(--muted); }
.pt-add-row svg { flex: none; width: 18px; }
.path-tree .pt-add-input { flex: 1; min-width: 0; padding: 4px 0; border: 0; border-radius: 0; background: transparent; color: var(--text); font: inherit; box-shadow: none; }
.path-tree .pt-add-input:focus { outline: none; }
.pt-add-row:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
/* After and Then unlocks: a small heading, joined to the card by a dashed line. */
.pt-gate { display: flex; flex-direction: column; gap: 2px; margin-left: 16px; padding-left: 10px; border-left: 1.5px dashed var(--muted); }
.pt-heading { padding: 4px 8px 0; color: var(--muted); font-size: var(--fs-caps); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.pt-add { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 30px; padding: 2px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-meta); }
.pt-add:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
/* Add a key and Add an unlock show while the pointer or focus is in the tree
   (they are always in the card's ⋯ menu too), and so does an empty group. */
.path-tree .pt-add-gate, .path-tree .pt-gate.empty { display: none; }
.path-tree:hover .pt-add-gate, .path-tree:focus-within .pt-add-gate { display: inline-flex; }
.path-tree:hover .pt-gate.empty, .path-tree:focus-within .pt-gate.empty { display: flex; }
.pt-linking { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0 0 26px; }
.pt-linking .link-picker { flex: 1; min-width: 0; margin-left: 0; }
.pt-remove { visibility: hidden; }
.pt-row:hover .pt-remove, .pt-remove:focus-visible { visibility: visible; }
@media (max-width: 720px) {
  .state-chip { min-height: 32px; }
  .pt-remove { visibility: visible; }
}

/* ---------- the workspace: the docked card editor and the frame ---------- */
/* The view and the card docked beside it, each scrolling on its own. */
.workspace { flex: 1; min-height: 0; display: flex; }
.workspace > :not(.inspector):not(.insp-resize) { flex: 1; min-width: 0; }
.inspector {
  flex: none; width: var(--insp-w, clamp(420px, 32vw, 460px)); min-width: 380px; max-width: max(380px, calc(100% - 400px));
  min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--line);
}
.inspector:focus { outline: none; }
/* Its left edge: dragged, or arrowed with focus, to make it wider or narrower.
   The tap area is 12px over the line; the line turns accent on hover, focus
   and while dragging. */
.insp-resize { flex: none; width: 0; position: relative; z-index: 4; touch-action: none; }
.insp-resize::before { content: ''; position: absolute; inset: 0 -6px; cursor: col-resize; }
.insp-resize::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 3px; border-radius: 2px;
  background: var(--accent); opacity: 0; transition: opacity .12s; pointer-events: none;
}
@media (hover: hover) { .insp-resize:hover::after { opacity: .7; } }
.insp-resize.dragging::after, .insp-resize:focus-visible::after { opacity: 1; }
.insp-resize:focus { outline: none; }
.insp-resize:focus-visible::before { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 4px; }
html.resizing-x, html.resizing-x * { cursor: col-resize !important; user-select: none; }
/* Its top row: back, the card's list, then copy, expand, ⋯ and ×. */
.insp-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 2px; padding: 8px 8px 0 12px; background: var(--bg); }
.insp-bar .modal-where { padding-left: 0; }
.modal-head.insp-head { padding-top: 2px; }
.modal-head.insp-head .tick.large { margin-top: 9px; }
/* Narrower than 1100px it fills the screen; expanded, it is a wide page. */
.overlay:has(> .card-sheet) { padding: 0; }
.modal.card-sheet { width: 100%; min-height: 100dvh; border-radius: 0; box-shadow: none; }
.modal.card-page { width: min(860px, 100%); }
.card-tabs { display: flex; align-self: stretch; }
.card-tabs button { flex: 1; }
/* The frame: a sidebar (icons only below 1100px), or on a phone the board
   switcher on top and the bottom bar. */
.main-col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.sidebar {
  flex: none; width: 232px; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  padding: calc(12px + env(safe-area-inset-top)) 10px 12px calc(10px + env(safe-area-inset-left));
  background: var(--col); border-right: 1px solid var(--line);
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; font-size: var(--fs-bar); font-weight: 700; }
.sb-brand img { flex: none; }
.sb-tools { display: flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 2px 6px; }
.sb-tools .sync { flex: 1; }
.sb-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left;
}
.sb-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.sb-item.on { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.sb-item > svg, .sb-item > .swatch { flex: none; }
.sb-item > svg { color: var(--muted); }
.sb-item.on > svg { color: var(--text); }
.sb-item.quiet { color: var(--muted); }
.sb-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-heading { padding: 14px 8px 4px; font-size: var(--fs-caps); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sb-views { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 16px; padding-left: 8px; border-left: 1.5px solid var(--line); }
.sb-view { min-height: 30px; }
.sb-settings { width: 100%; }
.sb-settings > .btn { width: 100%; justify-content: flex-start; gap: 10px; min-height: 34px; padding: 6px 8px; color: var(--text); font-weight: 400; }
.sb-settings > .btn > svg { color: var(--muted); }
/* A menu at the foot of the screen opens upwards. */
.menu-wrap.up > .menu { top: auto; bottom: calc(100% + 4px); }
/* The sidebar scrolls, so Settings' menu sits on the screen rather than in
   it: it would be cut off at the sidebar's edge, narrow or not. */
.menu-wrap.sb-settings > .menu { position: fixed; top: auto; bottom: calc(54px + env(safe-area-inset-bottom)); left: calc(8px + env(safe-area-inset-left)); right: auto; }
.sidebar.compact { width: 60px; align-items: center; padding-left: 8px; padding-right: 8px; }
.sidebar.compact .sb-label, .sidebar.compact .sync { display: none; }
.sidebar.compact .sb-heading { width: 100%; height: 1px; margin: 8px 0; padding: 0; overflow: hidden; color: transparent; background: var(--line); }
.sidebar.compact .sb-item, .sidebar.compact .sb-settings > .btn { justify-content: center; padding: 8px; }
.sidebar.compact .sb-views { margin: 2px 0 6px; padding-left: 0; border-left: 0; }
.sidebar.compact .sb-tools { flex-direction: column; padding: 0 0 6px; }
.sidebar.compact .undo-redo { flex-direction: column; }
.sidebar.compact .sb-brand { padding: 2px 0 8px; }
.bottom-bar {
  flex: none; display: flex; gap: 2px; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}
.bb-tab, .bb-more > .btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; min-height: 48px; padding: 6px 2px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: var(--fs-caps); font-weight: 600;
}
.bb-more { flex: 1; display: flex; }
.bb-tab.on, .bb-more.on > .btn { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
/* On a phone the lists stack top to bottom as folds, so nothing scrolls sideways. */
@media (max-width: 720px) {
  .app .board { flex-direction: column; align-items: stretch; overflow-x: hidden; overflow-y: auto; scroll-snap-type: none; }
  .app .list, .app .add-list { width: auto; max-height: none; flex: none; }
  .app .list-cards { overflow: visible; }
  .app .list-head, .app .list-strip { touch-action: pan-y; }
  .app .list-strip { flex-direction: row; width: 100%; padding: 12px 12px 12px 14px; }
  .app .list-strip-name { writing-mode: horizontal-tb; max-height: none; }
  .app .list-strip .count { flex: 1; text-align: left; }
}

/* Search: the Notes view's search box and a .row-list of results. */
.search-modal { width: min(560px, 100%); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.search-modal .notes-search { max-width: none; flex: none; }
.search-results { max-height: min(60vh, 520px); overflow-y: auto; overscroll-behavior: contain; }
.search-results li { padding: 0; }
.search-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 0; background: transparent; text-align: left;
}
.search-row:hover, .search-row:focus-visible { background: color-mix(in srgb, var(--text) 6%, transparent); }
.search-results li:first-child .search-row { border-radius: 9px 9px 0 0; }
.search-results li:last-child .search-row { border-radius: 0 0 9px 9px; }
.search-row.done .row-name { color: var(--muted); text-decoration: line-through; }
.search-none { padding: 2px 4px; }

/* Beside the sidebar the calendar's bar wraps rather than cutting its title short. */
.app .cal-bar { flex-wrap: wrap; row-gap: 6px; }
.app .cal-title { flex: none; }

/* The Outline view: every card as a row in columns, grouped by
   list or due date, subtasks indented 26px a level (outline.js). */
.outline-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ol-group-by { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-size: var(--fs-body); }
.ol-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); }
.ol-row {
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(120px, 220px) 120px 150px 110px;
  align-items: center; min-height: 40px; border-bottom: 1px solid var(--line);
}
.ol-cell { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 8px; }
.ol-head { position: sticky; top: -8px; z-index: 1; min-height: 30px; background: var(--bg); }
.ol-row .ol-name { padding-left: calc(8px + var(--lvl, 0) * 26px); }
.ol-head .ol-cell { font-size: var(--fs-caps); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.ol-group-head { padding: 16px 8px 6px; font-size: var(--fs-body); }
.ol-group-head .muted { margin-left: 4px; }
.ol-row[data-row-id]:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.ol-row.on, .ol-row.on:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.ol-title { flex: 0 1 auto; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; overflow-wrap: anywhere; }
.ol-title:hover { text-decoration: underline; text-underline-offset: 2px; }
.ol-row.done .ol-title { color: var(--muted); text-decoration: line-through; }
.ol-labels { flex-wrap: wrap; gap: 4px; }
.ol-due, .ol-planned { font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; }
.ol-due.overdue, .ol-due.overdue svg { color: var(--danger); font-weight: 600; }
.ol-due.soon, .ol-due.soon svg { color: var(--warn); font-weight: 600; }
.ol-bar { flex: none; width: 52px; height: 5px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent)) left / var(--p) 100% no-repeat, color-mix(in srgb, var(--text) 10%, transparent); }
.ol-bar.complete { background: var(--ok); }
.ol-empty { padding: 24px 8px; }
/* Narrow (a phone, or beside the docked editor): the name on the first
   line, then its labels, due, planned and progress on one line under it, and
   no column headings. */
.ol-body { container: outline / inline-size; }
@container outline (max-width: 820px) {
  .ol-row.ol-head { display: none; }
  .ol-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 6px 8px 8px calc(36px + var(--lvl, 0) * 26px); }
  .ol-row .ol-name { flex: 1 1 100%; margin-left: -28px; padding: 2px 0; }
  .ol-row .ol-cell:not(.ol-name) { padding: 0; }
  .ol-row .ol-cell:not(.ol-name):empty { display: none; }
}
@media (max-width: 720px) {
  .outline-view .board-bar > .swatch, .outline-view .board-bar > .board-name { display: none; }
  .ol-group-by { margin-left: 0; }
  .ol-body { padding: 0 10px 16px; }
}

/* The time strip in the card editor (ui/timestrip.js): the verdict, then the
   days as one bar with day lines, blocks (accent), the usual finish
   (hatched), today (solid line) and the due date (flag, dashed line). */
.time-strip { display: flex; flex-direction: column; gap: 6px; }
.ts-verdict { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-body); }
.ts-verdict svg { margin-top: 2px; color: var(--muted); }
.ts-verdict.ok svg { color: var(--ok); }
.ts-verdict.soon svg, .ts-verdict.warn svg { color: var(--warn); }
.ts-verdict.overdue, .ts-verdict.overdue svg { color: var(--danger); }
.ts-track {
  position: relative; height: 26px; margin-top: 16px; border: 1px solid var(--line); border-radius: 6px;
  background: linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / calc(100% / var(--days, 7)) 100% repeat-x, var(--surface);
}
.ts-track > span { position: absolute; top: 0; bottom: 0; }
.ts-usual {
  top: 4px !important; bottom: 4px !important; border-radius: 3px; border: 1px solid color-mix(in srgb, var(--text) 35%, transparent);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--text) 28%, transparent) 0 2px, transparent 2px 6px);
}
.ts-block, .ts-key.block { min-width: 4px; top: 6px !important; bottom: 6px !important; border-radius: 3px; background: var(--accent); }
.ts-block.after { background: var(--warn); }
.ts-start { width: 0; margin-left: -1px; border-left: 2px dotted color-mix(in srgb, var(--text) 60%, transparent); }
.ts-today { width: 2px; margin-left: -1px; background: var(--text); }
.ts-due { width: 0; border-left: 2px dashed var(--text); margin-left: -1px; }
.ts-due svg { position: absolute; bottom: calc(100% + 1px); left: -3px; color: var(--text); }
.ts-due.overdue { border-color: var(--danger); }
.ts-due.overdue svg { color: var(--danger); }
.ts-scale { display: flex; justify-content: space-between; font-size: var(--fs-meta); color: var(--muted); }
.ts-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-meta); color: var(--muted); }
.ts-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ts-key { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 14px; height: 10px; }
.ts-key.block { position: static; width: 14px; height: 8px; }
.ts-key.usual { border-radius: 2px; border: 1px solid color-mix(in srgb, var(--text) 35%, transparent); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--text) 28%, transparent) 0 2px, transparent 2px 5px); }
.ts-key.start { width: 0; height: 12px; border-left: 2px dotted color-mix(in srgb, var(--text) 60%, transparent); margin: 0 6px; }
.ts-key.today { width: 2px; height: 12px; background: var(--text); margin: 0 6px; }
.ts-key.due { width: 14px; height: 14px; color: var(--text); }
.ts-key.due.overdue { color: var(--danger); }

/* Calendar, Map and Notes in the frame. The Map's key floats over its corner
   instead of filling the bar; Notes uses the width as a grid of notes. */
.app .map-view { position: relative; }
.app .map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; max-width: calc(100% - 24px);
  flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow);
}
.app .map-bar .plan-btn { margin-left: 0; }
.app .notes-list { max-width: none; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
/* Packed by usePacked in notes.js: thin rows, each note spanning its own
   height plus the gap, filled densely so each note goes to the shortest column. */
.app .notes-list.packed { grid-auto-rows: 2px; grid-auto-flow: row dense; row-gap: 0; }
/* The calendar's Cards: a board's name once, its lists under it. */
.tray-board { display: flex; align-items: center; gap: 6px; padding: 14px 4px 0; font-weight: 650; font-size: var(--fs-body); }
.tray-board + .tray-list { padding-top: 4px; }
@media (max-width: 720px) {
  .app .map-legend { order: 0; width: auto; flex-direction: row; flex-wrap: wrap; gap: 4px 10px; }
}

/* Calendar alerts: the defaults in Settings → Alerts, this device's row, and
   the Alert picker under a block's or due date's times. */
.alert-defaults { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.alert-device-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.alert-line { margin-top: 6px; }
.toast > .icon { flex: none; }

/* Who a card is assigned to (docs/DESIGN.md, "Assignees"). On a tile, a badge
   with the person icon; yours in the text colour rather than muted. */
.badge.assignee { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.badge.assignee.mine { color: var(--text); font-weight: 600; }
.assign-section { display: flex; flex-direction: column; gap: 6px; }
.assign-section .prop-button { display: inline-flex; align-items: center; gap: 4px; }
.assign-panel .label-opt label { gap: 8px; }
.assign-panel .icon { color: var(--muted); flex: none; }
.assign-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-role { flex: none; }
.assign-panel .menu-heading { padding: 0 0 2px; }

/* A teammate's block on the calendar: the board's colour in stripes, with
   their username, so it never reads as your own time or another calendar's. */
.block.theirs, .chip.theirs {
  background: repeating-linear-gradient(135deg, var(--tint) 0 6px, color-mix(in srgb, var(--tint) 40%, var(--surface)) 6px 12px);
}
.block.theirs { border-left-style: dashed; }
.block-who, .chip-who { display: flex; align-items: center; gap: 3px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chip-who { flex: none; max-width: 45%; }
.block-who .icon, .chip-who .icon { flex: none; }
/* A phone's month cells are too narrow for a username and a title: the
   person icon alone marks it, and the tooltip names them. */
.chip-who-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.month.compact .chip-who-name { display: none; }
.block.short .block-who { flex: none; }
.agenda-who { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; }
.sched-who { display: inline-flex; align-items: center; gap: 3px; }

/* My tasks: every board's cards assigned to you, in groups by due date. */
.mine-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mine-bar { gap: 8px; padding: 10px 12px 6px; flex-wrap: wrap; row-gap: 6px; }
.mine-bar > * { flex: none; white-space: nowrap; }
.mine-bar > .spacer { flex: 1; }
.mine-bar > .icon { color: var(--muted); }
.mine-title { margin: 0; font-weight: 650; }
.mine-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; max-width: 760px; width: 100%; }
.mine-heading { margin: 0 0 6px; font-size: var(--fs-caps); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mine-heading.late { color: var(--danger); }
.mine-heading .muted { font-weight: 500; }
.mine-list li { padding: 0 0 0 12px; gap: 10px; }
.mine-open { flex: 1; min-width: 0; display: flex; align-items: center; min-height: 52px; padding: 8px 12px 8px 0; border: 0; background: transparent; color: inherit; text-align: left; border-radius: 0 9px 9px 0; }
.mine-open:hover, .mine-open:focus-visible { background: color-mix(in srgb, var(--text) 5%, transparent); }
.mine-where { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.mine-where .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.mine-with { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 720px) {
  .mine-body { padding: 4px 10px 16px; }
  .mine-bar .auto-btn { padding-left: 10px; padding-right: 10px; }
}

/* Cleaning up the calendar (calclear.js). A picked entry has an accent ring
   and a tick in an accent dot at its start, so it reads as picked whatever
   its board's colour, and the bar under the calendar's says how many. */
.chip.picked, .block.picked, .agenda-row.picked { box-shadow: inset 0 0 0 2px var(--accent); }
.agenda-row.picked { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pick-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 14px; height: 14px; border-radius: 50%; margin-right: 3px; vertical-align: -2px;
  background: var(--accent); color: var(--accent-ink);
}
.block-title .pick-mark .icon { margin: 0; }
.cal-pick-bar {
  display: flex; align-items: center; gap: 8px; flex: none; padding: 6px 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-top: 1px solid var(--line);
}
.cal-pick-bar > .icon { color: var(--accent); }
.cal-pick-bar .pick-how { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clear-kinds .label-opt label { gap: 8px; }
.clear-kinds .icon { color: var(--muted); flex: none; }
.clear-kind { flex: 1; min-width: 0; }
.clear-count { flex: none; font-variant-numeric: tabular-nums; }
.clear-kinds .menu-heading { padding: 0 0 2px; }
.clear-kinds .clear-also { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.clear-pick-tip { margin: 0; }
@media (max-width: 720px) {
  .cal-pick-bar .pick-how, .clear-pick-tip { display: none; }
}
