/*
 * Ujilo portal.
 *
 * A dense operations tool: the data is the interface, so chrome stays quiet and hierarchy comes from
 * type, spacing and one accent rather than from boxes and colour. Every colour is a token, and dark mode
 * is a selected set of steps against the dark surface rather than an inverted light theme.
 *
 * Status colours are never the only signal — every badge carries its label as text.
 */

:root {
  /* Surfaces, lightest to most recessed */
  --page: #f6f7f9;
  --surface: #ffffff;
  --surface-sunken: #f1f3f6;
  --surface-hover: #f7f9fb;

  /* Ink */
  --ink: #12161c;
  --ink-secondary: #47505c;
  --ink-muted: #6d7682;
  --ink-label: #5c646f;       /* column headers: small text, needs 4.5:1 on the sunken surface */

  /* Lines */
  --line: #e5e8ec;
  --line-strong: #cfd5dc;

  /* Accent */
  --accent: #2a78d6;          /* focus rings, active nav — never carries text */
  --accent-ink: #1f5dab;      /* accent text and links: 6.5:1 on white */
  --accent-solid: #2264b8;    /* button fill: white text reaches 5.9:1 */
  --accent-on-solid: #ffffff;
  --accent-tint: #eaf2fc;

  /* Status — fixed, never themed. Paired with a text label everywhere they appear. */
  --good: #0ca30c;
  --good-ink: #0a6b18;
  --good-tint: #e6f5e8;
  --warning: #fab219;
  --warning-ink: #7d5400;
  --warning-tint: #fdf3df;
  --critical: #d03b3b;
  --critical-ink: #a32525;
  --critical-tint: #fbeaea;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(18, 22, 28, 0.04);
  --shadow-pop: 0 4px 16px rgba(18, 22, 28, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #14161a;
    --surface: #1b1e24;
    --surface-sunken: #22262d;
    --surface-hover: #242830;
    --ink: #f2f4f7;
    --ink-secondary: #b7c0cc;
    --ink-muted: #8a94a1;
    --ink-label: #8a94a1;
    --line: #2b3038;
    --line-strong: #3a414b;
    --accent: #3987e5;
    --accent-ink: #8dbcf2;
    /* On dark, a bright fill with dark ink reads better than white on blue, and clears AA at 5.0:1. */
    --accent-solid: #3987e5;
    --accent-on-solid: #12161c;
    --accent-tint: #1a2b40;
    --good-ink: #5ed36a;
    --good-tint: #16301c;
    --warning-ink: #f0c05a;
    --warning-tint: #33280f;
    --critical-ink: #f08b8b;
    --critical-tint: #371d1d;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 4px 16px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #14161a;
  --surface: #1b1e24;
  --surface-sunken: #22262d;
  --surface-hover: #242830;
  --ink: #f2f4f7;
  --ink-secondary: #b7c0cc;
  --ink-muted: #8a94a1;
  --ink-label: #8a94a1;
  --line: #2b3038;
  --line-strong: #3a414b;
  --accent: #3987e5;
  --accent-ink: #8dbcf2;
  --accent-solid: #3987e5;
  --accent-on-solid: #12161c;
  --accent-tint: #1a2b40;
  --good-ink: #5ed36a;
  --good-tint: #16301c;
  --warning-ink: #f0c05a;
  --warning-tint: #33280f;
  --critical-ink: #f08b8b;
  --critical-tint: #371d1d;
}

* { box-sizing: border-box; }

body.admin {
  margin: 0;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: 400 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Sidebar ------------------------------------------------------------------------------------ */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 0 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 0 20px 20px;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.sidebar nav { display: flex; flex-direction: column; gap: 1px; padding: 0 10px; }
.sidebar nav a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 0.875rem;
}
.sidebar nav a:hover { background: var(--surface-sunken); color: var(--ink); }
.sidebar nav a.active { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }

.nav-shop { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.nav-shop-name {
  padding: 0 20px 8px;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.balance {
  margin: 14px 20px 0;
  padding: 10px 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.balance-value { display: block; font-size: 1.125rem; font-weight: 650; letter-spacing: -0.02em; }
.balance-label { font-size: 0.75rem; color: var(--ink-muted); }
.balance-low { background: var(--warning-tint); border-color: transparent; }
.balance-low .balance-value, .balance-low .balance-label { color: var(--warning-ink); }

.sidebar-user { margin-top: auto; padding: 16px 20px 0; border-top: 1px solid var(--line); font-size: 0.8125rem; }
.sidebar-user > div { font-weight: 550; }
.role-tag {
  display: inline-block; margin-top: 5px; padding: 1px 7px; border-radius: 4px;
  background: var(--surface-sunken); color: var(--ink-muted); font-size: 0.6875rem; font-weight: 600;
}
.sidebar-account { margin-top: 10px; display: flex; gap: 14px; }
.sidebar-account a { color: var(--ink-muted); font-size: 0.8125rem; text-decoration: none; }
.sidebar-account a:hover { color: var(--accent-ink); text-decoration: underline; }

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

.content { padding: 28px 32px 64px; max-width: 1240px; min-width: 0; }
.page-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--line);
}
h1 { font-size: 1.375rem; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 0.9375rem; font-weight: 650; letter-spacing: -0.005em; margin: 32px 0 12px; }
h2:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.section-head h2 { margin: 0; }
p { margin: 0 0 10px; }
a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.8125rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.negative { color: var(--critical-ink); }
.positive { color: var(--good-ink); }

/* ---- Messages ------------------------------------------------------------------------------------ */

.flash, .notice {
  padding: 11px 14px; border-radius: var(--radius); margin-bottom: 20px;
  border: 1px solid var(--line); background: var(--surface); font-size: 0.875rem;
}
.flash-ok, .notice-ok { background: var(--good-tint); border-color: transparent; color: var(--good-ink); }
.flash-error, .notice-error { background: var(--critical-tint); border-color: transparent; color: var(--critical-ink); }
.notice-warn { background: var(--warning-tint); border-color: transparent; color: var(--warning-ink); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice a { color: inherit; }

/* ---- Stat tiles ---------------------------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-card);
}
/* Label first, value second: the reader needs to know what they are looking at before the number. */
.stat .label { color: var(--ink-muted); font-size: 0.8125rem; margin-bottom: 4px; }
/* Proportional figures: tabular-nums makes a display-size number look loose. */
.stat .value { font-size: 1.625rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; }

.hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 12px; box-shadow: var(--shadow-card);
}
.hero .label { color: var(--ink-muted); font-size: 0.875rem; margin-bottom: 6px; }
.hero .value { font-size: 2.75rem; font-weight: 650; letter-spacing: -0.035em; line-height: 1.05; }
.hero .context { color: var(--ink-muted); font-size: 0.8125rem; margin-top: 8px; }

/* ---- Panels -------------------------------------------------------------------------------------- */

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-card);
}
/*
 * Two columns of fields.
 *
 * `align-items: start` is the whole trick: a grid stretches its items to the tallest in the row by
 * default, and a field that stretches hands the spare height to its control — which is why an input
 * next to a field carrying a hint used to render visibly taller than its neighbour. Starting every
 * field at the top lines labels up with labels and controls with controls, whatever sits beneath them.
 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 18px 20px;
  align-items: start;
  /* The same step the rows use, so whatever follows the grid keeps the rhythm going. */
  margin-bottom: 18px;
}
/* Two cards side by side are a pair and should read as one: they keep matching heights. */
.grid-2 > .panel { align-self: stretch; }

