/* The interface shell. Three regions on a wide screen, one column on a phone, and every state a
   screen can be in has a design: empty, loading, partial, error, and full. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol, figure, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute; left: var(--s-3); top: var(--s-3); z-index: 100;
  transform: translateY(-200%);
  background: var(--surface); color: var(--ink);
  padding: var(--s-2) var(--s-4); border-radius: var(--radius); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.skip-link:focus { transform: none; }

/* ------------------------------------------------------------------ shell */

.shell {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr) var(--rail-width);
  min-height: 100vh;
}

/* ------------------------------------------------------------------ left: navigation */

.nav {
  grid-column: 1;
  border-right: 1px solid var(--line);
  background: var(--surface-sunken);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.nav__brand {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-4) var(--s-3);
}
.nav__mark {
  width: 30px; height: 30px; flex: none;
  border-radius: 9px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: var(--text-sm); font-weight: var(--weight-semibold); letter-spacing: -0.02em;
}
.nav__name { font-size: var(--text-base); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
.nav__version { font-size: var(--text-xs); color: var(--ink-faint); }

.nav__group { padding: var(--s-3) var(--s-2) 0; }
.nav__grouplabel {
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 var(--s-3) var(--s-2);
}
.nav__item {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%;
  padding: var(--s-2) var(--s-3);
  margin-bottom: 2px;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink-soft);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  text-align: left; cursor: pointer;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.nav__item:hover { background: var(--neutral-wash); color: var(--ink); }
.nav__item[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.nav__icon { width: 18px; height: 18px; flex: none; opacity: 0.75; }
.nav__item[aria-current="page"] .nav__icon { opacity: 1; color: var(--accent); }
.nav__count {
  margin-left: auto;
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  background: var(--accent); color: #fff;
  border-radius: var(--radius-pill);
  padding: 1px var(--s-2); min-width: 20px; text-align: center;
}
.nav__count[data-tone="quiet"] { background: var(--neutral-wash); color: var(--ink-faint); }

.nav__foot { margin-top: auto; padding: var(--s-4); display: flex; align-items: center; gap: var(--s-2); }

/* ------------------------------------------------------------------ centre: work */

.main { grid-column: 2; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: var(--header-height);
  padding: var(--s-3) var(--s-5);
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
.topbar__sub { font-size: var(--text-sm); color: var(--ink-faint); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.menu-toggle { display: none; }

.work { padding: var(--s-5); max-width: 1080px; width: 100%; }
.work > * + * { margin-top: var(--s-5); }

.lede { font-size: var(--text-base); color: var(--ink-soft); max-width: var(--measure); }

/* ------------------------------------------------------------------ right: what needs you */

.rail {
  grid-column: 3;
  border-left: 1px solid var(--line);
  background: var(--surface-sunken);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: var(--s-4);
}
.rail > * + * { margin-top: var(--s-4); }
.rail__title {
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: var(--s-3);
}

/* ------------------------------------------------------------------ cards and panels */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
}
.card__head--plain { border-bottom: 0; padding-bottom: 0; }
.card__title { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.card__hint { font-size: var(--text-sm); color: var(--ink-faint); }
.card__body { padding: var(--s-5); }
.card__body > * + * { margin-top: var(--s-4); }
.card__foot { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); background: var(--surface-sunken); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card__actions { margin-left: auto; display: flex; gap: var(--s-2); flex: none; }

/* ------------------------------------------------------------------ the score block */

.score {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-5);
  align-items: center;
}
.score__dial { position: relative; width: 108px; height: 108px; flex: none; }
.score__dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score__track { stroke: var(--neutral-wash); }
.score__value {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight);
}
.score__caption { font-size: var(--text-sm); color: var(--ink-soft); max-width: var(--measure); }
.score__caption strong { color: var(--ink); font-weight: var(--weight-semibold); }

.stats { display: flex; flex-wrap: wrap; gap: var(--s-5); }
.stat__value { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
.stat__label { font-size: var(--text-xs); color: var(--ink-faint); text-transform: uppercase; letter-spacing: var(--tracking-wide); font-weight: var(--weight-semibold); }

/* ------------------------------------------------------------------ ranked list */

.finding { border-bottom: 1px solid var(--line); }
.finding:last-child { border-bottom: 0; }
.finding__button {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: var(--s-3); align-items: start;
  width: 100%; padding: var(--s-4) var(--s-5);
  border: 0; background: transparent; text-align: left; cursor: pointer;
}
.finding__button:hover { background: var(--surface-sunken); }
.finding__rank {
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  color: var(--ink-faint); font-variant-numeric: tabular-nums; padding-top: 1px;
}
.finding__headline { display: block; font-size: var(--text-base); font-weight: var(--weight-medium); line-height: var(--leading-snug); }
.finding__meta { display: block; font-size: var(--text-sm); color: var(--ink-faint); margin-top: var(--s-1); }
.finding__meta .badge { margin-right: var(--s-2); }
.finding__priority {
  font-size: var(--text-sm); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums;
  padding-top: 1px; white-space: nowrap;
}
.finding__detail { padding: 0 var(--s-5) var(--s-5) calc(var(--s-5) + 30px + var(--s-3)); }
.finding__detail > * + * { margin-top: var(--s-3); }

.evidence {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-3) var(--s-4);
  font-size: var(--text-sm); color: var(--ink-soft);
}
.evidence__label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); font-weight: var(--weight-semibold); color: var(--ink-faint); margin-bottom: var(--s-1); }

