/* theme.css: IAM Policy Lint. "Change-review ledger": cool paper, graphite ink, one steel-blue
   accent. Green margin for added statements, red margin for removed ones, monospace for every
   address, policy JSON and count. Signature: the PR note sits on a slip whose head carries a
   row of drawn redaction bars and the tag "IDENTIFIERS OMITTED". Nothing else is redacted-looking.
   Loaded after styles.css; the builder adds layout only, never colours, radii, shadows or sizes.
   Contrast ratios (WCAG 2.x, approximate) are noted beside each text pair. */

:root {
  color-scheme: light dark;

  /* Palette (light) */
  --bg: #f4f5f2;
  --surface: #ffffff;
  --raised: #eceee9;
  --text: #1b2129;            /* ~15.8:1 on --surface, ~14.6:1 on --bg, ~13.5:1 on --raised */
  --muted: #4f5761;           /* ~7.3:1 on --surface, ~6.7:1 on --bg, ~6.2:1 on --raised */
  --border: #d7dad4;          /* hairlines only */
  --border-strong: #858b92;   /* ~3.5:1 on --surface: input and zone outlines (non-text) */
  --accent: #23558f;          /* ~7.6:1 with --on-accent */
  --accent-hover: #1c4675;
  --accent-active: #15375c;
  --accent-text: #23558f;     /* ~7.6:1 on --surface, ~7:1 on --bg */
  --accent-tint: #e3ecf7;     /* --accent-text on it ~6.5:1 */
  --on-accent: #ffffff;
  --success: #1c6b3c;         /* ~6.4:1 on --surface, ~5.8:1 on --success-tint */
  --success-edge: #2f9a5a;    /* edges and + glyph background only */
  --success-tint: #e6f3ea;
  --warning: #8a5300;         /* ~6.3:1 on --surface, ~5.6:1 on --warning-tint */
  --warning-edge: #d08a17;    /* edges only, never text */
  --warning-tint: #fbf0d9;
  --danger: #b42318;          /* ~6.5:1 on --surface, ~5.8:1 on --danger-tint */
  --danger-edge: #d9483b;     /* edges only */
  --danger-tint: #fdecea;
  --ink-bar: #1b2129;         /* redaction bars on the note slip (decorative) */
  --slip: #fbfbf8;            /* note slip paper; --text on it ~15.3:1 */

  /* Type */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --text-xs: 0.8125rem;   /* 13px caps labels, chips */
  --text-sm: 0.9375rem;   /* 15px hints, statement JSON, note, status */
  --text-md: 1.0625rem;   /* 17px body */
  --text-lg: 1.3125rem;   /* 21px h2, card titles */
  --text-xl: 2rem;        /* 32px tally numerals */
  --text-2xl: clamp(1.75rem, 4.6vw, 2.5rem); /* h1 */

  /* Space */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Radii and shadows */
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  --shadow-1: 0 1px 2px rgb(27 33 41 / 0.06), 0 2px 8px rgb(27 33 41 / 0.05);
  --shadow-2: 0 8px 28px rgb(27 33 41 / 0.16);

  /* Motion */
  --fast: 160ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);

  /* Template variables, mapped so its own rules follow the theme */
  --line: var(--border);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --surface: #191e24;
    --raised: #222932;
    --text: #e5e9ee;            /* ~15:1 on --bg, ~14:1 on --surface, ~12.4:1 on --raised */
    --muted: #a2acb7;           /* ~7.9:1 on --bg, ~7.3:1 on --surface, ~6.4:1 on --raised */
    --border: #2c343d;
    --border-strong: #69737e;   /* ~3.5:1 on --surface */
    --accent: #8cb8ef;          /* ~8.5:1 with --on-accent */
    --accent-hover: #a6c8f3;
    --accent-active: #bfd8f7;
    --accent-text: #9cc2f2;     /* ~9:1 on --surface */
    --accent-tint: #1b2b3f;     /* --accent-text on it ~7.4:1 */
    --on-accent: #0b1a2c;
    --success: #6fd394;         /* ~8.3:1 on --success-tint */
    --success-edge: #3fa868;
    --success-tint: #16281e;
    --warning: #f0b85a;         /* ~9:1 on --warning-tint */
    --warning-edge: #c98a26;
    --warning-tint: #2e2412;
    --danger: #ff8f85;          /* ~7.9:1 on --danger-tint */
    --danger-edge: #e0645a;
    --danger-tint: #2f1a19;
    --ink-bar: #e5e9ee;
    --slip: #151a1f;            /* --text on it ~14.5:1 */
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 10px 32px rgb(0 0 0 / 0.55);
  }
}

