/* Project Tracker — single stylesheet, no build step.
   Colour tokens on :root; dark values under prefers-color-scheme.
   Meaning is never carried by colour alone: every state has a text label. */

:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #17222c;
  --ink-2: #485664;
  --line: #d3d9df;
  --accent: #0e6168;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0f1;
  --fresh: #17643a;
  --ageing: #8a4b00;
  --stale: #a3261c;
  --danger: #a3261c;
  --danger-ink: #ffffff;
  --focus: #0e6168;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Type scale (1.2 ratio from 16px) */
  --t-s: 0.833rem;
  --t-m: 1rem;
  --t-l: 1.2rem;
  --t-xl: 1.44rem;
  --t-xxl: 1.728rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #11181e;
    --surface: #18222a;
    --surface-2: #1f2b34;
    --ink: #e6edf2;
    --ink-2: #a8b5c0;
    --line: #2e3c47;
    --accent: #5fc0c7;
    --accent-ink: #0b1a1c;
    --accent-soft: #173a3e;
    --fresh: #6fd39a;
    --ageing: #f0b35b;
    --stale: #ff8a7a;
    --danger: #ff8a7a;
    --danger-ink: #2a0a06;
    --focus: #8fe0e6;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-m);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: var(--t-xxl); font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: var(--t-l); font-weight: 600; }
p { margin: 0 0 0.75em; max-width: 72ch; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: 0.9em; }
q { quotes: "“" "”"; }

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

.skip-link { position: absolute; left: 0.5rem; top: -3rem; background: var(--surface); color: var(--ink); padding: 0.5rem 0.75rem; z-index: 10; border-radius: var(--radius-s); }
.skip-link:focus { top: 0.5rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-2); }
.count { color: var(--ink-2); font-weight: 400; font-size: var(--t-s); margin-left: 0.25rem; }
.lede { color: var(--ink-2); font-size: var(--t-l); }
.tag { font-size: var(--t-s); font-weight: 500; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.1rem 0.4rem; vertical-align: middle; color: var(--ink-2); }

