/* Pramagent interface system.
 *
 * Ink on paper. Color is reserved for decisions: the three nodes of the logo
 * mark are the three outcomes of a tool check, so teal means allowed, amber
 * means held for a person, and red means blocked. Everything else is neutral.
 *
 * Shape scale: inline tokens 4px, controls 6px, containers 10px.
 * Layers: sticky bars 20, navigation drawer 40, skip link 50.
 * Fonts are self-hosted; the CSP allows font-src 'self' only.
 */

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f4f5f6;
  --rail: #eceef1;
  --surface: #fcfcfd;
  --sunk: #eef0f2;
  --hover: #e6e9ec;
  --ink: #111417;
  --ink-2: #343b42;
  --muted: #59616a;
  --faint: #8a929a;
  --line: #dfe3e7;
  --line-strong: #c9cfd5;
  --field-line: #8a929a;
  --on-ink: #f4f5f6;
  --ink-hover: #2b3137;

  --allow: #0b7268;
  --allow-bg: #e2f3f0;
  --allow-line: #b5ddd7;
  --allow-mark: #17a398;
  --review: #8a5a08;
  --review-bg: #faf0db;
  --review-line: #ebd3a0;
  --review-mark: #d39b2a;
  --block: #b3312a;
  --block-bg: #fbe9e7;
  --block-line: #f1c1bc;
  --block-mark: #e2554f;
  --on-signal: #fcfcfd;

  --shadow-hue: 210 14% 18%;
  --shadow-sm: 0 1px 2px hsl(var(--shadow-hue) / .07);
  --shadow-md: 0 1px 2px hsl(var(--shadow-hue) / .06), 0 10px 28px -8px hsl(var(--shadow-hue) / .16);
  --shadow-lg: 0 2px 6px hsl(var(--shadow-hue) / .05), 0 32px 72px -18px hsl(var(--shadow-hue) / .28);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2359616a'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --dur: 180ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0c0e10;
    --rail: #101316;
    --surface: #131619;
    --sunk: #1a1e22;
    --hover: #20252a;
    --ink: #eceef0;
    --ink-2: #c2c8ce;
    --muted: #8f98a1;
    --faint: #5c646c;
    --line: #242a30;
    --line-strong: #343b42;
    --field-line: #5c646c;
    --on-ink: #0c0e10;
    --ink-hover: #d5dade;
    --allow: #4fc7ba;
    --allow-bg: #14302d;
    --allow-line: #1f4a45;
    --review: #e3b04f;
    --review-bg: #33290f;
    --review-line: #574619;
    --block: #f08079;
    --block-bg: #3a1c1a;
    --block-line: #5e2c28;
    --on-signal: #0c0e10;
    --shadow-hue: 210 30% 2%;
    --shadow-sm: 0 1px 2px hsl(var(--shadow-hue) / .5);
    --shadow-md: 0 1px 2px hsl(var(--shadow-hue) / .5), 0 10px 28px -8px hsl(var(--shadow-hue) / .7);
    --shadow-lg: 0 2px 6px hsl(var(--shadow-hue) / .5), 0 32px 72px -18px hsl(var(--shadow-hue) / .85);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%238f98a1'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0c0e10;
  --rail: #101316;
  --surface: #131619;
  --sunk: #1a1e22;
  --hover: #20252a;
  --ink: #eceef0;
  --ink-2: #c2c8ce;
  --muted: #8f98a1;
  --faint: #5c646c;
  --line: #242a30;
  --line-strong: #343b42;
  --field-line: #5c646c;
  --on-ink: #0c0e10;
  --ink-hover: #d5dade;
  --allow: #4fc7ba;
  --allow-bg: #14302d;
  --allow-line: #1f4a45;
  --review: #e3b04f;
  --review-bg: #33290f;
  --review-line: #574619;
  --block: #f08079;
  --block-bg: #3a1c1a;
  --block-line: #5e2c28;
  --on-signal: #0c0e10;
  --shadow-hue: 210 30% 2%;
  --shadow-sm: 0 1px 2px hsl(var(--shadow-hue) / .5);
  --shadow-md: 0 1px 2px hsl(var(--shadow-hue) / .5), 0 10px 28px -8px hsl(var(--shadow-hue) / .7);
  --shadow-lg: 0 2px 6px hsl(var(--shadow-hue) / .5), 0 32px 72px -18px hsl(var(--shadow-hue) / .85);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%238f98a1'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
}

