/* Quality Review Assistant — Wave-2 UI, JobLogic-branded, dual-theme (ADR-0005 amended 2026-07-17).
   Self-contained: brand tokens from .claude/skills/jl-generating-frontend/assets/{color,typography}-tokens.json,
   Open Sans vendored locally under /static/fonts/ (NO CDN) with a system-font fallback.
   Dark-theme values are DERIVED (the DS token file ships light values only) — flagged for DS confirmation. */

/* ---- Vendored Open Sans (self-hosted; NO CDN). If a .woff2 is absent the stack falls back to
   system-ui, so nothing regresses (spec AC-4). Drop the OFL woff2 files into static/fonts/. ---- */
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/static/fonts/OpenSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("/static/fonts/OpenSans-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("/static/fonts/OpenSans-Bold.woff2") format("woff2"); }

/* ============================ Design tokens ============================ */
:root {
  color-scheme: light;
  /* ds-color/background/* (light) */
  --ds-bg-page: #eceff1;            /* ds-color/background/web */
  --ds-bg-surface-01: #ffffff;      /* surface-01 */
  --ds-bg-surface-02: #f5f5f5;      /* surface-02 */
  --ds-bg-surface-03: #efefef;      /* surface-03 */
  --ds-bg-surface-04: #e0e0e0;      /* surface-04 */
  --ds-bg-primary: #0099a5; --ds-bg-primary-hover: #008b95; --ds-bg-primary-pressed: #007780;
  --ds-bg-primary-subtle: #e0f3f4;
  --ds-bg-tertiary: #073948; --ds-bg-tertiary-hover: #04546c;
  --ds-brand-lake-blue: #072d3d; --ds-brand-cyan: #0099a5;
  --ds-bg-positive: #4c9f01; --ds-bg-positive-subtle: #e9f8dd;
  --ds-bg-negative: #e61513; --ds-bg-negative-subtle: #ffe9e9;
  --ds-bg-warning: #ffc205; --ds-bg-warning-subtle: #fcf5df;
  --ds-bg-informative-subtle: #e9f4fb; --ds-link-default: #0a6cc2;
  /* text */
  --ds-on-surface-strong: #333333; --ds-on-surface-medium: #545454; --ds-on-surface-weak: #6f6f6f;
  --ds-on-surface-placeholder: #8e8e8e; --ds-on-primary: #f5f5f5;
  /* Accessible primary-action teal (WCAG-AA fix, AC-2): DS background/primary #0099a5 with white text
     is only 3.44:1, so filled buttons + the REQUIRED chip use the DS's deeper primary-pressed family
     (theme-independent, ≥4.9:1). Cyan #0099a5 stays the accent everywhere else. Flagged for DS-team. */
  --ds-btn-bg: #007780; --ds-btn-bg-hover: #006e77; --ds-btn-bg-pressed: #005f66;
  --ds-on-positive-subtle: #496e1c; --ds-on-negative-subtle: #ca1513; --ds-on-warning-subtle: #805e00;
  --ds-on-informative-subtle: #195b94;
  /* borders */
  --ds-border-weak: #e0e0e0; --ds-border-strong: #cccccc; --ds-border-primary: #0099a5;
  --ds-border-negative-subtle: #ff9a99; --ds-border-positive-subtle: #94cd62;
  --ds-border-warning-subtle: #e9ce83; --ds-border-informative-subtle: #57aae1;
  --ds-border-focus-strong: #428bca;
  /* elevation (ds-shadow/*) */
  --ds-shadow-100: 0 1px 2px rgba(7,45,61,.07), 0 1px 1px rgba(7,45,61,.05);
  --ds-shadow-200: 0 6px 16px rgba(7,45,61,.12), 0 2px 4px rgba(7,45,61,.08);
  --ds-shadow-300: 0 16px 40px rgba(7,45,61,.24);
  /* spacing + radius */
  --space-4:.25rem; --space-8:.5rem; --space-12:.75rem; --space-16:1rem;
  --space-24:1.5rem; --space-32:2rem; --space-40:2.5rem; --space-48:3rem;
  --radius-small:.25rem; --radius-medium:.5rem; --radius-large:.75rem; --radius-full:999px;
}

/* Dark theme — DERIVED from brand/lake-blue + background/tertiary* (no dark ds-color/* tokens exist
   yet). Auto via prefers-color-scheme when the user hasn't explicitly chosen light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ds-bg-page:#051b24; --ds-bg-surface-01:#073948; --ds-bg-surface-02:#072d3d;
    --ds-bg-surface-03:#0a4456; --ds-bg-surface-04:rgba(255,255,255,.14);
    --ds-bg-primary:#0099a5; --ds-bg-primary-hover:#24b0ba; --ds-bg-primary-pressed:#007780;
    --ds-bg-primary-subtle:rgba(0,153,165,.24); --ds-bg-tertiary:#04546c; --ds-bg-tertiary-hover:#087fa3;
    --ds-bg-positive:#7bc93f; --ds-bg-positive-subtle:rgba(76,159,1,.24);
    --ds-bg-negative:#ff6b69; --ds-bg-negative-subtle:rgba(230,21,19,.24);
    --ds-bg-warning:#ffc205; --ds-bg-warning-subtle:rgba(255,194,5,.20);
    --ds-bg-informative-subtle:rgba(87,170,225,.20); --ds-link-default:#6bb6f2;
    --ds-on-surface-strong:#f5f5f5; --ds-on-surface-medium:#bcd2d8; --ds-on-surface-weak:#8fa8b0;
    --ds-on-surface-placeholder:#7c949c; --ds-on-primary:#f5f5f5;
    --ds-on-positive-subtle:#d9f2c2; --ds-on-negative-subtle:#ffd3d2; --ds-on-warning-subtle:#ffe6a3;
    --ds-on-informative-subtle:#cfe8fb;
    --ds-border-weak:rgba(255,255,255,.14); --ds-border-strong:rgba(255,255,255,.30);
    --ds-border-primary:#24b0ba; --ds-border-negative-subtle:rgba(255,107,105,.45);
    --ds-border-positive-subtle:rgba(123,201,63,.45); --ds-border-warning-subtle:rgba(255,194,5,.40);
    --ds-border-informative-subtle:rgba(107,182,242,.45); --ds-border-focus-strong:#66c2c9;
    --ds-shadow-100:0 1px 2px rgba(0,0,0,.4); --ds-shadow-200:0 6px 16px rgba(0,0,0,.5);
    --ds-shadow-300:0 20px 48px rgba(0,0,0,.6);
  }
}
/* Explicit toggle overrides — win over the media query in both directions. */
[data-theme="dark"] {
  color-scheme: dark;
  --ds-bg-page:#051b24; --ds-bg-surface-01:#073948; --ds-bg-surface-02:#072d3d;
  --ds-bg-surface-03:#0a4456; --ds-bg-surface-04:rgba(255,255,255,.14);
  --ds-bg-primary:#0099a5; --ds-bg-primary-hover:#24b0ba; --ds-bg-primary-pressed:#007780;
  --ds-bg-primary-subtle:rgba(0,153,165,.24); --ds-bg-tertiary:#04546c; --ds-bg-tertiary-hover:#087fa3;
  --ds-bg-positive:#7bc93f; --ds-bg-positive-subtle:rgba(76,159,1,.24);
  --ds-bg-negative:#ff6b69; --ds-bg-negative-subtle:rgba(230,21,19,.24);
  --ds-bg-warning:#ffc205; --ds-bg-warning-subtle:rgba(255,194,5,.20);
  --ds-bg-informative-subtle:rgba(87,170,225,.20); --ds-link-default:#6bb6f2;
  --ds-on-surface-strong:#f5f5f5; --ds-on-surface-medium:#bcd2d8; --ds-on-surface-weak:#8fa8b0;
  --ds-on-surface-placeholder:#7c949c; --ds-on-primary:#f5f5f5;
  --ds-on-positive-subtle:#d9f2c2; --ds-on-negative-subtle:#ffd3d2; --ds-on-warning-subtle:#ffe6a3;
  --ds-on-informative-subtle:#cfe8fb;
  --ds-border-weak:rgba(255,255,255,.14); --ds-border-strong:rgba(255,255,255,.30);
  --ds-border-primary:#24b0ba; --ds-border-negative-subtle:rgba(255,107,105,.45);
  --ds-border-positive-subtle:rgba(123,201,63,.45); --ds-border-warning-subtle:rgba(255,194,5,.40);
  --ds-border-informative-subtle:rgba(107,182,242,.45); --ds-border-focus-strong:#66c2c9;
  --ds-shadow-100:0 1px 2px rgba(0,0,0,.4); --ds-shadow-200:0 6px 16px rgba(0,0,0,.5);
  --ds-shadow-300:0 20px 48px rgba(0,0,0,.6);
}
[data-theme="light"] { color-scheme: light; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
}

/* ============================ Base ============================ */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ds-bg-page); color: var(--ds-on-surface-strong);
  font-family: "Open Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 13px; line-height: 20px;
  transition: background-color .18s ease, color .18s ease;
}
h1,h2,h3 { margin: 0; }
h1 { font-weight:700; font-size:20px; line-height:28px; }
h2 { font-weight:700; font-size:20px; line-height:28px; margin:0 0 4px; }
code { background: var(--ds-bg-surface-03); color: var(--ds-on-surface-strong);
  padding: 1px 5px; border-radius: var(--radius-small); font-size: 12px; }
