/* Sprint Board — "sprint ledger" (v1.9). Cool paper, ink, ledger green for done, marigold
   for work in progress, signal red reserved for late work. Fonts are self-hosted
   (strict CSP: font-src 'self'): Bricolage Grotesque for headings and figures,
   Atkinson Hyperlegible Next for everything else. Both SIL OFL 1.1 (see fonts/). */
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2") format("woff2");
}
:root {
  /* Palette */
  --paper: #f2f4f1; --ink: #1c2733; --ledger: #0e6655; --marigold: #d9930b; --signal: #b83a26; --rule: #d3d9d3;
  --bg: var(--paper);
  --surface: #fbfcfa;
  --line: var(--rule);
  --fg: var(--ink);
  --muted: #56636f;
  --accent: var(--ledger);
  --accent-soft: #dcebe5;
  --good: var(--ledger);
  --good-soft: #dcebe5;
  --warn: #8a5b00;
  --warn-soft: #f8ecd0;
  --bad: var(--signal);
  --bad-soft: #f6e1dc;
  /* Balance bar fills */
  --f-done: var(--ledger); --f-progress: var(--marigold); --f-proposed: #c3cbc4;
  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --mono: var(--font);
  --radius: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141a1f; --ink: #e4e9e4; --ledger: #4fb393; --marigold: #e9a93a; --signal: #ef7a63; --rule: #2c363d;
    --surface: #1a2127; --muted: #9aa6ad;
    --accent-soft: #17352d; --good-soft: #17352d;
    --warn: #e9a93a; --warn-soft: #3a2c10; --bad-soft: #3d1d17;
    --f-proposed: #3f4a50;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 15px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
:is(a, button, select, summary):focus-visible, #main:focus-visible, h1:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 10; }
.skip:focus { left: 8px; }

/* Bar */
.bar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.bar-inner, main, .foot {
  /* Wide screens use most of the width (the items table needs it); the gutter grows
     with the screen: 16px on phones, up to 40px on large monitors. */
  max-width: 1600px; width: 100%; margin: 0 auto;
  padding-left: max(clamp(16px, 2.5vw, 40px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(16px, 2.5vw, 40px), env(safe-area-inset-right, 0px));
}
.bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 800; font-size: 0.82rem; text-decoration: none; flex-shrink: 0; }
.project-pick { display: inline-flex; align-items: center; min-width: 0; }
.project-pick select { font-weight: 600; max-width: min(220px, 40vw); font-size: 0.92rem; border: 0; background: transparent; color: var(--fg); cursor: pointer; padding: 4px 2px; }
nav { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.nav-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); flex-shrink: 0; }
.nav-tabs a { display: inline-block; padding: 5px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.88rem; transition: background 0.15s, color 0.15s; white-space: nowrap; }
.nav-tabs a + a { border-left: 1px solid var(--line); }
.nav-tabs a:hover { color: var(--fg); background: var(--surface); }
.nav-tabs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-pages { display: flex; flex-wrap: wrap; gap: 2px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav-more { position: relative; }
.nav-more-btn { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 5px 12px; font-size: 0.85rem; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }
.nav-more-btn:hover { color: var(--fg); background: var(--surface); }
.nav-more-menu { position: absolute; top: calc(100% + 4px); right: 0; min-width: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.12); padding: 4px 0; z-index: 100; }
.nav-more-menu a { display: block; padding: 8px 14px; text-decoration: none; color: var(--fg); font-size: 0.88rem; white-space: nowrap; }
.nav-more-menu a:hover { background: var(--bg); }
.nav-more-menu a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.account { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 0.85rem; min-width: 0; flex-shrink: 0; }
#account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.link-button { border: 0; background: none; color: var(--accent); padding: 4px; cursor: pointer; font-size: 0.85rem; }