/* Base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.55 var(--sans);
  font-feature-settings: "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.02em;
  text-wrap: balance;
}

h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.028em; }
h2 { font-size: 15px; line-height: 1.35; }
h3 { font-size: 14px; line-height: 1.4; }

p {
  margin: 0 0 12px;
  color: var(--ink-2);
  text-wrap: pretty;
}

p:last-child { margin-bottom: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

button { font: inherit; color: inherit; }

strong { font-weight: 600; color: var(--ink); }

code, kbd, samp, pre { font-family: var(--mono); }

:not(pre) > code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--sunk);
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}

pre {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--sunk);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
  tab-size: 2;
}

pre code { font-size: inherit; }

kbd {
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12px;
}

ul, ol {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--ink-2);
}

li + li { margin-top: 4px; }

hr {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

img, svg, video { max-width: 100%; }

blockquote {
  margin: 0 0 12px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line-strong);
}

blockquote footer {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

dl { margin: 0; }

summary { cursor: pointer; }

::selection { background: color-mix(in srgb, var(--allow-mark) 30%, transparent); }

/* Icons: Phosphor glyphs drawn through a CSS mask so they take currentColor. */

.i {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
  vertical-align: -3px;
}

/* Text helpers */

td.mono { white-space: nowrap; }

.mono, td.mono, .hash-value {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

.hash-value { display: block; overflow-wrap: anywhere; color: var(--ink-2); }

.muted { color: var(--muted); }

.field-note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.truncate {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 50;
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus { top: 12px; }

/* Brand */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.025em;
  text-decoration: none;
}

.wordmark img { width: 26px; height: 26px; border-radius: 6px; }

/* Buttons */

.button {
  --h: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--h);
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font: 500 13px/1 var(--sans);
  letter-spacing: -.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform 120ms var(--ease);
}

.button:hover {
  border-color: var(--faint);
  background: var(--sunk);
  color: var(--ink);
}

.button:active { transform: translateY(1px); }

.button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-ink);
}

.button.primary:hover {
  border-color: var(--ink-hover);
  background: var(--ink-hover);
}

.button.approve {
  border-color: var(--allow);
  background: var(--allow);
  color: var(--on-signal);
}

.button.approve:hover {
  border-color: var(--allow);
  background: color-mix(in srgb, var(--allow) 86%, var(--ink));
}

.button.bad, .button.deny {
  border-color: var(--block-line);
  background: var(--surface);
  color: var(--block);
}

.button.bad:hover, .button.deny:hover {
  border-color: var(--block);
  background: var(--block-bg);
  color: var(--block);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.button.ghost:hover { background: var(--hover); border-color: transparent; }

.button.small { --h: 28px; padding: 0 10px; font-size: 12.5px; }
.button.large { --h: 42px; padding: 0 18px; font-size: 14px; }
.button .i { width: 15px; height: 15px; }

.button:disabled, .button[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 13px var(--sans);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-button:hover { color: var(--ink); text-decoration-color: currentColor; }

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.arrow-link .i { transition: transform var(--dur) var(--ease); }
.arrow-link:hover .i { transform: translateX(3px); }

/* Forms */

label {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
select,
textarea {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--field-line);
  border-radius: var(--r);
  background-color: var(--surface);
  color: var(--ink);
  font: 400 14px/1.4 var(--sans);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

label > input:not([type="checkbox"]):not([type="radio"]),
label > select,
label > textarea { margin-top: 6px; }

textarea { min-height: 72px; resize: vertical; }

select {
  appearance: none;
  padding-right: 32px;
  background-image: var(--chevron);
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 14px;
  cursor: pointer;
}

input:hover, select:hover, textarea:hover { border-color: var(--muted); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 16%, transparent);
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

input[readonly], textarea[readonly] { background-color: var(--sunk); }

input[type="checkbox"], input[type="radio"] {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--ink);
  cursor: pointer;
}

label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-2);
  font-weight: 400;
  line-height: 1.45;
}