/* ---- Tables -------------------------------------------------------------------------------------- */

.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 16px; overflow-x: auto; box-shadow: var(--shadow-card);
}
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { text-align: left; padding: 11px 16px; vertical-align: top; }
th {
  font-size: 0.75rem; font-weight: 650; color: var(--ink-label);
  background: var(--surface-sunken); border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }

/* ---- Activity feed ------------------------------------------------------------------------------- */

.activity-action { font-weight: 550; }
.activity-target { margin-top: 2px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.activity-kind {
  font-size: 0.6875rem; color: var(--ink-muted); background: var(--surface-sunken);
  padding: 1px 6px; border-radius: 4px; text-transform: lowercase;
}

/* ---- Badges and chips ---------------------------------------------------------------------------- */

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 5px; white-space: nowrap;
  font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.01em;
  background: var(--surface-sunken); color: var(--ink-secondary);
}
.badge-active, .badge-approved, .badge-on_sale, .badge-confirmed, .badge-completed, .badge-redeemed,
.badge-submitted, .badge-done, .badge-superadmin, .badge-topup, .badge-create, .badge-sample,
.badge-claimed, .badge-live { background: var(--good-tint); color: var(--good-ink); }
.badge-draft, .badge-pending, .badge-validated, .badge-importing, .badge-unlisted, .badge-seller,
.badge-new_version, .badge-skip_duplicate { background: var(--warning-tint); color: var(--warning-ink); }
.badge-suspended, .badge-withdrawn, .badge-revoked, .badge-refunded, .badge-error, .badge-failed,
.badge-archived, .badge-inactive, .badge-void_system, .badge-access_revoked, .badge-charge,
.badge-cancelled { background: var(--critical-tint); color: var(--critical-ink); }
.chip {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 4px;
  background: var(--accent-tint); color: var(--accent-ink); font-size: 0.6875rem; font-weight: 600;
  text-decoration: none;
}
a.chip:hover { background: var(--accent-solid); color: var(--accent-on-solid); }
/* A cell can hold several chips — a question in several products — so they wrap without colliding. */
td .chip { margin: 1px 4px 1px 0; }