/* ------------------------------------------------------------------ before and after */

.diff { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.diff__side { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.diff__label {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide);
  font-weight: var(--weight-semibold); padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--line);
}
.diff__side--before .diff__label { background: var(--neutral-wash); color: var(--ink-faint); }
.diff__side--after .diff__label { background: var(--positive-wash); color: var(--positive); }
.diff__text { padding: var(--s-3); font-size: var(--text-sm); line-height: var(--leading-normal); white-space: pre-wrap; overflow-wrap: anywhere; }
.diff__side--before .diff__text { color: var(--ink-soft); }

/* ------------------------------------------------------------------ gallery: visual output */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
}
.gallery__card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.gallery__card[data-verdict="failed"] { border-color: var(--critical-line); }
.gallery__card[data-verdict="rework"] { border-color: var(--caution-line); }

.gallery__art {
  position: relative;
  display: block; width: 100%; aspect-ratio: 1 / 1;
  padding: 0; border: 0; border-bottom: 1px solid var(--line);
  background: var(--surface-sunken);
  cursor: pointer; overflow: hidden;
}
.gallery__art:hover { background: var(--neutral-wash); }
.gallery__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery__card[data-verdict="failed"] .gallery__img { opacity: 0.65; }

/* No picture yet is not an empty box. It is the hook, set at the size the hook is the whole point
   of, which is what a build sheet is for. */
.gallery__standin {
  display: flex; flex-direction: column; justify-content: space-between;
  width: 100%; height: 100%; padding: var(--s-4);
  text-align: left;
  background: linear-gradient(160deg, var(--accent-wash), var(--surface-sunken));
}
.gallery__hook {
  font-size: var(--text-2xl); font-weight: var(--weight-semibold);
  line-height: var(--leading-tight); letter-spacing: var(--tracking-tight);
  color: var(--ink);
  overflow: hidden;
}
.gallery__standinnote {
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  color: var(--ink-faint);
}
.gallery__verdict { position: absolute; top: var(--s-2); right: var(--s-2); }

.gallery__body { padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: var(--s-1); flex: 1; }
.gallery__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.gallery__meta { font-size: var(--text-xs); color: var(--ink-faint); }
.gallery__reason { font-size: var(--text-xs); color: var(--ink-soft); }
.gallery__reason[data-tone="critical"] { color: var(--critical); }
.gallery__reason[data-tone="caution"] { color: var(--caution); }
.gallery__badges { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: var(--s-1); }
.gallery__foot { display: flex; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); background: var(--surface-sunken); }

