/* PalmGuardAI console, a Palm Mind AI product.
   Minimal light shell; PalmMind blue (#1B6FD8) only for actions and focus,
   PalmMind navy (#0F2A4A) for brand moments. Onest, self-hosted (CSP 'self').
   The verdict colours (pass / redact / block) are the product's own language
   and are the only strong colours outside actions. */

@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  --bg: #fbfcfd;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --border: #e7eaef;
  --border-strong: #d5dae2;
  --ink: #0e1726;
  --ink-2: #4b5565;
  --ink-3: #848ea0;
  --primary: #1b6fd8;
  --primary-hover: #155ebd;
  --primary-ink: #ffffff;
  --primary-50: #eef4fd;
  --primary-100: #d9e7fb;
  --navy: #0f2a4a;
  --pass: #157a59;
  --pass-50: #e8f6f0;
  --redact: #b25e09;
  --redact-50: #fdf3e6;
  --block: #c42a30;
  --block-50: #fcebec;
  --focus-ring: 0 0 0 3px rgb(27 111 216 / 22%);
  --shadow-pop: 0 1px 2px rgb(14 23 38 / 4%), 0 12px 32px -12px rgb(14 23 38 / 18%);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;
  --sidebar-w: 256px;
  --side-bg: #f6f7f9;
  --side-ink: #2b3544;
  --side-faint: #8a94a5;
  --side-line: #e6e9ee;
  --side-hover: #eceff3;
  --font: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans",
    "Noto Sans Devanagari", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

/* Dark theme: chosen in the top bar or on Account (light is the default). */
:root[data-theme="dark"] {
  --bg: #0a0f17;
  --surface: #0f1622;
  --surface-2: #121a27;
  --border: #1d2634;
  --border-strong: #2a3546;
  --ink: #e9eef5;
  --ink-2: #aab6c6;
  --ink-3: #6f7c8f;
  --primary: #5b9df1;
  --primary-hover: #7ab0f4;
  --primary-ink: #061629;
  --primary-50: #13233a;
  --primary-100: #1a3152;
  --pass: #4fc69d;
  --pass-50: #0f2a22;
  --redact: #f0a64a;
  --redact-50: #2e2210;
  --block: #f2767c;
  --block-50: #33171a;
  --shadow-pop: 0 1px 2px rgb(0 0 0 / 40%), 0 16px 40px -16px rgb(0 0 0 / 70%);
  --side-bg: #0c121b;
  --side-ink: #d3dbe6;
  --side-faint: #6f7c8f;
  --side-line: #1a2230;
  --side-hover: #141c29;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 14.5px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.75rem; font-weight: 640; letter-spacing: -0.028em; }
h2 { font-size: 0.98rem; font-weight: 620; letter-spacing: -0.01em; }
h3 { font-size: 0.9rem; font-weight: 600; }
p { margin: 0 0 0.75rem; max-width: 72ch; }
.muted { color: var(--ink-3); }
.small { font-size: 0.84rem; }
.mono { font-family: var(--mono); font-size: 0.86em; }
[hidden] { display: none !important; }
.icon { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }

/* ----------------------------------------------------------------- shell */

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 12px 14px;
  background: var(--side-bg);
  border-right: 1px solid var(--side-line);
  color: var(--side-ink);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; color: inherit; }
.brand:hover { color: inherit; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-weight: 700; font-size: 1.08rem; letter-spacing: -0.025em; line-height: 1.1; color: var(--ink); }
.brand-name .ai { color: var(--primary); }
.brand-by { display: block; margin-top: 2px; font-size: 0.68rem; font-weight: 500; color: var(--ink-3); }

