/* One stylesheet, no framework, no build step.

   Colour values are GitHub Primer's functional tokens (primer/primitives,
   light and dark themes), so the palette has been contrast-checked by people
   whose job that is. Layout follows Primer's patterns: a grouped sidebar
   (NavList) whose current item changes the URL, a page header of title plus
   description, and bordered "Box" panels. Labels and table headers are
   deliberately quieter than the data they describe. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* surfaces */
  --canvas: #f6f8fa;          /* page behind the panels */
  --surface: #ffffff;         /* panels, tables, inputs, sidebar */
  --surface-muted: #f6f8fa;   /* table headers, code, quiet fills */
  --hover: #eff2f5;
  --selected: #e7ecf0;

  /* text */
  --fg: #1f2328;
  --fg-muted: #59636e;
  --fg-disabled: #818b98;
  --fg-on-emphasis: #ffffff;

  /* borders */
  --border: #d1d9e0;
  --border-muted: #d1d9e0b3;

  /* semantic: fg / muted background / emphasis background */
  --accent-fg: #0969da;   --accent-muted: #ddf4ff;   --accent-emphasis: #0969da;
  --success-fg: #1a7f37;  --success-muted: #dafbe1;  --success-emphasis: #1f883d;
  --attention-fg: #9a6700; --attention-muted: #fff8c5; --attention-emphasis: #9a6700;
  --danger-fg: #d1242f;   --danger-muted: #ffebe9;   --danger-emphasis: #cf222e;
  --done-fg: #8250df;     --done-muted: #fbefff;     --done-emphasis: #8250df;

  --shadow-sm: 0 1px 1px 0 #1f23280a, 0 1px 2px 0 #1f232808;
  --radius: 6px;
  --sidebar-width: 232px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #010409;
    --surface: #0d1117;
    --surface-muted: #151b23;
    --hover: #262c36;
    --selected: #2a313c;
    --fg: #f0f6fc;
    --fg-muted: #9198a1;
    --fg-disabled: #656c76;
    --border: #3d444d;
    --border-muted: #3d444db3;
    --accent-fg: #4493f8;   --accent-muted: #388bfd1a;   --accent-emphasis: #1f6feb;
    --success-fg: #3fb950;  --success-muted: #2ea04326;  --success-emphasis: #238636;
    --attention-fg: #d29922; --attention-muted: #bb800926; --attention-emphasis: #9e6a03;
    --danger-fg: #f85149;   --danger-muted: #f851491a;   --danger-emphasis: #da3633;
    --done-fg: #ab7df8;     --done-muted: #ab7df826;     --done-emphasis: #8957e5;
    --shadow-sm: none;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--fg);
  background: var(--canvas);
}

h1, h2, h3 { line-height: 1.25; font-weight: 600; text-wrap: balance; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 32px 0 12px; }
h3 { font-size: 15px; margin: 24px 0 8px; }

a { color: var(--accent-fg); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-muted); padding: 1px 5px; border-radius: 4px; }
pre { margin: 0; }

:focus-visible { outline: 2px solid var(--accent-emphasis); outline-offset: 2px; }

.muted { color: var(--fg-muted); }
.hint { color: var(--fg-muted); font-size: 13px; }
.error { color: var(--danger-fg); }
.rationale { color: var(--fg-muted); font-style: italic; }
.undefined { color: var(--fg-disabled); font-style: italic; font-weight: 400; }
.inline-form { display: inline; }
.lede { color: var(--fg-muted); max-width: 72ch; margin: 0 0 24px; }
.note { color: var(--fg-muted); font-size: 13px; border-top: 1px solid var(--border-muted); padding-top: 12px; margin-top: 24px; }

/* ==========================================================================
   Layout: sidebar + content
   ========================================================================== */

body.has-nav {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}
main.wide { max-width: none; padding: 24px; }