.field { display: grid; gap: 6px; }
.field p { margin: 0; color: var(--muted); font-size: 12.5px; }
.form-grid { display: grid; gap: 16px; }

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.form-row > label { flex: 1 1 200px; }

.password-wrap { position: relative; display: block; }
.password-wrap > input { padding-right: 64px !important; }
label > .password-wrap { margin-top: 6px; }
label > .password-wrap > input { margin-top: 0; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  min-height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font: 500 12px var(--sans);
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle:hover { background: var(--hover); color: var(--ink); }

/* Status: stamps for decisions, tags for descriptive labels */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--sunk);
  color: var(--ink-2);
  font: 500 11px/1 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}

.badge.ok, .badge.allow { border-color: var(--allow-line); background: var(--allow-bg); color: var(--allow); }
.badge.warn, .badge.review { border-color: var(--review-line); background: var(--review-bg); color: var(--review); }
.badge.bad, .badge.block { border-color: var(--block-line); background: var(--block-bg); color: var(--block); }
.badge.info { border-color: var(--line-strong); background: var(--surface); color: var(--ink-2); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--sunk);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: middle;
}

.tag .i { width: 13px; height: 13px; }
.tag.ok { border-color: var(--allow-line); background: var(--allow-bg); color: var(--allow); }
.tag.warn { border-color: var(--review-line); background: var(--review-bg); color: var(--review); }
.tag.bad { border-color: var(--block-line); background: var(--block-bg); color: var(--block); }

/* Signal marks: a decision state drawn as the logo's node. */
.signal {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.signal.allow { background: var(--allow-mark); }
.signal.review { background: var(--review-mark); }
.signal.block { background: var(--block-mark); }

/* Callouts */

.callout {
  position: relative;
  margin: 14px 0;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--sunk);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.5;
}

.callout::before {
  --i: var(--icon-info);
  content: "";
  position: absolute;
  top: 13px;
  left: 14px;
  width: 17px;
  height: 17px;
  background: var(--muted);
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}

.callout > * { margin: 0; }
.callout > * + * { margin-top: 6px; }
.callout h2, .callout h3 { font-size: 13.5px; }
.callout p { color: inherit; }
.callout pre { margin-top: 8px; background: var(--surface); }

.callout.ok { border-color: var(--allow-line); background: var(--allow-bg); }
.callout.warn { border-color: var(--review-line); background: var(--review-bg); }
.callout.bad { border-color: var(--block-line); background: var(--block-bg); }
.callout.ok::before {
  --i: var(--icon-check-circle);
  background: var(--allow);
}
.callout.warn::before {
  --i: var(--icon-hourglass-medium);
  background: var(--review);
}
.callout.bad::before {
  --i: var(--icon-warning);
  background: var(--block);
}

/* Containers */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  min-height: 52px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 { font-size: 14px; }
.panel-header p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel-header .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-body { padding: 18px; }
.panel-body > :first-child { margin-top: 0; }
.panel-body > :last-child { margin-bottom: 0; }
.panel-body + .panel-body { border-top: 1px solid var(--line); }
.panel-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

.panel > .table-wrap:last-child table tbody tr:last-child td { border-bottom: 0; }

/* Tables */

.table-wrap {
  position: relative; /* clips visually hidden header labels on narrow screens */
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: bottom;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}

tbody tr { transition: background-color var(--dur) var(--ease); }
tbody tr:hover { background: color-mix(in srgb, var(--sunk) 70%, transparent); }
td a { color: var(--ink); font-weight: 500; text-decoration: none; }
td a:hover { text-decoration: underline; }
td small, td .sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
td.num, th.num { text-align: right; }

