/* ================================================================
   DELT4 dashboard — design system (Stage 2b)
   Hand-rolled CSS. No frameworks, no build step, no external
   resources. Tokens are the single source of truth — everything
   below is assembled from them.
   ================================================================ */

:root {
  /* surfaces */
  --bg: #0b0b10;
  --surface: #141419;
  --surface-2: #1b1b22;
  --border: #26262e;

  /* ink */
  --text: #f5f5f7;
  --muted: #9a9aa5;
  --faint: #5f5f69;

  /* brand accent — used sparingly: active nav, primary actions, links */
  --accent: #6d7cff;
  --accent-strong: #8491ff;
  --accent-ink: #0b0b10; /* text on accent fills */
  --accent-soft: rgba(109, 124, 255, 0.12);
  --accent-line: rgba(109, 124, 255, 0.35);

  /* status — 1:1 with receipt flags (GREEN / YELLOW / RED) */
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #fb7185;
  --green-soft: rgba(52, 211, 153, 0.11);
  --green-line: rgba(52, 211, 153, 0.30);
  --yellow-soft: rgba(251, 191, 36, 0.11);
  --yellow-line: rgba(251, 191, 36, 0.30);
  --red-soft: rgba(251, 113, 133, 0.11);
  --red-line: rgba(251, 113, 133, 0.30);

  /* type — system stack only; mono for hashes, IDs, keys, timestamps */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas,
               monospace;

  /* 8px spacing grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* radii */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  --sidebar-w: 240px;
  --topbar-h: 56px;
  --content-max: 1200px;
}

/* ── base ─────────────────────────────────────────────────────── */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
  scrollbar-color: var(--border) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
}

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

.small {
  font-size: 12px;
}

::selection {
  background: rgba(109, 124, 255, 0.35);
}

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

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
}

/* ── app frame ────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* sidebar */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
}