a { color: var(--ds-link-default); }

/* ============================ App shell ============================ */
header.app {
  background: var(--ds-bg-surface-01); border-bottom: 3px solid var(--ds-bg-primary);
  box-shadow: var(--ds-shadow-100); padding: var(--space-12) var(--space-24);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-16);
  flex-wrap: wrap; position: sticky; top: 0; z-index: 100;
}
.brand { display: flex; align-items: center; gap: var(--space-12); }
.brand-mark {
  width: 36px; height: 36px; border-radius: var(--radius-medium);
  background: var(--ds-brand-lake-blue); color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: -.02em;
}
.sub, .app-sub { color: var(--ds-on-surface-weak); font-size: 11px; line-height: 16px; margin-top: 2px; }

.theme-toggle {
  width: 38px; height: 38px; border-radius: var(--radius-full); border: 1px solid var(--ds-border-weak);
  background: var(--ds-bg-surface-02); cursor: pointer; color: var(--ds-on-surface-medium); flex: none;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: var(--ds-bg-surface-03); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

main { max-width: 1040px; margin: 0 auto; padding: var(--space-24) var(--space-24) 96px; }
footer.corpus {
  max-width: 1040px; margin: 0 auto; padding: var(--space-16) var(--space-24) var(--space-40);
  color: var(--ds-on-surface-weak); font-size: 12px; border-top: 1px solid var(--ds-border-weak);
}

/* Focus rings — visible in both themes */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--ds-border-focus-strong); outline-offset: 2px; border-radius: var(--radius-small);
}