.gallery__full { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-sunken); }

/* ------------------------------------------------------------------ board: a batch in stages */

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: var(--s-3);
  overflow-x: auto;
  padding-bottom: var(--s-2);
}
.board__stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s-3);
  min-width: 0;
}
.board__stage[data-current="true"] { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-wash); }
.board__head { display: flex; align-items: center; gap: var(--s-2); }
.board__label { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.board__count {
  margin-left: auto; font-size: var(--text-xs); font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  background: var(--neutral-wash); color: var(--ink-soft);
  border-radius: var(--radius-pill); padding: 1px var(--s-2); min-width: 22px; text-align: center;
}
.board__count[data-tone="positive"] { background: var(--positive-wash); color: var(--positive); }
.board__count[data-tone="critical"] { background: var(--critical-wash); color: var(--critical); }
.board__count[data-tone="caution"] { background: var(--caution-wash); color: var(--caution); }
.board__count[data-tone="accent"] { background: var(--accent-wash); color: var(--accent); }
.board__hint { font-size: var(--text-xs); color: var(--ink-faint); margin-top: var(--s-1); }
.board__items { margin-top: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }
.board__item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s-2) var(--s-3);
}
.board__item:hover { border-color: var(--ink-faint); background: var(--neutral-wash); }
.board__itemtitle { display: block; font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-snug); }
.board__itemmeta { display: block; font-size: var(--text-xs); color: var(--ink-faint); margin-top: 2px; }
.board__none { font-size: var(--text-xs); color: var(--ink-faint); margin-top: var(--s-3); }

@media (max-width: 860px) {
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow-x: visible; }
}

/* ------------------------------------------------------------------ badges and pills */

.badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  padding: 2px var(--s-2); border-radius: var(--radius-pill);
  border: 1px solid transparent; white-space: nowrap;
}
.badge[data-tone="neutral"] { background: var(--neutral-wash); color: var(--ink-soft); border-color: var(--line); }
.badge[data-tone="accent"] { background: var(--accent-wash); color: var(--accent); border-color: var(--accent-line); }
.badge[data-tone="positive"] { background: var(--positive-wash); color: var(--positive); border-color: var(--positive-line); }
.badge[data-tone="caution"] { background: var(--caution-wash); color: var(--caution); border-color: var(--caution-line); }
.badge[data-tone="critical"] { background: var(--critical-wash); color: var(--critical); border-color: var(--critical-line); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: currentColor; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 36px; padding: 0 var(--s-4);
  border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  cursor: pointer; white-space: nowrap;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), opacity var(--speed) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--ink-faint); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--danger { color: var(--critical); border-color: var(--critical-line); }
.btn--danger:hover:not(:disabled) { background: var(--critical-wash); border-color: var(--critical); }
.btn--quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn--quiet:hover:not(:disabled) { background: var(--neutral-wash); color: var(--ink); border-color: transparent; }
.btn--sm { min-height: 30px; padding: 0 var(--s-3); font-size: var(--text-xs); }
.btn--block { width: 100%; }
.btn--icon { width: 36px; padding: 0; }

/* ------------------------------------------------------------------ forms */

.field { display: block; }
.field + .field { margin-top: var(--s-4); }
.field__label { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); margin-bottom: var(--s-1); }
.field__help { font-size: var(--text-sm); color: var(--ink-faint); margin-bottom: var(--s-2); max-width: var(--measure); }
.field__error { font-size: var(--text-sm); color: var(--critical); margin-top: var(--s-2); display: flex; gap: var(--s-2); align-items: baseline; }

.input, .textarea, .select {
  width: 100%; max-width: 520px;
  min-height: 38px; padding: var(--s-2) var(--s-3);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--ink-faint); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--critical); }