/* ---------- Page ---------- */

html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

header, main, footer { max-width: 60rem; padding-left: var(--s5); padding-right: var(--s5); }

header {
  padding-top: var(--s3);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand::before {
  content: "";
  width: 24px;
  height: 24px;
  flex: none;
  background: url('./icons/favicon.svg') center / 24px 24px no-repeat;
}
header nav a {
  padding: 0 var(--s3);
  border-radius: var(--r-s);
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
header nav a:hover { background: var(--raised); color: var(--text); }
header nav a:active { background: var(--border); }

main { padding-top: var(--s6); padding-bottom: var(--s6); }

h1 {
  font-size: var(--text-2xl);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s3);
  max-width: 34ch;
}
.lede { font-size: 1.125rem; color: var(--muted); max-width: 62ch; margin: 0 0 var(--s6); }

h2 {
  font-size: var(--text-lg);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: var(--s7) 0 var(--s3);
}
h3 { font-size: var(--text-md); margin: var(--s5) 0 var(--s1); }
main > p, main > ol, main > ul, .example > p { max-width: 68ch; }
main li + li { margin-top: var(--s2); }

a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

code, kbd, samp, pre, .mono { font-family: var(--font-mono); }
code, kbd, samp { font-size: 0.92em; }
:not(pre) > code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--raised);
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--accent-tint);
}

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

/* ---------- Tool: plain section, no card (results are the cards) ---------- */

.tool { margin: 0; }

/* File drop zone. The real <input type="file" id="input"> covers the zone, transparent, so a
   click anywhere opens the picker and a drop lands on it; the zone shows its focus. */
.drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s5);
  margin: 0;
  min-height: 9.5rem;
  padding: var(--s5);
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-l);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.drop span { display: block; margin: 0; font-weight: inherit; } /* undo template's span rule */
.drop:hover { border-color: var(--accent); background: var(--accent-tint); }
.drop.over { border-color: var(--accent); border-style: solid; background: var(--accent-tint); }
.drop:focus-within { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 4px var(--accent-tint); }
.drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.drop input[type="file"]:disabled { cursor: progress; }
.drop[aria-disabled="true"] { cursor: progress; border-color: var(--border); background: var(--raised); }
.drop[aria-disabled="true"]:hover { border-color: var(--border); background: var(--raised); }
.drop[aria-disabled="true"] .drop-button { color: var(--muted); border-color: var(--border); background: var(--surface); }

.drop-icon { flex: none; width: 48px; height: 48px; color: var(--accent-text); }
.drop-icon svg { display: block; width: 48px; height: 48px; }
.drop-text { flex: 1 1 auto; min-width: 0; }
.drop .drop-title { font-size: var(--text-lg); font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; color: var(--text); }
.drop .drop-hint { margin-top: var(--s1); font-size: var(--text-sm); color: var(--muted); }
.drop .drop-hint code { background: var(--raised); }
/* The look of a button inside the zone; the input under it does the work. */
.drop .drop-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s5);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.drop:hover .drop-button { border-color: var(--accent); color: var(--accent-text); }
.drop:active .drop-button { background: var(--raised); }

/* ---------- Action row ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin: var(--s3) 0 0;
  min-height: 44px;
}
.actions .facts { flex: 1 1 auto; font-size: var(--text-xs); color: var(--muted); }
.actions button, .btn {
  min-height: 44px;
  padding: 0 var(--s5);
  border-radius: var(--r-m);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.actions button:active:not(:disabled), .btn:active:not(:disabled) { transform: translateY(1px); }
.actions button[hidden] { display: none; }

/* Quiet: Cancel review, Clear */
.actions .quiet, .btn.quiet {
  background: transparent;
  color: var(--muted);
  padding: 0 var(--s4);
}
.actions .quiet:hover:not(:disabled), .btn.quiet:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.actions .quiet:active:not(:disabled), .btn.quiet:active:not(:disabled) { background: var(--border); }
#cancel { color: var(--danger); }
#cancel:hover { background: var(--danger-tint); color: var(--danger); }
.actions button:disabled, .btn:disabled { cursor: not-allowed; color: var(--muted); opacity: 0.6; }