/* ============================ Cards & callouts ============================ */
.card {
  background: var(--ds-bg-surface-01); border: 1px solid var(--ds-border-weak);
  border-radius: var(--radius-large); box-shadow: var(--ds-shadow-100);
  padding: var(--space-24); margin-bottom: var(--space-16);
}
.hint { color: var(--ds-on-surface-weak); font-size: 12px; margin: var(--space-4) 0 var(--space-16); }

.callout {
  border-radius: var(--radius-medium); border: 1px solid var(--ds-border-informative-subtle);
  background: var(--ds-bg-informative-subtle); color: var(--ds-on-informative-subtle);
  padding: var(--space-12) var(--space-16); margin-bottom: var(--space-16); font-size: 12.5px;
}
.callout b { display: block; margin-bottom: 2px; color: inherit; }
.callout span, .callout p { color: var(--ds-on-surface-medium); }
.callout.callout-positive { background: var(--ds-bg-positive-subtle); border-color: var(--ds-border-positive-subtle); }
.callout.callout-positive b { color: var(--ds-on-positive-subtle); }
.callout.callout-negative, .callout.error-callout { background: var(--ds-bg-negative-subtle); border-color: var(--ds-border-negative-subtle); }
.callout.callout-negative b, .callout.error-callout b { color: var(--ds-on-negative-subtle); }
.callout.callout-warning { background: var(--ds-bg-warning-subtle); border-color: var(--ds-border-warning-subtle); }
.callout.callout-warning b { color: var(--ds-on-warning-subtle); }

/* ============================ Form ============================ */
fieldset { border: 1px solid var(--ds-border-weak); border-radius: var(--radius-medium); padding: var(--space-16); margin: 0 0 var(--space-16); }
legend { padding: 0 6px; font-weight: 600; font-size: 13px; }
.optional-tag { color: var(--ds-on-surface-weak); font-weight: 400; }
.subgroup-title { font-weight: 600; font-size: 12.5px; margin: var(--space-8) 0; color: var(--ds-on-surface-weak); }

details.optional-block { border: 1px solid var(--ds-border-weak); border-radius: var(--radius-medium); margin: 0 0 var(--space-16); overflow: hidden; }
details.optional-block > summary { list-style: none; cursor: pointer; padding: var(--space-12) var(--space-16); font-weight: 600; display: flex; align-items: center; gap: var(--space-8); background: var(--ds-bg-surface-02); }
details.optional-block > summary::-webkit-details-marker { display: none; }
details.optional-block > summary::before { content: "▸"; color: var(--ds-on-surface-weak); transition: transform .15s ease; }
details.optional-block[open] > summary::before { transform: rotate(90deg); }
details.optional-block .optional-body { padding: var(--space-16); }

.field { margin-bottom: var(--space-16); }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.req-inline, .req-chip {
  display: inline-block; background: var(--ds-btn-bg); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 2px 7px;
  border-radius: var(--radius-small); margin-right: var(--space-8); vertical-align: 1px;
}
input[type=text], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--ds-border-strong); border-radius: var(--radius-medium);
  font: inherit; background: var(--ds-bg-surface-01); color: var(--ds-on-surface-strong);
}
textarea { min-height: 72px; resize: vertical; }
.help { color: var(--ds-on-surface-weak); font-size: 12px; margin-top: 6px; }
.field-error { color: var(--ds-on-negative-subtle); font-size: 12.5px; margin-top: 6px; font-weight: 600; }
.field-row { display: flex; gap: var(--space-16); } .field-row .field { flex: 1; }
/* jira-id-intake: intake-mode radio toggle (Upload files / By JIRA ID). */
.mode-toggle { display: flex; gap: var(--space-16); flex-wrap: wrap; }
.mode-option { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13.5px; cursor: pointer; }
.mode-option input[type=radio] { width: auto; }
.mode-option-disabled { color: var(--ds-on-surface-weak); cursor: not-allowed; }
.mode-option-disabled input[type=radio] { cursor: not-allowed; }
.dropzone-row, .cols-3 { display: grid; gap: var(--space-16); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .cols-3, .field-row { grid-template-columns: 1fr; flex-direction: column; } }

/* ---- Drag-&-drop dropzones (upgrade #1) — the native file input covers the zone and handles
   drag/drop + click; JS only toggles visual state, so POST /review is byte-for-byte identical. ---- */
.dropzone {
  position: relative; border: 2px dashed var(--ds-border-strong); border-radius: var(--radius-medium);
  background: var(--ds-bg-surface-02); min-height: 108px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: var(--space-16); transition: border-color .12s ease, background-color .12s ease;
}
.dropzone.is-dragging { border-color: var(--ds-bg-primary); background: var(--ds-bg-primary-subtle); }