/* ---- Forms --------------------------------------------------------------------------------------- */

/*
 * `hidden` must win. The browser's own `[hidden] { display: none }` carries the same weight as any class
 * here, so `.field { display: grid }` quietly overrode it and a conditional field stayed on screen.
 */
[hidden] { display: none !important; }


/*
 * A field is always label, control, hint, in that order and at the same spacing. `align-content: start`
 * stops the rows absorbing any slack the field is given, so the control keeps its own height.
 */
.field { display: grid; align-content: start; gap: 6px; margin-bottom: 18px; }
.field-label { font-size: 0.8125rem; font-weight: 600; line-height: 1.35; }
.hint { color: var(--ink-muted); font-size: 0.75rem; line-height: 1.45; }
/* Inside a grid of fields the gap does the spacing; a margin as well would double it. */
.grid-2 > .field, .grid-2 > .field:last-child { margin-bottom: 0; }

input[type=text], input[type=email], input[type=number], input[type=search], input[type=password],
input[type=date], input[type=file], select, textarea {
  font: inherit; font-size: 0.875rem; width: 100%; padding: 8px 11px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
/* One height for every single-line control, so a select never sits taller than the input beside it. */
input[type=text], input[type=email], input[type=number], input[type=search], input[type=password],
input[type=date], input[type=file], select {
  height: 38px;
}
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
input:disabled, select:disabled { background: var(--surface-sunken); color: var(--ink-muted); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

/*
 * A file input renders its own button, which the browser styles like nothing else on the page. Dressing
 * it as a secondary button makes "choose a file" look like every other action here.
 */
input[type=file] { padding: 5px 6px; }
input[type=file]::file-selector-button {
  font: inherit; font-size: 0.8125rem; font-weight: 600; margin: 0 10px 0 0; padding: 5px 11px;
  color: var(--ink); background: var(--surface-sunken); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--surface-hover); border-color: var(--accent); }
label.checkbox { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 12px; font-size: 0.875rem; }
label.checkbox input { width: auto; }

button, .button {
  display: inline-block; font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer;
  padding: 8px 15px; border-radius: var(--radius-sm); text-decoration: none;
  background: var(--accent-solid); border: 1px solid var(--accent-solid); color: var(--accent-on-solid);
}
button:hover, .button:hover { filter: brightness(0.93); }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary, .button.secondary {
  background: var(--surface); color: var(--ink); border-color: var(--line-strong);
}
button.secondary:hover, .button.secondary:hover { background: var(--surface-sunken); border-color: var(--line-strong); }
button.danger, .button.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
button.danger:hover, .button.danger:hover { filter: brightness(0.92); }
button.wide { width: 100%; padding: 10px; }
.small-button { padding: 5px 11px; font-size: 0.8125rem; }

/* A submit button right under the last field reads as part of its hint without a little air. */
.field + button, form > .disclosure + button { margin-top: 10px; }

/* Short instructions read as steps rather than a paragraph someone has to parse. */
.steps { margin: 0 0 14px; padding-left: 18px; }
.steps li { margin-bottom: 4px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.inline-form { display: inline-flex; gap: 7px; align-items: center; margin: 0 6px 6px 0; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form select { width: auto; min-width: 130px; padding: 5px 9px; font-size: 0.8125rem; }
.inline-form button { padding: 5px 11px; font-size: 0.8125rem; }
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 160px; }

/* ---- Disclosure ---------------------------------------------------------------------------------- */

.disclosure { margin: 14px 0 24px; }
.disclosure > summary {
  display: inline-block; cursor: pointer; list-style: none;
  font-size: 0.875rem; font-weight: 600; color: var(--ink);
  padding: 8px 15px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "+"; display: inline-block; width: 14px; color: var(--ink-muted); font-weight: 700; }
.disclosure[open] > summary::before { content: "−"; }
.disclosure > summary:hover { background: var(--surface-sunken); }
.disclosure > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.disclosure-body {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-card);
}

/* ---- Definition lists, previews, misc ------------------------------------------------------------- */

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 24px; margin: 0 0 14px; font-size: 0.875rem; }
.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; }