/* Buttons */
.button {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 44px; padding: 0.5rem 1rem;
  font: inherit; font-weight: 550; text-decoration: none; cursor: pointer;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.button:hover { border-color: var(--ink-2); }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.primary:hover { filter: brightness(1.08); }
.button.danger { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.button.small { min-height: 36px; padding: 0.25rem 0.7rem; font-size: var(--t-s); }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer; }

/* Forms */
.field { margin-bottom: 1rem; display: grid; gap: 0.3rem; }
.field label, legend { font-weight: 550; }
.optional { font-weight: 400; color: var(--ink-2); }
.help { font-size: var(--t-s); color: var(--ink-2); margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--ink-2); border-radius: var(--radius-s);
  padding: 0.55rem 0.65rem; min-height: 44px; width: 100%; max-width: 32rem;
}
textarea { min-height: 7rem; resize: vertical; }
.has-error input, .has-error select, .has-error textarea { border: 2px solid var(--danger); }
.error { color: var(--danger); font-weight: 550; font-size: var(--t-s); margin: 0; }
.error::before { content: "Error: "; }
.form-errors { border-left: 4px solid var(--danger); background: var(--surface-2); padding: 0.75rem 1rem; margin-bottom: 1rem; }
.form-errors p { margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset ul, .field ul { list-style: none; padding: 0; margin: 0.25rem 0 0; display: grid; gap: 0.35rem; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.field-check { display: flex; gap: 0.5rem; align-items: center; min-height: 44px; }
.field-check label { font-weight: 400; }

/* Messages */
.messages { margin-bottom: 1rem; }
.message { padding: 0.75rem 1rem; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); border-left-width: 4px; max-width: none; }
.message-success { border-left-color: var(--fresh); }
.message-error { border-left-color: var(--danger); }
.notice { background: var(--surface-2); padding: 0.6rem 0.9rem; border-radius: var(--radius-m); }

/* Auth pages */
body.auth { display: grid; min-height: 100vh; place-items: start center; padding: 6vh 1rem 2rem; }
.auth-panel { width: 100%; max-width: 30rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 2rem; }
.brand { font-weight: 700; color: var(--accent); margin-bottom: 1.5rem; }
body:not(.auth):not(.app) .auth-panel { margin: 10vh auto; }

/* App shell */
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 1.25rem;
  background: var(--surface); border-right: 1px solid var(--line); padding: 1rem 0.75rem;
}
.workspace-switcher summary { cursor: pointer; font-weight: 650; padding: 0.5rem; border-radius: var(--radius-s); list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.workspace-switcher summary::-webkit-details-marker { display: none; }
.workspace-switcher summary::after { content: "▾"; color: var(--ink-2); }
.workspace-switcher[open] summary::after { content: "▴"; }
.workspace-switcher ul { list-style: none; margin: 0.25rem 0 0; padding: 0.25rem; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.workspace-switcher a { display: block; padding: 0.45rem 0.5rem; text-decoration: none; color: var(--ink); border-radius: var(--radius-s); }
.workspace-switcher a[aria-current] { font-weight: 650; }
.workspace-switcher a[aria-current]::after { content: " (current)"; color: var(--ink-2); font-weight: 400; font-size: var(--t-s); }
.main-nav { position: relative; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.main-nav a { display: block; padding: 0.55rem 0.6rem; color: var(--ink); text-decoration: none; border-radius: var(--radius-s); border-left: 3px solid transparent; }
.main-nav a:hover { background: var(--surface-2); }
.main-nav a[aria-current] { background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
.account { margin-top: auto; display: flex; gap: 0.6rem; align-items: center; font-size: var(--t-s); }
.account a { display: block; font-weight: 550; }
.avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent-soft); color: var(--ink); font-size: var(--t-s); font-weight: 650; flex-shrink: 0; }
.avatar.small { width: 1.6rem; height: 1.6rem; font-size: 0.7rem; vertical-align: middle; }
.content { padding: 2rem clamp(1rem, 3vw, 2.5rem); min-width: 0; }

/* Page structure */
.page-head { margin-bottom: 1.5rem; }
.crumb { font-size: var(--t-s); margin-bottom: 0.25rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; margin-top: 0.75rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem; margin-bottom: 1.25rem; }
.panel.narrow { max-width: 40rem; }
.section { margin-top: 2rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.section-head h2 { margin: 0; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.dash-grid .panel { margin: 0; }
.panel-wide { grid-column: 1 / -1; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }
.empty, .empty-state { color: var(--ink-2); }
.empty-state { border: 1px dashed var(--line); border-radius: var(--radius-m); padding: 2rem; text-align: left; }
.empty-state .button { margin-top: 0.5rem; }
.confirm .button { margin-right: 0.5rem; margin-top: 0.5rem; }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.danger-zone a { color: var(--danger); }
.inline-form { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: end; }
.inline-form .field { flex: 1 1 14rem; }
.inline-form .button { margin-bottom: 1rem; }
.inline-form .form-errors { flex-basis: 100%; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }

/* Freshness: the signature element. Shape + text, never colour alone. */
.fresh { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--t-s); font-weight: 550; white-space: nowrap; }
.fresh-mark { width: 0.7rem; height: 0.7rem; border-radius: 50%; border: 2px solid currentColor; flex-shrink: 0; }
.fresh-fresh { color: var(--fresh); }
.fresh-fresh .fresh-mark { background: currentColor; }
.fresh-ageing { color: var(--ageing); }
.fresh-ageing .fresh-mark { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.fresh-stale { color: var(--stale); }
.fresh-stale .fresh-mark { background: transparent; border-style: dashed; }
.fresh-closed { color: var(--ink-2); font-weight: 400; }
.fresh-closed .fresh-mark { border-radius: 2px; height: 2px; border-width: 1px; }

/* Status, priority, due, health */
.status { display: inline-block; font-size: var(--t-s); font-weight: 550; padding: 0.1rem 0.5rem; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.status-in_progress { border-color: var(--accent); }
.status-done, .status-cancelled { color: var(--ink-2); }
.prio { font-size: var(--t-s); }
.prio-4 { font-weight: 700; color: var(--stale); }
.prio-3 { font-weight: 600; }
.due-overdue { color: var(--stale); font-weight: 600; }
.due-soon { color: var(--ageing); font-weight: 550; }
.health { font-size: var(--t-s); font-weight: 600; }
.health::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.3rem; border-radius: 50%; background: currentColor; vertical-align: 0.05em; }
.health-on_track { color: var(--fresh); }
.health-at_risk { color: var(--ageing); }
.health-off_track { color: var(--stale); }

/* Task lines on the dashboard */
.task-lines { list-style: none; margin: 0; padding: 0; }
.task-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 1rem; padding: 0.65rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.task-line > :not(form) { grid-column: 1; }
.task-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: center; font-size: var(--t-s); }
.task-line:last-child { border-bottom: 0; }
.task-line form { grid-column: 2; grid-row: 1 / span 2; }
.task-title { font-weight: 550; overflow-wrap: anywhere; }
.task-line .muted { font-size: var(--t-s); }
.due { font-size: var(--t-s); }

.project-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.project-cards li { display: grid; gap: 0.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem; font-size: var(--t-s); }
.project-cards strong { font-size: var(--t-m); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 1rem; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { font-size: var(--t-s); color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; }
.data-table .actions { text-align: right; white-space: nowrap; }
.row-form { display: flex; gap: 0.4rem; align-items: center; }
.row-form select { width: auto; min-height: 36px; padding: 0.25rem 0.5rem; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: end; margin-bottom: 1rem; }
.filters .field { margin: 0; flex: 0 1 12rem; }
.filters .field:first-child { flex-basis: 16rem; }
.filters .button { min-height: 44px; }

/* Board */
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.view-switch a { padding: 0.45rem 0.9rem; text-decoration: none; color: var(--ink); min-height: 40px; display: inline-flex; align-items: center; }
.view-switch a[aria-current] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(14.5rem, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: start; }
.column { background: var(--surface-2); border-radius: var(--radius-m); padding: 0.75rem; }
.column-head { font-size: var(--t-m); margin-bottom: 0.75rem; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0.75rem; display: grid; gap: 0.4rem; }
.card-meta { font-size: var(--t-s); color: var(--ink-2); margin: 0; }
.move-form { display: flex; gap: 0.4rem; margin-top: 0.25rem; }
.move-form select { flex: 1 1 auto; min-width: 0; width: auto; min-height: 36px; padding: 0.25rem 0.4rem; font-size: var(--t-s); }
.move-form .button { flex-shrink: 0; }
.add-card { display: block; margin-top: 0.75rem; font-size: var(--t-s); }
.board-filter { font-size: var(--t-s); }

/* Task detail */
.task-summary { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; }
.description { color: var(--ink-2); }
.history { list-style: none; padding: 0; margin: 0; font-size: var(--t-s); }
.history li { display: grid; gap: 0.1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.history time { color: var(--ink-2); }

.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: 0.5rem; }

/* Tablet */
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Mobile and small tablet: sidebar becomes a top bar, tables become stacked rows */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 0.5rem; padding: 0.5rem 0.75rem; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .workspace-switcher { flex: 1 1 auto; min-width: 0; position: relative; }
  .ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .workspace-switcher ul { position: absolute; z-index: 5; min-width: 15rem; box-shadow: 0 6px 18px rgba(0,0,0,.15); }
  .account { margin: 0; }
  .account div { display: flex; gap: 0.75rem; align-items: center; }
  .account .avatar { display: none; }
  .main-nav { order: 3; flex-basis: 100%; min-width: 0; overflow-x: auto; }
  .main-nav ul { display: flex; gap: 0.25rem; }
  .main-nav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .main-nav a[aria-current] { border-bottom-color: var(--accent); }
  .content { padding: 1.25rem 1rem; }
  .dash-grid { grid-template-columns: 1fr; }
  h1 { font-size: var(--t-xl); }

  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--line); }
  .data-table td { border: 0; padding: 0.2rem 0; display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 0.5rem; text-align: left; justify-items: start; align-items: center; }
  .data-table td[data-label]::before { content: attr(data-label); color: var(--ink-2); font-size: var(--t-s); }
  .data-table td:first-child { grid-template-columns: 1fr; font-weight: 600; }
  .data-table td:first-child::before { display: none; }
  .data-table .num, .data-table .actions { text-align: left; }
  .table-wrap { overflow-x: visible; }

  .filters .field, .filters .field:first-child { flex: 1 1 100%; }
  .board { grid-auto-columns: minmax(80vw, 1fr); scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }
  .task-line { grid-template-columns: 1fr; }
  .task-line form { grid-column: 1; grid-row: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .sidebar, .filters, .head-actions, .move-form, .button { display: none !important; }
  .shell { display: block; }
}

/* ---- v2 components ---- */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-content: start; min-width: 0; }
.stack > .panel { margin: 0; }
.badge { display: inline-block; min-width: 1.4rem; padding: 0 0.4rem; margin-left: 0.35rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; font-weight: 700; text-align: center; line-height: 1.4rem; }

.subtask-list, .file-list, .comments, .notifications, .workflow-list, .recovery-codes { list-style: none; margin: 0 0 1rem; padding: 0; }
.subtask-list li { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.subtask-list li.is-closed > a { text-decoration-line: line-through; color: var(--ink-2); }
.subtask-list .muted { font-size: var(--t-s); }
.subtask-of { display: block; font-size: var(--t-s); color: var(--ink-2); }

.file-list li { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.file-list a { font-weight: 550; overflow-wrap: anywhere; }
.file-list .muted { font-size: var(--t-s); }
.file-list form { margin-left: auto; }
input[type=file] { font: inherit; max-width: 100%; min-width: 0; padding: 0.4rem 0; }
input[type=date] { min-width: 0; }

.comments li { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.comment-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; font-size: var(--t-s); margin-bottom: 0.3rem; }
.comment-meta time { color: var(--ink-2); }
.comment-body { overflow-wrap: anywhere; max-width: 72ch; }
.comment-actions { display: flex; gap: 1rem; font-size: var(--t-s); margin: 0.35rem 0 0; }

.workflow-list li { display: grid; gap: 0.5rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.workflow-list li:last-child { border-bottom: 0; }
.workflow-row { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: end; }
.workflow-row .field { flex: 1 1 12rem; margin-bottom: 0; }
.workflow-row .field .help { display: none; }
.workflow-tools { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; font-size: var(--t-s); }
.workflow-tools form { display: flex; gap: 0.4rem; }
.button[disabled] { opacity: 0.45; cursor: not-allowed; }

.notifications li { border-bottom: 1px solid var(--line); }
.note-button { display: grid; gap: 0.2rem; width: 100%; text-align: left; padding: 0.85rem 0.75rem; font: inherit; color: var(--ink); background: none; border: 0; border-left: 3px solid transparent; cursor: pointer; }
.note-button:hover { background: var(--surface-2); }
.unread .note-button { border-left-color: var(--accent); background: var(--surface); }
.unread-mark { justify-self: start; font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.note-detail { font-size: var(--t-s); overflow-wrap: anywhere; }

.steps { padding-left: 1.25rem; }
.steps li { margin-bottom: 1.25rem; }
.qr { display: block; background: #ffffff; padding: 0.5rem; border: 1px solid var(--line); border-radius: var(--radius-m); max-width: 100%; height: auto; }
.secret { font-size: var(--t-m); letter-spacing: 0.05em; overflow-wrap: anywhere; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 1rem; background: var(--surface-2); padding: 1rem; border-radius: var(--radius-m); }
.recovery-codes code { font-size: var(--t-m); }
.security-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.message-warning { border-left-color: var(--ageing); }
.message-info { border-left-color: var(--accent); }

/* ---- v3: check-ins ---- */
.checkin-toggle { font-size: var(--t-s); margin-bottom: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: baseline; }
.quick-replies, .reply-actions, .decision-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.review-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.review-list .panel { min-width: 0; }
.review-list .panel { margin: 0; }
.reply-quote { margin: 0.75rem 0; padding: 0.6rem 0.9rem; border-left: 4px solid var(--line); background: var(--surface-2); border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.reply-quote p { margin: 0 0 0.25rem; overflow-wrap: anywhere; }
.reply-quote footer { font-size: var(--t-s); color: var(--ink-2); }
.change-table { border-collapse: collapse; margin: 0.5rem 0 0.75rem; width: 100%; max-width: 36rem; table-layout: fixed; }
.change-table td, .change-table th { overflow-wrap: anywhere; }
.change-table th, .change-table td { text-align: left; padding: 0.4rem 0.75rem 0.4rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.change-table thead th { font-size: var(--t-s); color: var(--ink-2); font-weight: 600; }
.change-table .field-check { min-height: 0; margin-top: 0.35rem; font-size: var(--t-s); }

/* ---- v4: billing, reports, timeline ---- */
.usage { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.75rem 1.5rem; margin: 0 0 1rem; }
.usage dt { font-size: var(--t-s); color: var(--ink-2); }
.usage dd { margin: 0; font-weight: 600; }
.usage dd .muted { font-weight: 400; font-size: var(--t-s); }
.danger-link { color: var(--danger); }
.danger-panel { border-color: var(--danger); }

.tiles { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; }
.tiles li { display: grid; gap: 0.15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0.9rem 1rem; font-size: var(--t-s); color: var(--ink-2); }
.tile-num { font-size: var(--t-xl); font-weight: 700; color: var(--ink); }
.tile-num.due-overdue, .tile-num.fresh-stale { color: var(--stale); }
.chart-wrap { width: 100%; max-width: 46rem; }
.chart { width: 100%; height: auto; display: block; }
.chart-bar { fill: var(--accent); }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis, .chart-value { fill: var(--ink-2); font: 11px var(--font); }
.chart-value { fill: var(--ink); font-weight: 600; }
.data-table.compact { max-width: 22rem; margin-top: 0.5rem; }
details > summary { cursor: pointer; color: var(--accent); margin-top: 0.5rem; min-height: 32px; }
.meter { display: inline-block; width: 4.5rem; height: 0.5rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; vertical-align: middle; overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--accent); width: 0; }
.meter-fill.w10 { width: 10%; } .meter-fill.w20 { width: 20%; } .meter-fill.w30 { width: 30%; } .meter-fill.w40 { width: 40%; }
.meter-fill.w50 { width: 50%; } .meter-fill.w60 { width: 60%; } .meter-fill.w70 { width: 70%; } .meter-fill.w80 { width: 80%; }
.meter-fill.w90 { width: 90%; } .meter-fill.w100 { width: 100%; }

.timeline-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; margin-bottom: 0.75rem; }
.timeline-nav span { font-weight: 600; }
.timeline-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0.5rem 0; }
.timeline { display: block; }
.tl-week { stroke: var(--line); stroke-width: 1; }
.tl-head, .tl-off { fill: var(--ink-2); font: 11px var(--font); }
.tl-label { fill: var(--ink); font: 13px var(--font); }
.tl-sub { fill: var(--ink-2); }
.tl-today { stroke: var(--stale); stroke-width: 2; stroke-dasharray: 4 3; }
.tl-today-label { fill: var(--stale); font: 600 11px var(--font); }
.tl-bar.tl-open, .tl-milestone.tl-open { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.tl-bar.tl-overdue, .tl-milestone.tl-overdue { fill: transparent; stroke: var(--stale); stroke-width: 2; stroke-dasharray: 5 3; }
.tl-bar.tl-closed, .tl-milestone.tl-closed { fill: var(--surface-2); stroke: var(--ink-2); stroke-width: 1; }
.tl-progress { fill: var(--accent); opacity: 0.55; pointer-events: none; }
.timeline-key { list-style: none; padding: 0; margin: 0.75rem 0 0.25rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; font-size: var(--t-s); }
.timeline-key li { display: flex; gap: 0.4rem; align-items: center; }
.key { display: inline-block; width: 1.4rem; height: 0.7rem; border-radius: 2px; }
.key-open { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.key-overdue { border: 2px dashed var(--stale); }
.key-closed { background: var(--surface-2); border: 1px solid var(--ink-2); }

/* Scroll containers must be positioning contexts: otherwise absolutely positioned
   children (e.g. .visually-hidden labels) escape them and widen the whole page.
   Found twice (sidebar badge in v3, board at 360px in v6); fixed for all of them here. */
.board, .table-wrap, .timeline-wrap, .chart-wrap, .main-nav, .filters { position: relative; }
