/* AssetReady.
   Every colour, size and space below comes from a token. The sheet previously carried 30 loose hex
   values — a bespoke green palette with Tailwind-ish slates and limes mixed through it — plus six
   `var(--mute, #6b7280)` fallbacks whose fallback was a *different* grey from the token. That is
   why the interface read as two design systems stitched together. */

:root {
  /* Ink and ground — one grey ramp. */
  --ink: #16261f;
  --ink-soft: #33463e;
  /* Was #6b7671, which cleared 4.5:1 on white but failed on every tinted band ground (4.11-4.43:1
     across ten elements). Darkened so it passes on white AND on tint. */
  --mute: #56635d;
  --line: #dfe4e1;
  --line-strong: #c6cfca;
  --bg: #f6f8f7;
  --card: #ffffff;
  --sunken: #fbfcfb;

  /* One brand family and three semantic families. Each carries a ground, a border and an ink that
     is legible on that ground, so a tinted surface never has to guess at its own text colour. */
  --brand: #115740;
  --brand-soft: #e8f0ec;
  --brand-line: #c4d8cd;

  --danger: #96201f;
  --danger-soft: #fbecea;
  --danger-line: #eec9c5;
  --danger-ink: #7a1a19;

  --warn: #7d5100;
  --warn-soft: #fdf3e0;
  --warn-line: #ecdcbb;
  --warn-ink: #6b4500;

  --info: #1b5695;
  --info-soft: #ecf2f9;
  --info-line: #cddef0;
  --info-ink: #17497f;

  /* Six steps, 12px floor. Was nine sizes with no ratio, bottoming out at 10.5px. */
  --t-xs: 12px;
  --t-sm: 13px;
  --t-md: 15px;
  --t-lg: 18px;
  --t-xl: 24px;
  --t-2xl: 30px;

  /* One 4px scale, replacing ad-hoc 10/12/14/16/18/22/26px. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  --radius: 12px;
  --radius-sm: 8px;
  --tap: 44px;

  /* Depth carries an offset and a soft blur; a zero-offset halo is decoration, not elevation. */
  --lift: 0 1px 2px rgba(22, 38, 31, .04), 0 2px 8px rgba(22, 38, 31, .05);
  --lift-hover: 0 1px 2px rgba(22, 38, 31, .05), 0 4px 14px rgba(22, 38, 31, .08);
  /* The same ink as the shadows, at the weight that dims a page without hiding it. */
  --scrim: rgba(22, 38, 31, .62);
  --ease: cubic-bezier(.2, .7, .3, 1);
  --fast: 160ms;
}

/* Drawn, not typed. A chevron and a check at one stroke weight, tinted by `currentColor` through a
   mask — the disclosure markers and the progress ticks were Unicode glyphs standing in for icons,
   which inherit whatever the text face happens to draw. */
.icon { display: inline-block; width: 16px; height: 16px; background: currentColor; flex: none; }
.icon-chevron {
  -webkit-mask: var(--chevron) center / 16px no-repeat;
  mask: var(--chevron) center / 16px no-repeat;
  transition: transform var(--fast) var(--ease);
}
:root {
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3.5L10.5 8L6 12.5'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E");
  --dot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='3.25' fill='%23000'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* The only focus rule in the sheet. Without it the ring is the browser default — blue, against a
   green palette, and one stray `outline: none` from disappearing with nothing to catch it. */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* The surfaces the browser draws for us still belong to the palette. */
::selection { background: var(--brand-soft); color: var(--ink); }
:root { accent-color: var(--brand); }
a, .link-button { text-underline-offset: 3px; }
/* Counts and numbers line up in a column instead of jittering. */
.group-count, .verdict-count, #missing li::before { font-variant-numeric: tabular-nums; }

body {
  margin: 0 auto;
  padding: var(--s6) var(--s5) var(--s7);
  max-width: 1060px;
  font: var(--t-md)/1.55 -apple-system, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---- Header ------------------------------------------------------------------------------- */
header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s5);
         margin-bottom: var(--s5); }
/* Application chrome: a second neutral layer above the content surface, as a toolbar should be. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
          padding: 0 0 var(--s3); margin-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.wordmark { font-weight: 700; font-size: var(--t-sm); color: var(--brand); letter-spacing: -.01em; }
h1 { margin: 0; font-size: var(--t-2xl); line-height: 1.15; letter-spacing: -.02em; }
.header-actions, .user-actions { display: flex; align-items: center; gap: var(--s3); }
/* Three actions plus a filename do not fit a phone, and a real report name runs to 40 characters.
   Wrap the row and truncate the chip rather than pushing the header off the page. */