.question-form .choice-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 8px; }
.choice-correct { display: flex; gap: 7px; align-items: center; font-weight: 650; color: var(--ink-secondary); font-size: 0.8125rem; }
.choice-correct input { width: auto; }
.type-block { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }

.preview { background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.preview-type { font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 10px; }
.preview ol.choices { padding-left: 22px; margin: 12px 0; }
.preview ol.choices li { margin-bottom: 5px; }
.preview ol.choices li.correct { font-weight: 600; color: var(--good-ink); }
.preview-explanation { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; color: var(--ink-secondary); }

.issues {
  background: var(--critical-tint); color: var(--critical-ink); border-radius: var(--radius);
  padding: 11px 14px 11px 30px; margin-bottom: 16px; font-size: 0.875rem;
}
.issues li { margin-bottom: 3px; }
.code-output {
  width: 100%; margin-top: 10px; padding: 10px 12px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9375rem; letter-spacing: 0.06em;
}
.code-output.one-line { display: inline-block; width: auto; font-size: 1.0625rem; font-weight: 650; }

/* ---- Sign-in pages -------------------------------------------------------------------------------- */

body.admin-auth {
  display: block; margin: 0; background: var(--page); color: var(--ink);
  font: 400 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.auth-card {
  max-width: 392px; margin: 8vh auto 0; padding: 30px 30px 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
}
.auth-brand { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.015em; margin-bottom: 20px; }
.auth-card h1 { font-size: 1.125rem; margin: 0 0 8px; }
.auth-card > p:first-of-type { color: var(--ink-muted); font-size: 0.875rem; margin-bottom: 20px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card p { margin-top: 14px; }

/* ---- Narrow screens -------------------------------------------------------------------------------- */

@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
  .sidebar-brand { padding: 0 8px 0 0; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; padding: 0; }
  .nav-shop { margin: 0; padding: 0; border-top: none; width: 100%; }
  .nav-shop-name { padding: 6px 0 4px; }
  .balance, .sidebar-user { margin: 0; padding: 8px 0 0; border-top: none; }
  .content { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .question-form .choice-row { grid-template-columns: 1fr; }
}

/*
 * Row actions. A filled button in every row competes with the data, so inside a table the controls
 * drop to a quiet outline and destructive ones carry their meaning in the text colour rather than a
 * red fill. The confirmation dialog, not the styling, is what guards the action.
 */
td .inline-form { margin: 0 4px 4px 0; }
td .inline-form button {
  background: var(--surface); color: var(--ink-secondary); border-color: var(--line-strong);
  font-weight: 550; padding: 4px 10px; font-size: 0.78125rem;
}
td .inline-form button:hover { background: var(--surface-sunken); color: var(--ink); filter: none; }
td .inline-form button.danger { background: var(--surface); color: var(--critical-ink); border-color: var(--line-strong); }
td .inline-form button.danger:hover { background: var(--critical-tint); border-color: var(--critical-tint); filter: none; }
td .inline-form select, td .inline-form input[type=text] { padding: 4px 8px; font-size: 0.78125rem; min-width: 112px; }

/* A question belongs to as many products as the seller ticks, so membership is a checklist. */
.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2px;
  margin-bottom: 16px;
}

.checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.checklist label:hover { border-color: var(--accent); }
.checklist label:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.checklist label span:last-child { margin-left: auto; white-space: nowrap; }

/* Question pictures. The picture is the content, so the card around it is only a line and a caption. */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.image-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  overflow: hidden;
}

/* A checkerboard behind a transparent PNG, so a white diagram on a dark theme is still visible. */
.image-card img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background:
    linear-gradient(45deg, var(--surface-hover) 25%, transparent 25%, transparent 75%, var(--surface-hover) 75%) 0 0 / 16px 16px,
    linear-gradient(45deg, var(--surface-hover) 25%, transparent 25%, transparent 75%, var(--surface-hover) 75%) 8px 8px / 16px 16px,
    var(--surface);
  border-bottom: 1px solid var(--line);
}

.image-card figcaption { padding: 12px 14px; }
.image-card figcaption .field { margin-bottom: 8px; }

/* An empty section states the next step and offers it, rather than ending the road. */
.empty-next { padding: 18px 0 4px; }
.empty-next .actions { margin-top: 12px; }