.textarea { min-height: 120px; resize: vertical; max-width: none; line-height: var(--leading-normal); }
.textarea--code { font-family: var(--font-mono); font-size: var(--text-sm); min-height: 380px; }

.switch { display: flex; align-items: center; gap: var(--s-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 40px; height: 24px; flex: none; border-radius: var(--radius-pill);
  background: var(--line-strong); position: relative;
  transition: background var(--speed) var(--ease);
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform var(--speed) var(--ease);
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius); }
.segmented button {
  border: 0; background: transparent; color: var(--ink-soft);
  padding: var(--s-1) var(--s-3); border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead th {
  text-align: left; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide);
  font-weight: var(--weight-semibold); color: var(--ink-faint);
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--surface-sunken);
}
tbody td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-sunken); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ------------------------------------------------------------------ states */

.empty {
  display: grid; place-items: center; text-align: center;
  padding: var(--s-8) var(--s-5);
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty__art { width: 44px; height: 44px; color: var(--ink-faint); margin-bottom: var(--s-4); }
.empty__title { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
.empty__body { font-size: var(--text-base); color: var(--ink-soft); max-width: 44ch; margin-top: var(--s-2); }
.empty__actions { margin-top: var(--s-5); display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: center; }

.skeleton {
  background: linear-gradient(90deg, var(--neutral-wash) 25%, var(--surface-sunken) 37%, var(--neutral-wash) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
  height: 12px;
}
.skeleton + .skeleton { margin-top: var(--s-3); }
.skeleton--title { height: 20px; width: 40%; }
.skeleton--wide { width: 100%; }
.skeleton--half { width: 60%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } * { transition-duration: 1ms !important; } }

.notice {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); font-size: var(--text-sm);
}
.notice__icon { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.notice__title { font-weight: var(--weight-semibold); }
.notice__body { color: var(--ink-soft); }
.notice[data-tone="critical"] { background: var(--critical-wash); border-color: var(--critical-line); }
.notice[data-tone="critical"] .notice__icon, .notice[data-tone="critical"] .notice__title { color: var(--critical); }
.notice[data-tone="caution"] { background: var(--caution-wash); border-color: var(--caution-line); }
.notice[data-tone="caution"] .notice__icon, .notice[data-tone="caution"] .notice__title { color: var(--caution); }
.notice[data-tone="positive"] { background: var(--positive-wash); border-color: var(--positive-line); }
.notice[data-tone="positive"] .notice__icon, .notice[data-tone="positive"] .notice__title { color: var(--positive); }
.notice[data-tone="accent"] { background: var(--accent-wash); border-color: var(--accent-line); }
.notice[data-tone="accent"] .notice__icon, .notice[data-tone="accent"] .notice__title { color: var(--accent); }

/* ------------------------------------------------------------------ approvals in the rail */

.approval { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-3); }
.approval + .approval { margin-top: var(--s-3); }
.approval__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.approval__meta { font-size: var(--text-xs); color: var(--ink-faint); margin-top: var(--s-1); }
.approval__actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.approval__actions .btn { flex: 1; }

.change { display: flex; gap: var(--s-3); align-items: baseline; padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.change:last-child { border-bottom: 0; }
.change__text { font-size: var(--text-sm); color: var(--ink-soft); }
.change__text button { border: 0; background: none; padding: 0; color: var(--ink); font-weight: var(--weight-medium); cursor: pointer; text-align: left; }
.change__text button:hover { color: var(--accent); }
.change__when { margin-left: auto; font-size: var(--text-xs); color: var(--ink-faint); white-space: nowrap; }
.change__unseen { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; align-self: center; }

/* ------------------------------------------------------------------ prose, for the brain and outputs */

.prose { max-width: var(--measure); font-size: var(--text-base); line-height: var(--leading-normal); }
.prose > * + * { margin-top: var(--s-3); }
.prose h1 { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); margin-top: var(--s-5); }
.prose h2 { font-size: var(--text-xl); letter-spacing: var(--tracking-tight); margin-top: var(--s-5); }
.prose h3 { font-size: var(--text-lg); margin-top: var(--s-4); }
.prose ul { list-style: disc; padding-left: var(--s-5); }
.prose ol { list-style: decimal; padding-left: var(--s-5); }
.prose li + li { margin-top: var(--s-1); }
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--neutral-wash); padding: 1px 4px; border-radius: 4px; }
.prose pre, pre.prose { background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-3); overflow-x: auto; max-width: 100%; }
.prose pre code, pre.prose code { background: none; padding: 0; }
/* A label and a value, side by side where there is room and stacked where there is not. A value
   that is a whole sentence must wrap rather than push the page sideways on a phone. */