.header-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
.user-actions { color: var(--mute); font-size: var(--t-sm); }
.chip {
  font: 500 var(--t-xs)/1 ui-monospace, monospace;
  color: var(--mute); background: var(--card);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px var(--s3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: min(100%, 32ch);
}
.link-button {
  border: 0; background: none; color: var(--ink); text-decoration: underline; cursor: pointer;
  font-family: inherit; font-size: var(--t-sm);
  padding: var(--s3) var(--s2); min-height: var(--tap);
}

/* ---- Cards and the entry state -------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); margin-bottom: var(--s5); }
.card.soft { background: var(--brand-soft); border-color: var(--brand-line); }
.login-card { max-width: 420px; margin: var(--s7) auto; }
.login-card form { display: grid; gap: var(--s2); }
.login-card h2, .login-card p { margin: 0 0 var(--s1); }
.login-card label { font-weight: 650; font-size: var(--t-sm); }
.login-card input { padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; min-height: var(--tap); }

/* No longer a card: a bordered panel wrapping a bordered dashed panel was a frame inside a frame,
   and the outer one earned nothing. It carries spacing only. */
#input-card { margin-bottom: var(--s5); }
#input-summary { cursor: pointer; font-weight: 600; color: var(--brand); min-height: var(--tap); display: flex; align-items: center; }
#input-card:not([open]) { padding-bottom: var(--s2); }

.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--sunken); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop.busy { opacity: .55; pointer-events: none; }
.drop-inner { padding: var(--s7) var(--s5); text-align: center; }
.drop-title { margin: 0; font-size: var(--t-lg); font-weight: 600; }
.drop-sub { margin: var(--s1) 0 var(--s5); color: var(--mute); font-size: var(--t-sm); }
.drop-actions { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; }

/* `font: 500 14px/1 inherit` is invalid — `inherit` is not a valid family in the shorthand — so the
   whole declaration was dropped and every real <button> fell back to Arial 13.33px while the
   label-styled control rendered at 15px. Longhand, so it survives the parser. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: var(--t-sm); font-weight: 500; line-height: 1;
  min-height: var(--tap); padding: 0 var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); cursor: pointer;
}
.btn:hover { border-color: var(--mute); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--card); font-weight: 600; }

.paste { margin-top: var(--s4); text-align: left; }
.paste summary { cursor: pointer; color: var(--mute); font-size: var(--t-sm); min-height: var(--tap); display: flex; align-items: center; }
.paste textarea { width: 100%; margin: var(--s2) 0; padding: var(--s3); font: var(--t-sm)/1.5 ui-monospace, monospace; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); resize: vertical; }
.status { margin: var(--s3) 0 0; text-align: center; color: var(--mute); font-size: var(--t-sm); min-height: 18px; }
.status.err { color: var(--danger); }

/* Running updates. Each step is a fact already established, so completed steps stay visible —
   the accumulation is what shows a long wait is doing something. */
.progress { list-style: none; margin: var(--s3) 0 0; padding: 0; font-size: var(--t-sm); }
.progress li { padding: var(--s1) 0 var(--s1) var(--s5); position: relative; color: var(--mute); }
.progress li::before {
  content: ""; position: absolute; left: var(--s1); top: 6px; width: 16px; height: 16px;
  background: var(--brand);
  -webkit-mask: var(--check) center / 16px no-repeat; mask: var(--check) center / 16px no-repeat;
}
.progress li.active { color: var(--ink); font-weight: 600; }
.progress li.active::before {
  background: var(--warn);
  -webkit-mask: var(--dot) center / 16px no-repeat; mask: var(--dot) center / 16px no-repeat;
}
.progress li.active::after { content: attr(data-elapsed); margin-left: var(--s2); font-weight: 400; color: var(--mute); }

/* ---- Results ------------------------------------------------------------------------------- */
.summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: 0 0 var(--s3); max-width: 78ch; box-shadow: var(--lift); }
.verified { font-size: var(--t-xs); padding: var(--s2) var(--s3); border-radius: var(--radius-sm); margin-bottom: var(--s5); }
.verified.ok { background: var(--brand-soft); color: var(--brand); }
.verified.bad { background: var(--danger-soft); color: var(--danger-ink); }
.verified.warn { background: var(--warn-soft); color: var(--warn-ink); }