.sidebar-logo {
  padding: 4px 12px 20px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.logo-dot {
  color: var(--accent);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 13.5px;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 18px;
  border-radius: 2px;
  background: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tenant-name {
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
}

.tenant-fp {
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.link-btn {
  align-self: flex-start;
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  color: var(--faint);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--text);
}

/* top bar */

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: rgba(11, 11, 16, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.page-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.verifier-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, opacity 0.12s ease;
}

.verifier-pill:hover {
  border-color: var(--accent-line);
}

.verifier-pill:disabled {
  cursor: default;
}

.verifier-pill.is-running {
  opacity: 0.6;
}

.verifier-action {
  color: var(--accent);
  font-weight: 550;
}

/* content column */

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  align-content: start;
}

.view-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* ── dots (status markers) ────────────────────────────────────── */

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.dot-lg {
  width: 12px;
  height: 12px;
}

.dot-muted {
  background: var(--faint);
}

.dot-green {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.dot-yellow {
  background: var(--yellow);
  box-shadow: 0 0 0 3px var(--yellow-soft);
}

.dot-red {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

/* ── badges (pill: dot + label, never colour alone) ───────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.badge .dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.badge-green {
  color: var(--green);
  background: var(--green-soft);
  border-color: var(--green-line);
}

.badge-yellow {
  color: var(--yellow);
  background: var(--yellow-soft);
  border-color: var(--yellow-line);
}

.badge-red {
  color: var(--red);
  background: var(--red-soft);
  border-color: var(--red-line);
}

/* ── cards ────────────────────────────────────────────────────── */

.card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-link {
  font-size: 12.5px;
  font-weight: 500;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* metric cards — a slim strip of context under the verdict sentence */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric-sub {
  font-size: 11.5px;
  color: var(--faint);
}

/* overview verdict — the headline sentence */

.verdict-card {
  padding: var(--sp-5) var(--sp-6);
  gap: var(--sp-3);
}

.verdict-card-good {
  background: var(--green-soft);
  border-color: var(--green-line);
}

.verdict-card-bad {
  background: var(--red-soft);
  border-color: var(--red-line);
}

.verdict-card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.verdict-card-word {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.verdict-card-good .verdict-card-word {
  color: var(--green);
}

.verdict-card-bad .verdict-card-word {
  color: var(--red);
}

.verdict-paragraph {
  margin: 0;
  max-width: 78ch;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}

/* overview activity list — one readable line per receipt */

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s ease;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover,
.activity-item:focus-visible {
  background: var(--surface-2);
}

.activity-ts {
  flex: none;
  color: var(--muted);
}

.activity-mid {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

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

.activity-sep {
  color: var(--faint);
}

.activity-topic {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-item .badge {
  flex: none;
}

/* chain integrity card rows */

.chain-stats {
  font-size: 13px;
  color: var(--muted);
}

.kv-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
}

.kv-label {
  flex: none;
  min-width: 88px;
  color: var(--muted);
}

.hash {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

/* ── buttons ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease,
              border-color 0.12s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  color: var(--red);
  border-color: var(--red-line);
}

.btn-danger:hover:not(:disabled) {
  background: var(--red-soft);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--r-sm);
}

.btn-block {
  width: 100%;
}

.copy-btn {
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: none;
  color: var(--faint);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--accent-line);
}

.copy-btn.is-copied {
  color: var(--green);
  border-color: var(--green-line);
}

/* ── inputs ───────────────────────────────────────────────────── */

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.input::placeholder {
  color: var(--faint);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── tables ───────────────────────────────────────────────────── */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background 0.1s ease;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table .mono {
  color: var(--text);
}

.table .cell-ts {
  color: var(--muted);
}

.row-link {
  cursor: pointer;
}

.row-revoked {
  opacity: 0.55;
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

.arrow {
  color: var(--faint);
  padding: 0 6px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12.5px;
}

.pager {
  display: flex;
  gap: 8px;
}

/* ── states: loading / empty / error ──────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: var(--sp-6);
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--faint);
  text-align: center;
}

.empty-glyph {
  font-size: 26px;
  line-height: 1;
}

.empty p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.panel-error {
  padding: 12px 14px;
  border: 1px dashed var(--red-line);
  border-radius: var(--r-md);
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
}

.panel-note {
  max-width: 680px;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

/* ── corrections — told in prose, not columns ─────────────────── */

.correction-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.correction-item {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.correction-item:last-child {
  border-bottom: none;
}

.correction-line {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.correction-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

/* ── quarantine cards ─────────────────────────────────────────── */

.q-card {
  gap: var(--sp-3);
}

/* the reason is the story — a one-line sentence, first */
.q-reason {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin: 0;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.55;
}

.q-reason .dot {
  margin-top: 6px;
}

.q-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}

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

.q-summary {
  font-size: 14px;
  line-height: 1.55;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 3px 9px;
  border: 1px solid var(--red-line);
  border-radius: var(--r-sm);
  background: var(--red-soft);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.q-raw summary {
  font-size: 12px;
  color: var(--faint);
  cursor: pointer;
  user-select: none;
}

.q-raw summary:hover {
  color: var(--muted);
}

.q-raw[open] summary {
  margin-bottom: 8px;
}

.json-block {
  margin: 0;
  padding: 14px;
  max-height: 320px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre;
}

/* ── compliance verdict ───────────────────────────────────────── */

.verdict-hero {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  padding: var(--sp-5);
  border: 1px solid;
  border-radius: var(--r-lg);
}

.verdict-hero-green {
  background: var(--green-soft);
  border-color: var(--green-line);
}

.verdict-hero-red {
  background: var(--red-soft);
  border-color: var(--red-line);
}

.verdict-main {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.verdict-word {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.verdict-reason {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.verdict-stats {
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.vstat-value {
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.vstat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.first-error {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12.5px;
}

.fe-title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.first-error .muted {
  margin-top: 4px;
}

/* one-line plain-English verdict under the hero */

.compliance-verdict {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ── API keys ─────────────────────────────────────────────────── */

.key-create-form {
  display: flex;
  gap: var(--sp-3);
}

.key-create-form .input {
  max-width: 320px;
}

.key-once {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--yellow-line);
  border-radius: var(--r-md);
}

.key-once-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--yellow);
}

.key-once-value {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  overflow-wrap: anywhere;
}

.key-once-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.key-once-warning {
  font-size: 12px;
  color: var(--yellow);
}

/* ── login screen ─────────────────────────────────────────────── */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: radial-gradient(
      620px 420px at 50% 32%,
      rgba(109, 124, 255, 0.07),
      transparent 70%
    ),
    var(--bg);
}

.login-card {
  width: 360px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.login-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.login-sub {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.login-error {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--red-line);
  border-radius: var(--r-sm);
  background: var(--red-soft);
  color: var(--red);
  font-size: 12.5px;
}

.login-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--faint);
}

/* ── receipt detail drawer ────────────────────────────────────── */

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.55);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(520px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
}

.drawer:not([hidden]) {
  animation: drawer-in 0.18s ease;
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.drawer-section {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 550;
}

.verdict-green {
  background: var(--green-soft);
  border-color: var(--green-line);
}

.verdict-red {
  background: var(--red-soft);
  border-color: var(--red-line);
}

/* one-line plain-English summary at the top of the drawer */

.drawer-summary {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.55;
}

.kv {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.kv-item {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: var(--sp-3);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.kv-item:last-child {
  border-bottom: none;
}

.kv-item dt {
  color: var(--faint);
}

.kv-item dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

/* ── noscript ─────────────────────────────────────────────────── */

noscript {
  display: block;
  padding: var(--sp-6);
  text-align: center;
  color: var(--muted);
  font-family: var(--font-ui);
}

/* ── records view (Stage 7) — the product centre ──────────────── */

.records-toolbar {
  display: flex;
}

.records-toolbar .input {
  max-width: 480px;
}

/* facet filter chips — one group per dimension, live counts */
.facet-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.facet-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.facet-label {
  flex: none;
  width: 56px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.facet-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease,
              background 0.12s ease;
}

.facet-chip:hover {
  color: var(--text);
  border-color: var(--accent-line);
}

.facet-chip.active {
  color: var(--accent-strong);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.facet-count {
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.facet-chip.active .facet-count {
  color: var(--accent);
}

/* record cards — lead with the human content, not slugs */
.record-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.record-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.record-card:hover,
.record-card:focus-visible {
  border-color: var(--accent-line);
  background: var(--surface);
}

.record-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 11.5px;
  color: var(--faint);
}

.record-excerpt {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* full content block in the record drawer */
.record-content {
  margin: 0;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* overview "Recent records" list items */
.recent-record-item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s ease;
}

.recent-record-item:last-child {
  border-bottom: none;
}

.recent-record-item:hover,
.recent-record-item:focus-visible {
  background: var(--surface-2);
}

.rr-title {
  flex: 1;
  min-width: 0;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-meta {
  flex: none;
  color: var(--faint);
}

/* ── responsive ───────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-5);
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-logo {
    padding: 0;
    white-space: nowrap;
  }

  .nav {
    flex: 1;
    flex-direction: row;
    gap: 2px;
    overflow-x: auto;
  }

  .nav-item {
    white-space: nowrap;
  }

  .nav-item.active::before {
    display: none;
  }

  .sidebar-foot {
    flex-direction: row;
    align-items: center;
    gap: var(--sp-3);
    margin-top: 0;
    padding: 0;
    border-top: none;
  }

  .tenant-fp {
    display: none;
  }

  .link-btn {
    margin-top: 0;
  }

  .topbar {
    padding: 0 var(--sp-5);
  }

  .content {
    padding: var(--sp-5);
  }
}

@media (max-width: 560px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: var(--sp-4);
  }

  .verifier-label {
    display: none;
  }

  .key-create-form {
    flex-direction: column;
  }

  .key-create-form .input {
    max-width: none;
  }

  .kv-item {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ── motion ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