/* Page header: title, then a description that closes the header with a rule. */
/* The rule spans the page while the text keeps a readable 72ch measure. */
main > h1 + .lede {
  max-width: none;
  padding: 0 max(0px, 100% - 72ch) 16px 0;
  border-bottom: 1px solid var(--border-muted);
}
main > h1:first-child { margin-top: 0; }
/* A "← back" link above a title reads as a breadcrumb, not as content. */
main > p:first-child { margin: 0 0 8px; font-size: 13px; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  color: var(--fg);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}
.brand span { font-size: 12px; font-weight: 400; color: var(--fg-muted); }
.brand:hover { text-decoration: none; }

.nav { display: flex; flex-direction: column; gap: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading {
  margin: 0 0 4px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--fg);
}
.nav-item:hover { background: var(--hover); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--selected); font-weight: 600; }
.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 4px;
  height: 24px;
  margin-top: -12px;
  border-radius: var(--radius);
  background: var(--accent-emphasis);
}

.counter {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 2em;
  background: var(--accent-muted);
  color: var(--accent-fg);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.account {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--border-muted);
  font-size: 13px;
}
.account-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .link-button { align-self: flex-start; font-size: 13px; color: var(--fg-muted); }
.account .link-button:hover { color: var(--accent-fg); }

/* Narrow screens: the sidebar becomes a top bar whose links scroll sideways. */
@media (max-width: 860px) {
  body.has-nav { display: block; }
  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand span { display: none; }
  .nav { flex-direction: row; gap: 2px; overflow-x: auto; flex: 1 1 auto; scrollbar-width: none; }
  .account .link-button { white-space: nowrap; }
  .nav-group { display: contents; }
  .nav-heading { display: none; }
  .nav-item { white-space: nowrap; }
  .nav-item[aria-current="page"]::before { display: none; }
  .account { margin: 0; padding: 0; border: 0; }
  .account-name { display: none; }
  main, main.wide { padding: 20px 16px 48px; }
  table { display: block; overflow-x: auto; }
}

/* ==========================================================================
   Panels ("Box")
   ========================================================================== */

.dash-panel, .actions, .entity-form, .login-box, .offer, .lead-identity, .danger-zone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.dash-panel { margin-bottom: 24px; }
.dash-panel > h2:first-child, .actions > h2:first-child, .danger-zone > h2:first-child { font-size: 16px; margin: 0 0 12px; }
.actions { margin-top: 24px; }
.actions form { margin-bottom: 16px; }
.actions label { display: block; margin-bottom: 8px; font-weight: 600; }
.actions input, .actions textarea { width: 100%; margin-top: 4px; }

.danger-zone { margin-top: 32px; max-width: 640px; border-color: var(--danger-emphasis); }

.workspace-block { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border-muted); }
.workspace-block:last-child { border-bottom: 0; }

.lead-identity { margin: 16px 0 24px; }
.lead-identity dl, .draft-fields, .dash-stats {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 24px;
  margin: 0;
}
.lead-identity dt, .draft-fields dt, .dash-stats dt { color: var(--fg-muted); }
.lead-identity dd, .draft-fields dd, .dash-stats dd { margin: 0; overflow-wrap: anywhere; }
.dash-stats dd { font-weight: 600; font-variant-numeric: tabular-nums; }

.draft-view, .evidence-view, .scoring-view { margin-top: 24px; }

/* ==========================================================================
   Tables
   ========================================================================== */