/* Controls above the list. A 44-row report needs a way in that is not scrolling. */
.controls { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.search { flex: 1 1 260px; display: flex; }
.search input {
  width: 100%; min-height: var(--tap); padding: 0 var(--s3);
  font: inherit; font-size: var(--t-sm); color: var(--ink);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.search input::placeholder { color: var(--mute); }
.filters { display: flex; gap: var(--s2); flex-wrap: wrap; }
.filter {
  font: inherit; font-size: var(--t-xs); font-weight: 600; min-height: var(--tap);
  padding: 0 var(--s3); cursor: pointer; color: var(--ink-soft);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.filter:hover { border-color: var(--mute); }
.filter[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--card); }
.shown { font-size: var(--t-xs); color: var(--mute); }
.empty-filter { color: var(--mute); font-size: var(--t-sm); padding: var(--s5) 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* The rule that put these rows here. Ordered rungs, unordered rows inside one — the heading says
   which rule fired without claiming the projects under it are ranked against each other. */
.rung {
  display: flex; align-items: baseline; gap: var(--s2);
  padding: var(--s3) var(--s4) var(--s2);
  background: var(--card); border: 1px solid var(--line); border-top: none;
  font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--mute);
}
.rung-count { margin-left: auto; font-weight: 500; letter-spacing: 0; }
.rung + .row { border-top: none; }

.group { margin-bottom: var(--s5); }
/* `justify-content: flex-start` with the count pushed right, rather than `space-between`: the fold
   marker is a ::before pseudo-element and therefore a third flex item, which space-between would
   spread out, leaving the label stranded in the middle of the bar. */
.group-head {
  display: flex; align-items: baseline; justify-content: flex-start; gap: var(--s3);
  padding: var(--s3) var(--s4); min-height: var(--tap);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border: 1px solid var(--line); border-bottom: none;
}
.group-head:only-child { border-bottom: 1px solid var(--line); border-radius: var(--radius-sm); }
/* Never break mid-phrase into "Do / now" once the header wraps. */
.group-label { font-weight: 700; white-space: nowrap; }
.group-sub { margin-left: var(--s2); color: var(--mute); font-size: var(--t-xs); }
.group-count { margin-left: auto; font: 500 var(--t-xs)/1 ui-monospace, monospace; color: var(--mute); white-space: nowrap; }

.group.do_now .group-head { background: var(--danger-soft); border-color: var(--danger-line); }
.group.do_now .group-label { color: var(--danger); }
.group.do_now .group-sub, .group.do_now .group-count { color: var(--danger-ink); }
.group.plan_soon .group-head { background: var(--warn-soft); border-color: var(--warn-line); }
.group.plan_soon .group-label { color: var(--warn); }
.group.plan_soon .group-sub, .group.plan_soon .group-count { color: var(--warn-ink); }
.group.defer .group-head { background: var(--info-soft); border-color: var(--info-line); }
.group.defer .group-label { color: var(--info); }
.group.defer .group-sub, .group.defer .group-count { color: var(--info-ink); }
/* Contradictory rows are shown rather than dropped, and must not look like released work. */
.group.review .group-head { background: var(--warn-soft); border-color: var(--warn-line); }
.group.review .group-label { color: var(--warn-ink); }
.group.review .group-sub, .group.review .group-count { color: var(--warn-ink); }

.row { background: var(--card); border: 1px solid var(--line); border-top: none;
       transition: background var(--fast) var(--ease); }
details.row:hover { background: var(--sunken); }
details.row[open] { background: var(--card); }
.group .row:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.project-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.project-head b { font-size: var(--t-md); }
/* Rationales average ~286 characters. At 15px across the full column that is ~130 per line. */
.row p { margin: 0; max-width: 74ch; color: var(--ink-soft); }
.violations { margin-top: var(--s1); }

/* Which building system this belongs to. Neutral by design — it is a category, not a severity. */
.system-chip { font: 500 var(--t-xs)/1 inherit; padding: 5px var(--s2); border-radius: 4px; color: var(--ink-soft); background: var(--bg); border: 1px solid var(--line); }

.label-chip.mandatory { font: 600 var(--t-xs)/1 inherit; padding: 5px var(--s2); border-radius: 4px; color: var(--danger-ink); background: var(--danger-soft); border: 1px solid var(--danger-line); }
.has-photo { font: 600 var(--t-xs)/1 inherit; padding: 5px var(--s2); border-radius: 4px; color: var(--info-ink); background: var(--info-soft); border: 1px solid var(--info-line); }

/* Why this row has the urgency it has. The priority is computed from the evidence, so the reason
   is a fact about the rule, not a claim the model made. */
.derived { display: flex; gap: var(--s2); align-items: baseline; margin-top: var(--s1); font-size: var(--t-xs); color: var(--mute); }
.derived span { font-weight: 600; color: var(--ink); white-space: nowrap; }

.violations { margin: var(--s2) 0 0; padding-left: 0; list-style: none; font-size: var(--t-xs); color: var(--warn-ink); }

/* ---- Row detail ---------------------------------------------------------------------------- */
details.row > summary {
  cursor: pointer; list-style: none; position: relative;
  padding: var(--s3) var(--s6) var(--s3) var(--s4);
  min-height: var(--tap); display: flex; flex-direction: column; justify-content: center; gap: var(--s1);
}
details.row > summary::-webkit-details-marker { display: none; }
/* Was `float: right`, which placed the marker after three block children — at the row's bottom-right
   corner, on the divider, some 80px below the title it belongs to. */
details.row > summary::after {
  content: ""; position: absolute; right: 0; top: 2px; width: 16px; height: 16px;
  background: var(--mute);
  -webkit-mask: var(--chevron) center / 16px no-repeat; mask: var(--chevron) center / 16px no-repeat;
  transform: rotate(0deg); transition: transform var(--fast) var(--ease);
}
details.row[open] > summary::after { transform: rotate(90deg); }

.detail { padding: var(--s3) var(--s4) var(--s4); border-top: 1px dashed var(--line); margin: 0 var(--s4); }
/* The decisive rule, stated once in a sentence. A reader who sees four evidence chips will
   otherwise assume all four drove the ranking; only the first one did. */
.why { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); margin-bottom: var(--s4); }
.why p, .rationale p { margin: 0; max-width: 74ch; color: var(--ink-soft); }
.rationale { margin-bottom: var(--s4); }
.evidence { margin-bottom: var(--s4); }
.detail-label { display: block; font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); margin: 0 0 var(--s2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* The evidence behind the priority. These carry the product's whole mechanism and used to render
   as six identical grey pills — the quietest thing on the row. The ramp says which kind of fact
   this is; the cascade in engine/priority.py still decides what it means. */
.evidence-chip { font-size: var(--t-xs); font-weight: 600; padding: 5px var(--s3); border-radius: 999px; border: 1px solid transparent; }
.evidence-chip.critical { background: var(--danger-soft); color: var(--danger-ink); border-color: var(--danger-line); }
.evidence-chip.serious { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-line); }
.evidence-chip.context { background: var(--bg); color: var(--ink-soft); border-color: var(--line); font-weight: 500; }
.evidence-chip.none { background: transparent; color: var(--mute); border: 0; font-style: italic; font-weight: 400; padding-left: 0; }

/* What a report photograph shows for this project. The reference is verified server-side against
   the images actually sent, so an uncheckable claim never reaches this line. */
.photo { margin-top: var(--s4); }
.photo-strip { display: flex; flex-wrap: wrap; gap: var(--s4); }
/* One photograph keeps the full column; several share it, so a three-angle deficiency reads as one
   piece of evidence rather than three stacked screens. */
.photo-figure { margin: 0; flex: 1 1 100%; max-width: 420px; }
.photo-many .photo-figure { flex: 1 1 220px; max-width: 260px; }
.photo-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius-sm); }
/* The box is reserved, so a lazily-loaded photograph cannot shift the page under the reader (W20). */
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); transition: border-color var(--fast) var(--ease); }
.photo-open:hover img { border-color: var(--mute); }
.photo-ref { display: block; font-size: var(--t-xs); font-weight: 600; color: var(--mute); margin-top: var(--s2); }
.photo p { margin: var(--s1) 0 var(--s2); font-size: var(--t-sm); max-width: 74ch; }