.kv { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 4px 16px; margin: 0; }
.kv dt { color: var(--ink-faint); min-width: 0; overflow-wrap: anywhere; }
.kv dd { margin: 0; min-width: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv dd { margin-bottom: 6px; } }

/* A block of working, laid out in columns, has to scroll inside itself rather than widen the page.
   An agent that shows its arithmetic is unreadable on a phone if the phone scrolls sideways. */
pre.prose { white-space: pre; font-family: var(--font-mono); font-size: var(--text-sm); line-height: var(--leading-normal); }
.prose table { margin-top: var(--s-3); }
.prose blockquote { border-left: 3px solid var(--line-strong); padding-left: var(--s-4); color: var(--ink-soft); }

/* ------------------------------------------------------------------ toast */

.toasts { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 60; display: flex; flex-direction: column; gap: var(--s-2); max-width: min(380px, calc(100vw - 2rem)); }
.toast {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: var(--s-3) var(--s-4); font-size: var(--text-sm);
  display: flex; gap: var(--s-3); align-items: flex-start;
  animation: rise var(--speed) var(--ease);
}
.toast[data-tone="critical"] { border-color: var(--critical-line); background: var(--critical-wash); color: var(--critical); }
.toast[data-tone="positive"] { border-color: var(--positive-line); background: var(--positive-wash); color: var(--positive); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ filter bar */

.filters { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.filters .input, .filters .select { max-width: 260px; min-height: 34px; }
.filters__count { margin-left: auto; font-size: var(--text-sm); color: var(--ink-faint); }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--nav-width) minmax(0, 1fr); }
  .rail {
    grid-column: 1 / -1; grid-row: 3;
    position: static; height: auto; border-left: 0; border-top: 1px solid var(--line);
  }
  .main { grid-column: 2; grid-row: 1 / 3; }
  .nav { grid-row: 1 / 3; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .main, .rail { grid-column: 1; }
  .nav {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(280px, 84vw);
    transform: translateX(-100%);
    transition: transform var(--speed) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .nav[data-open="true"] { transform: none; }
  .scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
  .menu-toggle { display: inline-flex; }
  .work { padding: var(--s-4); }
  .diff { grid-template-columns: 1fr; }
  .score { grid-template-columns: 1fr; gap: var(--s-4); }
}

@media (max-width: 420px) {
  .work { padding: var(--s-3); }
  .card__head, .card__body { padding: var(--s-4) var(--s-3); }
  .card__foot { padding: var(--s-3); }
  .finding__button { grid-template-columns: 24px minmax(0, 1fr); padding: var(--s-3); }
  .finding__priority { grid-column: 2; }
  .finding__detail { padding: 0 var(--s-3) var(--s-4) calc(var(--s-3) + 24px + var(--s-3)); }
  .topbar { padding: var(--s-2) var(--s-3); }
  .rail { padding: var(--s-3); }
  .stats { gap: var(--s-4); }
  .card__head { flex-wrap: wrap; }
  .card__actions { margin-left: 0; width: 100%; }
  .btn { padding: 0 var(--s-3); }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