table {
  width: 100%;
  margin: 16px 0;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td { text-align: left; padding: 8px 16px; vertical-align: top; }
td { border-top: 1px solid var(--border-muted); }
th {
  background: var(--surface-muted);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
tbody tr:hover td { background: var(--surface-muted); }
td .muted { display: block; font-size: 12px; }

/* Inside a panel the panel is the box: no second border. */
:is(.dash-panel, .actions, .offer) table { border: 0; border-radius: 0; margin: 8px 0 0; background: transparent; }
:is(.dash-panel, .actions, .offer) th { background: transparent; border-bottom: 1px solid var(--border); }
:is(.dash-panel, .actions, .offer) tr:first-child td { border-top: 0; }

.dash-total-row td { font-weight: 600; border-top: 2px solid var(--border); }
.error-cell, .dash-table .error-cell { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); max-width: 32rem; overflow-wrap: anywhere; }
.outbox-table tr.blocked td { opacity: 0.7; }
tr.dash-alert td { background: var(--danger-muted); }
.row-action form, .proof-table form { margin: 0; }
.mailbox-actions { white-space: nowrap; }
.mailbox-actions form { display: inline; }

/* Retired claims stay visible, struck through: a draft sent last month may
   still cite one, and "where did that stat go" is the worse question. */
.proof-table tr.retired td { color: var(--fg-disabled); text-decoration: line-through; }
.proof-table tr.retired td:last-child { text-decoration: none; }

/* ==========================================================================
   Labels (status chips)
   ========================================================================== */

.status-tag, .verification-tag, .job-tag, .mailbox-tag, .badge, h1 .count, h2 .count {
  --tone-fg: var(--fg-muted);
  --tone-bg: var(--surface);
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 2em;
  border: 1px solid color-mix(in srgb, var(--tone-fg) 35%, transparent);
  background: var(--tone-bg);
  color: var(--tone-fg);
  font: 500 12px/1 var(--font);
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: none;
}
h1 .status-tag { margin-left: 8px; }
h2 .count { --tone-bg: var(--surface-muted); margin-left: 6px; }

.status-ready, .job-running, .badge
  { --tone-fg: var(--accent-fg); --tone-bg: var(--accent-muted); }
.status-researching
  { --tone-fg: var(--attention-fg); --tone-bg: var(--attention-muted); }
.status-approved, .verification-passed, .job-done, .mailbox-active
  { --tone-fg: var(--success-fg); --tone-bg: var(--success-muted); }
.status-sent
  { --tone-fg: var(--done-fg); --tone-bg: var(--done-muted); }
.status-held, .verification-failed, .job-failed, .mailbox-disabled, .mailbox-needs_reconnect
  { --tone-fg: var(--danger-fg); --tone-bg: var(--danger-muted); }

/* Status filter: a row of chips, the current one ringed. */
.status-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.status-filter a { text-decoration: none; }
.status-filter a:not(.status-tag) {
  display: inline-flex; align-items: center; height: 22px; padding: 0 10px;
  border-radius: 2em; border: 1px solid var(--border); color: var(--fg-muted); font-size: 12px; font-weight: 500;
}
.status-filter a.active:not(.status-tag) { background: var(--fg); border-color: var(--fg); color: var(--canvas); }
.status-filter a.status-tag.active { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 3px var(--tone-fg); font-weight: 600; }

/* ==========================================================================
   Buttons and form controls
   ========================================================================== */

button {
  font: 500 14px/20px var(--font);
  padding: 5px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
button:hover { background: var(--hover); }
button:disabled, button:disabled:hover {
  cursor: not-allowed;
  color: var(--fg-disabled);
  background: var(--surface-muted);
  border-color: var(--border-muted);
  box-shadow: none;
}
button.approve { background: var(--success-emphasis); border-color: #1f232826; color: var(--fg-on-emphasis); }
button.approve:hover { background: color-mix(in srgb, var(--success-emphasis) 90%, #000); }
button.reject { color: var(--danger-fg); }
button.reject:hover { background: var(--danger-emphasis); border-color: var(--danger-emphasis); color: var(--fg-on-emphasis); }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--accent-fg);
  font: inherit;
  cursor: pointer;
}
.link-button:hover { background: none; text-decoration: underline; }
.link-button.danger { color: var(--danger-fg); }
/* The inbox's stage tags are buttons: a set tag is a chip, an unset one a link. */
button.mailbox-tag { cursor: pointer; padding: 0 8px; }
td .inline-form + .inline-form { margin-left: 8px; }

input:is([type="text"], [type="email"], [type="password"], [type="search"], [type="number"], [type="url"], [type="date"], [type="month"], :not([type])),
select,
textarea {
  font: 14px/20px var(--font);
  padding: 5px 12px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 100%;
}
textarea { line-height: 1.5; }
input:disabled { background: var(--surface-muted); color: var(--fg-muted); }
:is(input, select, textarea):focus-visible { outline: 2px solid var(--accent-emphasis); outline-offset: -1px; border-color: var(--accent-emphasis); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-emphasis); }

.entity-form { max-width: 680px; }
.entity-form label { display: block; margin-bottom: 16px; font-weight: 600; }
.entity-form input, .entity-form textarea, .entity-form select { width: 100%; margin-top: 4px; font-weight: 400; }
.entity-form textarea { font-family: var(--mono); font-size: 13px; }
.entity-form .hint { display: block; font-weight: 400; margin-top: 4px; }
.entity-form label.checkbox input[type="checkbox"] { width: auto; margin: 0 6px 0 0; vertical-align: baseline; }

.stack-form { display: grid; gap: 12px; max-width: 520px; }
.stack-form label { display: grid; gap: 4px; font-weight: 600; }
.stack-form button { justify-self: start; }
/* Irreversible: looks like it. */
form[action$="/delete-person"] button { color: var(--danger-fg); }
form[action$="/delete-person"] button:hover { background: var(--danger-emphasis); border-color: var(--danger-emphasis); color: var(--fg-on-emphasis); }

.login-box { max-width: 360px; margin: 12vh auto 0; padding: 24px; box-shadow: var(--shadow-sm); }
.login-box h1 { font-size: 20px; margin-bottom: 16px; }
.login-box label { display: block; margin-bottom: 12px; font-weight: 600; }
.login-box input { width: 100%; margin-top: 4px; }
.login-box button { width: 100%; margin-top: 4px; background: var(--success-emphasis); border-color: #1f232826; color: var(--fg-on-emphasis); }

/* ==========================================================================
   Banners ("Flash") and empty states
   ========================================================================== */

.banner, .sent-banner, .queued-banner, .mailbox-problem, .held-banner, .error-banner, p.dash-alert {
  --tone-fg: var(--accent-fg);
  --tone-bg: var(--accent-muted);
  padding: 12px 16px;
  margin: 0 0 16px;
  border: 1px solid color-mix(in srgb, var(--tone-fg) 40%, transparent);
  border-radius: var(--radius);
  background: var(--tone-bg);
  color: var(--fg);
}
.sent-banner, .banner.ok { --tone-fg: var(--success-fg); --tone-bg: var(--success-muted); }
.banner.error { --tone-fg: var(--danger-fg); --tone-bg: var(--danger-muted); }
.banner.warn { --tone-fg: var(--attention-fg); --tone-bg: var(--attention-muted); }
.banner.danger, .mailbox-problem, .held-banner, .error-banner, p.dash-alert
  { --tone-fg: var(--danger-fg); --tone-bg: var(--danger-muted); }
.error-banner, p.dash-alert { font-weight: 600; }
.held-banner .verification-notes { margin-top: 8px; }
.dash-alert { color: var(--danger-fg); font-weight: 600; }
p.dash-alert { color: var(--fg); }
.send-hint { margin-top: 6px; }

p.empty, div.empty {
  margin: 16px 0;
  padding: 24px 16px;
  text-align: center;
  color: var(--fg-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
/* Inside something that is already a box, an empty state is just a sentence. */
:is(.dash-panel, .actions, .review-detail-pane, #review-list-dynamic, .offer) :is(p.empty, div.empty) {
  margin: 8px 0; padding: 8px 0; text-align: left; border: 0; background: none;
}
#review-list-dynamic p.empty { padding: 8px 12px; }

/* ==========================================================================
   Drafts, evidence, previews
   ========================================================================== */

.verification-notes, .draft-body {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--surface-muted);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
  padding: 12px;
}
.draft-body { font-family: var(--font); font-size: 14px; background: var(--surface); }

.evidence-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.evidence-list li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.fact-kind { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-muted); }
blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--border); color: var(--fg); }

.config-preview {
  display: inline-block;
  max-width: 420px;
  overflow-x: auto;
  white-space: nowrap;
  font: 12px var(--mono);
  background: var(--surface-muted);
  padding: 1px 6px;
  border-radius: 4px;
}

/* The campaign offer: the preview is the only place the client reads the
   sentence his fields actually produce before a stranger does. */
.offer { margin-bottom: 16px; background: var(--surface-muted); }
.offer legend { font-weight: 600; padding: 0 6px; }
.offer > .hint { display: block; margin-bottom: 8px; }
.preview {
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-left: 3px solid var(--accent-emphasis);
  border-radius: 0 var(--radius) var(--radius) 0;
  line-height: 1.6;
}
.preview em { color: var(--fg-muted); font-style: normal; }
.preview strong { background: var(--attention-muted); font-weight: 600; padding: 0 2px; border-radius: 3px; }
.proof-points { margin-top: 32px; }
.proof-points > .hint { display: block; margin-bottom: 12px; }

/* ==========================================================================
   /review: two panes
   ========================================================================== */

.review-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  height: calc(100vh - 48px);
}
.review-list-pane { display: flex; flex-direction: column; height: 100%; min-height: 0; gap: 8px; }
.review-search-input { width: 100%; }
.review-list-pane .status-filter { margin: 4px 12px 0; }