/* The enlarged view. A <dialog> escapes the row's clipping and traps focus without a hand-rolled
   trap; only the sliding and the focus return are ours. */
#lightbox { width: min(92vw, 900px); padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); }
#lightbox::backdrop { background: var(--scrim); }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.lightbox-position { font-size: var(--t-xs); font-weight: 600; color: var(--mute); }
#lightbox-figure img { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius-sm); background: var(--bg); }
.lightbox-caption { margin: var(--s3) 0 0; font-size: var(--t-sm); color: var(--ink-soft); max-width: 74ch; }
.lightbox-nav { display: flex; gap: var(--s2); margin-top: var(--s3); }
.lightbox-btn { font: inherit; font-size: var(--t-sm); font-weight: 500; min-height: var(--tap); padding: 0 var(--s4); cursor: pointer; color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.lightbox-btn:hover { border-color: var(--mute); }
/* Amber, not green: this labels a failure, and green announces a pass. */
.photo .supports { display: inline-block; font-size: var(--t-xs); font-weight: 600; padding: 5px var(--s3); border-radius: 999px; background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-line); }

/* Where to go and verify. The one line that lets a reader check the tool rather than trust it. */
.provenance { color: var(--ink-soft); font-size: var(--t-xs); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.provenance span { margin-right: var(--s2); font-weight: 600; color: var(--mute); }

/* ---- Before you act -------------------------------------------------------------------------- */
#missing-wrap > summary { cursor: pointer; font-weight: 600; list-style: none; min-height: var(--tap); display: flex; align-items: center; gap: var(--s2); }
#missing-wrap > summary::-webkit-details-marker { display: none; }
#missing-wrap > summary::before {
  content: ""; width: 16px; height: 16px; flex: none; background: currentColor; opacity: .8;
  -webkit-mask: var(--chevron) center / 16px no-repeat; mask: var(--chevron) center / 16px no-repeat;
  transform: rotate(90deg); transition: transform var(--fast) var(--ease);
}
#missing-wrap:not([open]) > summary::before { transform: rotate(0deg); }
/* The list a person is meant to act on. Numbered rows with room to breathe read as a checklist;
   long sentences behind default bullets read as a wall. */