/* ---------- Status line ---------- */

#status {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  min-height: 1.6em;
  margin: var(--s3) 0 0;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#status:not(:empty)::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 0.5em;
  border-radius: 50%;
  background: var(--border-strong);
}
#status.busy::before { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
#status.ok { color: var(--success); }
#status.ok::before { background: var(--success-edge); }
#status.error { color: var(--danger); }
#status.error::before { background: var(--danger-edge); }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ---------- Output ---------- */

#output { margin-top: var(--s4); }
#output:empty { display: none; }
#output > * { animation: rise 180ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Empty state */
.empty-state {
  display: flex;
  gap: var(--s4);
  align-items: flex-start;
  padding: var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  background: var(--surface);
  color: var(--muted);
}
.empty-state strong { display: block; color: var(--text); margin-bottom: var(--s1); }
.empty-state p { margin: 0; max-width: 62ch; }
.empty-state ul { margin: var(--s2) 0 0; padding-left: 1.2em; }
.empty-state li + li { margin-top: var(--s1); }
.empty-mark { flex: none; width: 32px; height: 32px; color: var(--border-strong); }
.empty-mark svg { display: block; width: 32px; height: 32px; }

/* Working: reading / comparing */
.working {
  padding: var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  background: var(--surface);
}
.working .bar {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--raised);
}
.working .bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  border-radius: 2px;
  background: var(--accent);
  animation: sweep 1.1s var(--ease) infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.steps { display: flex; flex-direction: column; gap: var(--s2); margin: var(--s4) 0 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.steps li { display: flex; align-items: center; gap: var(--s2); margin: 0; color: var(--muted); }
.steps li + li { margin-top: 0; }
.steps li::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}
.steps li.now { color: var(--text); font-weight: 650; }
.steps li.now::before { border-color: var(--accent); background: var(--accent); }
.steps li.done { color: var(--text); }
.steps li.done::before { border-color: var(--success-edge); background: var(--success-edge); }

/* Error card */
.error-card {
  display: flex;
  gap: var(--s4);
  align-items: flex-start;
  padding: var(--s4) var(--s5);
  border-radius: var(--r-l);
  background: var(--danger-tint);
  box-shadow: inset 5px 0 0 var(--danger-edge);
  color: var(--text);
}
.error-card .err-mark {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--danger);
  color: var(--danger-tint);    /* ~5.8:1 light, ~7.9:1 dark */
  font: 800 15px/24px var(--font-ui);
  text-align: center;
}
.error-card strong { display: block; color: var(--danger); font-size: var(--text-md); }
.error-card p { margin: var(--s1) 0 0; max-width: 64ch; }
.error-card code { background: var(--surface); }

/* ---------- Success: tally strip (three kinds) ---------- */