.org-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--side-line);
  border-radius: var(--radius);
  background: var(--surface);
}
.org-switch .org-meta { min-width: 0; flex: 1; }
.org-switch .org-caption { font-size: 0.68rem; color: var(--ink-3); line-height: 1.2; }
.org-switch select {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 0.9rem var(--font);
  cursor: pointer;
  box-shadow: none;
}
.org-switch select:focus { box-shadow: none; }
.org-switch .org-name { font-weight: 600; font-size: 0.9rem; color: var(--ink); }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #2a7de0, #0f2a4a);
}
.avatar.round { border-radius: 50%; background: linear-gradient(140deg, #6a8fb8, #0f2a4a); }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-heading { padding: 6px 10px 4px; font-size: 0.72rem; font-weight: 550; color: var(--side-faint); }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--side-ink);
  font-weight: 500;
  font-size: 0.92rem;
}
.nav a .icon { color: var(--side-faint); }
.nav a:hover { background: var(--side-hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); border-color: var(--side-line); color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"] .icon { color: var(--primary); }
.nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.nav a .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav > .small { padding: 4px 10px; color: var(--side-faint); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); }
.user-card:hover { background: var(--side-hover); }
.user-card .who { min-width: 0; flex: 1; line-height: 1.25; }
.user-card .who .name { font-weight: 600; font-size: 0.86rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .who .role { font-size: 0.72rem; color: var(--side-faint); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--side-faint);
  box-shadow: none;
  cursor: pointer;
}
.icon-btn:hover { background: var(--side-line); color: var(--ink); }

.made-by { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 0.7rem; color: var(--side-faint); }
.made-by:hover { color: var(--ink-2); }
.made-by img { height: 18px; width: auto; }

/* ---------------------------------------------------------------- topbar */

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 36px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.86rem; color: var(--ink-3); }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--border-strong); }
.crumbs .current { color: var(--ink); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .menu-toggle { display: none; color: var(--ink-2); }
.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 500;
}
.chip-link:hover { color: var(--ink); border-color: var(--border-strong); }
.chip-link .icon { width: 14px; height: 14px; }

.main { padding: 32px 36px 72px; min-width: 0; width: 100%; max-width: 1480px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head .sub { margin-top: 6px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }

/* -------------------------------------------------------------- controls */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 550 0.88rem/1.2 var(--font);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
button:hover, .button:hover { background: var(--surface-2); color: var(--ink); }
button.primary, .button.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
button.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--primary)); border-color: transparent; color: var(--bg); }
button.accent { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
button.accent:hover { background: var(--primary-hover); color: var(--primary-ink); }
button.danger { color: var(--block); border-color: color-mix(in srgb, var(--block) 30%, var(--border)); }
button.danger:hover { background: var(--block-50); color: var(--block); }
button.link { padding: 0; border: 0; background: none; color: var(--primary); font-weight: 550; }
button.link:hover { background: none; color: var(--primary-hover); }
button.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--surface-2); color: var(--ink); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
kbd {
  padding: 1px 5px;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 4px;
  font: 500 0.72rem var(--mono);
  opacity: 0.75;
}

input, select, textarea {
  font: 400 0.92rem var(--font);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  min-width: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--ink-3); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
textarea { width: 100%; min-height: 110px; line-height: 1.6; resize: vertical; }

label { display: block; margin-bottom: 6px; font-size: 0.84rem; font-weight: 550; color: var(--ink-2); }
.field { margin-bottom: 16px; }
.field > input:not([type="checkbox"]):not([type="radio"]), .field > select { width: 100%; max-width: 480px; }
.field .hint { margin-top: 5px; font-size: 0.8rem; font-weight: 400; color: var(--ink-3); }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline label { margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 500;
  font-size: 0.86rem;
  color: var(--ink-2);
  cursor: pointer;
}
.checks label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--ink); }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { padding: 0; margin-bottom: 10px; }
fieldset > label.field {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 8px;
}
fieldset > label.field:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
fieldset > label.field .hint { margin-left: 23px; }