#review-list-dynamic {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.review-count { margin: 8px 12px 0; font-size: 12px; }
.review-rows { list-style: none; margin: 0; padding: 4px; }
.review-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
}
.review-row:hover { background: var(--hover); }
.review-row.selected { background: var(--accent-muted); box-shadow: inset 3px 0 0 var(--accent-emphasis); }
.review-row-body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.review-row-name { font-weight: 600; }
.review-row-email { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}

.review-detail-pane {
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.review-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-muted);
}
.review-panel-header h2 { margin: 0 0 6px; font-size: 20px; }
.review-panel-header .status-tag { margin-right: 6px; }

.email-preview summary { cursor: pointer; color: var(--accent-fg); font-weight: 500; list-style: none; white-space: nowrap; }
.email-preview summary::-webkit-details-marker { display: none; }
.email-preview[open] summary { margin-bottom: 8px; }
.email-preview-body {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  max-width: 560px;
}
.email-preview-body dl { margin: 0; }
.email-preview-body dt { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-muted); margin-top: 8px; }
.email-preview-body dt:first-child { margin-top: 0; }
.email-preview-body dd { margin: 2px 0 0; }
.email-preview-body pre { white-space: pre-wrap; font-family: var(--font); font-size: 14px; }

.review-compose-form label { display: block; margin-bottom: 12px; font-weight: 600; }
.review-compose-form input, .review-compose-form textarea { width: 100%; margin-top: 4px; font-weight: 400; }