#missing { counter-reset: confirm; list-style: none; margin: var(--s2) 0 0; padding: 0; }
#missing li { counter-increment: confirm; position: relative; padding: var(--s3) 0 var(--s3) var(--s6); border-top: 1px solid var(--brand-line); line-height: 1.5; max-width: 78ch; }
#missing li:first-child { border-top: none; }
#missing li::before { content: counter(confirm); position: absolute; left: 0; top: var(--s3); width: 22px; height: 22px; border-radius: 999px; background: var(--brand); color: var(--card); font: 600 var(--t-xs)/22px ui-monospace, monospace; text-align: center; }

.note { color: var(--mute); font-size: var(--t-xs); }
footer { margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid var(--line); }
/* Token counts are developer instrumentation, and used to be the last thing on the page. */
#usage-wrap { margin-top: var(--s2); }
#usage-wrap summary { cursor: pointer; }

@media (max-width: 720px) {
  body { padding: var(--s5) var(--s4) var(--s7); }
  header { align-items: flex-start; flex-direction: column; gap: var(--s3); }
  /* Left-align with the title rather than stranding the last action on its own right-aligned row. */
  .header-actions { justify-content: flex-start; width: 100%; }
  /* Caret and label stay on one line; only the sub-heading drops. `flex-basis` alone still shrinks,
     so the sub needs `flex-shrink: 0` to actually claim its own row. */
  .group-head { flex-wrap: wrap; align-items: center; }
  /* The sub is not a flex item — it is inline inside the label's div — so it drops to its own line
     by becoming a block, not by flex-basis. Caret, label and count stay on the first row. */
  .group-sub { display: block; margin: var(--s1) 0 0; }
  .group-count { margin-left: auto; }
}

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

@media print {
  body { padding: 0; background: var(--card); max-width: none; font-size: 11px; }
  #input-card, footer { display: none; }
  .row, .group { break-inside: avoid; }
}

/* ---- Folding bands --------------------------------------------------------------------------- */
/* The marker sits on the left of the bar, where the row's own right-hand marker cannot be mistaken
   for it. */
details.group > summary.group-head { cursor: pointer; list-style: none; }
details.group > summary.group-head::-webkit-details-marker { display: none; }
details.group > summary.group-head::before {
  content: ""; width: 16px; height: 16px; margin-right: -4px; flex: none; align-self: center;
  background: currentColor; opacity: .8;
  -webkit-mask: var(--chevron) center / 16px no-repeat; mask: var(--chevron) center / 16px no-repeat;
  transform: rotate(0deg); transition: transform var(--fast) var(--ease);
}
details.group[open] > summary.group-head::before { transform: rotate(90deg); }
summary.group-head { transition: filter var(--fast) var(--ease); }
details.group > summary.group-head:hover { filter: brightness(.985); }
/* `.group-head:only-child` rounds an empty band's bar, but it matches on DOM structure — a closed
   band still has row children, so without this its bar renders with a clipped, borderless base. */
details.group:not([open]) > .group-head { border-bottom: 1px solid var(--line); border-radius: var(--radius-sm); }
details.group.do_now:not([open]) > .group-head { border-bottom-color: var(--danger-line); }
details.group.plan_soon:not([open]) > .group-head { border-bottom-color: var(--warn-line); }
details.group.defer:not([open]) > .group-head { border-bottom-color: var(--info-line); }
details.group.review:not([open]) > .group-head { border-bottom-color: var(--warn-line); }
.group.empty .group-head { cursor: default; }