/* Tabs: underline, quiet. */
.tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs a {
  padding: 10px 0;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  font-weight: 550;
  font-size: 0.9rem;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a .new { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--primary-50); color: var(--primary); font-size: 0.68rem; font-weight: 650; }

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.panel > h2 { margin-bottom: 4px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-2 > .panel { margin-bottom: 0; }
form .grid-2 { margin-bottom: 0; gap: 0 24px; }

/* KPI strip: one quiet container, numbers carry it, sparklines add the pulse. */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.figure { position: relative; padding: 16px 18px 14px; box-shadow: -1px 0 0 var(--border); min-height: 104px; }
.figure .label { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 550; color: var(--ink-3); }
.figure .label .icon { width: 14px; height: 14px; }
.figure .value { margin-top: 8px; font-size: 1.6rem; font-weight: 620; letter-spacing: -0.035em; line-height: 1.1; }
.figure.pass .value { color: var(--pass); }
.figure.redact .value { color: var(--redact); }
.figure.block .value { color: var(--block); }
.spark { display: block; width: 100%; height: 26px; margin-top: 8px; color: var(--ink-3); }
.figure.redact .spark { color: var(--redact); }
.figure.block .spark { color: var(--block); }
.figure.scans .spark { color: var(--primary); }
.spark path.area { fill: currentColor; opacity: 0.1; stroke: none; }
.spark path.line { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.chart-box { position: relative; height: 280px; }
.chart-box.short { height: 220px; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; margin: 0 -22px; }
.panel > .table-wrap:first-child { margin-top: -20px; }
.panel > .table-wrap:last-child { margin-bottom: -20px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
th { font-size: 0.78rem; font-weight: 550; color: var(--ink-3); white-space: nowrap; }
td { white-space: nowrap; color: var(--ink); }
td:first-child, td.wrap { white-space: normal; }
tbody tr td { transition: background 0.1s; }
tbody tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 16px; text-align: center; color: var(--ink-3); }
.empty .empty-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-3); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pass, .badge.active { background: var(--pass-50); color: var(--pass); }
.badge.redact, .badge.expiring { background: var(--redact-50); color: var(--redact); }
.badge.block, .badge.revoked, .badge.suspended, .badge.error { background: var(--block-50); color: var(--block); }

.meter { height: 6px; margin-top: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.meter.warn > span { background: var(--redact); }
.meter.full > span { background: var(--block); }

/* ------------------------------------------------------------ one-offs */

.secret {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--redact) 35%, var(--border));
  border-radius: var(--radius-lg);
  background: var(--redact-50);
}
.secret code {
  display: block;
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px dashed color-mix(in srgb, var(--redact) 45%, var(--border));
  font: 500 0.9rem var(--mono);
  color: var(--ink);
  word-break: break-all;
}
.revealed { padding: 1px 6px; border-radius: 5px; background: var(--block-50); color: var(--block); }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-2);
}
.notice.warn { border-color: color-mix(in srgb, var(--redact) 35%, var(--border)); background: var(--redact-50); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: 420px;
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  box-shadow: var(--shadow-pop);
}
.toast.error { background: var(--block); color: #fff; }

dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
}
dialog h2 { margin-bottom: 8px; font-size: 1.12rem; }
dialog::backdrop { background: rgb(10 15 23 / 45%); backdrop-filter: blur(2px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-error { min-height: 1.2em; margin: 8px 0 0; color: var(--block); font-size: 0.86rem; }
.form-error:empty { min-height: 0; margin: 0; }

/* ------------------------------------------------------------ playground */

.pg { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.pg .panel { margin-bottom: 0; }
.pg-input { position: sticky; top: 74px; }
.pg-input textarea { min-height: 170px; font-size: 0.95rem; }
.pg-key { display: flex; gap: 8px; }
.pg-key input { flex: 1; font-family: var(--mono); font-size: 0.84rem; }
.key-state { display: flex; align-items: center; gap: 8px; min-height: 22px; margin-top: 8px; font-size: 0.82rem; color: var(--ink-3); }
.samples { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.samples button { padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 500; color: var(--ink-2); }
.pg-run { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }

.verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}
.verdict .v-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--surface); }
.verdict .v-icon .icon { width: 20px; height: 20px; }
.verdict .v-title { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.02em; }
.verdict .v-sub { font-size: 0.84rem; color: var(--ink-3); }
.verdict .v-meta { margin-left: auto; text-align: right; font-size: 0.82rem; color: var(--ink-3); }
.verdict .v-meta strong { display: block; font-size: 1.05rem; color: var(--ink); font-weight: 620; }
.verdict.pass { background: var(--pass-50); border-color: color-mix(in srgb, var(--pass) 25%, transparent); }
.verdict.pass .v-icon, .verdict.pass .v-title { color: var(--pass); }
.verdict.redact { background: var(--redact-50); border-color: color-mix(in srgb, var(--redact) 25%, transparent); }
.verdict.redact .v-icon, .verdict.redact .v-title { color: var(--redact); }
.verdict.block { background: var(--block-50); border-color: color-mix(in srgb, var(--block) 25%, transparent); }
.verdict.block .v-icon, .verdict.block .v-title { color: var(--block); }

/* Scan trace: the message passing through each guardrail. */
.trace { display: flex; align-items: stretch; gap: 0; margin-bottom: 20px; }
.trace .step {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.trace .step + .step { margin-left: 26px; }
.trace .step + .step::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 50%;
  width: 26px;
  border-top: 1px dashed var(--border-strong);
}
.trace .step .s-name { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.trace .step .s-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.trace .step .s-ms { font-size: 0.78rem; color: var(--ink-3); }
.trace .step.skipped { border-style: dashed; color: var(--ink-3); background: transparent; }

.pg-section { margin-top: 18px; }
.pg-section > h3 { margin-bottom: 8px; color: var(--ink-2); font-size: 0.82rem; font-weight: 600; }
.annotated {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  line-height: 2.05;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Redaction tape: detected values marked in place, labelled with their type. */
.ent { position: relative; padding: 2px 5px; border-radius: 5px; background: var(--redact-50); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--redact) 55%, transparent); }
.ent .ent-label { margin-left: 5px; padding: 0 5px; border-radius: 4px; background: var(--redact); color: #fff; font: 600 0.62rem/1.6 var(--font); vertical-align: 2px; }
.ent.block { background: var(--block-50); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--block) 55%, transparent); }
.ent.block .ent-label { background: var(--block); }
.output-text { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--mono); font-size: 0.86rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kv > div { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.kv .k { font-size: 0.74rem; color: var(--ink-3); }
.kv .v { margin-top: 2px; font-weight: 600; font-size: 0.92rem; }
details.raw summary { cursor: pointer; color: var(--ink-3); font-size: 0.84rem; margin-top: 18px; }
details.raw pre { margin: 10px 0 0; padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font: 0.8rem/1.55 var(--mono); overflow: auto; max-height: 360px; }
.pg-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 360px; text-align: center; color: var(--ink-3); }
.pg-empty .empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.spinner { width: 16px; height: 16px; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ auth pages */

.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 40px 52px;
  background:
    radial-gradient(800px 460px at 100% 0%, rgb(27 111 216 / 40%), transparent 62%),
    linear-gradient(180deg, #0f2a4a, #0a1d34);
  color: #dbe5f1;
}
.auth-brand .brand { padding: 0; }
.auth-brand .brand-name { font-size: 1.25rem; color: #fff; }
.auth-brand .brand-name .ai { color: #6aaaf5; }
.auth-brand .brand-by { color: #8ea4c0; }
.auth-pitch h2 { font-size: 2.1rem; line-height: 1.12; letter-spacing: -0.035em; color: #fff; font-weight: 640; max-width: 16ch; }
.auth-pitch p { margin-top: 14px; color: #a9bbd2; font-size: 1rem; max-width: 44ch; }
.specimen { max-width: 460px; border: 1px solid rgb(255 255 255 / 11%); border-radius: var(--radius-lg); background: rgb(4 14 28 / 45%); box-shadow: 0 30px 60px -30px rgb(0 0 0 / 60%); }
.specimen-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid rgb(255 255 255 / 8%); font-size: 0.76rem; color: #8ea4c0; }
.specimen-head .mono { color: #b8c8dc; }
.specimen-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.specimen .msg { padding: 10px 12px; border-radius: 10px; background: rgb(255 255 255 / 5%); color: #e3ebf5; font-size: 0.92rem; line-height: 1.65; }
.specimen .pii { padding: 1px 6px; border-radius: 5px; background: rgb(240 166 74 / 18%); color: #f5c078; font-family: var(--mono); font-size: 0.82rem; }
.specimen .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.78rem; color: #8ea4c0; }
.specimen .badge { font-size: 0.7rem; }
.specimen .badge.redact { background: rgb(240 166 74 / 16%); color: #f5c078; }
.specimen .badge.pass { background: rgb(79 198 157 / 16%); color: #7ad9b6; }
.auth-foot a { display: inline-flex; align-items: center; gap: 10px; font-size: 0.78rem; color: #8ea4c0; }
.auth-foot img { height: 22px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-form-inner { width: min(360px, 100%); }
.auth-form-inner > .brand { display: none; margin-bottom: 28px; padding: 0; }
.auth-form-inner h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-form-inner > .muted { margin-bottom: 26px; }
.auth-form-inner input:not([type="checkbox"]) { width: 100%; max-width: none; padding: 10px 12px; }
.auth-form-inner button.primary { width: 100%; margin-top: 8px; padding: 11px; font-size: 0.94rem; }
.auth-form-inner form > p.small { margin-top: 16px; }
.auth-made-by { display: none; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
  .pg { grid-template-columns: minmax(0, 1fr); }
  .pg-input { position: static; }
}

@media (max-width: 1100px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-inner > .brand { display: flex; }
  .auth-made-by { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; font-size: 0.8rem; color: var(--ink-3); }
  .auth-made-by img { height: 22px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .pg-key { flex-wrap: wrap; }
  .pg-key input { flex-basis: 100%; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgb(10 15 23 / 45%); }
  .topbar { padding: 0 16px; }
  .topbar .menu-toggle { display: inline-grid; }
  .topbar .chip-link span { display: none; }
  .main { padding: 22px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .trace { flex-direction: column; }
  .trace .step + .step { margin-left: 0; margin-top: 14px; }
  .trace .step + .step::before { left: 50%; top: -14px; width: 0; height: 14px; border-top: 0; border-left: 1px dashed var(--border-strong); }
  .verdict { flex-wrap: wrap; }
  .verdict .v-meta { margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ============================================================ v3 pages */

/* Theme-dependent logos */
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline; }

.theme-toggle { color: var(--ink-2); }
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }

/* Plain-language headline: the numbers carry the verdict colours. */
.headline {
  margin: 4px 0 26px;
  max-width: 62ch;
  font-size: 1.42rem;
  line-height: 1.45;
  font-weight: 450;
  letter-spacing: -0.018em;
  color: var(--ink-2);
}
.headline .n { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.headline .n.redact { color: var(--redact); }
.headline .n.block { color: var(--block); }
.headline .n.pass { color: var(--pass); }
.headline .quiet { color: var(--ink-3); }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 0.8rem; font-weight: 550; color: var(--ink-3); }
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pass); box-shadow: 0 0 0 3px var(--pass-50); }

/* Card grids (organizations, projects, members) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.12s, transform 0.12s;
}
a.card:hover { border-color: var(--border-strong); color: var(--ink); transform: translateY(-1px); }
.card-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.card-title { font-weight: 620; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { font-size: 0.8rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-stats { display: flex; gap: 18px; font-size: 0.8rem; color: var(--ink-3); }
.card-stats strong { display: block; font-size: 1.05rem; font-weight: 620; color: var(--ink); }
.card-stats .redact strong { color: var(--redact); }
.card-stats .block strong { color: var(--block); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.card.add { align-items: center; justify-content: center; border-style: dashed; color: var(--ink-3); min-height: 132px; cursor: pointer; background: transparent; font: inherit; }
.card.add:hover { color: var(--ink); border-color: var(--border-strong); }

/* Redaction tape: masked / secret values */
.tape {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 6px;
  background: repeating-linear-gradient(-45deg, var(--surface-2) 0 6px, color-mix(in srgb, var(--border) 70%, var(--surface-2)) 6px 12px);
  border: 1px solid var(--border);
  font: 500 0.82rem var(--mono);
  color: var(--ink-2);
  white-space: nowrap;
}
.tape b { color: var(--ink); font-weight: 600; }

/* Key list */
.key-list { display: flex; flex-direction: column; }
.key-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.key-row:last-child { border-bottom: 0; }
.key-row .k-name { font-weight: 600; }
.key-row .k-meta { font-size: 0.8rem; color: var(--ink-3); margin-top: 4px; }
.key-row .k-actions { display: flex; gap: 6px; }
.panel.flush { padding: 0; overflow: hidden; }

/* Settings: label column + content column */
.settings { display: flex; flex-direction: column; }
.settings-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: 32px; padding: 26px 0; border-top: 1px solid var(--border); }
.settings-section:first-child { border-top: 0; padding-top: 4px; }
.settings-section > .about h2 { margin-bottom: 6px; }
.settings-section > .about p { color: var(--ink-3); font-size: 0.88rem; }
.settings-section > .body { min-width: 0; }

/* Audit timeline */
.timeline { position: relative; }
.timeline .day { margin: 18px 0 8px; font-size: 0.8rem; font-weight: 600; color: var(--ink-3); }
.timeline .day:first-child { margin-top: 0; }
.tl-item { position: relative; display: grid; grid-template-columns: 70px 14px minmax(0, 1fr); gap: 12px; align-items: start; padding: 7px 0; }
.tl-time { font-size: 0.8rem; color: var(--ink-3); text-align: right; padding-top: 2px; }
.tl-dot { position: relative; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.tl-item::before { content: ""; position: absolute; left: 87px; top: 22px; bottom: -8px; width: 1px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-item.key .tl-dot { border-color: var(--primary); }
.tl-item.reveal .tl-dot { border-color: var(--block); background: var(--block-50); }
.tl-item.limits .tl-dot, .tl-item.privacy .tl-dot { border-color: var(--redact); }
.tl-what { font-size: 0.92rem; }
.tl-what strong { font-weight: 600; }
.tl-detail { font-size: 0.8rem; color: var(--ink-3); margin-top: 2px; }

/* Log stream */
.stream { display: flex; flex-direction: column; }
.stream-row { display: grid; grid-template-columns: 4px 92px minmax(0, 1.4fr) minmax(0, 1.6fr) 80px 90px; gap: 14px; align-items: center; padding: 11px 18px 11px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.stream-row:last-child { border-bottom: 0; }
.stream-row .bar { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--border-strong); }
.stream-row.pass .bar { background: var(--pass); }
.stream-row.redact .bar { background: var(--redact); }
.stream-row.block .bar, .stream-row.rejected .bar { background: var(--block); }
.stream-row .when { color: var(--ink-3); font-size: 0.8rem; }
.stream-row .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-row .sub { color: var(--ink-3); font-size: 0.8rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-row .ms { text-align: right; color: var(--ink-2); }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.seg button { padding: 6px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); font-size: 0.84rem; box-shadow: none; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border); }
.pg-mode { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.pg-project { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.pg-project select { min-width: 260px; }

@media (max-width: 900px) {
  .settings-section { grid-template-columns: 1fr; gap: 12px; }
  .key-row { grid-template-columns: 1fr; gap: 8px; }
  .stream-row { grid-template-columns: 4px 1fr; row-gap: 2px; }
  .stream-row > :not(.bar) { grid-column: 2; }
  .headline { font-size: 1.15rem; }
}

.card-id { min-width: 0; }
.card.pending { border-style: dashed; }
a.card-top, a.card-top:hover { color: inherit; }
.theme-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-choice button { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; border-radius: var(--radius-lg); text-align: left; font-weight: 550; }
.theme-choice button[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.theme-swatch { height: 64px; border-radius: 8px; border: 1px solid var(--border); background: linear-gradient(#fff 0 30%, #f4f6f9 30%); }
.theme-swatch.dark { background: linear-gradient(#0f1520 0 30%, #161e2b 30%); }
.theme-swatch.system { background: linear-gradient(90deg, #f4f6f9 50%, #161e2b 50%); }
@media (max-width: 600px) { .theme-choice { grid-template-columns: 1fr; } }
.stream-row .what { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.stream-row .what > :not(.badge) { overflow: hidden; text-overflow: ellipsis; }
.key-row { grid-template-columns: minmax(0, 2fr) 150px 210px 250px; }
.key-row .k-actions { justify-content: flex-end; }
@media (max-width: 900px) { .key-row { grid-template-columns: 1fr; } .key-row .k-actions { justify-content: flex-start; } }