main { flex: 1; padding-block: 20px 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.foot { padding-block: 0 24px; font-size: 0.8rem; color: var(--muted); }
#view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
#view > * { min-width: 0; }

/* Buttons and controls */
button, select {
  font: inherit; font-size: 0.85rem; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
button:hover, select:hover { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
.sync-group { display: inline-flex; flex-wrap: wrap; gap: 6px; }
select { max-width: 100%; min-width: 0; }

/* Page head */
.page-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; justify-content: space-between; }
.page-head > div { min-width: 0; }
.page-head .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.88rem; color: var(--muted); }
.page-head .meta > * { overflow-wrap: anywhere; min-width: 0; }

/* Notices */
#notices { display: grid; gap: 8px; }
#notices:empty { display: none; }
.notice { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; font-size: 0.92rem; }
.notice.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.notice.bad { color: var(--bad); background: var(--bad-soft); border-color: var(--bad); }
.notice.info { background: var(--accent-soft); border-color: var(--accent); }
.notice.good { color: var(--good); background: var(--good-soft); border-color: var(--good); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: grid; gap: 2px; min-width: 0;
}
.card .label { font-size: 0.78rem; color: var(--muted); }
.card .value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.card .sub { font-size: 0.82rem; color: var(--muted); }
.card.attention .value { color: var(--bad); }
.secondary { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.88rem; color: var(--muted); }

/* Panels */
.grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 12px; min-width: 0;
}
.panel-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tabs button { border: 0; border-radius: 0; padding: 5px 12px; background: var(--surface); }
.tabs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Bars (text values always shown) */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) 8.5rem; gap: 10px; align-items: center; }
.bar-row .name { overflow-wrap: anywhere; font-size: 0.9rem; }
.bar-track { height: 14px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); min-width: 2px; border-radius: 4px; }
.bar-row .count { text-align: right; }
.bar-row .count small { display: block; color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
@media (max-width: 480px) { .bar-row { grid-template-columns: minmax(0, 1fr) auto; } .bar-track { grid-column: 1 / -1; grid-row: 2; } }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
td.n, th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Chips (sprint time frame) */
.chip { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); line-height: 1.4; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 6px; }
.chip.current { color: var(--good); background: var(--good-soft); border-color: var(--good); }
.chip.future { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.chip.past { color: var(--muted); }

/* Project pills (Overview, Team): toggle which projects are shown */
.project-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.project-pills .pills-label { font-size: 0.75rem; color: var(--muted); margin-right: 4px; }
.proj-pill {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 0.82rem; font-weight: 600;
  padding: 4px 6px 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer;
}
.proj-pill:hover { border-color: var(--muted); }
.proj-pill .n { font-size: 0.74rem; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.proj-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.proj-pill.tf-past .dot, .proj-pill.tf-unscheduled .dot { background: var(--muted); }
.proj-pill.tf-future .dot { background: var(--accent); }
.proj-pill[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.proj-pill[aria-pressed="true"] .n { background: var(--accent); color: var(--surface); }

/* Team page */
.section-title { font-size: 1rem; margin: 0; }
.team-table td.num, .team-table th.num { text-align: right; }
.team-table td.strong { font-weight: 700; }
.meter { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; vertical-align: middle; }
.meter i { display: block; height: 100%; width: 0; background: var(--good); }
.idle { font-size: 0.85rem; margin-top: 8px; }
.person-toggle { display: inline-flex; gap: 6px; align-items: baseline; border: 0; background: none; padding: 0; font: inherit; color: var(--fg); cursor: pointer; text-align: left; }
.person-toggle:hover { color: var(--accent); text-decoration: underline; }
.person-toggle .caret { color: var(--muted); width: 0.8em; }
tr.person.open td { background: var(--accent-soft); border-bottom-color: transparent; }
tr.person-items > td { background: var(--surface); padding: 4px 10px 12px 28px; }
.person-list > p { margin: 4px 0 6px; font-size: 0.8rem; }
.person-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.person-list li { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.person-list li:last-child { border-bottom: 0; }
.person-list li.closed .item-link { color: var(--muted); }
.person-list .proj { font-size: 0.8rem; white-space: nowrap; }
.person-list .title-line { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .team-table td.num, .team-table th.num { text-align: left; }
  tr.person-items > td { padding: 4px 0 10px; }
  tr.person-items > td::before { content: none !important; }
  .person-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .person-list li .id, .person-list li .proj { grid-column: 1; }
}

/* Sprint selector */
.selector { display: inline-flex; gap: 0; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.selector select { flex: 1 1 140px; min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 6px 10px; font-weight: 600; font-size: 0.88rem; }
.selector button { flex: 0 0 auto; border: 0; border-radius: 0; background: transparent; padding: 6px 12px; font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.selector button:not(:disabled):hover { background: var(--bg); color: var(--fg); }
.selector button + select, .selector select + button { border-left: 1px solid var(--line); }

/* Static pages */
.prose { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 72ch; }
.prose > * + * { margin-top: 0.8em; }
.prose pre { overflow-x: auto; background: var(--bg); padding: 10px; border-radius: var(--radius); }

.center { display: grid; gap: 12px; justify-items: start; padding: 24px 0; }
.empty { color: var(--muted); padding: 8px 0; }

/* ---------------------------------------------------------------- v1.2 sprint board */
:root {
  --c-progress: #8a5b00; --c-progress-soft: #f8ecd0;
  --c-proposed: #56636f; --c-proposed-soft: #e4e8e4;
  --c-resolved: #2b6e5c; --c-resolved-soft: #e3eee9;
  --c-done: #0e6655; --c-done-soft: #dcebe5;
  --c-removed: #7d878f; --c-removed-soft: #eceeec;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-progress: #e9a93a; --c-progress-soft: #3a2c10;
    --c-proposed: #9aa6ad; --c-proposed-soft: #232b31;
    --c-resolved: #7cc4ab; --c-resolved-soft: #18302a;
    --c-done: #4fb393; --c-done-soft: #17352d;
    --c-removed: #6c767d; --c-removed-soft: #1d2429;
  }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprint-head { display: grid; gap: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0; }
.stats > div { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; transition: border-color 0.15s, box-shadow 0.15s; }
.stats > div:hover { border-color: var(--muted); }
.stats dt { font-size: 0.72rem; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 1.4rem; font-weight: 700; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type="search"] {
  flex: 1 1 200px; min-width: 0; font: inherit; font-size: 0.85rem; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px 7px 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23888' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 9px center; background-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filters input[type="search"]:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); outline: none; }
.filters input[type="search"]::placeholder { color: var(--muted); }
.filters select { flex: 0 1 160px; font-size: 0.84rem; padding: 7px 10px; background: var(--bg); }
.filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); outline: none; }
.filters #f-clear { border: 0; background: none; color: var(--muted); font-size: 0.82rem; font-weight: 500; padding: 6px 8px; }
.filters #f-clear:hover { color: var(--accent); }
.count { font-size: 0.85rem; margin: 0 0 6px; }

/* Items table */
.items-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.items { min-width: 980px; }
table.items th { position: sticky; top: 0; background: var(--bg); font-size: 0.75rem; color: var(--muted); border-bottom: 1px solid var(--line); }
table.items td { vertical-align: top; padding: 9px 10px; }
table.items td.id { color: var(--muted); white-space: nowrap; width: 5.5rem; }
table.items td.title { min-width: 300px; }
table.items td.num { white-space: nowrap; }
table.items tr.closed .item-link { color: var(--muted); }
table.items tbody tr { transition: background 0.1s; }
table.items tbody tr:hover { background: var(--bg); }
.title-line { display: flex; gap: 8px; align-items: baseline; }
.item-link { color: var(--fg); font-weight: 500; text-decoration: none; line-height: 1.35; }
.item-link:hover { color: var(--accent); text-decoration: underline; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: 0.72rem; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }

.pill { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 1px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.pill.cat-progress { color: var(--c-progress); background: var(--c-progress-soft); }
.pill.cat-proposed { color: var(--c-proposed); background: var(--c-proposed-soft); }
.pill.cat-resolved { color: var(--c-resolved); background: var(--c-resolved-soft); }
.pill.cat-done { color: var(--c-done); background: var(--c-done-soft); }
.pill.cat-removed { color: var(--c-removed); background: var(--c-removed-soft); text-decoration: line-through; }
.pill.cat-none { color: var(--muted); border-color: var(--line); }

.type { flex: none; font-size: 0.7rem; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.type-bug { color: var(--bad); border-color: var(--bad); }
.type-user-story { color: var(--accent); border-color: var(--accent); }
.type-task { color: var(--good); border-color: var(--good); }

/* Phone: table rows become cards */
@media (max-width: 760px) {
  table.items { min-width: 0; }
  table.items thead { display: none; }
  table.items, table.items tbody, table.items tr, table.items td { display: block; width: 100%; }
  table.items tr { border-bottom: 1px solid var(--line); padding: 10px 12px; }
  table.items td { border: 0; padding: 2px 0; }
  table.items td.title { min-width: 0; }
  table.items td:not(.title):not(.id)::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.8rem; font-family: var(--font); }
  table.items td.id { width: auto; font-size: 0.8rem; }
  table.items tr.group-head td:empty, table.items tr.group-head td:not([data-label])::before { display: none; }
  table.items tr.group-head td:not([data-label]) { display: none; }
  table.items tr.group-head td.title[colspan] { display: block; }
  table.items tr.group-head { background: var(--bg); }
}

/* Details panel */
/* Above the sticky header (z-index 50), so the panel's title is never covered. */
.scrim { position: fixed; inset: 0; background: rgba(10, 20, 30, 0.35); z-index: 60; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 61;
  background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.drawer-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; font-size: 1.1rem; line-height: 1.3; overflow-wrap: anywhere; }
.drawer-body { padding: 16px 18px; overflow: auto; display: grid; grid-auto-rows: max-content; gap: 16px; align-content: start; flex: 1; min-height: 0; }
.drawer-body h3 { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.drawer-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 0.92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.children { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; }
.button-link { display: inline-block; padding: 6px 12px; border: 1px solid var(--accent); border-radius: var(--radius); text-decoration: none; font-weight: 600; }
body.drawer-open { overflow: hidden; }

/* Item panel tabs (v1.7) */
/* Own class: ".tabs" is the List/Gantt toggle, whose overflow:hidden let the grid squash this bar. */
.item-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -16px -18px 0; padding: 12px 18px 0; position: sticky; top: -16px; background: var(--surface); z-index: 2; min-height: max-content; }
.item-tabs [role="tab"] { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; font: inherit; font-size: 0.9rem; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.item-tabs [role="tab"]:hover { color: var(--fg); }
.item-tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: grid; gap: 16px; align-content: start; min-width: 0; }
.small { font-size: 0.82rem; }
.table-scroll { overflow-x: auto; }
table.time-log { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.time-log th { text-align: left; font-size: 0.72rem; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
table.time-log td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.time-log td.num { text-align: right; white-space: nowrap; }
table.time-log td.neg { color: var(--bad); }
.time-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 0.9rem; }
.time-people li { display: flex; justify-content: space-between; gap: 12px; }
.time-people strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* Contributors section in item detail drawer */
.contributors { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.contributors li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 10px; background: var(--bg); border-radius: var(--radius); }
.contributor-name { font-weight: 600; font-size: 0.88rem; }
.contributor-hours { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); font-weight: 600; }
ol.history { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 14px; }
.hist { position: relative; display: grid; gap: 4px; min-width: 0; }
.hist::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.hist-head { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; font-size: 0.9rem; }
.hist-head time { margin-left: auto; font-size: 0.8rem; }
.hist-changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 0.86rem; }
.hist-changes .hf { color: var(--muted); }
.hist-changes .hv { overflow-wrap: anywhere; }
.hist-changes .arrow { color: var(--muted); }
.rich.comment { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; font-size: 0.88rem; }
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: slide-in 0.16s ease-out; }
  @keyframes slide-in { from { transform: translateX(24px); opacity: 0.6; } }
}

/* Static pages: wide tables scroll inside the article */
.prose { max-width: 100%; }
.prose table { display: block; overflow-x: auto; }
.prose th, .prose td { vertical-align: top; }

/* ---------------------------------------------------------------- v1.3 layout pages */
:root { --sunk: #eef1f5; --ai: #6b4a7a; --ai-soft: #ece1f1; --human: var(--accent); --human-soft: var(--accent-soft); --gate: #946f0e; --gate-soft: #f4eacb; }
@media (prefers-color-scheme: dark) {
  :root { --sunk: #1b2330; --ai: #c6a5d6; --ai-soft: #2e2337; --gate: #d9b451; --gate-soft: #382f13; }
}
.lede { color: var(--muted); max-width: 72ch; font-size: 1rem; }
.note { font-size: 0.9rem; }
.card-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card-box h3 { font-size: 1rem; margin-bottom: 8px; }
.card-box p { margin: 4px 0; }
.card-box ul { margin: 0; padding-left: 18px; }
.card-box li { margin-bottom: 6px; }
table.plain { width: 100%; }
table.plain th { text-align: left; white-space: nowrap; color: var(--fg); padding-right: 12px; vertical-align: top; }
.lbl { font-weight: 600; }
.tone-good { color: var(--good); } .tone-warn { color: var(--gate); } .tone-bad { color: var(--bad); } .tone-info { color: var(--accent); }

/* Workflow: swimlane diagram */
.wf-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.wf-svg { display: block; min-width: 980px; width: 100%; height: auto; font-family: var(--font); }
.wf-lane { fill: var(--surface); }
.wf-lane.alt { fill: var(--sunk); opacity: 0.7; }
.wf-lane-t { font-size: 13px; font-weight: 600; fill: var(--muted); }
.wf-col { font-size: 11px; font-weight: 700; fill: var(--muted); }
.wf-sep { stroke: var(--line); }
.wf-e { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.wf-e.dash { stroke: var(--gate); stroke-dasharray: 5 4; }
.wf-ah { fill: var(--muted); } .wf-ahd { fill: var(--gate); }
.wf-start { fill: var(--accent); }
.wf-l { font-size: 11px; fill: var(--muted); } .wf-l.warn { fill: var(--gate); }
.wf-n { cursor: pointer; outline: none; }
.wf-n rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.4; }
.wf-n.own rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; }
.wf-n:hover rect, .wf-n:focus-visible rect { stroke: var(--accent); stroke-width: 2.4; }
.wf-n.sel rect { stroke: var(--fg); stroke-width: 2.4; }
.wf-nt { font-size: 12.5px; font-weight: 700; fill: var(--fg); }
.wf-nc { font-size: 10.5px; fill: var(--muted); } .wf-n.own .wf-nc { fill: var(--accent); }
.wf-pc { fill: var(--accent); } .wf-n.sel .wf-pc { fill: var(--fg); }
.wf-plus { font-size: 12px; font-weight: 700; fill: var(--surface); pointer-events: none; }
.wf-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.8rem; color: var(--muted); padding: 10px 14px; border-top: 1px solid var(--line); min-width: 900px; }
.wf-legend i { display: inline-block; width: 16px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.wf-legend .lq { background: var(--accent-soft); border: 1px solid var(--accent); }
.wf-legend .ld { height: 0; border-top: 2px dashed var(--gate); border-radius: 0; vertical-align: 3px; }
.wf-detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.wf-dh { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.wf-dh h3 { font-size: 1.1rem; }
.wf-dlane { font-size: 0.72rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.wf-sub { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.wf-sub li { display: flex; gap: 10px; background: var(--sunk); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.wf-sub li > div { min-width: 0; flex: 1; }
.wf-sub li.gate { box-shadow: inset 3px 0 0 var(--gate); }
.wf-sn { font-weight: 700; font-size: 1.25rem; line-height: 1; color: var(--accent); min-width: 20px; }
.wf-sub b { font-size: 0.92rem; }
.wf-sub p { margin: 2px 0 6px; font-size: 0.82rem; color: var(--muted); }
.wf-gate { margin-left: 6px; font-size: 0.62rem; font-weight: 700; color: var(--gate); border: 1px solid var(--gate); border-radius: 999px; padding: 0 6px; vertical-align: 1px; }
.wf-jobs { display: flex; flex-direction: column; gap: 4px; }
.wf-job { display: flex; gap: 6px; align-items: baseline; font-size: 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 8px; }
.wf-job b { color: var(--accent); flex: none; }
.wf-gates { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.wf-gates .gk { font-size: 0.75rem; font-weight: 700; color: var(--gate); }

/* Process: EDLC phase grid */
.edlc-head { display: grid; gap: 6px; }
.aims { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.aims span { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 12px; font-size: 0.82rem; font-weight: 600; }
.edlc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 1100px) { .edlc { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .edlc { grid-template-columns: minmax(0, 1fr); } }
.ph { padding: 16px 14px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; min-width: 0; }
.ph:not(:last-child)::after { content: ""; position: absolute; right: -7px; top: 24px; width: 12px; height: 12px; background: var(--surface); border-top: 1px solid var(--line); border-right: 1px solid var(--line); transform: rotate(45deg); z-index: 1; }
.ph:nth-child(4n)::after { display: none; }
@media (max-width: 1100px) { .ph::after { display: none; } }
.split { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--sunk); }
.split .a { background: var(--ai); }
.split .h { background: var(--human); }
.split.none .h { background: repeating-linear-gradient(45deg, var(--human) 0 6px, var(--human-soft) 6px 12px); }
.ph.new .split.none .h { background: repeating-linear-gradient(45deg, var(--ai) 0 6px, var(--ai-soft) 6px 12px); }
.splitlab { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 700; margin: 6px 0 14px; color: var(--muted); }
.splitlab .la { color: var(--ai); } .splitlab .lh { color: var(--human); }
.ph.new .splitlab { color: var(--ai); }
.phnote { font-size: 0.75rem; color: var(--muted); margin: -8px 0 12px; line-height: 1.4; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.st { display: flex; gap: 10px; align-items: flex-start; background: var(--sunk); border-radius: var(--radius); padding: 10px; }
.st .sn { flex: none; font-weight: 700; font-size: 1.25rem; line-height: 1; color: var(--accent); min-width: 22px; }
.st b { display: block; font-size: 0.88rem; line-height: 1.3; }
.st small { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.st.br { background: var(--bad-soft); margin-left: 14px; } .st.br .sn { color: var(--bad); font-size: 1rem; }
.st.opt { background: var(--accent-soft); margin-left: 14px; border: 1px dashed var(--accent); } .st.opt .sn { color: var(--accent); font-size: 1rem; }
.edlc-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.78rem; color: var(--muted); }
.edlc-key i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.edlc-key .ka { background: var(--ai); } .edlc-key .kh { background: var(--human); }
.edlc-key .kn { background: repeating-linear-gradient(45deg, var(--muted) 0 3px, transparent 3px 6px); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* Dynamic KPI cards (v1.3) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.kpi {
  display: grid; gap: 2px; align-content: start; text-align: left; font: inherit; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 0;
}
.kpi .k { font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.kpi .v { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.kpi .s { font-size: 0.75rem; color: var(--muted); }
button.kpi { cursor: pointer; box-shadow: inset 4px 0 0 var(--line); }
button.kpi:hover { border-color: var(--muted); }
button.kpi.cat-progress { box-shadow: inset 4px 0 0 var(--c-progress); }
button.kpi.cat-proposed { box-shadow: inset 4px 0 0 var(--c-proposed); }
button.kpi.cat-resolved { box-shadow: inset 4px 0 0 var(--c-resolved); }
button.kpi.cat-done { box-shadow: inset 4px 0 0 var(--c-done); }
button.kpi.cat-removed { box-shadow: inset 4px 0 0 var(--c-removed); }
button.kpi.on { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--accent-soft); }

/* ---------------------------------------------------------------- v1.4 Gantt */
.items-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.items-bar .count { margin: 0; }
.items-switches { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* Grouped list (v1.7): parent rows head their tasks */
table.items tr.group-head td { background: var(--bg); border-top: 1px solid var(--line); }
table.items tr.group-head .item-link { font-weight: 700; }
table.items tr.group-head.context td, table.items tr.group-head.outside td { color: var(--muted); }
table.items tr.group-head.context .item-link, table.items tr.group-head.outside .item-link { font-weight: 600; }
table.items tr.child td.title { padding-left: 28px; position: relative; }
table.items tr.child td.title::before { content: ""; position: absolute; left: 14px; top: 0; bottom: 0; border-left: 2px solid var(--line); }
.group-toggle { border: 0; background: none; padding: 0 6px 0 0; font-size: 0.85rem; color: var(--muted); cursor: pointer; line-height: 1; }
.group-toggle:hover { color: var(--accent); }
.rollup { font-size: 0.8rem; margin-top: 2px; }
@media (max-width: 760px) {
  table.items tr.child { padding-left: 26px; }
  table.items tr.child td.title { padding-left: 0; }
  table.items tr.child td.title::before { display: none; }
}
.where { font-size: 0.72rem; border: 1px dashed var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px 0 4px; }
.pager button { padding: 6px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-weight: 500; font-size: 0.84rem; color: var(--fg); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.pager button:hover:not(:disabled) { border-color: var(--muted); background: var(--surface); }
.pager button:disabled { opacity: 0.35; cursor: default; }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skel { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 25%, var(--line) 50%, var(--surface) 75%); background-size: 800px 100%; animation: shimmer 1.5s infinite ease-in-out; }
.skel-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.skel-row .skel { height: 14px; }
.skel-row .skel:nth-child(1) { width: 40px; }
.skel-row .skel:nth-child(2) { flex: 1; }
.skel-row .skel:nth-child(3) { width: 72px; }
.skel-row .skel:nth-child(4) { width: 100px; }
.skel-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.skel-head .skel { height: 22px; }
.skel-head .skel:first-child { width: 180px; height: 28px; }
.skel-head .skel:last-child { width: 260px; height: 14px; }
.skel-filters { display: flex; gap: 10px; margin-bottom: 14px; }
.skel-filters .skel { height: 34px; border-radius: var(--radius); }
.skel-filters .skel:first-child { flex: 1; max-width: 220px; }
.skel-filters .skel:nth-child(n+2) { width: 110px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; border-radius: 0; padding: 5px 14px; background: transparent; font-weight: 600; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--surface); }

.gantt-view { display: grid; gap: 10px; }
.g-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 0.88rem; }
.g-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.78rem; color: var(--muted); margin: 0; }
.g-legend i { display: inline-block; width: 18px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.g-legend .lg-planned { background: var(--c-progress); }
.g-legend .lg-actual { background: repeating-linear-gradient(45deg, var(--c-progress) 0 3px, var(--c-progress-soft) 3px 6px); }
.g-legend .lg-ms { width: 10px; transform: rotate(45deg); background: var(--c-progress); border-radius: 2px; }
.g-legend .lg-late { background: transparent; border: 2px solid var(--bad); }
.g-legend .lg-today { width: 2px; background: var(--accent); }

.gantt-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.gantt { min-width: 820px; }
.g-row { display: grid; align-items: stretch; min-height: 46px; border-bottom: 1px solid var(--line); position: relative; }
.g-row:last-child { border-bottom: 0; }
.g-head { min-height: 0; position: sticky; top: 0; z-index: 5; background: var(--surface); }
.g-lab {
  grid-row: 1; grid-column: 1; position: sticky; left: 0; z-index: 4; background: var(--surface);
  padding: 6px 10px; border-right: 1px solid var(--line); min-width: 0; display: grid; gap: 2px; align-content: center;
}
.g-head .g-lab { z-index: 6; font-size: 0.75rem; color: var(--muted); }
.g-title { display: flex; gap: 6px; align-items: baseline; min-width: 0; font-size: 0.86rem; }
.g-title .item-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.g-id { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; flex: none; }
.g-sub { display: flex; gap: 6px; align-items: center; font-size: 0.75rem; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; }
.g-sub .pill { font-size: 0.68rem; padding: 0 6px; }
.g-row.closed .item-link { color: var(--muted); }
.g-day { grid-row: 1; text-align: center; padding: 6px 0 4px; font-size: 0.68rem; color: var(--muted); line-height: 1.2; position: relative; }
.g-day b { display: block; font-size: 0.82rem; color: var(--fg); }
.g-day .g-mon { position: absolute; top: -1px; left: 3px; font-size: 0.62rem; font-weight: 700; color: var(--accent); }
.g-day .g-wd { display: block; margin-top: 8px; }
.g-cell { grid-row: 1; }
.g-cell.we, .g-day.we { background: var(--sunk); }
.g-cell.out, .g-day.out { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--sunk) 6px 8px); }
.g-cell.td, .g-day.td { box-shadow: inset 2px 0 0 var(--accent); }
.g-day.td b { color: var(--accent); }
.g-group { padding: 12px 10px 4px; font-size: 0.82rem; font-weight: 700; border-bottom: 1px solid var(--line); background: var(--sunk); position: sticky; left: 0; }

.g-bar {
  grid-row: 1; align-self: center; z-index: 2; height: 24px; margin: 0 2px; padding: 0 8px; min-width: 0;
  display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; cursor: pointer;
  border: 0; border-radius: var(--radius); font: inherit; font-size: 0.72rem; font-weight: 700; text-align: left;
  color: var(--surface); background: var(--c-proposed);
}
.g-bar:hover { filter: brightness(1.08); }
.g-bar:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.g-bar .g-text { overflow: hidden; text-overflow: ellipsis; }
.g-bar.cat-progress { background: var(--c-progress); }
.g-bar.cat-proposed { background: var(--c-proposed); }
.g-bar.cat-resolved { background: var(--c-resolved); }
.g-bar.cat-done { background: var(--c-done); }
.g-bar.cat-removed { background: var(--c-removed); }
.g-bar.k-actual { color: var(--fg); background: repeating-linear-gradient(45deg, var(--c-proposed-soft) 0 5px, var(--surface) 5px 10px); box-shadow: inset 0 0 0 1.5px var(--c-proposed); }
.g-bar.k-actual.cat-progress { background: repeating-linear-gradient(45deg, var(--c-progress-soft) 0 5px, var(--surface) 5px 10px); box-shadow: inset 0 0 0 1.5px var(--c-progress); }
.g-bar.k-actual.cat-done { background: repeating-linear-gradient(45deg, var(--c-done-soft) 0 5px, var(--surface) 5px 10px); box-shadow: inset 0 0 0 1.5px var(--c-done); }
.g-bar.k-actual.cat-resolved { background: repeating-linear-gradient(45deg, var(--c-resolved-soft) 0 5px, var(--surface) 5px 10px); box-shadow: inset 0 0 0 1.5px var(--c-resolved); }
.g-bar.k-milestone { background: transparent; color: var(--fg); padding: 0 2px; overflow: visible; }
.g-bar.k-milestone .g-dia { flex: none; width: 12px; height: 12px; transform: rotate(45deg); border-radius: 2px; background: var(--c-proposed); }
.g-bar.k-milestone.cat-progress .g-dia { background: var(--c-progress); }
.g-bar.k-milestone.cat-done .g-dia { background: var(--c-done); }
.g-bar.late { box-shadow: 0 0 0 2px var(--bad); }
.g-bar.late .g-text { font-weight: 800; }
.g-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.g-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.g-outside { grid-row: 1; align-self: center; padding: 0 10px; font-size: 0.75rem; color: var(--muted); }
.g-unscheduled { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.g-unscheduled summary { cursor: pointer; font-weight: 600; }
.g-unscheduled ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 0.88rem; }
/* Grids holding wide controls must not grow past the page (phone width). */
.sprint-head, .gantt-view { grid-template-columns: minmax(0, 1fr); }
.sprint-head > *, .gantt-view > * { min-width: 0; }

/* v1.5: sign-in form */
.login { display: grid; place-items: center; padding: 48px 0 64px; }
.login-card {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px 24px; display: grid; gap: 10px;
  box-shadow: 0 8px 28px -18px rgba(23, 34, 51, 0.45);
}
.login-card h1 { font-size: 1.3rem; }
.login-mark {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: var(--surface); font-weight: 700;
}
.login-form { display: grid; gap: 6px; margin-top: 10px; }
.login-form label { font-size: 0.85rem; font-weight: 600; margin-top: 6px; }
.login-form input {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 11px; width: 100%;
}
.login-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-form button { margin-top: 10px; padding: 10px; justify-content: center; }
.login-error { color: var(--bad); font-size: 0.88rem; min-height: 1.3em; }
.login-error:empty { min-height: 0; }

/* v1.5: job to be done and rich text */
.jtbd {
  display: inline-flex; align-items: baseline; gap: 6px; font-size: 0.74rem; font-weight: 600;
  padding: 0 8px 0 0; border-radius: 999px; border: 1px solid var(--accent);
  color: var(--accent); background: var(--accent-soft); overflow: hidden; max-width: 100%;
}
.jtbd-k { background: var(--accent); color: var(--surface); padding: 0 6px; font-size: 0.66rem; }
.filters select.f-jtbd { flex: 0 1 220px; min-width: 0; }
.rich { font-size: 0.93rem; overflow-wrap: anywhere; display: grid; gap: 6px; }
.rich :is(p, ul, ol, pre, blockquote, table, h1, h2, h3, h4, h5, h6) { margin: 0; }
.rich :is(h1, h2, h3, h4, h5, h6) { font-size: 0.98rem; text-transform: none; letter-spacing: 0; color: var(--fg); }
.rich :is(ul, ol) { padding-left: 1.3em; }
.rich pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; }
.rich table { border-collapse: collapse; display: block; overflow-x: auto; }
.rich :is(th, td) { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.rich blockquote { border-left: 3px solid var(--line); padding-left: 10px; color: var(--muted); }
.rich em:only-child { color: var(--muted); }
.rich img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 4px 0; }

/* v1.6: project switcher and first-time collection */

.collecting { display: grid; gap: 10px; justify-items: start; padding: 32px 0; max-width: 62ch; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.project-list { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }

/* ================================================================ v1.9 sprint ledger
   Kept last so it settles the look over the older rules above. */
body { font-size: 15.5px; line-height: 1.55; font-feature-settings: "tnum" 1; }
.num { font-family: var(--font); font-variant-numeric: tabular-nums; }
h1, h2, h3, .section-title { font-family: var(--display); font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 1.4rem + 1.4vw, 2.6rem); line-height: 1.08; letter-spacing: -0.025em; font-weight: 700; }
h2, .section-title { font-size: 1.15rem; }
:is(a, button, select, summary, input):focus-visible { outline: 2px solid var(--ledger); outline-offset: 2px; }

/* Top bar: a plain line of ink on paper. */
.bar { background: var(--paper); border-bottom: 1px solid var(--ink); }
.brand { background: var(--ink); color: var(--paper); border-radius: var(--radius); font-family: var(--display); font-size: 0.86rem; }
.project-pick select { font-family: var(--display); font-weight: 650; font-size: 1rem; }
.nav-tabs { border: 0; background: none; border-radius: 0; gap: 4px; overflow: visible; }
.nav-tabs a { padding: 6px 10px; border-radius: 0; color: var(--muted); border-bottom: 2px solid transparent; }
.nav-tabs a + a { border-left: 0; }
.nav-tabs a:hover { background: none; color: var(--ink); }
.nav-tabs a[aria-current="page"] { background: none; color: var(--ink); border-bottom-color: var(--ledger); }
.nav-more-btn { background: none; }
.link-button, a { color: var(--ledger); }

/* Controls */
button, select, .filters input[type="search"] { border-radius: var(--radius); background: var(--surface); }
button.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
button.primary:hover { filter: none; background: var(--ledger); border-color: var(--ledger); }
.seg button[aria-pressed="true"], .tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip { border-radius: var(--radius); font-size: 0.78rem; font-weight: 600; }
.chip.current { color: var(--ledger); background: var(--accent-soft); border-color: transparent; }
.chip.past, .chip.unscheduled { color: var(--muted); border-color: var(--line); }
.chip.future { color: var(--ink); background: none; border-color: var(--ink); }
.page-head .meta { font-size: 0.9rem; gap: 4px 16px; align-items: center; }
.page-head > div > .muted { margin-top: 6px; max-width: 70ch; }

/* The status sentence and the balance bar */
.balance { display: grid; gap: 12px; }
.status-line { font-family: var(--display); font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem); font-weight: 500; line-height: 1.3; max-width: 60ch; letter-spacing: -0.01em; }
.ledger { display: flex; width: 100%; min-height: 56px; gap: 2px; }
.ledger .seg {
  flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; gap: 4px; padding: 6px 10px; border: 0; border-radius: 0;
  font: inherit; text-align: left; overflow: hidden; white-space: nowrap; color: var(--ink);
}
.ledger .seg:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.ledger .seg:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.ledger .seg:only-child { border-radius: var(--radius); }
.ledger .seg b { font-family: var(--display); font-size: 1.6rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.ledger .seg .lbl { font-size: 0.85rem; padding-bottom: 2px; overflow: hidden; text-overflow: ellipsis; }
.ledger .s-done { background: var(--f-done); color: #fff; }
.ledger .s-progress { background: var(--f-progress); color: #241800; }
.ledger .s-proposed { background: var(--f-proposed); color: var(--ink); }
.ledger .seg.empty { background: var(--surface); border: 1px dashed var(--line); color: var(--muted); align-items: center; }
.ledger button.seg { cursor: pointer; }
.ledger button.seg:hover { filter: brightness(1.06); }
.ledger.has-active .seg:not(.on) { opacity: 0.35; }
.ledger button.seg:focus-visible { outline-offset: 3px; }
@media (prefers-color-scheme: dark) { .ledger .s-done { color: #08130f; } }

.tallies { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; }
.tally { border: 0; background: none; padding: 2px 0; font-size: 0.95rem; color: var(--muted); border-bottom: 1px solid transparent; border-radius: 0; }
.tally:hover { color: var(--ink); border-bottom-color: var(--muted); }
.tally.on { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--ink); }
.tally.late { color: var(--signal); font-weight: 700; }
.tally.late.on { border-bottom-color: var(--signal); }

/* Overview: project health */
.health { display: grid; gap: 8px; }
.health-key { display: flex; gap: 16px; font-size: 0.82rem; color: var(--muted); justify-content: flex-end; }
.health-key .key::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }
.health-key .s-done::before { background: var(--f-done); }
.health-key .s-progress::before { background: var(--f-progress); }
.health-key .s-proposed::before { background: var(--f-proposed); }
.health-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.health-row {
  display: grid; grid-template-columns: minmax(150px, 15rem) minmax(0, 1fr) 3.5rem 12rem 5rem;
  gap: 4px 18px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.health-row .h-name { display: grid; text-decoration: none; color: var(--ink); min-width: 0; }
.health-row .h-name span { font-family: var(--display); font-weight: 650; font-size: 1.08rem; line-height: 1.2; }
.health-row .h-name small { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-row .h-name:hover span { color: var(--ledger); text-decoration: underline; text-underline-offset: 3px; }
.health-row .ledger { min-height: 28px; }
.health-row .ledger .seg { padding: 2px 8px; align-items: center; }
.health-row .ledger .seg b { font-size: 0.95rem; }
.health-row .ledger .seg .lbl { display: none; }
.health-row .h-pct { font-family: var(--display); font-size: 1.35rem; font-weight: 700; text-align: right; }
.health-row .h-when { font-size: 0.88rem; }
.health-row .h-late { color: var(--signal); font-weight: 700; text-align: right; }
.health-row.stale { opacity: 0.6; }
.section-title { margin-top: 12px; }

/* Project pills */
.proj-pill { border-radius: var(--radius); background: none; font-weight: 600; }
.proj-pill .n { border-radius: 2px; }
.proj-pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.proj-pill[aria-pressed="true"] .n { background: var(--paper); color: var(--ink); }
.proj-pill[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--paper); }
.project-pills .pills-label { font-size: 0.88rem; }

/* Team: one row per department */
.dept-list { display: grid; border-top: 1px solid var(--ink); }
.dept-row {
  display: grid; grid-template-columns: minmax(120px, 12rem) minmax(0, 1fr) 4rem minmax(9rem, 11rem);
  gap: 4px 18px; align-items: center; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: none; text-align: left; width: 100%;
}
.dept-row:hover { background: var(--surface); }
.dept-row.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--ledger); }
.dept-row .d-name { font-family: var(--display); font-weight: 650; font-size: 1.02rem; }
.dept-row .dept-track { display: block; min-width: 0; }
.dept-row .ledger { min-height: 22px; }
.dept-row .ledger .seg { padding: 0 6px; align-items: center; }
.dept-row .ledger .seg b { font-size: 0.8rem; }
.dept-row .ledger .seg .lbl, .dept-row .ledger .seg.empty { display: none; }
.dept-row .d-n { font-family: var(--display); font-size: 1.35rem; font-weight: 700; text-align: right; }
.dept-row .d-sub { font-size: 0.85rem; }
.dept-row.zero { color: var(--muted); }
.dept-row.zero .d-n { color: var(--muted); font-weight: 500; }

/* Tables: ruled, not boxed */
.items-wrap { background: none; border: 0; border-top: 1px solid var(--ink); border-radius: 0; }
table.items th { background: var(--paper); font-size: 0.82rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
table.items td { border-bottom: 1px solid var(--line); }
table.items tbody tr:hover td { background: var(--surface); }
.pill { border-radius: 999px; font-size: 0.8rem; }
.type { border-radius: 2px; font-size: 0.72rem; }
.drawer, .item-tabs { background: var(--paper); }

@media (max-width: 760px) {
  .health-row { grid-template-columns: minmax(0, 1fr) auto; }
  .health-row .ledger { grid-column: 1 / -1; grid-row: 2; }
  .health-row .h-when { grid-column: 1; }
  .health-row .h-late { grid-column: 2; }
  .health-key { justify-content: flex-start; flex-wrap: wrap; }
  .dept-row { grid-template-columns: minmax(0, 1fr) auto; }
  .dept-row .dept-track { grid-column: 1 / -1; grid-row: 2; }
  .dept-row .d-sub { grid-column: 1 / -1; }
  /* Number above its label so "not started" fits a narrow segment. */
  .balance .ledger .seg { flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 0; min-width: 64px; white-space: normal; }
  .ledger .seg b { font-size: 1.25rem; }
  .ledger .seg .lbl { font-size: 0.76rem; line-height: 1.15; padding: 0; }
  /* Top bar: brand, project and account on the first line; the tabs on their own line. */
  .bar-inner > nav { order: 3; flex: 1 1 100%; }
  .project-pick { flex: 1 1 0; }
  .project-pick select { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* Page titles take focus after navigation (for screen readers); no ring for that. */
h1[tabindex="-1"]:focus { outline: none; }