/* Key/value facts */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.facts > div {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
}

.facts dt, .facts small { color: var(--muted); font-size: 12px; font-weight: 500; }
.facts dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.facts dd.mono { font-weight: 450; }
.facts span { color: var(--muted); font-size: 12.5px; }

.kv {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr);
  gap: 0;
}

.kv dt { padding-right: 20px; }

.kv dt, .kv dd {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }

/* In narrow side columns, key/value pairs stack. */
aside .kv { grid-template-columns: minmax(0, 1fr); }
aside .kv dt { padding-bottom: 0; border-bottom: 0; font-size: 12px; }
aside .kv dd { padding-top: 2px; }

/* Stat strip */

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 16px 18px 18px;
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
}

.metric small {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.metric strong {
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}

.metric .subline { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.metric.bad strong { color: var(--block); }
.metric.warn strong { color: var(--review); }
.metric.error { grid-column: 1 / -1; }
.metric.error strong { font-size: 14px; letter-spacing: 0; color: var(--block); }

.metrics-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 18px;
  color: var(--muted);
  font-size: 12.5px;
}

/* Empty and loading states */

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 40px 24px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.empty > .i { width: 22px; height: 22px; margin-bottom: 4px; color: var(--faint); }
.empty strong, .empty h2 { color: var(--ink); font-size: 14px; }
.empty p { max-width: 52ch; margin: 0; color: var(--muted); }
.empty .button { margin-top: 8px; }

/* Disclosure */

.disclosure {
  border-top: 1px solid var(--line);
}

.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  color: var(--ink);
  font-weight: 500;
  list-style: none;
}

.disclosure > summary::-webkit-details-marker { display: none; }

.disclosure > summary::before {
  --i: var(--icon-caret-right);
  content: "";
  width: 12px;
  height: 12px;
  background: var(--muted);
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
  transition: transform var(--dur) var(--ease);
}

.disclosure[open] > summary::before { transform: rotate(90deg); }
.disclosure > :not(summary) { margin: 0 0 12px 20px; }
.disclosure > pre { margin-left: 20px; }

/* Segmented choices */

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: calc(var(--r) + 4px);
  background: var(--sunk);
}

.segmented a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.segmented a:hover { background: var(--hover); color: var(--ink); }

.segmented a[aria-current] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}

/* Choice cards (radio) */

.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 10px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 400;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.choice-card:hover { border-color: var(--line-strong); }
.choice-card:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.choice-card:has(input:disabled) { opacity: .6; cursor: not-allowed; }
.choice-card > span { display: grid; gap: 3px; }
.choice-card strong { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.choice-card small { color: var(--muted); font-size: 12px; font-weight: 500; }
.choice-card strong small {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--sunk);
}

/* Steps: an ordered process with a connecting rail */

.steps {
  counter-reset: step;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps > li {
  position: relative;
  margin: 0;
  padding: 0 0 28px 44px;
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font: 600 12px/1 var(--mono);
}

.steps > li::after {
  content: "";
  position: absolute;
  top: 30px;
  bottom: 4px;
  left: 13px;
  width: 1px;
  background: var(--line);
}

.steps > li:last-child { padding-bottom: 0; }
.steps > li:last-child::after { display: none; }
.steps > li > h2, .steps > li > h3 { margin: 2px 0 8px; font-size: 15px; }

/* Decision ledger: a record of tool checks, drawn the way the console shows them. */

.ledger {
  position: relative;
  container-type: inline-size;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.ledger-head, .ledger-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  color: var(--muted);
  font-size: 12.5px;
}

.ledger-head { border-bottom: 1px solid var(--line); }
.ledger-head strong { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.ledger-head .mono, .ledger-foot .mono { font-size: 12px; }

.ledger-foot {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--sunk) 60%, transparent);
}