/* ---- Single-dropzone upload (upgrade): ONE drop target for all three files, with a checklist
   above naming each required file and its match state. Friendlier than three boxes; app.js routes
   each dropped file into the right hidden input, so POST /review is byte-for-byte identical. ---- */
.upload-group { border: 1px solid var(--ds-border-weak); border-radius: var(--radius-medium); background: var(--ds-bg-surface-01); overflow: hidden; }
.upload-checklist-head { padding: var(--space-12) var(--space-16); background: var(--ds-bg-surface-02); border-bottom: 1px solid var(--ds-border-weak); }
.upload-group-hint { margin: 0 0 var(--space-8); font-weight: 600; color: var(--ds-on-surface-strong); }
.upload-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.uc-item { display: flex; align-items: center; gap: var(--space-8); font-size: 12.5px; color: var(--ds-on-surface-medium); }
.uc-dot { flex: none; width: 16px; height: 16px; border-radius: var(--radius-full); border: 2px solid var(--ds-border-strong);
  display: inline-flex; align-items: center; justify-content: center; }
.uc-item.is-done .uc-dot { background: var(--ds-bg-positive); border-color: var(--ds-bg-positive); }
.uc-item.is-done .uc-dot::after { content: "✓"; color: #fff; font-size: 10px; font-weight: 700; line-height: 1; }
.uc-item.is-done .uc-text b { color: var(--ds-on-surface-strong); }
.uc-item.uc-error .uc-dot { border-color: var(--ds-bg-negative); }
.uc-item.uc-error { color: var(--ds-on-negative-subtle); }
.uc-type { color: var(--ds-on-surface-weak); font-weight: 400; }
.uc-file { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.uc-name { font-weight: 600; color: var(--ds-on-positive-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.uc-remove { border: 0; background: transparent; color: var(--ds-on-surface-weak); cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: var(--radius-small); }
.uc-remove:hover { background: var(--ds-bg-surface-03); color: var(--ds-on-negative-subtle); }
.uc-swap { display: inline-block; margin-top: var(--space-8); font-size: 12px; }
.dropzone.dz-bulk { min-height: 92px; margin: var(--space-16); }
.dropzone.dz-bulk .dz-empty-state { flex-direction: row; align-items: center; gap: var(--space-12); text-align: left; }
.dropzone.dz-bulk .dz-icon { width: 26px; height: 26px; flex: none; margin: 0; }
.dz-bulk-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; margin: 0; padding: 0; }
.dz-slot-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dz-slot-title { font-weight: 700; font-size: 13px; color: var(--ds-on-surface-strong); }
.dz-slot-hint { color: var(--ds-on-surface-weak); font-size: 12px; }
.dropzone.has-file { border-style: solid; border-color: var(--ds-border-positive-subtle); background: var(--ds-bg-positive-subtle); }
.dz-input-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; margin: 0; padding: 0; }
.dz-empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ds-on-surface-weak); pointer-events: none; }
.dz-empty-state svg { width: 22px; height: 22px; color: var(--ds-on-surface-placeholder); margin-bottom: 2px; }
.dz-browse-link { color: var(--ds-bg-primary-pressed); font-weight: 600; text-decoration: underline; }
.dz-filled-state { display: none; align-items: center; gap: var(--space-8); width: 100%; pointer-events: none; }
.dropzone.has-file .dz-empty-state { display: none; }
.dropzone.has-file .dz-filled-state { display: flex; }
.dz-badge { flex: none; width: 32px; height: 32px; border-radius: var(--radius-small); background: var(--ds-bg-tertiary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.dz-file-meta { display: flex; flex-direction: column; text-align: left; overflow: hidden; flex: 1; min-width: 0; }
.dz-filename { font-weight: 600; color: var(--ds-on-surface-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-filesize { color: var(--ds-on-surface-weak); font-size: 11px; }
.dz-remove-btn { position: relative; z-index: 5; pointer-events: auto; flex: none; border: 1px solid var(--ds-border-strong); background: var(--ds-bg-surface-01); color: var(--ds-on-surface-medium); border-radius: var(--radius-small); padding: 4px 9px; font: inherit; font-size: 11px; cursor: pointer; }
.dz-remove-btn:hover { background: var(--ds-bg-surface-03); }

/* ============================ Buttons ============================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: var(--radius-medium);
  padding: 11px 20px; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--ds-btn-bg); color: #fff; transition: background-color .12s ease;
}
.btn:hover { background: var(--ds-btn-bg-hover); }
.btn:active { background: var(--ds-btn-bg-pressed); }
.btn:disabled { background: var(--ds-bg-surface-04); color: var(--ds-on-surface-weak); cursor: not-allowed; }
.btn.secondary, .btn.btn-secondary { background: var(--ds-bg-surface-02); color: var(--ds-on-surface-strong); border: 1px solid var(--ds-border-strong); }
.btn.secondary:hover, .btn.btn-secondary:hover { background: var(--ds-bg-surface-03); }
.btn-link { background: transparent; border: 0; color: var(--ds-on-surface-weak); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* ---- Sticky action bar (upgrade #4): stays in normal flow but pins to the viewport bottom while
   the page scrolls (position: sticky; keeps the submit button inside its form). ---- */
.sticky-actions {
  position: sticky; bottom: 0; z-index: 50;
  margin: var(--space-16) calc(-1 * var(--space-24)) calc(-1 * var(--space-24));
  background: var(--ds-bg-surface-01); border-top: 1px solid var(--ds-border-weak); box-shadow: var(--ds-shadow-200);
  padding: var(--space-12) var(--space-24);
  display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap;
  border-bottom-left-radius: var(--radius-large); border-bottom-right-radius: var(--radius-large);
}
.sticky-hint { color: var(--ds-on-surface-weak); font-size: 12px; flex: 1; min-width: 220px; margin: 0; }
.sticky-spacer { flex: 1; }
.page-sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: var(--ds-bg-surface-01); border-top: 1px solid var(--ds-border-weak); box-shadow: var(--ds-shadow-200);
  padding: var(--space-12) var(--space-24);
}
.page-sticky-inner { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap; }

/* The cosmetic full-screen "progress overlay" (indeterminate bar + cycling stage hints) was removed
   in Wave 4 (quality-review-progress) — superseded by the real HTMX-polled .reviewing-card panel
   below. The inline HTMX indicator remains for the brief initial /review POST. */

/* inline HTMX indicator (no-JS fallback next to the button, covers the short initial POST) */
.htmx-indicator { display: none; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.reviewing-inline { align-items: center; gap: 8px; color: var(--ds-on-surface-weak); }
.spinner-small { width: 14px; height: 14px; border: 2px solid var(--ds-border-strong); border-top-color: var(--ds-bg-primary);
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Reviewing panel (Wave 4 / quality-review-progress): the HTMX-polled step-log panel rendered
   by reviewing_panel.html. Real per-stage progress from the JobStore (replaced the former cosmetic
   overlay). Tokens flip automatically in dark mode. ---- */
.reviewing-card { text-align: center; padding: var(--space-48) var(--space-32); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--ds-border-weak); border-top-color: var(--ds-bg-primary);
  border-radius: 50%; margin: 0 auto var(--space-16); animation: spin .9s linear infinite; }
.reviewing-card .step-log { text-align: left; max-width: 420px; margin: var(--space-24) auto 0;
  font-family: ui-monospace, "Cascadia Code", "Consolas", "SFMono-Regular", Menlo, monospace; font-size: 12px;
  color: var(--ds-on-surface-medium); background: var(--ds-bg-surface-02); border: 1px solid var(--ds-border-weak);
  border-radius: var(--radius-medium); padding: var(--space-12) var(--space-16); }
.reviewing-card .step-log > div { margin-bottom: var(--space-4); }
.reviewing-card .step-log > div:last-child { margin-bottom: 0; }
/* NF-6: state is conveyed by a text/icon marker (and weight), never colour alone. */
.reviewing-card .step-log .pending { color: var(--ds-on-surface-weak); }
.reviewing-card .step-log .pending::before { content: "○ "; }
.reviewing-card .step-log .done::before { content: "✓ "; color: var(--ds-bg-positive); }
.reviewing-card .step-log .current { font-weight: 700; color: var(--ds-on-surface-strong); }
.reviewing-card .step-log .current::before { content: "… "; color: var(--ds-bg-primary); }
.htmx-note { font-size: 11.5px; color: var(--ds-on-surface-weak); margin-top: var(--space-24); }

/* ============================ Results ============================ */
.verdict { border-radius: var(--radius-medium); padding: var(--space-16) 20px; margin-bottom: var(--space-8);
  border: 1px solid; display: flex; align-items: center; gap: var(--space-16); }
.verdict .icon { font-size: 26px; line-height: 1; }
.verdict .word { font-size: 22px; font-weight: 700; }
.verdict.approved { background: var(--ds-bg-positive-subtle); border-color: var(--ds-border-positive-subtle); color: var(--ds-on-positive-subtle); }
/* quality-review-functional-scope (AC-15): "Approved with warning" gets its OWN dedicated rule —
   never falls back to a default/unknown style. Uses the same warning-subtle tokens as the
   retired NEEDS WORK style (still kept below as a legacy-safety fallback key only). */
.verdict.warning { background: var(--ds-bg-warning-subtle); border-color: var(--ds-border-warning-subtle); color: var(--ds-on-warning-subtle); }
.verdict.needswork { background: var(--ds-bg-warning-subtle); border-color: var(--ds-border-warning-subtle); color: var(--ds-on-warning-subtle); }
.verdict.blocked { background: var(--ds-bg-negative-subtle); border-color: var(--ds-border-negative-subtle); color: var(--ds-on-negative-subtle); }
.proposal-label { font-weight: 700; font-size: 12.5px; color: var(--ds-on-surface-weak); margin: var(--space-4) 0 var(--space-16);
  padding: var(--space-8) var(--space-12); background: var(--ds-bg-surface-02); border-radius: var(--radius-small);
  border-left: 3px solid var(--ds-bg-tertiary); }
.rationale { margin: 0 0 var(--space-16); }

/* summary strip (upgrade #3) */
.counts { display: flex; gap: var(--space-8); flex-wrap: wrap; margin-bottom: var(--space-16); }
.count { border: 1px solid var(--ds-border-weak); border-radius: var(--radius-medium); padding: var(--space-8) var(--space-16); min-width: 100px; background: var(--ds-bg-surface-01); }
.count .n { font-size: 20px; font-weight: 700; } .count .l { font-size: 11px; color: var(--ds-on-surface-weak); }
.count.count-negative { background: var(--ds-bg-negative-subtle); border-color: var(--ds-border-negative-subtle); } .count.count-negative .n { color: var(--ds-on-negative-subtle); }
.count.count-informative { background: var(--ds-bg-informative-subtle); border-color: var(--ds-border-informative-subtle); } .count.count-informative .n { color: var(--ds-on-informative-subtle); }
.count.count-warning { background: var(--ds-bg-warning-subtle); border-color: var(--ds-border-warning-subtle); } .count.count-warning .n { color: var(--ds-on-warning-subtle); }

.banner { border-radius: var(--radius-medium); padding: var(--space-12) var(--space-16); margin-bottom: var(--space-16); border: 1px solid; font-size: 13px; }
.banner.warn { background: var(--ds-bg-warning-subtle); border-color: var(--ds-border-warning-subtle); } .banner.warn b { color: var(--ds-on-warning-subtle); }
.banner.info { background: var(--ds-bg-informative-subtle); border-color: var(--ds-border-informative-subtle); } .banner.info b { color: var(--ds-on-informative-subtle); }

/* collapsible, severity-ordered findings (upgrade #3) */
.findings-group { border: 1px solid var(--ds-border-weak); border-radius: var(--radius-medium); margin-bottom: var(--space-12); overflow: hidden; }
.findings-group > summary { list-style: none; cursor: pointer; padding: var(--space-12) var(--space-16); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: var(--space-8); background: var(--ds-bg-surface-02); }
.findings-group > summary::-webkit-details-marker { display: none; }
.findings-group > summary::before { content: "▸"; color: var(--ds-on-surface-weak); transition: transform .15s ease; }
.findings-group[open] > summary::before { transform: rotate(90deg); }
.grp-count { background: var(--ds-bg-surface-04); color: var(--ds-on-surface-medium); border-radius: var(--radius-full); font-size: 12px; padding: 0 9px; font-weight: 700; }
.grp-count.negative { background: var(--ds-bg-negative-subtle); color: var(--ds-on-negative-subtle); }
.grp-count.informative { background: var(--ds-bg-informative-subtle); color: var(--ds-on-informative-subtle); }
.grp-count.warning { background: var(--ds-bg-warning-subtle); color: var(--ds-on-warning-subtle); }

/* quality-review-finding-severity-status: per-section status pill (Passed / Passed with warning /
   Failed — AC-22). Mirrors the .grp-count.* subtle-bg + on-color token pattern above. */
.status-pill { display: inline-block; margin-left: var(--space-8); border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; padding: 2px 10px; vertical-align: 1px; }
.status-pill.passed { background: var(--ds-bg-positive-subtle); color: var(--ds-on-positive-subtle); }
.status-pill.warning { background: var(--ds-bg-warning-subtle); color: var(--ds-on-warning-subtle); }
.status-pill.failed { background: var(--ds-bg-negative-subtle); color: var(--ds-on-negative-subtle); }

/* per-finding severity badge (Critical / High / Medium / Low — AC-22). Critical/High share the
   negative (blocking) tier visually; Medium reads informative; Low reads neutral/surface. */
.sev { display: inline-block; border-radius: var(--radius-small); font-size: 11px; font-weight: 700;
  padding: 1px 8px; letter-spacing: .01em; }
.sev.critical { background: var(--ds-bg-negative-subtle); color: var(--ds-on-negative-subtle); }
.sev.high { background: var(--ds-bg-warning-subtle); color: var(--ds-on-warning-subtle); }
.sev.medium { background: var(--ds-bg-informative-subtle); color: var(--ds-on-informative-subtle); }
.sev.low { background: var(--ds-bg-surface-03); color: var(--ds-on-surface-medium); }

.findings-body { padding: var(--space-12) var(--space-16); }
.finding { border: 1px solid var(--ds-border-weak); border-left: 4px solid var(--ds-border-strong); border-radius: var(--radius-small);
  padding: var(--space-12); margin-bottom: var(--space-8); background: var(--ds-bg-surface-01); }
.finding:last-child { margin-bottom: 0; }
.finding.coverage, .finding.finding-coverage { border-left-color: var(--ds-bg-negative); }
.finding.impact, .finding.finding-impact { border-left-color: var(--ds-link-default); }
.finding.format, .finding.finding-format { border-left-color: var(--ds-bg-warning); }
.finding.input, .finding.finding-input { border-left-color: var(--ds-border-strong); }

/* quality-review-per-req-finding-grouping (NF-5): a coverage finding nested inside its parent AC
   card — indent + left rule read as "belonging to" the card header above, reusing the same
   negative accent as .finding.coverage. */
.finding.nested { margin: var(--space-8) 0 0; margin-left: var(--space-16); padding: var(--space-8) var(--space-12);
  border-left-color: var(--ds-bg-negative); background: var(--ds-bg-surface-02); }
.finding .txt { font-size: 13.5px; }
.finding .meta { margin-top: var(--space-8); font-size: 12px; color: var(--ds-on-surface-weak); display: flex; gap: var(--space-8); flex-wrap: wrap; }
.chip { background: var(--ds-bg-surface-03); color: var(--ds-on-surface-medium); border-radius: var(--radius-small); padding: 1px 8px; font-size: 11px; }

/* quality-review-br-portal-link: a chip that is also a link — keeps the badge shape/size (inherits
   .chip via the shared "chip" class) but reads as clickable: pointer cursor, no underline until
   hover, and the design system's link colour so it's distinguishable from a plain chip. Focus ring
   is inherited from the global `a:focus-visible` rule above (AA keyboard visibility). */
.chip-link { text-decoration: none; cursor: pointer; color: var(--ds-link-default); }
.chip-link:hover, .chip-link:focus-visible { text-decoration: underline; }
.empty { color: var(--ds-on-surface-weak); font-size: 13px; font-style: italic; }

.degradation { background: var(--ds-bg-informative-subtle); border: 1px solid var(--ds-border-informative-subtle); border-radius: var(--radius-medium); padding: var(--space-12) var(--space-16); margin-bottom: var(--space-16); font-size: 13px; }
.degradation ul { margin: 6px 0 0; padding-left: 18px; }

.context-grid { display: grid; grid-template-columns: 170px 1fr; gap: 6px var(--space-16); font-size: 13px; }
.context-grid dt { color: var(--ds-on-surface-weak); } .context-grid dd { margin: 0; }

.download-card { background: var(--ds-bg-positive-subtle); border: 1px solid var(--ds-border-positive-subtle); border-radius: var(--radius-medium); padding: var(--space-16); margin-bottom: var(--space-16); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
/* the note sits on its own row below the download button(s) */
.download-card .note { color: var(--ds-on-surface-medium); font-size: 12px; margin-top: 6px; flex-basis: 100%; }
/* per-step elapsed time in the reviewing panel step-log */
.step-secs { color: var(--ds-on-surface-medium); font-variant-numeric: tabular-nums; }

.checkbox-row { display: flex; align-items: flex-start; gap: var(--space-8); margin: var(--space-12) 0; }
.checkbox-row input { margin-top: 3px; }

.corpus-pill { display: inline-block; background: var(--ds-bg-surface-03); color: var(--ds-on-surface-medium); border-radius: var(--radius-full); padding: 3px 12px; font-size: 12px; }
.error-page { text-align: center; padding: var(--space-40) var(--space-24); }
.error-page .big { font-size: 34px; }

/* ==================== Finding triage (quality-review-finding-triage) ==================== */
/* Accept / Reject disposition control (styled after the SME feedback UI). A joined segmented
   pair sits bottom-right of each actionable card; choosing Reject reveals an inline Reason + Notes
   panel below it (no dropup / absolute positioning — it grows the card in place). */
.finding { position: relative; }
.finding-actions { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-8); margin-top: var(--space-12); }
.triage-seg { display: inline-flex; border-radius: var(--radius-medium); overflow: hidden;
  border: 1px solid var(--ds-border-strong); box-shadow: var(--ds-shadow-100); }
.seg-btn { border: 0; background: var(--ds-bg-surface-01); color: var(--ds-on-surface-medium);
  padding: 8px 18px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: background-color .12s ease, color .12s ease; }
.seg-btn + .seg-btn { border-left: 1px solid var(--ds-border-strong); }
.seg-accept:hover { background: var(--ds-bg-positive); color: #fff; }
.seg-reject:hover { background: var(--ds-bg-negative); color: #fff; }
.seg-reject[aria-expanded="true"] { background: var(--ds-bg-negative); color: #fff; }

.reject-panel { display: none; width: 100%; margin-top: var(--space-4);
  background: var(--ds-bg-surface-02); border: 1px solid var(--ds-border-negative-subtle);
  border-radius: var(--radius-medium); box-shadow: var(--ds-shadow-100);
  padding: var(--space-12) var(--space-16); }
.reject-panel.is-open { display: block; animation: reject-reveal .14s ease; }
@keyframes reject-reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.reject-field { margin-bottom: var(--space-12); }
.reject-field label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--ds-on-surface-weak); margin-bottom: 4px; }
.reject-field select, .reject-field textarea { font-size: 12.5px; padding: 7px 9px; }
.reject-field textarea { min-height: 48px; }
.req-mark { color: var(--ds-on-negative-subtle); font-weight: 700; }
.reject-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-16); }
.btn.btn-danger { background: var(--ds-bg-negative); }
.btn.btn-danger:hover { background: var(--ds-on-negative-subtle); }
/* Edit disposition — amber (right area, wrong detail/severity). */
.seg-edit:hover { background: var(--ds-bg-warning); color: var(--ds-on-surface-strong); }
.seg-edit[aria-expanded="true"] { background: var(--ds-bg-warning); color: var(--ds-on-surface-strong); }
.reject-panel.edit-panel { border-color: var(--ds-border-warning-subtle); }
.btn.btn-edit { background: var(--ds-bg-warning); color: var(--ds-on-surface-strong); }
.btn.btn-edit:hover { background: var(--ds-on-warning-subtle); color: #fff; }
.triage-badge.edited { background: var(--ds-bg-warning-subtle); color: var(--ds-on-warning-subtle); font-weight: 700; }

.triage-badge.confirmed { background: var(--ds-bg-positive-subtle); color: var(--ds-on-positive-subtle); font-weight: 700; }
.triage-badge.ignored { background: var(--ds-bg-surface-03); color: var(--ds-on-surface-medium); }
.finding.is-ignored > .txt { opacity: .55; }
.triage-undo, .manual-delete { display: inline; }

/* ================= Manual findings (quality-review-manual-findings) ================= */
/* "SME-added" chip reuses the informative-subtle token pair — distinguishes an SME-authored
   finding from an AI one without a new colour. */
.chip-manual { background: var(--ds-bg-informative-subtle); color: var(--ds-on-informative-subtle); font-weight: 700; }
/* quality-review-per-artifact-outputs: the artifact-area chip on each finding + the by-area summary. */
.chip-target { background: var(--ds-bg-surface-02); color: var(--ds-on-surface-medium); border: 1px solid var(--ds-border-subtle); font-weight: 600; }
.area-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ds-on-surface-medium); margin: 4px 0 12px; }
.area-pill { background: var(--ds-bg-surface-03); border-radius: var(--radius-small); padding: 2px 9px; }
.area-pill b { color: var(--ds-on-surface-high); }
/* quality-review-rounds-reupload: round tag on the title + the Resolved/Still-open/New diff pills. */
.round-tag { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--ds-bg-informative-subtle); color: var(--ds-on-informative-subtle); vertical-align: middle; }
.round-diff { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.rd-pill { font-size: 12.5px; padding: 3px 11px; border-radius: 999px; background: var(--ds-bg-surface-03); }
.rd-pill b { margin-left: 4px; }
.rd-resolved { background: var(--ds-bg-positive-subtle); color: var(--ds-on-positive-subtle); }
.rd-open { background: var(--ds-bg-negative-subtle); color: var(--ds-on-negative-subtle); }
.rd-new { background: var(--ds-bg-warning-subtle); color: var(--ds-on-warning-subtle); }
/* quality-review-ux-overhaul: category-tab / filter bar + keyboard-focus ring. */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 14px; padding: 8px 10px; background: var(--ds-bg-surface-02); border: 1px solid var(--ds-border-subtle); border-radius: var(--radius-medium); font-size: 12.5px; }
.fb-lead { color: var(--ds-on-surface-medium); }
.fb-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.fb-tab { font: inherit; cursor: pointer; border: 1px solid var(--ds-border-subtle); background: var(--ds-bg-surface-01); color: var(--ds-on-surface-medium); border-radius: 999px; padding: 3px 11px; }
.fb-tab.on { background: var(--ds-bg-brand, var(--ds-bg-informative-subtle)); color: var(--ds-on-informative-subtle); border-color: transparent; font-weight: 700; }
.fb-tab b { margin-left: 3px; }
.fb-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--ds-on-surface-medium); cursor: pointer; }
.fb-accept { margin: 0; }
.fb-kbd { margin-left: auto; color: var(--ds-on-surface-low, var(--ds-on-surface-medium)); font-size: 11.5px; }
.finding:focus { outline: 2px solid var(--ds-border-focus, #2f5496); outline-offset: 1px; }
.finding:focus-visible { outline: 2px solid var(--ds-border-focus, #2f5496); outline-offset: 1px; }
/* Delete reuses .btn-link's understated look but reads as destructive (negative-subtle text). */
.manual-delete .btn-link { color: var(--ds-on-negative-subtle); }
/* The collapsible "Add finding" form reuses .optional-block (index.html's own collapsible idiom)
   — no new disclosure widget invented for this card. */
#manual-add { margin-bottom: var(--space-16); }

/* Triage progress + gated write action (AC-7/AC-8). */
.write-mom-bar { display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap;
  background: var(--ds-bg-surface-02); border: 1px solid var(--ds-border-weak);
  border-radius: var(--radius-medium); padding: var(--space-12) var(--space-16); }
.write-mom-bar .hint { margin: 0; flex: 1; min-width: 180px; }
.write-mom-bar .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Review timing block (start / end / total elapsed) — shown on the reviewing panel (live) and the
   results page (final). Compact key/value rows; tabular numerals keep the timestamps aligned. */
.review-timing { margin-top: var(--space-16); padding: var(--space-12) var(--space-16);
  background: var(--ds-bg-surface-02); border: 1px solid var(--ds-border-weak); border-radius: var(--radius-medium); }
.review-timing .rt-row { display: flex; justify-content: space-between; gap: var(--space-16); padding: 3px 0; font-size: 12.5px; }
.review-timing .rt-k { color: var(--ds-on-surface-weak); font-weight: 600; }
.review-timing .rt-v { color: var(--ds-on-surface-strong); font-variant-numeric: tabular-nums; text-align: right; }
.review-timing .rt-pending { color: var(--ds-on-surface-weak); font-weight: 400; }
.review-timing .rt-note { margin-top: 6px; color: var(--ds-on-surface-weak); font-size: 11px; }

/* Results page title — a clear heading above the verdict card. */
.results-title { margin-bottom: var(--space-16); }