.tally {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
  margin: 0 0 var(--s4);
}
.tile {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  min-width: 0;
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.tile .k {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.tile .n {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s4);
  align-items: baseline;
  font: 750 var(--text-xl)/1.1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.tile .n > span { white-space: nowrap; }
.tile .add { color: var(--success); }
.tile .del { color: var(--danger); }
.tile .zero { color: var(--muted); font-weight: 600; }
.tile .d { font-size: var(--text-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.tile.quiet { box-shadow: none; background: transparent; }

/* ---------- Signature: the PR note slip ---------- */

.note-card {
  margin: 0 0 var(--s5);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-l);
  background: var(--slip);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.note-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.note-head h2 {
  margin: 0;
  font-size: var(--text-md);
  letter-spacing: 0;
}
/* The tag: three ink bars of different widths, then the words. */
.redacted {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font: 700 var(--text-xs)/1 var(--font-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.redacted::before {
  content: "";
  width: 46px;
  height: 10px;
  background:
    linear-gradient(var(--ink-bar), var(--ink-bar)) 0 0 / 18px 10px no-repeat,
    linear-gradient(var(--ink-bar), var(--ink-bar)) 22px 0 / 10px 10px no-repeat,
    linear-gradient(var(--ink-bar), var(--ink-bar)) 36px 0 / 10px 10px no-repeat;
  border-radius: 2px;
}
.note-head .grow { flex: 1 1 auto; }

/* Copy PR note: the page's one filled button. Fixed width: "Copied" never moves the row. */
.primary, #copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 48px;
  min-width: 11rem;
  padding: 0 var(--s5);
  border: 1px solid transparent;
  border-radius: var(--r-m);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
#copy { width: 12.5rem; }
.primary:hover:not(:disabled), #copy:hover:not(:disabled) { background: var(--accent-hover); }
.primary:active:not(:disabled), #copy:active:not(:disabled) { background: var(--accent-active); transform: translateY(1px); }
.primary:disabled, #copy:disabled {
  cursor: not-allowed;
  background: var(--raised);
  border-color: var(--border);
  color: var(--muted);
  box-shadow: none;
}
.primary svg, #copy svg { width: 18px; height: 18px; flex: none; }

#note, .note-card pre {
  margin: 0;
  padding: var(--s4) var(--s5);
  min-height: 9.5rem;   /* six lines reserved */
  font: var(--text-sm)/1.65 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--slip);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
#note:focus-visible, .stmt pre:focus-visible {
  outline-offset: -2px;
  box-shadow: inset 0 0 0 5px var(--accent-tint);
}
#note::selection, #note ::selection { background: var(--accent-tint); color: var(--text); }
.note-foot {
  margin: 0;
  padding: var(--s2) var(--s5) var(--s3);
  font-size: var(--text-xs);
  color: var(--muted);
  background: var(--slip);
}
.note-foot.error { color: var(--danger); font-weight: 650; font-size: var(--text-sm); }

/* ---------- Section heads inside the result ---------- */

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
  margin: var(--s6) 0 var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 2px solid var(--text);
}
.result-head h2 { margin: 0; font-size: var(--text-lg); }
.result-head .private {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Changed document card ---------- */

.change {
  margin: 0 0 var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.change-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
}
.addr {
  flex: 1 1 18rem;
  min-width: 0;
  font: 650 var(--text-sm)/1.45 var(--font-mono);
  color: var(--text);
  overflow-wrap: anywhere;
}
.addr.none { font-family: var(--font-ui); font-style: italic; color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 var(--s2);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  background: var(--raised);
  color: var(--text);
}
.chip.kind { background: var(--accent-tint); color: var(--accent-text); }
.chip.create { background: var(--success-tint); color: var(--success); }
.chip.delete { background: var(--danger-tint); color: var(--danger); }
.chip.update, .chip.replace { background: var(--warning-tint); color: var(--warning); }

.diff { padding: var(--s3) var(--s4) var(--s4); }
.diff h3 {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: var(--s3) 0 var(--s2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text);
}
.diff h3:first-child { margin-top: 0; }
.diff h3 .count { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; color: var(--muted); }

/* One statement: a coloured margin with a drawn + or − and the JSON beside it. */
.stmt {
  display: grid;
  grid-template-columns: 32px 1fr;
  margin: 0 0 var(--s2);
  border-radius: var(--r-s);
  overflow: hidden;
}
.stmt::before {
  content: "";
  background-color: var(--border-strong);
}
.stmt pre {
  margin: 0;
  padding: var(--s2) var(--s3);
  min-width: 0;
  max-height: 22rem;
  overflow: auto;
  font: 0.875rem/1.55 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  tab-size: 2;
}
.stmt.added { background: var(--success-tint); }
.stmt.added::before {
  background:
    linear-gradient(var(--surface), var(--surface)) center 14px / 12px 2px no-repeat,
    linear-gradient(var(--surface), var(--surface)) 15px 9px / 2px 12px no-repeat,
    var(--success-edge);
}
.stmt.removed { background: var(--danger-tint); }
.stmt.removed::before {
  background:
    linear-gradient(var(--surface), var(--surface)) center 14px / 12px 2px no-repeat,
    var(--danger-edge);
}
.stmt .times {
  grid-column: 2;
  padding: 0 var(--s3) var(--s2);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
}

/* Top-level document fields, before and after */
.fields { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
#output .fields th, #output .fields td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
#output .fields th {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--raised);
}
#output .fields td { font-family: var(--font-mono); overflow-wrap: anywhere; }
#output .fields td:first-child { font-weight: 650; width: 10rem; }
.fields .absent { font-family: var(--font-ui); font-style: italic; color: var(--muted); }

/* Nothing changed */
.no-change {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0 0 var(--s4);
  padding: var(--s4) var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  background: var(--surface);
  font-weight: 600;
}
.no-change::before {
  content: "";
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    linear-gradient(var(--surface), var(--surface)) center / 10px 2px no-repeat,
    var(--border-strong);
}

/* ---------- Unreviewed list ---------- */

.unreviewed {
  margin: 0 0 var(--s4);
  border-radius: var(--r-l);
  background: var(--warning-tint);
  box-shadow: inset 5px 0 0 var(--warning-edge);
  padding: var(--s4) var(--s5);
}
.unreviewed > strong { display: block; color: var(--warning); }
.unreviewed > p { margin: var(--s1) 0 0; font-size: var(--text-sm); color: var(--text); max-width: 66ch; }
.unreviewed ul { list-style: none; margin: var(--s3) 0 0; padding: 0; }
.unreviewed li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s1) var(--s4);
  margin: 0;
  padding: var(--s2) 0;
  border-top: 1px solid var(--warning-edge);
}
.unreviewed li + li { margin-top: 0; }
.unreviewed .addr { flex: none; }
.unreviewed .why { font-size: var(--text-sm); font-weight: 650; color: var(--warning); text-align: right; }

/* ---------- Worked example (reading section) ---------- */

.example {
  margin: var(--s4) 0 0;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
}
.example .stmt { margin-bottom: var(--s2); }
.example figure { margin: var(--s4) 0 0; }
.example figcaption {
  margin-bottom: var(--s2);
  font: 700 var(--text-xs)/1.5 var(--font-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.example .note-card { margin: 0; box-shadow: none; }
.example .note-card pre { min-height: 0; }

/* ---------- Template furniture: styled, never resized ---------- */

.ad-slot { background: var(--raised); border: 1px solid var(--border); }
.ad-label { color: var(--muted); opacity: 1; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; }
.house-card { background: var(--surface); border: 1px solid var(--border); transition: border-color var(--fast) var(--ease); }
.house-card:hover { border-color: var(--accent); }
.house-card strong { color: var(--accent-text); }
.house-card span { color: var(--muted); }

.consent {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
}
.consent button { border-color: var(--border-strong); border-radius: var(--r-m); font-weight: 600; transition: background-color var(--fast) var(--ease); }
.consent button:hover { background: var(--raised); }
.consent button:active { background: var(--border); }

footer {
  opacity: 1;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: var(--s7);
  padding-top: var(--s5);
  padding-bottom: var(--s6);
  font-size: var(--text-sm);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ---------- Phone ---------- */

@media (max-width: 46rem) {
  header, main, footer { padding-left: var(--s4); padding-right: var(--s4); }
  main { padding-top: var(--s5); }
  .lede { margin-bottom: var(--s5); }
  .drop { flex-direction: column; align-items: flex-start; gap: var(--s3); min-height: 0; padding: var(--s4); }
  .drop-icon, .drop-icon svg { width: 40px; height: 40px; }
  .drop .drop-button { width: 100%; justify-content: center; }
  .actions .facts { flex-basis: 100%; }
  .tally { grid-template-columns: 1fr; gap: var(--s2); }
  .tile { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; padding: var(--s3) var(--s4); }
  .tile .k { flex-basis: 100%; }
  .tile .n { font-size: 1.5rem; }
  .note-head { padding: var(--s3); }
  .note-head .grow { display: none; }
  .primary, #copy { flex: 1 1 100%; }
  #note, .note-card pre { padding: var(--s3) var(--s4); font-size: 0.875rem; }
  .note-foot { padding-left: var(--s4); padding-right: var(--s4); }
  .change-head, .diff { padding-left: var(--s3); padding-right: var(--s3); }
  .stmt { grid-template-columns: 24px 1fr; }
  .stmt.added::before {
    background:
      linear-gradient(var(--surface), var(--surface)) center 14px / 10px 2px no-repeat,
      linear-gradient(var(--surface), var(--surface)) 11px 10px / 2px 10px no-repeat,
      var(--success-edge);
  }
  .stmt.removed::before {
    background:
      linear-gradient(var(--surface), var(--surface)) center 14px / 10px 2px no-repeat,
      var(--danger-edge);
  }
  #output .fields td:first-child { width: auto; }
  .unreviewed { padding: var(--s4); }
  .unreviewed li { grid-template-columns: 1fr; }
  .unreviewed .why { text-align: left; }
  .example { padding: var(--s4); }
}

/* ---------- Motion off ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .actions button:active:not(:disabled), .btn:active:not(:disabled),
  .primary:active:not(:disabled), #copy:active:not(:disabled) { transform: none; }
  .working .bar::after { left: 0; width: 100%; opacity: 0.35; }
}