.ledger-foot span:first-child { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.ledger-foot .i { width: 14px; height: 14px; color: var(--allow); }

.ledger-rows {
  margin: 0;
  padding: 8px 18px;
  list-style: none;
}

.ledger-row {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
  margin: 0;
  padding: 14px 0;
}

.ledger-row + .ledger-row { margin-top: 0; border-top: 1px dashed var(--line); }

.ledger-node {
  position: relative;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 4px var(--surface);
}

.ledger-node.allow { background: var(--allow-mark); }
.ledger-node.review { background: var(--review-mark); }
.ledger-node.block { background: var(--block-mark); }

/* The chain: each record links to the one before it. */
.ledger-row + .ledger-row::before {
  content: "";
  position: absolute;
  top: calc(23px - 100%);
  left: 6.5px;
  width: 1px;
  height: 100%;
  background: var(--line-strong);
  transform-origin: top;
}

.ledger-call {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  font: 500 13.5px/1.35 var(--mono);
}

.ledger-call b { font-weight: 600; }
.ledger-call span { overflow: hidden; color: var(--ink-2); font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }

.ledger-meta {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--muted);
  font-size: 12px;
}

.ledger-meta .mono { font-size: 11.5px; }
.ledger-row .badge { grid-column: 3; grid-row: 1 / span 2; align-self: center; }

@media (prefers-reduced-motion: no-preference) {
  .hero .ledger-row, .auth-aside .ledger-row { animation: row-in 560ms var(--ease) both; }
  .hero .ledger-row .badge, .auth-aside .ledger-row .badge { animation: stamp 420ms cubic-bezier(.34, 1.56, .64, 1) both; }
  .hero .ledger-row .ledger-node, .auth-aside .ledger-row .ledger-node { animation: node-in 420ms cubic-bezier(.34, 1.56, .64, 1) both; }
  .hero .ledger-row + .ledger-row::before, .auth-aside .ledger-row + .ledger-row::before { animation: chain 420ms var(--ease) both; }
  .hero .ledger-foot, .auth-aside .ledger-foot { animation: fade 700ms var(--ease) both; }

  .ledger-row:nth-child(1) { animation-delay: .75s; }
  .ledger-row:nth-child(1) .ledger-node { animation-delay: .8s; }
  .ledger-row:nth-child(1) .badge { animation-delay: 1.1s; }
  .ledger-row:nth-child(2)::before { animation-delay: 1.3s; }
  .ledger-row:nth-child(2) { animation-delay: 1.45s; }
  .ledger-row:nth-child(2) .ledger-node { animation-delay: 1.5s; }
  .ledger-row:nth-child(2) .badge { animation-delay: 1.8s; }
  .ledger-row:nth-child(3)::before { animation-delay: 2s; }
  .ledger-row:nth-child(3) { animation-delay: 2.15s; }
  .ledger-row:nth-child(3) .ledger-node { animation-delay: 2.2s; }
  .ledger-row:nth-child(3) .badge { animation-delay: 2.5s; }
  .hero .ledger-foot, .auth-aside .ledger-foot { animation-delay: 2.85s; }
}

@keyframes row-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes stamp {
  0% { opacity: 0; transform: scale(1.45) rotate(-3deg); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

@keyframes node-in {
  from { transform: scale(0); }
  to { transform: none; }
}

@keyframes chain {
  from { transform: scaleY(0); }
  to { transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@container (max-width: 440px) {
  .ledger-row { grid-template-columns: 14px minmax(0, 1fr); }
  .ledger-row .badge { grid-column: 2; grid-row: auto; justify-self: start; margin-top: 4px; }
}

.nowrap { white-space: nowrap; }

/* Narrow screens: a long button label wraps inside the button instead of
   pushing the page sideways. Single-line buttons keep their height. */
@media (max-width: 640px) {
  .button {
    flex-shrink: 0;
    max-width: 100%;
    padding-block: 6px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }
  .button:has(> .i) { text-align: left; }
  .button.small { padding-block: 5px; }
  .button.large { padding-block: 6px; }
  /* Tables scroll inside .table-wrap, so their buttons stay on one line. */
  td .button { max-width: none; white-space: nowrap; }
}

/* Reduced motion: no transitions or animations beyond instant state changes. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