.verification-line { margin: 16px 0; color: var(--fg-muted); }
.review-actions { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-muted); }
.review-action-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.review-action-row form { margin: 0; }
.reject-form { display: flex; gap: 8px; align-items: center; flex: 1 1 280px; }
.reject-form input { flex: 1 1 auto; }
.approve-disabled-hint { margin-top: 8px; font-size: 13px; }

@media (max-width: 860px) {
  .review-shell { grid-template-columns: minmax(0, 1fr); height: auto; }
  .review-list-pane { height: auto; }
  #review-list-dynamic { max-height: 40vh; }
  .review-detail-pane { height: auto; }
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.dash-panel .kpi { background: var(--surface-muted); border-color: var(--border-muted); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.kpi-value { font-size: 28px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-value.undefined { color: var(--fg-disabled); font-style: normal; font-weight: 400; }
.kpi-note { font-size: 13px; color: var(--fg-muted); }

/* ==========================================================================
   Import
   ========================================================================== */

.import-form input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 16px;
  background: var(--surface-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
}
.import-form .hint { margin: 8px 0 16px; }
.import-tally { display: flex; flex-wrap: wrap; gap: 24px; list-style: none; padding: 0; margin: 0 0 16px; }
.import-tally li { display: flex; flex-direction: column; color: var(--fg-muted); font-size: 13px; }
.import-tally .count { font-size: 22px; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.import-report h3 { margin-top: 24px; }

.block-reason { display: block; font-size: 12px; margin-top: 2px; }
.reply-body { white-space: pre-wrap; font-family: var(--font); font-size: 14px; margin-top: 8px; }
