/* NanoCo portal design system. Brand reference: near-monochrome ink on paper,
 * warm linen grouping, one action teal, and one restrained highlight. */

/* ── Inter (vendored variable font — no CDN) ───────────────────────────────── */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/fonts/InterVariable.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/fonts/InterVariable-Italic.woff2") format("woff2");
}

:root {
  --ink: #1a1612;
  --ink-soft: #3a332b;
  --ink-softest: #8a8178;
  --icon: #3a332b;
  --paper: #ffffff;
  --surface-tint: #f2ebd7;
  --mint-fill: #faf5ea;
  --divider-soft: #e7e0d3;
  --divider-solid: #8a8178;
  --teal: #0f756d;
  --teal-strong: #095f59;
  --teal-bright: #1fb8b0;
  --teal-subtle: #e1f4f1;
  --teal-border: #80cbc5;
  --mint: #56edd6;
  --on-teal: #ffffff;
  --highlight: #e85d3a;
  --danger: #b6432c;
  --danger-subtle: #fcebe6;
  --amber: #9a6108;
  --amber-subtle: #fff2cf;

  /* ── Page-layout spacing & rhythm (block gap > line height) ─────────────── */
  --space-2xs: 12px;
  --space-xs: 16px;
  --space-sm: 24px;
  --space-md: 32px;
  --space-lg: 40px;

  /* ── Control sizing (Fui Control Height) ────────────────────────────────── */
  --control-h: 34px;       /* Fui Control Height/md */
  --control-h-sm: 26px;    /* Fui Control Height/sm */

  /* ── Semantic aliases (component layer reads these) ─────────────────────── */
  --bg: var(--ink);
  --surface: var(--paper);
  --surface-2: #f7f7f5;
  --surface-3: #f1f2f1;
  --surface-warm: var(--surface-tint);
  --border: var(--divider-soft);
  --border-strong: var(--divider-solid);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --text-faint: #6d645b;
  --accent: var(--teal);
  --action: var(--teal);           /* alias used by buttons/links/focus */
  --accent-strong: var(--teal-strong);
  --accent-soft: var(--teal-subtle);
  --accent-ring: rgba(15, 117, 109, 0.24);
  --green: var(--teal);            /* success == teal in the kit */
  --green-soft: var(--teal-subtle);
  --amber-soft: var(--amber-subtle);
  --red: var(--danger);
  --red-soft: var(--danger-subtle);
  --brand: var(--teal-bright);
  --on-brand: var(--on-teal);
  --on-action: var(--on-teal);
  --shadow-sm: none;
  --shadow-md: 0 16px 38px rgba(26, 22, 18, 0.09);
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 12px;
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 56px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ── Dark theme ─────────────────────────────────────────────────────────────
 * Overrides only the raw tokens (+ the few literal semantic aliases); every
 * component reads tokens via var(), so the whole UI recolours from here.
 * Applied via [data-theme="dark"] on <html>, set before paint by the head
 * script (localStorage → OS preference). Teal accent is preserved. */
:root[data-theme="dark"] {
  --ink: #ffffff;
  --ink-soft: #b0b0b0;
  --ink-softest: #767676;
  --icon: #d8d8d8;
  --paper: #181818;
  --surface-tint: #202020;
  --mint-fill: #101010;
  --divider-soft: #3a3a3a;
  --divider-solid: #666666;
  --teal: #56edd6;
  --teal-strong: #88ffe8;
  --teal-bright: #56edd6;
  --teal-subtle: #163a35;
  --teal-border: #2f6a63;
  --mint: #56edd6;
  --on-teal: #06110f;
  --highlight: #e85d3a;
  --danger: #f07b61;
  --danger-subtle: #3a1d16;
  --amber: #e0a63f;
  --amber-subtle: #362a12;
  --surface-2: #000000;
  --text-faint: #949494;
  --accent-ring: rgba(86, 237, 214, 0.32);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 18px 46px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
}
/* Theme toggle: show the icon for the theme you'd switch TO. */
.theme-ico-dark { display: none; }
:root[data-theme="dark"] .theme-ico-light { display: none; }
:root[data-theme="dark"] .theme-ico-dark { display: inline-flex; }

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--surface-2);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}

a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--ink); }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 2px;
}

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

.sidebar {
  background: var(--surface);
  color: var(--text-soft);
  border-right: 1px solid var(--border);
  padding: 24px 17px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; padding: 5px 10px 26px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-wordmark { display: grid; width: 137px; height: 16px; }
.brand-wordmark img { grid-area: 1 / 1; width: 137px; height: 16px; display: block; }
.wordmark-on-dark { display: none !important; }
:root[data-theme="dark"] .wordmark-on-light { display: none !important; }
:root[data-theme="dark"] .wordmark-on-dark { display: block !important; }
.brand .subtitle { color: var(--text-faint); font-size: 11.5px; font-weight: 600; }

.nav-label { color: var(--text-faint); font-size: 11px; font-weight: 650; letter-spacing: 0.01em; padding: 14px 10px 6px; }
/* Collapsible sections: the label is a <summary>. Strip the native disclosure
   marker and put a rotating chevron on the right instead. */
.nav-section { display: block; }
summary.nav-label {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  cursor: pointer; list-style: none; user-select: none; border-radius: 8px;
  transition: color 0.12s;
}
summary.nav-label::-webkit-details-marker, summary.nav-label::marker { display: none; content: ''; }
summary.nav-label:hover { color: var(--text-soft); }
summary.nav-label:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }
.nav-label .chev { display: inline-flex; opacity: 0.55; transition: transform 0.15s ease; margin-left: auto; }
/* Section-level icon: hidden on the expanded section headers (Build/Manage/Admin
   are text-only there); shown as a teal-filled dark-bordered badge only in the
   collapsed rail. Dashboard is a nav item (not a nav-label) so it keeps its icon
   in both modes. */
.sec-ico { display: inline-flex; align-items: center; flex: none; }
.nav-label .sec-ico { display: none; }
details.nav-section[open] > summary.nav-label .chev { transform: rotate(90deg); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; border-radius: 8px; color: var(--text-soft);
  font-weight: 500; font-size: 13.5px; cursor: pointer;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-item.active .ico { opacity: 1; }
.nav-item .ico { width: 18px; text-align: center; opacity: 0.7; }
.sidebar .spacer { flex: 1; }
.sidebar .foot { display: grid; gap: 5px; color: var(--text-faint); font-size: 11px; padding: 14px 10px 2px; border-top: 1px solid var(--border); }
.foot-status { display: inline-flex; align-items: center; gap: 6px; color: var(--action); font-weight: 650; }
.sidebar-backdrop { display: none; }
.sidebar-tenant-switcher { position: relative; display: grid; gap: 5px; margin: 6px 8px 10px; }
.sidebar-tenant-label { color: var(--text-faint); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-tenant-switcher details { position: relative; }
.sidebar-tenant-switcher summary { min-height: var(--control-h); display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); cursor: pointer; list-style: none; }
.sidebar-tenant-switcher summary::-webkit-details-marker, .sidebar-tenant-switcher summary::marker { display: none; content: ''; }
.sidebar-tenant-switcher summary > span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-tenant-switcher summary > .icon { flex: none; transform: rotate(90deg); transition: transform .15s ease; }
.sidebar-tenant-switcher details[open] summary { border-color: var(--teal); box-shadow: 0 0 0 3px var(--accent-ring); }
.sidebar-tenant-switcher details[open] summary > .icon { transform: rotate(-90deg); }
.sidebar-tenant-menu { position: absolute; z-index: 4; top: calc(100% + 6px); left: 0; right: 0; max-height: min(320px, 55vh); overflow-y: auto; padding: 5px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-md); }
.sidebar-tenant-menu a { min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--radius-sm); color: var(--text-soft); font-size: 12.5px; }
.sidebar-tenant-menu a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.sidebar-tenant-menu a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.sidebar-tenant-menu a .icon { margin-left: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 36px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
.topbar .crumb { color: var(--text-faint); font-size: 12.5px; margin-bottom: 2px; }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
/* Square icon button (e.g. the sidebar-collapse toggle in every header). */
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: var(--icon); cursor: pointer; transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }

/* ── Collapsed sidebar (icon-only rail) — toggled by [data-sidebar-toggle].
   Shows the individual sub-item icons (Dashboard + every section's items) as a
   flat rail; section headers hide and their sections are force-open (JS). ───── */
.sidebar-collapsed .app { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.sidebar-collapsed .sidebar { padding: 22px 8px; gap: 2px; }
.sidebar-collapsed .brand { display: none; }
.sidebar-collapsed .nav-text, .sidebar-collapsed .chev { display: none; }
.sidebar-collapsed .nav-label { display: none; }
.sidebar-collapsed .nav-section { padding: 0; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 9px 0; gap: 0; border-radius: 9px; }
.sidebar-collapsed .nav-item .ico { width: auto; opacity: 1; }
.sidebar-collapsed .sidebar .foot { display: none; }
.sidebar-collapsed .sidebar-tenant-switcher { display: none; }
.content { padding: 36px 40px 56px; max-width: 1240px; width: 100%; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-sm); }
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; }
.card-head .sub { color: var(--text-faint); font-size: 12.5px; }
.card-body { padding: 22px; }
.grid { display: grid; gap: var(--space-sm); align-items: stretch; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
/* Cards in a grid share the row height and use the grid gap, not stacked margin. */
.grid > .card { height: 100%; margin-top: 0; display: flex; flex-direction: column; }
.grid > .card > .card-body { flex: 1; }
/* The .sidebar-collapsed override must ALSO collapse to one column here — it
   outranks the bare .app rule on specificity, and with .sidebar display:none
   the main pane would auto-place into the empty 56px first column. */
@media (max-width: 860px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } .app, .sidebar-collapsed .app { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ── Buttons (action, never brand) ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  font: inherit; font-weight: 560; font-size: 13.5px; line-height: 1.1;
  padding: 7px 15px; min-height: var(--control-h); border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { color: var(--red); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 4px 11px; min-height: var(--control-h-sm); font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Badges (color is never the only signal — always paired with a label) ──── */
/* Fui badges: bordered pills, height 26 (sm). Neutral is the default. */
.badge {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.3;
  background: var(--surface-tint); color: var(--text-soft); border: 1px solid var(--divider-soft); white-space: nowrap;
}
.badge.enforced { background: var(--mint-fill); color: var(--teal-strong); border-color: var(--teal-border); }
.badge.stored { background: var(--surface-tint); color: var(--text-faint); border-color: var(--divider-soft); }
.badge.green { background: var(--teal-subtle); color: var(--teal-bright); border-color: var(--teal-border); }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: #e6d9ad; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: #f3c9bd; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Tables / lists ──────────────────────────────────────────────────────── */
/* Data table (e.g. Templates): lives inside a .card, header row in faint caps,
   numeric columns tabular + right-aligned, whole rows hover like list rows. */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 13px 20px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-size: 11.5px; font-weight: 650; color: var(--text-faint); text-transform: none; background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .name { font-weight: 600; color: var(--ink); }
.table .name a { color: inherit; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.right, .table td.right { text-align: right; white-space: nowrap; }
.table .muted { color: var(--text-faint); }
.table .content-cell { color: var(--text-soft); }
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; color: var(--ink); }
.row .meta { color: var(--text-faint); font-size: 12.5px; margin-top: 4px; }
.row .actions { display: flex; gap: 7px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { margin-bottom: 20px; }
.field label, .field-label { display: block; font-weight: 580; font-size: 12.5px; margin-bottom: 6px; color: var(--ink); }
.field .hint { color: var(--text-faint); font-size: 12px; margin-top: 5px; }
.field-error { margin: 6px 0 0; color: var(--red); font-size: 12px; font-weight: 580; overflow-wrap: anywhere; }
[aria-invalid="true"] { border-color: var(--red) !important; }
input:not([type]), input[type=text], input[type=email], input[type=search], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 14px; line-height: 1.4; color: var(--ink);
  min-height: var(--control-h); padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-softest); }
input[readonly], textarea[readonly] { background: var(--surface-2); color: var(--text-soft); cursor: default; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px var(--accent-ring); }
select, input[type=date] { height: var(--control-h); }
select { cursor: pointer; }
select:disabled { cursor: not-allowed; opacity: 0.6; }
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
/* `label.chk` (0,1,1) so it outranks `.field label { display:block }` (0,1,1, earlier)
   — otherwise the chips render as blocks and the flex centering/reset never apply. */
label.chk { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500; line-height: 1; color: var(--ink); user-select: none; }
.chk input { accent-color: var(--action); margin: 0; flex: none; }
.chk:has(input:checked) { background: var(--accent-soft); border-color: var(--action); color: var(--accent-strong); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Runtime-managed app skills ─────────────────────────────────────────── */
.app-skill-intro { align-items: flex-start; }
.app-skills-layout { display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); gap: var(--space-sm); align-items: start; }
.app-skills-layout > .card { margin: 0; }
.app-skill-picker { position: sticky; top: 16px; }
.app-skill-picker .card-body { padding: 12px; }
.app-skill-search { margin-bottom: 10px; }
.app-skill-list { max-height: calc(100vh - 260px); overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 2px; }
.app-skill-option { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--ink); }
.app-skill-option:hover { text-decoration: none; background: var(--surface-2); }
.app-skill-option.active { background: var(--accent-soft); border-color: var(--accent); }
.app-skill-option[hidden] { display: none; }
.app-skill-mark, .app-skill-avatar { display: grid; place-items: center; flex: none; border-radius: 9px; background: var(--surface-3); color: var(--accent-strong); font-weight: 750; letter-spacing: -0.02em; }
.app-skill-mark { width: 34px; height: 34px; font-size: 11px; }
.app-skill-avatar { width: 42px; height: 42px; font-size: 13px; }
.app-skill-option-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.app-skill-option-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.app-skill-option-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-faint); font-size: 11px; margin-top: 2px; }
.app-skill-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.app-skill-option .badge { padding: 1px 5px; font-size: 9px; }
.app-skill-editor-head { align-items: center; }
.app-skill-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-skill-title .sub { margin-top: 3px; }
.app-skill-explain { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 22px; padding: 13px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-soft); font-size: 13px; line-height: 1.5; }
.app-skill-explain .icon { flex: none; margin-top: 1px; color: var(--accent-strong); }
.app-skill-editor textarea[name="instructions"] { min-height: 340px; }
.app-skill-actions { display: flex; align-items: center; gap: 12px; padding-top: 2px; }
.app-skill-actions .hint { margin: 0; }
.app-skill-remove { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13px; }
.app-skill-remove .hint { margin-top: 3px; }
@media (max-width: 860px) { .app-skills-layout { grid-template-columns: 1fr; } .app-skill-picker { position: static; } .app-skill-list { max-height: 280px; } }

/* ── Code / pills ────────────────────────────────────────────────────────── */
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.pill { display: inline-block; background: var(--surface-3); border-radius: 6px; padding: 1px 7px; font-family: var(--mono); font-size: 12px; margin: 2px 6px 2px 0; }
.pill.kept { background: var(--green-soft); color: var(--green); }
.pill.removed { background: var(--red-soft); color: var(--red); text-decoration: line-through; opacity: 0.85; }

/* ── Effective (∩) view ──────────────────────────────────────────────────── */
.intersect { display: grid; grid-template-columns: 1fr 28px 1fr 28px 1fr; align-items: stretch; gap: 0; }
.intersect .op { display: grid; place-items: center; font-size: 18px; color: var(--text-faint); font-weight: 600; }
.intersect .col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.intersect .col.result { background: linear-gradient(180deg, #f4faf9, #eaf3f2); border-color: var(--accent); }
.intersect .col h3 { margin: 0 0 4px; font-size: 12.5px; font-weight: 650; letter-spacing: 0.01em; color: var(--text-soft); }
.intersect .col .cap { font-size: 11.5px; color: var(--text-faint); margin-bottom: 12px; }
@media (max-width: 860px) { .intersect { grid-template-columns: 1fr; } .intersect .op { padding: 6px; } }
.op-inline { color: var(--text-faint); font-weight: 700; margin: 0 2px; }
.adv-sets > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-strong); margin-top: 14px; }
.adv-sets > summary::-webkit-details-marker { display: none; }

/* ══ Template × Policy inspector (design import) ══════════════════════════════ */
.insp-selects { display: flex; align-items: center; gap: 10px; }
.insp-sel { position: relative; display: inline-flex; align-items: center; }
.insp-sel select { width: auto; min-height: 0; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.insp-sel .icon { display: none; }
.insp-x { color: var(--text-faint); }
.insp-wrap, .insp { display: flex; gap: 20px; align-items: flex-start; }
.insp-loading { display: flex; align-items: center; gap: 10px; padding: 40px; color: var(--text-faint); }
.insp-empty { padding: 26px; text-align: center; color: var(--text-faint); font-size: 14px; }
.insp-empty.pad { padding: 48px; }

.insp-list { flex: none; width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.insp-list-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.insp-list-title { display: flex; align-items: baseline; gap: 8px; font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 13px; }
.insp-list-sub { font-size: 12.5px; font-weight: 400; color: var(--text-faint); }
.insp-search { display: flex; align-items: center; gap: 9px; padding: 0 12px; height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); margin-bottom: 12px; color: var(--text-faint); }
.insp-search input { flex: 1; border: none; outline: none; background: transparent; color: var(--ink); font: inherit; font-size: 14px; }
.insp-filters { display: flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; }
.insp-filters button { flex: 1; padding: 7px 4px; border: none; border-radius: 7px; background: transparent; color: var(--text-soft); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.insp-filters button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 20, 0.1); }
.insp-list-body { max-height: 640px; overflow: auto; padding: 6px 8px 10px; }
.insp-apphead { display: flex; align-items: center; gap: 9px; padding: 12px 10px 5px; }
.insp-appmark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; font-size: 9.5px; font-weight: 700; font-family: var(--mono); }
.insp-appname { font-size: 13px; font-weight: 700; font-family: var(--mono); color: var(--ink); }
.insp-appcount { font-size: 11.5px; color: var(--text-faint); }
.insp-row { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 10px; cursor: pointer; }
.insp-row:hover { background: var(--surface-2); }
.insp-row.sel { background: var(--accent-soft); }
.insp-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.insp-scope { flex: 1; min-width: 0; font-size: 13.5px; font-family: var(--mono); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-scope.rm { color: var(--text-faint); text-decoration: line-through; }
.insp-dot.allow { background: var(--teal); }
.insp-dot.ask { background: var(--amber); }
.insp-dot.block, .insp-dot.removed { background: var(--red); }
.ipill { flex: none; padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600; }
.ipill.allow { background: var(--green-soft); color: var(--teal-strong); }
.ipill.ask { background: var(--amber-soft); color: var(--amber); }
.ipill.block, .ipill.removed { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }

.insp-detail { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; align-self: stretch; }
.insp-dhead { display: flex; align-items: center; gap: 13px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.insp-dmark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 11px; font-size: 14px; font-weight: 700; font-family: var(--mono); }
.insp-did { flex: 1; min-width: 0; }
.insp-dscope { font-size: 19px; font-weight: 700; font-family: var(--mono); color: var(--ink); }
.insp-dsub { font-size: 13.5px; color: var(--text-soft); margin-top: 1px; }
.insp-badge { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.insp-badge-dot { width: 8px; height: 8px; border-radius: 50%; }
.insp-badge.allow { background: var(--green-soft); color: var(--teal-strong); }
.insp-badge.allow .insp-badge-dot { background: var(--teal); }
.insp-badge.ask { background: var(--amber-soft); color: var(--amber); }
.insp-badge.ask .insp-badge-dot { background: var(--amber); }
.insp-badge.block, .insp-badge.removed { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }
.insp-badge.block .insp-badge-dot, .insp-badge.removed .insp-badge-dot { background: var(--red); }
.insp-dbody { padding: 24px; }
.insp-verdict { font-size: 15px; line-height: 1.6; color: var(--text-soft); padding: 16px 18px; border-radius: 13px; margin-bottom: 26px; border: 1px solid var(--border); background: var(--surface-2); }
.insp-verdict.ok { background: var(--green-soft); border-color: var(--teal-border); color: var(--ink); }
.insp-verdict.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 32%, transparent); color: var(--ink); }
.insp-verdict.bad { background: color-mix(in srgb, var(--red) 8%, transparent); border-color: color-mix(in srgb, var(--red) 25%, transparent); color: var(--ink); }
.insp-trace-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 18px; }
.insp-trace { position: relative; padding-left: 34px; }
.insp-trace::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.insp-step { position: relative; padding-bottom: 22px; }
.insp-step:last-child { padding-bottom: 0; }
.insp-step-mark { position: absolute; left: -34px; top: 0; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid; }
.insp-step-mark.teal { background: color-mix(in srgb, var(--teal) 18%, transparent); border-color: var(--teal); color: var(--teal-strong); }
.insp-step-mark.amber { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.insp-step-mark.red { background: color-mix(in srgb, var(--red) 15%, transparent); border-color: var(--red); color: var(--red); }
.insp-step-mark.grey { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-faint); }
.insp-step-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.insp-step-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; font-weight: 700; color: var(--ink); }
.insp-step-desc { font-size: 13.5px; color: var(--text-soft); line-height: 1.5; margin-top: 5px; }
.insp-dcards { display: flex; gap: 12px; margin-top: 8px; padding-top: 22px; border-top: 1px solid var(--border); }
.insp-dcard { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 15px 16px; background: var(--surface-2); }
.insp-dcard-k { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.insp-dcard-v { font-size: 13.5px; color: var(--text-soft); word-break: break-word; }
.insp-dcard-v.mono { font-family: var(--mono); }
@media (max-width: 1000px) { .insp-wrap, .insp { flex-direction: column; } .insp-list { width: 100%; } }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 20px; color: var(--text-faint); }
.empty .big { font-size: 30px; margin-bottom: 10px; opacity: 0.7; }
/* Fui Notification: white/tinted card, 1px border, radius-lg, subtle shadow,
   and a 4px colored left-accent bar carrying the status signal. */
.banner {
  padding: 11px 14px; border-radius: var(--radius-lg); font-size: 13px; margin-bottom: 18px;
  display: flex; gap: 9px; align-items: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left-width: 4px; box-shadow: var(--shadow-sm);
}
.banner.warn { border-left-color: var(--amber); color: var(--amber); }
.banner.err { background: var(--red-soft); border-color: #f3c9bd; border-left-color: var(--red); color: var(--red); }
.banner.ok { background: var(--green-soft); border-color: var(--teal-border); border-left-color: var(--green); color: var(--green); }
/* Removable tag chips (e.g. IdP-group bindings) */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 11px; border-radius: 999px;
  background: var(--surface-tint); border: 1px solid var(--divider-solid); font-size: 12.5px;
}
.tag .meta { color: var(--text-faint); margin: 0; }
.tag .x {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  border: none; border-radius: 999px; background: transparent; color: var(--text-faint);
  cursor: pointer; font-size: 12px; line-height: 1; padding: 0;
}
.tag .x:hover { background: var(--red-soft); color: var(--red); }
.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field-row .btn { min-height: var(--control-h); } /* match the selects/inputs beside it */

.section-title { font-size: 12.5px; letter-spacing: 0.01em; color: var(--text-soft); font-weight: 650; margin: 0 0 10px; }
/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.dash-kpis > .card, .dash-actions > .card, .dash-row > .card { margin: 0; }
.dash-kpis > .kpi { border: 0; border-right: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.dash-kpis > .kpi:last-child { border-right: 0; }
.kpi { text-decoration: none; color: inherit; padding: 22px; display: flex; flex-direction: column; transition: background 0.12s; }
.kpi:hover { background: var(--surface-2); text-decoration: none; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12px; font-weight: 650; color: var(--text-faint); }
.kpi-ico { color: var(--teal); display: inline-flex; }
.kpi-num { font-size: 36px; font-weight: 760; letter-spacing: -0.035em; color: var(--ink); margin: 14px 0 5px; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-sub { font-size: 12.5px; color: var(--text-faint); }

.field.compact { margin: 0; }
.field.compact label { margin-bottom: 4px; font-size: 11.5px; }
.field.compact input, .field.compact select { font-size: 12.5px; }
.field .optional { color: var(--text-faint); font-weight: 450; }

/* ── Validation access administration ───────────────────────────────────── */
.access-link-panel { display: grid; gap: 14px; margin-bottom: var(--space-sm); padding: 18px 20px; border: 1px solid var(--teal-border); border-radius: var(--radius); background: var(--green-soft); box-shadow: var(--shadow-sm); }
.access-link-panel .hint { margin-top: 3px; color: var(--text-soft); }
.access-link-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.access-link-copy input { background: var(--surface); font-family: var(--mono); font-size: 12px; }
.access-create-card { margin-bottom: var(--space-sm); }
.access-create-grid { display: grid; grid-template-columns: 1fr 1fr 1.15fr 1.2fr auto; align-items: end; gap: 10px; }
.access-user-create-grid { grid-template-columns: 1fr 1fr 1.15fr auto; }
.access-create-grid .btn { white-space: nowrap; }
.access-host-hint { margin-top: 10px; color: var(--amber); }
.access-detail-card .kv code { margin-left: 4px; }
.access-admin-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.access-admin-actions form { margin: 0; }
.validation-version-list { display: flex; flex-direction: column; }
.validation-version-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.validation-version-row:first-child { padding-top: 0; }
.validation-version-row:last-child { padding-bottom: 0; border-bottom: none; }
.validation-version-row code { color: var(--text-faint); font-size: 11px; }
.admin-comment-version + .admin-comment-version { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.governance-viewer { display: flex; align-items: center; gap: 12px; margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--border); }
.governance-viewer > span { display: flex; flex-direction: column; text-align: right; line-height: 1.25; }
.governance-viewer small { color: var(--text-faint); font-size: 10.5px; }
.governance-viewer form { margin: 0; }
.company-template-admin { display: flex; flex-direction: column; gap: 14px; }
.company-template-add { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 15px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); }
.company-template-add form { display: flex; align-items: center; gap: 8px; margin: 0; }
.company-template-card { display: flex; flex-direction: column; gap: 11px; padding: 17px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.company-template-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.company-template-card h3 { margin: 0 0 3px; font-size: 16px; }
.company-template-card > form { margin: 0; }
.company-template-card details { padding-top: 10px; border-top: 1px solid var(--border); }
.company-template-card details summary { color: var(--text-soft); font-size: 12px; font-weight: 650; cursor: pointer; }
.company-template-card details[open] summary { margin-bottom: 12px; }

/* ── Company review inside the governance UI ────────────────────────────── */
.validation-body { min-height: 100vh; background: var(--surface-2); }
.validation-error-main { width: min(520px, calc(100% - 32px)); margin: 0 auto; padding-top: 10vh; }
.validation-gate { padding: 44px; text-align: center; }
.validation-gate h1 { margin: 16px 0 8px; font-size: 24px; }
.validation-gate p { color: var(--text-soft); }
.validation-gate-mark { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto; border-radius: 16px; background: var(--accent-soft); color: var(--accent-strong); }
.validation-versions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 18px 0 24px; color: var(--text-faint); font-size: 12px; }
.validation-versions > span { margin-right: 3px; font-weight: 650; }
.validation-versions a { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-soft); background: var(--surface); }
.validation-versions a:hover { text-decoration: none; border-color: var(--border-strong); }
.validation-versions a.active { border-color: var(--teal); background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.company-template-table { border-top: 1px solid var(--border); }
.validation-review { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.validation-review-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--text-soft); font-size: 12px; }
.validation-review-head > span { min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-3); font-size: 10px; }
.validation-comments { display: flex; flex-direction: column; gap: 8px; }
.validation-comment { padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.validation-comment-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 5px; color: var(--text-faint); font-size: 11px; }
.validation-comment-meta strong { color: var(--ink); }
.validation-no-comments { padding: 11px 13px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-faint); font-size: 12px; }
.validation-comment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-top: 10px; }
.validation-comment-form label { grid-column: 1 / -1; color: var(--ink); font-size: 11.5px; font-weight: 600; }
.validation-comment-form textarea { min-height: 72px; margin: 0; font-family: var(--font); font-size: 13px; }
.validation-comment-form .btn { align-self: end; }
.validation-signature { display: flex; align-items: flex-start; gap: 18px; margin-top: var(--space-sm); padding: 24px; border-color: var(--border-strong); }
.validation-signature.signed { border-color: var(--teal-border); background: var(--green-soft); }
.validation-signature-mark { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--accent-strong); }
.validation-signature h2 { margin: 0 0 6px; font-size: 18px; }
.validation-signature p { max-width: 760px; margin: 0 0 14px; color: var(--text-soft); }
.validation-signature code { display: block; max-width: 100%; margin-top: 8px; color: var(--text-faint); font-size: 10px; overflow-wrap: anywhere; }
.validation-signature-meta { color: var(--accent-strong); font-size: 12px; font-weight: 650; }
.validation-sign-form { max-width: 660px; margin-top: 18px; }
.validation-sign-check { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 16px; color: var(--ink); font-size: 13px; cursor: pointer; }
.validation-sign-check input { flex: none; margin-top: 3px; accent-color: var(--teal); }
.validation-disclaimer { max-width: 780px; margin: 16px auto 0; color: var(--text-faint); font-size: 11px; text-align: center; }

@media (max-width: 1000px) {
  .access-create-grid { grid-template-columns: 1fr 1fr; }
  .access-create-grid .btn { justify-self: start; }
}
@media (max-width: 700px) {
  .governance-viewer > span { display: none; }
  .validation-signature { padding: 18px; }
  .validation-signature-mark { display: none; }
  .validation-comment-form { grid-template-columns: 1fr; }
  .validation-comment-form .btn { justify-self: start; }
  .access-link-copy, .access-create-grid, .validation-version-row { grid-template-columns: 1fr; }
  .access-link-copy .btn, .access-create-grid .btn { justify-self: stretch; }
  .company-template-add, .company-template-card-head { align-items: stretch; flex-direction: column; }
  .company-template-add form { align-items: stretch; flex-direction: column; }
  .access-table th:nth-child(3), .access-table td:nth-child(3) { display: none; }
}

.dash-row { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-sm); margin-top: var(--space-sm); align-items: start; }
.chart-wrap { padding-top: 10px; }
.chart-svg { display: block; height: 210px; width: 100%; }
.chart-legend { display: flex; gap: 14px; }
.chart-legend .lg { font-size: 12px; color: var(--text-faint); display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .lg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.chart-legend .lg-req::before { background: var(--teal); }
.chart-legend .lg-blk::before { background: var(--text-soft); }
/* SVG chart elements — theme-aware (dashboard.ts renders them by class). */
.ch-grid { stroke: var(--border); }
.ch-axis { fill: var(--text-faint); }
.ch-line-prov { stroke: var(--teal); }
.ch-line-fail { stroke: var(--text-soft); opacity: 0.5; }

.audit-list { display: flex; flex-direction: column; }
.audit-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.audit-item:first-child { padding-top: 0; }
.audit-item:last-child { border-bottom: none; padding-bottom: 0; }
.audit-ico { flex: none; margin-top: 1px; display: inline-flex; }
.audit-ico.ok { color: var(--teal); }
.audit-ico.err { color: var(--red); }
.audit-ico.muted { color: var(--text-faint); }
.audit-text { font-size: 13px; color: var(--ink); line-height: 1.4; }
.audit-time { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.dash-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-sm); margin-top: var(--space-sm); }
.action-card { display: flex; align-items: flex-start; gap: 12px; padding: 18px; text-decoration: none; color: inherit; transition: border-color 0.12s, box-shadow 0.12s; }
.action-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); text-decoration: none; }
.action-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-3); color: var(--teal); display: inline-grid; place-items: center; flex: none; }
.action-title { font-weight: 640; color: var(--ink); }
.action-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
@media (max-width: 900px) {
  .dash-kpis, .dash-actions { grid-template-columns: 1fr 1fr; }
  .dash-kpis > .kpi:nth-child(2n) { border-right: 0; }
  .dash-kpis > .kpi:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
  .dash-row { grid-template-columns: 1fr; }
}

/* A divided sub-section inside a card body (e.g. "What it ships" under the form).
   As a <details> it collapses to just its summary to keep the card compact. */
.subsection { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
details.subsection > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; margin: 0; }
details.subsection > summary::-webkit-details-marker, details.subsection > summary::marker { display: none; content: ''; }
details.subsection > summary .chev { display: inline-flex; opacity: 0.6; transition: transform 0.15s ease; }
details.subsection[open] > summary .chev { transform: rotate(90deg); }
details.subsection[open] > .kv { margin-top: 12px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; }
.kv dd .badge { margin: 2px 6px 2px 0; } /* chip rows inside kv values — keep them apart */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.toolbar .grow { flex: 1; }
/* Hidden by default so it reserves NO width inside a button; shown on request.
   The `.spin` variant is repeated so this outranks the standalone `.spin`
   display (equal single-class specificity would otherwise let .spin win). */
.htmx-indicator, .htmx-indicator.spin { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator,
.htmx-request .htmx-indicator.spin, .htmx-request.htmx-indicator.spin { display: inline-block; }
/* Inline .spin indicator — a small ripple (used inside buttons/rows). */
.spin {
  display: inline-block; width: 13px; aspect-ratio: 1; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 0 rgba(25, 165, 155, 0.28);
  animation: l2 1.4s infinite linear; position: relative; vertical-align: middle;
}
.spin::before, .spin::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(25, 165, 155, 0.28); animation: inherit; animation-delay: -0.5s;
}
.spin::after { animation-delay: -1s; }
/* Standalone loader — the reference teal ripple (drop-in <div class="loader">). */
.loader {
  width: 20px; aspect-ratio: 1; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 0 0 rgba(25, 165, 155, 0.28);
  animation: l2 1.5s infinite linear; position: relative;
}
.loader::before, .loader::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(25, 165, 155, 0.28); animation: inherit; animation-delay: -0.5s;
}
.loader::after { animation-delay: -1s; }
@keyframes l2 { 100% { box-shadow: 0 0 0 40px transparent; } }

/* App picker (App rules section) — a single grouped <select> drives which
   one .app-detail card is visible; .tags/.tag (chips) and .card/.card-body
   are the existing classes, no new ones needed for those. */
.app-detail.card { margin-top: 9px; }

/* ══ MCP Servers — square-card grid ═══════════════════════════════════════════ */
/* Fixed-size square cards on fixed 220px tracks — every card is identical, so
   rows always align and gaps stay even (aspect-ratio + fr tracks were letting a
   long-content card grow taller than its neighbours). */
.mcp-grid { display: grid; grid-template-columns: repeat(auto-fill, 220px); gap: var(--space-sm); justify-content: start; }
/* `.mcp-grid .mcp-card` (0,2,0) so `margin:0` beats the base `.card + .card`
   margin-top — otherwise cards 2..n get shoved down inside their grid cell. */
.mcp-grid .mcp-card { width: 220px; height: 220px; display: flex; flex-direction: column; align-items: flex-start; padding: 20px; margin: 0; overflow: hidden; }
.mcp-card .mcp-ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--teal); flex: none; }
.mcp-card .mcp-name { margin-top: 14px; font-size: 15.5px; font-weight: 640; color: var(--ink); letter-spacing: -0.01em; }
.mcp-card .mcp-cmd { margin-top: 6px; min-width: 0; max-width: 100%; }
.mcp-card .mcp-cmd code { font-size: 11.5px; color: var(--text-faint); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.mcp-card .mcp-env { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 5px; }
.mcp-card .mcp-env-none { color: var(--text-faint); font-size: 12px; }
@media (max-width: 500px) { .mcp-grid { grid-template-columns: 1fr; } .mcp-card { width: 100%; height: auto; min-height: 180px; } }

/* ══ Users page (drawer layout — design import) ═══════════════════════════════ */
.users-card { padding: 0; }
.users-header { display: flex; align-items: center; gap: 16px; padding: 20px 22px 14px; }
.users-header h2 { margin: 0; }
.users-count { font-size: 13px; color: var(--text-faint); margin-top: 3px; }
.users-header .btn { margin-left: auto; }

/* Search + quick-filter chips (one row) */
.users-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 0 22px 14px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); display: inline-flex; pointer-events: none; }
.search input { padding-left: 38px; height: 42px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background 0.12s, color 0.12s, border-color 0.12s; }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.chip .chip-n { font-variant-numeric: tabular-nums; color: var(--text-faint); }
.chip[aria-pressed="true"] .chip-n { color: var(--accent-strong); }

/* Inline bulk bar (teal) */
.bulkbar { display: flex; align-items: center; gap: 12px; margin: 0 22px 14px; padding: 10px 16px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); }
.bulkbar[hidden] { display: none; }
.bulkbar select { width: auto; min-width: 150px; }
.bulkcount { font-size: 13.5px; font-weight: 600; }

/* Rows */
.ulist { border-top: 1px solid var(--border); }
.urow { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.urow:last-child { border-bottom: none; }
.urow:hover { background: var(--surface-2); }
.urow[hidden] { display: none; }
.rowsel { width: 20px; flex: none; display: flex; align-items: center; justify-content: center; margin: 0; }
.rowsel input { width: 17px; height: 17px; accent-color: var(--action); margin: 0; cursor: pointer; }
.rowmain { flex: 1; min-width: 0; display: block; text-align: left; background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; }
.rowmain .name { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.rowmain .meta { color: var(--text-faint); font-size: 12.5px; margin-top: 3px; }
.rowmain:hover .name { color: var(--action); }
.rowmain:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 3px; border-radius: 6px; }
.urow .statuscol { flex: none; }
.urow-cta { flex: none; display: flex; align-items: center; gap: 8px; }
.urow-cta .chev { display: inline-flex; vertical-align: middle; }
@media (max-width: 760px) { .urow { flex-wrap: wrap; } .urow-cta .btn .chev { display: none; } }

/* Status pills */
.badge.status { font-weight: 600; }
.badge.status.neutral { background: var(--surface-3); color: var(--text-soft); border-color: var(--border-strong); }
.badge.status.muted { background: transparent; color: var(--text-faint); border-color: var(--border); }

/* Source badges + external flag */
.sources { display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; vertical-align: middle; }
.src-badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-soft); border: 1px solid var(--border); }
.linked { color: var(--text-faint); display: inline-flex; }
.ext-flag { color: var(--amber); display: inline-flex; vertical-align: -2px; }

/* Button variants used in the rows / drawer */
.btn.outline { background: transparent; border: 1px solid var(--action); color: var(--accent-strong); }
.btn.outline:hover { background: var(--accent-soft); }
.btn.block { width: 100%; justify-content: center; }
.btn.danger-text { background: transparent; border: 1px solid transparent; color: var(--red); }
.btn.danger-text:hover { background: var(--red-soft); }
.icon-btn.xs { width: 32px; height: 32px; border-radius: 8px; flex: none; }

/* ── Centered modal popup (details + agent panel) ── */
.umodal-scrim { position: fixed; inset: 0; background: rgba(15, 20, 19, 0.42); z-index: 60; opacity: 0; pointer-events: none; transition: opacity 0.16s ease; }
.umodal-card { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%) scale(0.97); width: 480px; max-width: calc(100vw - 32px); max-height: 88vh; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.30); z-index: 61; display: flex; flex-direction: column; overflow: hidden; opacity: 0; pointer-events: none; transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.18s ease; }
.umodal-card > #drawerBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.modal-open .umodal-scrim { opacity: 1; pointer-events: auto; }
body.modal-open .umodal-card { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.drawer-loading { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 180px; }
/* Centered popup loading state (removing / provisioning) — no nested card. */
.popup-loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 13px; padding: 44px 20px; min-height: 200px; }
.popup-loading-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.drawer-title { flex: 1; min-width: 0; }
.drawer-name { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; color: var(--ink); }
.drawer-email { font-size: 13px; color: var(--text-faint); margin-top: 2px; word-break: break-all; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-kv { display: flex; flex-direction: column; gap: 11px; margin: 0; }
.drawer-kv > div { display: flex; gap: 12px; }
.drawer-kv dt { width: 100px; flex: none; font-size: 13px; color: var(--text-faint); }
.drawer-kv dd { margin: 0; font-size: 13.5px; display: flex; gap: 6px; flex-wrap: wrap; }
.drawer-warn { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent); color: var(--amber); font-size: 13px; line-height: 1.45; }
.drawer-warn svg { flex: none; margin-top: 1px; }

/* Agent panel — live · provisioning · provision form */
.agent-panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); padding: 16px; }
.agent-panel.live, .agent-panel.busy { border-top: 3px solid var(--teal); }
.agent-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.agent-ico { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--teal); }
.agent-panel-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint); }
.agent-panel-tag.plain { display: block; margin-bottom: 12px; }
.agent-id-box { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); margin-bottom: 12px; min-width: 0; }
.agent-id-box code { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-copy { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: none; border-radius: 6px; background: transparent; color: var(--text-faint); cursor: pointer; }
.agent-copy:hover { background: var(--surface-3); color: var(--ink); }
/* Agent stat tiles (Live card) */
.agent-stats { display: flex; gap: 10px; margin-bottom: 12px; }
.agent-stat { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.agent-stat-v { font-size: 15px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-stat-l { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.agent-panel-actions { display: flex; gap: 8px; }
.agent-panel-actions .btn:first-child { flex: 1; justify-content: center; }
.drawer-tpl { width: 100%; margin-bottom: 12px; }
.welcome-preview { padding: 11px 13px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-soft); line-height: 1.5; margin-bottom: 14px; }
.welcome-preview .wp-title { font-weight: 600; color: var(--ink); }
.welcome-preview .wp-tpl { font-weight: 600; }
.agent-panel-foot { font-size: 12px; color: var(--text-faint); text-align: center; margin-top: 10px; }
/* Provisioning steps — plain lines under the centered loader (no checkboxes),
   the current step highlighted; polled until the agent is live. */
.prov-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; text-align: center; }
.prov-step { font-size: 14px; color: var(--text-faint); transition: color 0.2s ease; }
.prov-step.done { color: var(--text-soft); }
.prov-step.active { color: var(--teal-strong); font-weight: 600; }
@media (max-width: 560px) { .umodal-card { width: calc(100vw - 24px); max-height: 92vh; } }

/* ══ IdP / Channels right pane (design import) ════════════════════════════════ */
.dir-body { display: flex; flex-direction: column; gap: 12px; }
/* Source mini-dashboard (IdP / Channels) */
.src-card { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); padding: 18px 20px; }
.src-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.src-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.src-head .badge { margin-left: auto; }
.src-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.src-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.src-stat-num { font-size: 28px; font-weight: 750; color: var(--ink); line-height: 1.05; letter-spacing: -0.01em; }
.src-stat-label { font-size: 12.5px; color: var(--text-faint); margin-top: 7px; }
/* Users pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px 4px; border-top: 1px solid var(--border); }
.pager-info { font-size: 13px; color: var(--text-faint); }
.pager-btns { display: inline-flex; align-items: center; gap: 10px; }
.pager-cur { font-size: 13px; font-weight: 600; color: var(--ink); }
.btn.sm[disabled] { opacity: 0.45; pointer-events: none; }

/* Sync loading — on sync start, SYNC_LOADER_JS replaces each card body with the
   teal ripple loader (so the card empties) until the fresh directory swaps in. */
.dir-loading { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 148px; }
.sync-busy { display: none; }

/* ══ Template detail (agent template — design import) ═════════════════════════ */
.tpl-hero { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.tpl-avatar { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--teal); display: inline-grid; place-items: center; flex: none; }
.tpl-hero-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.tpl-sub { color: var(--text-faint); font-size: 13.5px; margin-top: 1px; }
.tpl-section { margin-top: var(--space-sm); }
.tpl-instructions { font-size: 15px; line-height: 1.7; color: var(--ink); max-width: 72ch; }
.tpl-instructions p { margin: 0 0 15px; }
.tpl-instructions p:last-child { margin-bottom: 0; }

/* Trust stat tiles */
.tpl-stats { display: flex; gap: 12px; margin-bottom: 22px; }
.tpl-stat { flex: 1; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.tpl-stat.amber { border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: var(--amber-soft); }
.tpl-stat-num { font-size: 26px; font-weight: 720; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.tpl-stat.amber .tpl-stat-num, .tpl-stat.amber .tpl-stat-label { color: var(--amber); }
.tpl-stat-label { font-size: 13px; color: var(--text-faint); margin-top: 2px; }

/* Approval banner */
.tpl-approval { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; margin-bottom: 22px; border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); border-left: 4px solid var(--amber); border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 14px; line-height: 1.5; }
.tpl-approval svg { flex: none; margin-top: 1px; }
.tpl-approval b { font-weight: 640; }
.tpl-approval.ok { border-color: var(--teal-border); border-left-color: var(--teal); background: var(--green-soft); color: var(--teal-strong); }

/* Skills */
.skill-cards { display: flex; flex-direction: column; gap: 10px; }
.skill-card { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); max-width: 540px; }
.skill-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--teal); }
.skill-name { font-size: 14.5px; font-weight: 600; font-family: var(--mono); }
.tpl-text-list { display: grid; gap: 12px; }
.tpl-task-head { align-items: center; }
.tpl-task-meta { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.tpl-task-meta code { font-size: 12.5px; color: var(--text-soft); }
@media (max-width: 640px) {
  .tpl-task-head { align-items: flex-start; flex-direction: column; }
  .tpl-task-meta { justify-content: flex-start; }
}

/* Segmented tabs (reveal .seg) */
.reveal-tabs.seg { display: flex; gap: 8px; padding: 6px; background: var(--surface-3); border-radius: 14px; border: none; }
.reveal-tabs.seg .reveal-tab { flex: 1; justify-content: center; border-radius: 10px; border: none; padding: 12px; font-size: 14.5px; font-weight: 600; color: var(--text-soft); background: transparent; }
.reveal-tabs.seg .reveal-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* What it can do — grouped by trust */
.cap-group { padding: 14px 0 2px; }
.cap-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cap-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cap-group-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.cap-group-note { font-size: 12.5px; color: var(--text-faint); }
.cap-dot.teal, .cap-group-title.teal { color: var(--teal); background: var(--teal); }
.cap-group-title.teal { background: none; }
.cap-dot.blue { background: #3b82f6; }
.cap-group-title.blue { color: #3b82f6; }
.cap-dot.amber { background: var(--amber); }
.cap-group-title.amber { color: var(--amber); }
.cap-item { display: flex; align-items: center; gap: 13px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.cap-item:last-child { border-bottom: none; }
.cap-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; }
.cap-ico.teal { background: var(--accent-soft); color: var(--teal); }
.cap-ico.blue { background: #dbeafe; color: #1e40af; }
.cap-ico.amber { background: var(--amber-soft); color: var(--amber); }
:root[data-theme="dark"] .cap-ico.blue { background: rgba(59, 130, 246, 0.16); color: #93c5fd; }
.cap-text { flex: 1; min-width: 0; font-size: 14.5px; color: var(--ink); }
.cap-app { flex: none; font-size: 12px; color: var(--text-faint); }
.cap-app code { font-size: 12px; }

/* Connected apps + scope pills */
.scope-legend { margin-left: auto; display: inline-flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-faint); }
.scope-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.scope-legend .lg::before { content: ""; width: 9px; height: 9px; border-radius: 3px; }
.scope-legend .lg.allow::before { background: var(--teal); }
.scope-legend .lg.ask::before { background: var(--amber); }
.app-row { display: flex; gap: 20px; align-items: flex-start; padding: 18px 0; border-bottom: 1px solid var(--border); }
.app-row:last-child { border-bottom: none; }
.app-id { flex: none; width: 150px; padding-top: 3px; }
.app-name { font-size: 15px; font-weight: 600; font-family: var(--mono); }
.app-scopes-n { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.app-scopes { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.scope-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-3); color: var(--text-soft); font-size: 12.5px; font-weight: 500; font-family: var(--mono); }
.scope-pill .scope-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--teal); }
.scope-pill.allow { background: var(--green-soft); color: var(--teal-strong); border-color: transparent; }
.scope-pill.ask { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 32%, transparent); }
.scope-pill.ask .scope-dot { background: var(--amber); }
.scope-pill.sm { padding: 3px 9px; font-size: 11px; }
/* Connected apps & scopes — per-app collapse */
.app-collapses { display: flex; flex-direction: column; gap: 8px; }
.app-collapse { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.app-collapse > summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; }
.app-collapse > summary::-webkit-details-marker { display: none; }
.app-collapse > summary .chev { flex: none; color: var(--text-faint); transition: transform 0.15s ease; }
.app-collapse[open] > summary .chev { transform: rotate(90deg); }
.app-collapse > summary .app-name { font-size: 14px; }
.app-collapse > summary .app-scopes-n { margin: 0; }
.app-collapse-body { display: flex; flex-direction: column; gap: 9px; padding: 4px 16px 15px 40px; border-top: 1px solid var(--border); }
.scope-line { display: flex; align-items: center; gap: 11px; }
.scope-line .scope-pill { min-width: 62px; justify-content: center; }
.scope-line .scope-label { font-size: 13.5px; color: var(--ink); }
.scope-line .scope-code { font-size: 12px; color: var(--text-faint); font-family: var(--mono); margin-left: auto; }
@media (max-width: 720px) { .app-row { flex-direction: column; gap: 10px; } .app-id { width: auto; } }

/* ══ Policy edit (Finance — design import) ════════════════════════════════════ */
.policy-ceiling { display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px; margin-bottom: 22px; border: 1px solid var(--teal-border); border-left: 4px solid var(--teal); border-radius: 13px; background: var(--green-soft); color: var(--teal-strong); font-size: 14px; line-height: 1.55; }
.policy-ceiling svg { flex: none; margin-top: 1px; }
.policy-ceiling code { font-family: var(--mono); font-size: 13px; }

/* Numbered steps (Name & group → Tools → App rules) */
.policy-step { margin-bottom: 24px; }
.policy-step > .card { margin: 0; }
.step-head { display: flex; align-items: center; gap: 12px; margin: 0 2px 12px; }
.step-n { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--teal-strong); font-size: 14px; font-weight: 700; }
.step-head h2 { margin: 0; font-size: 16px; }
.step-sub { font-size: 13px; color: var(--text-faint); }
.step-sub strong { color: var(--text-soft); font-weight: 600; }

/* Current-mix panel (inline, atop the App rules step) */
.policy-mix { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); margin-bottom: 14px; }
.mix-head { display: flex; align-items: baseline; gap: 9px; padding: 16px 18px 0; }
.mix-title { font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-faint); }
.mix-sub { font-size: 12.5px; color: var(--text-faint); }
.mix-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 18px; }
.mix-tile { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; font: inherit; transition: border-color 0.12s; }
.mix-tile.allow:hover { border-color: var(--teal); }
.mix-tile.ask:hover { border-color: var(--amber); }
.mix-tile.block:hover { border-color: var(--text-faint); }
.mix-num { font-size: 30px; font-weight: 720; letter-spacing: -0.02em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.mix-tag { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 13px; font-weight: 600; color: var(--ink); }
.mix-dot { width: 8px; height: 8px; border-radius: 3px; }
.mix-tile.allow .mix-dot { background: var(--teal); }
.mix-tile.ask .mix-dot { background: var(--amber); }
.mix-tile.block .mix-dot { background: var(--text-faint); }
.mix-note { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.mix-foot { font-size: 11.5px; color: var(--text-faint); padding: 0 18px 16px; line-height: 1.45; }

/* Governs — bound-group chips + one-tap bind picker */
.governs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.governs-label { font-size: 13px; color: var(--text-faint); margin-right: 2px; }
.bind-picker { width: auto; min-width: 0; height: 32px; padding: 4px 30px 4px 13px; font-size: 13px; font-weight: 500; color: var(--accent-strong); border: 1px dashed var(--border-strong); border-radius: 999px; background: transparent; cursor: pointer; }
.bind-picker:hover { background: var(--surface-2); }

/* ── Policy list: click-to-expand row detail ── */
.policy-table .pr-chev { width: 34px; color: var(--text-faint); }
.policy-row { cursor: pointer; }
.policy-row:hover { background: var(--surface-2); }
.policy-row .pr-chev .icon { transition: transform 0.15s ease; }
.policy-row.open .pr-chev .icon { transform: rotate(90deg); }
.policy-detail > td { padding: 0 !important; background: var(--surface-2); }
.pd-body { padding: 16px 20px 18px; border-bottom: 1px solid var(--border); }
.pd-desc { margin: 0 0 14px; font-size: 13.5px; color: var(--text-soft); }
.pd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pd-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; }
.pd-num { font-size: 22px; font-weight: 750; color: var(--ink); line-height: 1.05; }
.pd-num.teal { color: var(--teal-strong); }
.pd-num.amber { color: var(--amber); }
.pd-lbl { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.pd-row { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; }
.pd-k { flex: none; width: 72px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.pd-v { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-actions { margin-top: 12px; }

/* Sticky edit-mode banner */
.edit-banner { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px 16px; border-radius: 12px; background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent); color: var(--amber); font-size: 13.5px; }
.edit-banner strong { color: var(--ink); }

/* ── Policy setup wizard (Details → Applications → Permissions) ── */
.wiz-progress { display: flex; align-items: stretch; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 8px; margin-bottom: 22px; }
.wiz-step { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: none; border-radius: 12px; background: transparent; cursor: pointer; font: inherit; text-align: left; }
.wiz-step.active { background: var(--accent-soft); }
.wiz-step-n { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-strong); color: var(--text-faint); font-size: 14px; font-weight: 700; background: var(--surface); }
.wiz-step.active .wiz-step-n { border-color: var(--teal); color: var(--teal-strong); }
.wiz-step.done .wiz-step-n { background: var(--teal); border-color: var(--teal); color: #fff; }
.wiz-step-txt { min-width: 0; display: flex; flex-direction: column; }
.wiz-step-title { font-size: 14.5px; font-weight: 700; color: var(--text-faint); white-space: nowrap; }
.wiz-step.active .wiz-step-title, .wiz-step.done .wiz-step-title { color: var(--ink); }
.wiz-step-desc { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wiz-arrow { flex: none; display: flex; align-items: center; color: var(--border-strong); }

.wiz-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; max-width: 820px; margin: 0 auto; }
.wiz-main > .card { margin: 0; }
.wiz-nav { display: flex; align-items: center; gap: 10px; }
.wiz-nav .grow { flex: 1; }
.wiz-card-title { display: flex; align-items: center; font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 16px; }
.wiz-card-sub { font-size: 13px; font-weight: 400; color: var(--text-faint); margin-left: 6px; }

.wiz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wiz-check, .wiz-appcard { position: relative; display: flex; gap: 12px; padding: 14px; border: 1.4px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; }
.wiz-check { align-items: center; }
.wiz-appcard { align-items: flex-start; }
.wiz-check:has(input:checked), .wiz-appcard:has(input:checked) { border-color: var(--teal); background: var(--accent-soft); }
.wiz-check input, .wiz-appcard input { position: absolute; opacity: 0; width: 0; height: 0; }
.wc-box { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border: 1.6px solid var(--border-strong); border-radius: 6px; color: transparent; }
.wiz-check:has(input:checked) .wc-box, .wiz-appcard:has(input:checked) .wc-box { background: var(--teal); border-color: var(--teal); color: #fff; }
.wc-avatar, .wa-avatar { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--surface-3); color: var(--text-soft); font-size: 12.5px; font-weight: 700; }
.wa-avatar { width: 40px; height: 40px; border-radius: 10px; }
.wa-avatar.sm { width: 26px; height: 26px; font-size: 10.5px; border-radius: 7px; }
.wc-main, .wa-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wc-name, .wa-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.wc-sub { font-size: 12.5px; color: var(--text-faint); }
.wa-desc { font-size: 12.5px; color: var(--text-faint); line-height: 1.45; margin-top: 2px; }
.wiz-pill { margin-left: auto; padding: 5px 13px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 700; }

/* Optional-description collapse */
.field-collapse { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 14px; }
.field-collapse > summary { display: inline-flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent-strong); user-select: none; }
.field-collapse > summary::-webkit-details-marker { display: none; }
.field-collapse > summary .opt { padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.field-collapse[open] > summary { margin-bottom: 12px; }
.field-collapse[open] > summary span:not(.opt)::after { content: ' — hide'; color: var(--text-faint); font-weight: 500; }
.field-collapse > textarea { width: 100%; }

/* Choose-applications: grid of square cards */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
.app-sqcard { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; padding: 22px 12px; border: 1.4px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; text-align: center; }
.app-sqcard:has(input:checked) { border-color: var(--teal); background: var(--accent-soft); }
.app-sqcard[hidden] { display: none; }
.app-sqcard input { position: absolute; opacity: 0; width: 0; height: 0; }
.app-sqcheck { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1.6px solid var(--border-strong); border-radius: 6px; color: transparent; background: var(--surface); }
.app-sqcard:has(input:checked) .app-sqcheck { background: var(--teal); border-color: var(--teal); color: #fff; }
.app-sqname { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.apprule-mark.lg { width: 44px; height: 44px; border-radius: 11px; font-size: 15px; }
/* Real logo tile — white chip with the SVG; falls back to initials on 404 */
.apprule-mark.logo-tile { position: relative; background: #fff; border: 1px solid var(--border); overflow: hidden; }
.apprule-mark.logo-tile .app-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 18%; box-sizing: border-box; }
.apprule-mark.logo-tile .mi { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; border-radius: inherit; }
.apprule-mark.logo-tile.logo-missing { border: none; }
.apprule-mark.logo-tile.logo-missing .mi { display: flex; }

.wiz-side-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.wiz-kv { margin-bottom: 14px; }
.wiz-k { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.wiz-v { font-size: 14px; font-weight: 500; color: var(--ink); }
.wiz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip-lite { padding: 5px 11px; border-radius: 8px; background: var(--surface-3); color: var(--text-soft); font-size: 12.5px; font-weight: 500; }
.wiz-total { border: 1px solid var(--teal-border); border-radius: 13px; background: var(--green-soft); padding: 16px; text-align: center; }
.wiz-total-ico { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--teal); color: #fff; margin-bottom: 8px; }
.wiz-total-lbl { font-size: 12.5px; color: var(--text-soft); }
.wiz-total-num { font-size: 24px; font-weight: 700; color: var(--ink); }
/* Review step: groups + recap side by side */
.wiz-screen[data-panel="2"] .wiz-main { max-width: 1040px; }
.wiz-review-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.wiz-review-cols > .card { margin: 0; }
@media (max-width: 860px) { .wiz-review-cols { grid-template-columns: 1fr; } }
/* Review-step recap card */
.wiz-recap .recap-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.wiz-recap .recap-row:last-of-type { border-bottom: none; }
.recap-k { font-size: 13px; color: var(--text-faint); flex: none; }
.recap-v { font-size: 14px; font-weight: 600; color: var(--ink); text-align: right; }
.recap-perms { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.rc { display: inline-flex; align-items: center; gap: 5px; }
.rc::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.rc.allow { color: var(--teal-strong); } .rc.allow::before { background: var(--teal); }
.rc.ask { color: var(--amber); } .rc.ask::before { background: var(--amber); }
.rc.block { color: var(--red); } .rc.block::before { background: var(--red); }
.wiz-recap .wiz-total { margin-top: 16px; }
.wiz-selapps { display: flex; flex-direction: column; gap: 11px; margin-bottom: 18px; }
.wiz-selapp { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-soft); }
.wiz-note { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 14px; font-size: 12.5px; color: var(--text-faint); line-height: 1.55; margin-bottom: 16px; }
.wiz-side-actions { display: flex; gap: 10px; }
.wiz-side-actions .btn { flex: 1; justify-content: center; }
.wiz-side-actions .btn:first-child:not(:only-child) { flex: none; }

.wiz-bar { margin-bottom: 13px; }
.wiz-bar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.wiz-bar-lbl { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-soft); }
.wiz-dot { width: 8px; height: 8px; border-radius: 50%; }
.wiz-dot.allow { background: var(--teal); }
.wiz-dot.ask { background: var(--amber); }
.wiz-dot.block { background: var(--red); }
.wiz-bar-n { font-size: 14px; font-weight: 700; color: var(--ink); }
.wiz-bar-track { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.wiz-bar-fill { height: 100%; border-radius: 999px; width: 0; transition: width 0.2s ease; }
.wiz-bar-fill.allow { background: var(--teal); }
.wiz-bar-fill.ask { background: var(--amber); }
.wiz-bar-fill.block { background: var(--red); }
@media (max-width: 900px) { .wiz-cols { grid-template-columns: 1fr; } .wiz-grid { grid-template-columns: 1fr; } .wiz-side { position: static; } }

/* App-rules editor — rows */
.apprules-toolbar { display: flex; align-items: center; gap: 12px; padding: 2px 0 4px; flex-wrap: wrap; }
.apprules-toolbar .search { flex: 1; min-width: 200px; }
.apprule-note { display: flex; align-items: center; gap: 9px; padding: 13px 2px; color: var(--text-faint); font-size: 13px; line-height: 1.5; }
.apprule-note svg { flex: none; }
.apprule-list { display: flex; flex-direction: column; }
.apprule-row { border-top: 1px solid var(--border); }
.apprule-row[hidden] { display: none; }
.apprule-main { display: flex; align-items: center; gap: 12px; padding: 13px 2px; }
.apprule-expand { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: none; border-radius: 6px; background: transparent; color: var(--text-faint); cursor: pointer; }
.apprule-expand:hover { background: var(--surface-3); }
.apprule-expand .icon { transition: transform 0.16s ease; }
.apprule-row.open .apprule-expand .icon { transform: rotate(90deg); }
.apprule-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--text-soft); cursor: pointer; }
.apprule-info { flex: 1; min-width: 0; cursor: pointer; }
.apprule-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.apprule-line { font-size: 12.5px; color: var(--text-faint); margin-top: 1px; }
.app-tri { flex: none; }
.apprule-scopes { padding: 4px 2px 14px 48px; }
.apprule-scope { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.apprule-scope-label { flex: 1; min-width: 0; font-size: 12.5px; }
.apprule-more, .apprule-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px; color: var(--text-faint); font-size: 13px; border-top: 1px solid var(--border); text-align: center; }
.apprule-more svg { flex: none; }

/* Tools tab */
.tools-intro { font-size: 14px; color: var(--ink); line-height: 1.55; margin-bottom: 22px; }
.tools-sub { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.tools-sep { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.mcp-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.mcp-chip { display: inline-flex; align-items: center; gap: 9px; padding: 9px 15px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.mcp-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.mcp-chip-box { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border: 1.5px solid var(--border-strong); border-radius: 5px; color: transparent; }
.mcp-chip:has(input:checked) { border-color: var(--teal); background: var(--accent-soft); }
.mcp-chip:has(input:checked) .mcp-chip-box { background: var(--teal); border-color: var(--teal); color: #fff; }
@media (max-width: 820px) { .policy-top { grid-template-columns: 1fr; } }

/* Segmented tri-state control (Block · Ask · Allow) — radios, CSS-highlighted */
.tri { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; background: var(--surface); flex: none; }
.tri-seg { display: inline-flex; align-items: center; justify-content: center; padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 560; color: var(--text-soft); cursor: pointer; background: transparent; border: none; border-left: 1px solid var(--border); white-space: nowrap; }
.tri-seg:first-child { border-left: none; }
.tri-seg input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.tri-seg:hover { color: var(--ink); }
.tri-seg:has(input:checked).tri-block, .tri-seg.on.tri-block { background: var(--red-soft); color: var(--red); }
.tri-seg:has(input:checked).tri-ask, .tri-seg.on.tri-ask { background: var(--amber-soft); color: var(--amber); }
.tri-seg:has(input:checked).tri-allow, .tri-seg.on.tri-allow { background: var(--green-soft); color: var(--teal-strong); }
.tri-seg:has(input:focus-visible) { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
.seg-view .tri-seg.active { background: var(--accent-soft); color: var(--accent-strong); }

/* ── Inline SVG icons (src/ui/icons.ts) — inherit currentColor ─── */
.icon { flex: none; vertical-align: -3px; }
.nav-item .ico { display: inline-flex; align-items: center; justify-content: center; }
/* Prose block (template instructions) — pre-wrap but not code-like. */
.prose { white-space: pre-wrap; font-size: 13.5px; line-height: 1.65; color: var(--text-soft); max-width: 72ch; margin: 0; }
/* .wide drops the readable-measure cap so the text fills the card width. */
.prose.wide { max-width: none; }

/* ── Reveal CTAs — a segmented control: equal-width segments on a tinted track;
   the active segment is a raised white pill and shows its card panel below the
   bar (full width). Wired by the [data-reveal] handler in layout. ──────────── */
.reveal { margin-top: 16px; }
.reveal-tabs {
  display: flex; gap: 6px; padding: 5px;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 12px;
}
.reveal-tab {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 560; font-size: 13.5px; color: var(--text-soft);
  padding: 9px 14px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; cursor: pointer;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
.reveal-tab:hover { color: var(--ink); }
.reveal-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.reveal-tab .icon { opacity: 0.9; }
.reveal-panel { margin-top: 12px; }
@media (max-width: 640px) { .reveal-tab { padding: 9px 8px; font-size: 12.5px; } }

/* Copyable code/prompt block inside a card body. */
.code-block {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; margin: 0;
  white-space: pre-wrap; word-break: break-word; color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 82%, var(--surface));
  border: 1px solid var(--border); border-radius: 12px; box-shadow: inset 3px 0 0 var(--teal-border);
  padding: 18px 20px; max-height: 440px; overflow: auto;
}

/* ══ Org chart — the live governed reporting tree ═════════════════════════════
   All motion is in-place class/attr mutation on the server-rendered SVG; the
   right rail is a separate htmx branch. Three motion signatures: soft ease-out
   travel (moving), spring overshoot (blocked at a gate), slow sine breathing
   (thinking). Color is never the only signal — every state has a text label. */
.org-canvas-card { margin: 0; }
.org-rail { display: flex; flex-direction: column; gap: var(--space-sm); }
.org-rail .card { margin: 0; }
.org-head-actions { display: inline-flex; align-items: center; gap: 8px; }
.org-canvas { padding: 10px 14px 14px; position: relative; }

/* Right drawer — the rail lives here, collapsed by default. Fixed overlay so
   opening it never reflows (and never re-renders) the SVG canvas. */
.org-drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw; z-index: 60;
  background: var(--card, #fff); border-left: 1px solid var(--divider-solid, #ddd); box-shadow: -12px 0 32px rgba(15, 23, 32, 0.12);
  transform: translateX(102%); transition: transform 0.22s ease; display: flex; flex-direction: column; }
.org-drawer.open { transform: none; }
.org-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--divider, #eee); }
.org-drawer-head h2 { margin: 0; font-size: 14px; }
.org-drawer .org-rail { overflow-y: auto; padding: 12px 16px 16px; flex: 1; }
.drawer-toggle { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--divider-solid, #ccc); background: transparent; cursor: pointer; }
/* .badge's explicit display beats the UA [hidden] rule — restore it. */
.drawer-toggle .badge[hidden] { display: none; }
.drawer-toggle:hover { background: var(--hover, #f4f5f7); }
.drawer-close { font: inherit; border: 0; background: transparent; cursor: pointer; font-size: 14px; padding: 4px 6px; color: var(--muted, #666); }
.drawer-close:hover { color: inherit; }

/* Hover tooltip — the last message that traveled a node/edge. */
.org-tip { position: absolute; max-width: 280px; padding: 7px 10px; border-radius: 8px; z-index: 30; pointer-events: none;
  background: rgba(24, 30, 37, 0.92); color: #fff; font-size: 12px; line-height: 1.45; }
.org-tip-head { font-weight: 650; font-size: 11px; opacity: 0.8; margin-bottom: 2px; }
.org-svg { display: block; width: 100%; height: auto; }

/* LIVE pill — teal dot at rest, amber "Reconnecting" on poll failure. */
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; background: var(--teal-subtle); color: var(--teal-strong); border: 1px solid var(--teal-border); white-space: nowrap; }
.live-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); animation: org-breathe 2.2s ease-in-out infinite; }
.live-pill.reconnecting { background: var(--amber-subtle); color: var(--amber); border-color: #e6d9ad; }
.live-pill.reconnecting .dot { background: var(--amber); animation: none; }

/* ── Tier 0: the "You" pill (a person, not an agent) ── */
.you-pill rect { fill: var(--surface-2); stroke: var(--divider-solid); stroke-width: 1.2; stroke-dasharray: 5 4; transition: fill 0.4s; }
.you-pill text { fill: var(--text-soft); font-size: 12.5px; font-weight: 600; text-anchor: middle; }
.you-pill.flash rect { fill: var(--mint-fill); stroke: var(--teal-border); }

/* ── Edges: quiet at rest; warm teal for 4s after a delivery ── */
.edge { fill: none; stroke: var(--divider-solid); stroke-width: 1.5; opacity: 0.4; transition: stroke 0.6s, opacity 0.6s; }
.edge.warm { stroke: var(--teal); opacity: 0.55; }
.edge-channel { stroke-dasharray: 4 4; }

/* ── Delivery dots (ephemeral, driven by org-chart.js) ── */
.msg-dot { fill: var(--teal); }
.msg-dot.parked { fill: var(--amber); }
.msg-dot.fade { transition: opacity 0.4s; opacity: 0; }
.arrive-pulse { fill: none; stroke: var(--teal); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: org-arrive 0.5s ease-out forwards; }

/* ── Nodes: state carried by border + badge label (+ halo when working) ── */
.node .node-rect { fill: var(--paper); stroke: var(--divider-soft); stroke-width: 1.2; transition: stroke 0.3s, filter 0.3s, fill 0.3s; }
.node-name { fill: var(--ink); font-size: 14px; font-weight: 700; }
.node-name.sm { font-size: 12.5px; font-weight: 650; }
.node-agent { fill: var(--text-faint); font-size: 9.5px; font-family: var(--mono); }
.node-prov { fill: var(--text-faint); font-size: 9px; }
.mgr-counter { fill: var(--ink-soft); font-size: 10.5px; font-family: var(--mono); transform-box: fill-box; transform-origin: center; }
.mgr-counter.pop { animation: org-pop 0.22s ease-out; }
.node-avatar { fill: var(--teal-subtle); stroke: var(--teal-border); stroke-width: 1; }
.node-initials { fill: var(--teal-strong); font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.avatar-ring { fill: none; stroke: var(--divider-soft); stroke-width: 1; }
.badge-dot { fill: var(--divider-solid); transition: fill 0.3s; }
.badge-text { fill: var(--text-faint); font-size: 10px; font-weight: 650; }
.tool-chip { fill: var(--teal-strong); font-size: 9.5px; font-family: var(--mono); }
.replied-chip { fill: var(--teal-strong); font-size: 9.5px; font-weight: 700; opacity: 0; transition: opacity 0.3s; }
.replied-chip.show { opacity: 1; }
/* waking spinner ring — hidden except in the waking state */
.spin-ring { fill: none; stroke: var(--teal); stroke-width: 2; stroke-dasharray: 10 40; stroke-linecap: round; opacity: 0; transform-box: fill-box; transform-origin: center; }
.node.node-waking .spin-ring { opacity: 1; animation: org-orbit 1.1s linear infinite; }
/* states */
.node.node-offline .node-rect { fill: var(--surface-2); stroke: var(--divider-soft); }
.node.node-offline .node-avatar-img, .node.node-offline .node-avatar, .node.node-offline .node-initials { opacity: 0.4; }
.node.node-waking .node-rect { stroke: var(--teal); stroke-dasharray: 5 4; }
.node.node-idle .node-rect { stroke: var(--divider-solid); }
.node.node-working .node-rect { stroke: var(--teal); stroke-width: 2; animation: org-halo 2.2s ease-in-out infinite; }
.node.node-working .badge-dot { fill: var(--teal); }
.node.node-nosignal .node-rect { stroke: var(--danger); stroke-width: 2; }
.node.node-nosignal .badge-dot { fill: var(--danger); }
.node.node-nosignal .badge-text { fill: var(--danger); }

/* ── Gates: 28px diamond + text chip; armed → held → approved/rejected ── */
.gate-scale { transform-box: fill-box; transform-origin: center; }
.gate .gate-diamond { fill: var(--paper); stroke: var(--divider-solid); stroke-width: 1.5; transition: fill 0.25s, stroke 0.25s; }
.gate .gate-glyph { fill: none; stroke: var(--text-faint); stroke-width: 1.3; }
.gate .gate-chip { fill: var(--text-faint); font-size: 10px; font-weight: 650; text-anchor: middle; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
.gate .gate-stamp { font-size: 15px; font-weight: 800; text-anchor: middle; opacity: 0; transform-box: fill-box; transform-origin: center; }
.gate.held .gate-diamond { fill: var(--amber-subtle); stroke: var(--amber); stroke-width: 2; }
.gate.held .gate-glyph { stroke: var(--amber); }
.gate.held .gate-chip { fill: var(--amber); }
.gate.held .gate-scale { animation: org-gate-pulse 1.6s ease-in-out infinite; }
.gate.held.pop .gate-scale { animation: org-gate-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.gate.approved .gate-diamond { fill: var(--teal-subtle); stroke: var(--teal); stroke-width: 2; }
.gate.approved .gate-glyph { display: none; }
.gate.approved .stamp-check { opacity: 1; fill: var(--teal-strong); animation: org-stamp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.gate.approved .gate-chip { fill: var(--teal-strong); }
.gate.rejected .gate-diamond { fill: var(--danger-subtle); stroke: var(--danger); stroke-width: 2; }
.gate.rejected .gate-glyph { display: none; }
.gate.rejected .stamp-x { opacity: 1; fill: var(--danger); animation: org-stamp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.gate.rejected .gate-chip { fill: var(--danger); }

/* ── Right rail cards ── */
.rail-empty { color: var(--text-faint); font-size: 12.5px; padding: 4px 0; }
.rail-gate { padding: 10px 0; border-bottom: 1px solid var(--border); }
.rail-gate:first-child { padding-top: 0; }
.rail-gate:last-child { border-bottom: none; padding-bottom: 0; }
.rail-gate-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail-age { color: var(--amber); font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rail-gate-route { font-weight: 640; font-size: 13px; margin-top: 7px; }
.rail-gate-preview { color: var(--text-soft); font-size: 12.5px; margin-top: 4px; line-height: 1.45; }
.rail-gate-approver { color: var(--text-faint); font-size: 11.5px; margin-top: 4px; }
.ticker { display: flex; flex-direction: column; }
.ticker-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; line-height: 1.4; }
.ticker-row:first-child { padding-top: 0; }
.ticker-row:last-child { border-bottom: none; padding-bottom: 0; }
.ticker-time { color: var(--text-faint); font-size: 11.5px; flex: none; padding-top: 1px; }
.ticker-row.warn { color: var(--amber); }
.ticker-row.ok { color: var(--teal-strong); }
.ticker-row.err { color: var(--danger); }
.rail-table th, .rail-table td { padding: 8px 14px; font-size: 12px; }
.rail-table .badge { font-size: 10.5px; padding: 1px 7px; margin: 1px 3px 1px 0; }

/* ── Keyframes (the only infinite loops are the working halo + held pulse) ── */
@keyframes org-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes org-halo {
  0%, 100% { filter: drop-shadow(0 0 1px rgba(25, 165, 155, 0.25)); }
  50% { filter: drop-shadow(0 0 7px rgba(25, 165, 155, 0.6)); }
}
@keyframes org-gate-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes org-gate-pop { 0% { transform: scale(1); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes org-stamp { 0% { transform: scale(1.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes org-arrive { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes org-pop { 0% { transform: scale(1); } 50% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes org-orbit { to { transform: rotate(360deg); } }
/* the tool chip owns the bottom-right slot while Working; ✓ Replied takes it back after */
.node.node-working .replied-chip.show { opacity: 0; }

/* ── Agents page — the card grid (one card per live agent group) ──────────── */
.agent-grid { margin-bottom: var(--space-sm); }
.agent-card { display: flex; flex-direction: column; gap: 11px; padding: 16px 18px; text-decoration: none; color: inherit; transition: border-color 0.12s, box-shadow 0.12s; }
.agent-card:hover { border-color: var(--teal-border); box-shadow: var(--shadow-sm); }
.agent-card-head { display: flex; align-items: center; gap: 12px; }
.agent-card-head .grow { min-width: 0; }
.agent-avatar { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--teal); display: inline-grid; place-items: center; flex: none; overflow: hidden; }
.agent-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agent-name { font-weight: 640; font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-person { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-foot { margin-top: auto; display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-faint); }

/* ── Standalone onboarding additions (reference tokens/components unchanged) ─ */
input[type=password], input[type=file] {
  width: 100%; font: inherit; font-size: 14px; line-height: 1.4; color: var(--ink);
  min-height: var(--control-h); padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
input[type=password]:focus, input[type=file]:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px var(--accent-ring); }
input[type=file] {
  padding: 4px; color: var(--text-soft); cursor: pointer;
}
input[type=file]::file-selector-button {
  min-height: calc(var(--control-h) - 10px); margin-right: 12px; padding: 6px 12px;
  border: 1px solid var(--teal-border); border-radius: calc(var(--radius-sm) - 2px);
  color: var(--accent-strong); background: var(--accent-soft); font: inherit; font-size: 12.5px; font-weight: 680;
  cursor: pointer; transition: color .12s, background .12s, border-color .12s;
}
input[type=file]::file-selector-button:hover {
  color: var(--on-action); border-color: var(--action); background: var(--action);
}
.actions { display: flex; align-items: center; gap: 8px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--text-faint); font-size: 12px; font-weight: 650; }
.hint { color: var(--text-faint); font-size: 12.5px; }
.optional { color: var(--text-faint); font-weight: 450; }
.field.compact { margin: 0; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.table-scroll { overflow-x: auto; }

.login-screen { min-height: 100vh; background: var(--surface-2); }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.08fr) minmax(460px, .92fr); }
.login-brand { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: clamp(48px, 7vw, 104px); background: #000; color: #b0b0b0; position: relative; overflow: hidden; }
.login-brand::after { content: ''; position: absolute; right: clamp(34px, 7vw, 100px); bottom: clamp(38px, 6vw, 82px); width: 74px; height: 12px; background: var(--mint); transform: skew(-42deg); transform-origin: center; }
.brand-lockup { position: absolute; top: 42px; left: clamp(48px, 7vw, 104px); }
.brand-lockup img { width: 171px; height: 20px; display: block; }
.login-copy { position: relative; z-index: 1; max-width: 680px; }
.login-kicker { margin: 0 0 18px; color: var(--mint); font-size: 13px; font-weight: 650; }
.login-brand h1 { max-width: 680px; margin: 0 0 24px; color: #fff; font-size: clamp(44px, 5.25vw, 76px); line-height: .97; letter-spacing: -.045em; text-wrap: balance; }
.login-copy > p:last-child { max-width: 570px; margin: 0; color: #b0b0b0; font-size: 18px; line-height: 1.55; text-wrap: balance; }
.login-assurance { position: absolute; left: clamp(48px, 7vw, 104px); bottom: 42px; display: flex; align-items: center; gap: 20px; color: #b0b0b0; font-size: 12.5px; }
.login-assurance span { display: inline-flex; align-items: center; gap: 7px; }
.login-assurance .icon { color: var(--mint); }
.login-panel { display: grid; place-items: center; padding: clamp(24px, 5vw, 72px); background: var(--surface-2); }
.login-card { width: min(440px, 100%); padding: clamp(28px, 4vw, 42px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md); }
.login-card h2 { margin: 22px 0 6px; font-size: 30px; letter-spacing: -.035em; }
.login-card > p { color: var(--text-faint); }
.login-form { margin-top: 28px; }
.login-submit { width: 100%; }
.login-help { margin: 18px 0 0; padding-top: 17px; border-top: 1px solid var(--border); font-size: 12px; }

.dash-kpis.compact { margin-bottom: var(--space-sm); }
.onboarding-card { margin: 0 0 var(--space-sm); overflow: hidden; }
.onboarding-head > div { min-width: 0; }
.onboarding-card > .card-body { padding: 28px 22px 24px; background: var(--surface-2); }
.timeline-visual { --timeline-progress: 0%; position: relative; min-height: 190px; padding: 0 8px; }
.timeline-line { position: absolute; z-index: 0; top: 18px; left: 26px; right: 26px; height: 3px; border-radius: 99px; background: var(--border); overflow: hidden; }
.timeline-line > span { display: block; width: var(--timeline-progress); height: 100%; background: var(--teal); border-radius: inherit; }
.onboarding-timeline { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); min-height: 190px; margin: 0; padding: 0; list-style: none; }
.onboarding-step { min-width: 0; display: grid; grid-template-rows: 42px 1fr; align-items: start; justify-items: stretch; }
.timeline-copy, .onboarding-step:nth-child(even) .timeline-copy { grid-row: 2; align-self: start; width: 100%; padding: 14px 14px 0 0; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.32; }
.timeline-milestone { color: var(--ink); font-size: 12px; font-weight: 700; }
.timeline-title { color: var(--ink); font-size: 13px; font-weight: 600; margin-top: 4px; text-wrap: balance; }
.timeline-details { color: var(--text-soft); font-size: 11.5px; margin-top: 4px; text-wrap: balance; }
.timeline-state { color: var(--text-faint); font-size: 11px; font-weight: 650; margin-top: 10px; }
.onboarding-step.current .timeline-state, .onboarding-step.completed .timeline-state { color: var(--accent-strong); }
.timeline-marker { grid-row: 1; position: relative; z-index: 2; display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--ink); border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 5px var(--surface-2); }
.onboarding-step.completed .timeline-marker { border-color: var(--teal); background: var(--teal); color: var(--on-teal); }
.onboarding-step.current .timeline-marker { border-color: var(--highlight); background: var(--highlight); color: #fff; box-shadow: 0 0 0 5px var(--surface-2), 0 0 0 8px color-mix(in srgb, var(--highlight) 22%, transparent); }
.onboarding-step.current .timeline-state { color: var(--highlight); }
.timeline-empty { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-faint); }
.timeline-empty strong { color: var(--ink); margin: 4px 0; }
.timeline-config { margin-top: 2px; padding-top: 16px; border-top: 1px solid var(--border); }
.timeline-config-body { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); overflow: hidden; }
.timeline-config-row { display: flex; align-items: flex-end; gap: 8px; padding: 14px; border-bottom: 1px solid var(--border); }
.timeline-config-row > form:last-child { flex: none; }
.timeline-edit-grid { display: grid; grid-template-columns: 72px minmax(92px, .8fr) minmax(180px, 1.5fr) 120px minmax(180px, 1.4fr) auto; align-items: end; gap: 8px; min-width: 0; flex: 1; }
.blueprint-edit-grid { grid-template-columns: 72px minmax(92px, .8fr) minmax(180px, 1.4fr) minmax(180px, 1.2fr) auto; }
.timeline-edit-grid .field { min-width: 0; }
.timeline-add-form { padding: 16px 14px; background: var(--surface); }
.timeline-add-heading { margin-bottom: 12px; }
.blueprint-card { margin-top: var(--space-sm); }
.review-copy-grid { display: grid; gap: var(--space-sm); }
.review-copy { margin: 0 !important; }
.review-copy textarea, .file-card textarea { min-height: 280px; }
.file-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.file-card { margin: 0 !important; }
.review-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: var(--space-sm); align-items: start; }
.version-rail { position: sticky; top: 95px; display: flex; flex-direction: column; gap: 6px; }
.version-rail h3 { margin: 0 0 5px; font-size: 12px; color: var(--text-faint); }
.version-item { display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--text-soft); background: var(--surface); }
.version-item:hover, .version-item.active { text-decoration: none; border-color: var(--teal-border); background: var(--accent-soft); }
.version-item small { color: var(--text-faint); }
.review-main { min-width: 0; }
.review-main .reveal-tabs { margin-bottom: 12px; }
.discussion { margin-top: var(--space-sm); }
.comment-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.validation-comment { padding: 12px 0; border-bottom: 1px solid var(--border); white-space: pre-wrap; }
.validation-comment:last-child { border-bottom: 0; }
.validation-comment-meta { margin-bottom: 5px; color: var(--text-faint); font-size: 11.5px; }

.review-hero, .tenant-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: var(--space-sm); padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.review-hero h2, .tenant-hero h2 { margin: 0 0 6px; font-size: 24px; }
.review-hero p, .tenant-hero p { margin: 0 0 9px; color: var(--text-soft); }
.review-hero code { display: block; max-width: 680px; overflow-wrap: anywhere; color: var(--text-faint); font-size: 11px; }
.review-action { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: var(--space-sm); padding: 16px 18px; border: 1px solid var(--teal-border); border-radius: var(--radius); background: var(--accent-soft); }
.review-action div { display: flex; flex-direction: column; }
.review-action span { color: var(--text-soft); font-size: 12.5px; }
.sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.sign-card { margin: 0 !important; padding: 20px; }
.sign-card h3 { margin: 0; }
.sign-card p { color: var(--text-soft); }
.package-inventory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.package-inventory > div { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.package-inventory > div > strong { font-size: 12px; color: var(--text-faint); }
.package-inventory a, .package-inventory span { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 7px; background: var(--surface-2); color: var(--text-soft); }
.review-columns { align-items: start; }
.validation-version-row { color: inherit; }
.validation-version-row.active { margin-inline: -10px; padding-inline: 10px; border-radius: 8px; background: var(--accent-soft); }
.compare-form { display: flex; align-items: end; gap: 10px; }
.compare-form label { flex: 1; color: var(--text-faint); font-size: 12px; }
.compare-form select { margin-top: 4px; }
.diff { display: flex; flex-direction: column; margin: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: auto; font: 12px/1.55 var(--mono); }
.diff span { display: block; white-space: pre-wrap; }
.diff .add { color: var(--teal-strong); background: var(--green-soft); }
.diff .remove { color: var(--red); background: var(--red-soft); }

.tenant-hero > div:last-child { display: flex; align-items: center; gap: 10px; }
.tenant-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-sm); }
.assignment-grid { margin-bottom: var(--space-sm); }
.assignment-card { margin: 0 !important; }
.assigned-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.assign-form { display: flex; gap: 8px; }
.inline-create, .tenant-picker { display: flex; align-items: end; gap: 10px; }
.inline-create .field, .tenant-picker .field, .tenant-picker > label { flex: 1; margin: 0; }
.access-create-grid { grid-template-columns: 1fr 1.2fr 1fr auto; margin-top: 20px; }
.user-manage { position: relative; }
.user-manage summary { list-style: none; }
.user-manage summary::-webkit-details-marker { display: none; }
.manage-popover {
  position: absolute; z-index: 3; top: calc(100% - 8px); right: 20px; width: min(620px, calc(100% - 40px));
  padding: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 18px 52px rgba(26, 22, 18, .15);
}
.manage-popover-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.manage-popover-head strong { font-size: 14px; }
.manage-popover-head span { color: var(--text-faint); font-size: 12px; overflow-wrap: anywhere; }
.manage-reset-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.manage-reset-form .btn { min-height: var(--control-h); white-space: nowrap; }
.manage-quick-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.manage-quick-actions form { margin: 0; }
.source-list { display: flex; flex-direction: column; }
.source-row { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.source-row:last-child { border-bottom: 0; }
.source-row > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.source-row > summary > div { display: flex; flex-direction: column; }
.source-row > summary span:not(.badge) { color: var(--text-faint); font-size: 12px; }
.source-row form { margin-top: 18px; padding: 18px; border-radius: 9px; background: var(--surface-2); }
.upload-form { margin-top: 22px; }

.error-panel { width: min(520px, calc(100% - 32px)); margin: 12vh auto; padding: 34px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md); text-align: center; }
.error-code { display: block; color: var(--teal); font-size: 52px; font-weight: 800; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 430px; padding: 110px 32px 100px; }
  .brand-lockup { left: 32px; }
  .login-assurance { left: 32px; bottom: 32px; }
  .login-brand::after { right: 40px; bottom: 44px; }
  .login-panel { padding: 32px 20px; }
  .review-layout { grid-template-columns: 1fr; }
  .version-rail { position: static; display: grid; grid-template-columns: repeat(3, 1fr); }
  .sign-grid, .package-inventory { grid-template-columns: 1fr 1fr; }
  .details-field { grid-column: span 2; }
}
@media (max-width: 640px) {
  .content { padding: 20px 14px; }
  .topbar { padding: 14px; }
  .topbar .governance-viewer { border: 0; padding: 0; }
  .card:has(> .table) { max-width: 100%; overflow-x: auto; }
  .card:has(> .table) > .table { min-width: 520px; }
  .review-hero, .tenant-hero, .review-action, .tenant-hero > div:last-child { flex-direction: column; align-items: stretch; }
  .sign-grid, .package-inventory, .version-rail, .access-create-grid { grid-template-columns: 1fr; }
  .details-field { grid-column: auto; }
  .compare-form, .assign-form, .inline-create, .tenant-picker { flex-direction: column; align-items: stretch; }
  .login-brand { min-height: 410px; padding: 98px 24px 96px; }
  .brand-lockup, .login-assurance { left: 24px; }
  .brand-lockup { top: 30px; }
  .login-brand h1 { font-size: 42px; }
  .login-copy > p:last-child { font-size: 16px; }
  .login-assurance { gap: 12px; flex-wrap: wrap; }
  .login-brand::after { display: none; }
  .login-card { padding: 24px; }
}

/* ── Workspace lifecycle and customer-facing resource surfaces ───────────── */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.grow { flex: 1; min-width: 0; }
.back-btn { white-space: nowrap; }
.section-intro, .workspace-heading, .template-hero, .catalog-app-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: var(--space-sm); }
.section-intro h2, .workspace-heading h2, .template-hero h2, .catalog-app-hero h2 { margin: 0 0 5px; font-size: clamp(22px, 3vw, 30px); letter-spacing: -.035em; }
.section-intro p, .workspace-heading p, .template-hero p, .catalog-app-hero p { max-width: 760px; margin: 0; color: var(--text-soft); }
.workspace-heading { align-items: center; margin: 4px 0 28px; padding: 4px; }
.workspace-heading > .badge { align-self: flex-start; }
.workspace-heading h2 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 42px); line-height: 1.05; text-wrap: balance; }
.signed-banner { border-left-color: var(--teal); background: color-mix(in srgb, var(--surface) 82%, var(--surface-3)); color: var(--text-soft); }
.signed-banner strong { color: var(--ink); }

.sign-workspace-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: clamp(20px, 4vw, 48px); align-items: center; padding: 28px; margin-bottom: var(--space-sm); border-color: #1a1612; background: #1a1612; color: #fff; box-shadow: var(--shadow-md); }
.sign-workspace-card .eyebrow { color: #56edd6; }
.sign-workspace-card h2 { margin: 3px 0 8px; color: #fff; font-size: 24px; }
.sign-workspace-card p { margin: 0; color: #b0b0b0; }
.sign-workspace-card form { display: grid; gap: 14px; justify-items: start; }
.sign-confirm { align-items: flex-start; }
.sign-workspace-card label.chk { color: #fff; border-color: #5c5349; }
.sign-workspace-card label.chk:has(input:checked) { color: #fff; border-color: #56edd6; background: #173a35; }
.sign-workspace-card .btn.primary { background: #56edd6; border-color: #56edd6; color: #1a1612; }
.sign-workspace-card .btn.primary:hover { background: #88ffe8; border-color: #88ffe8; }
.sign-workspace-card.is-disabled { border-color: var(--border); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.sign-workspace-card.is-disabled .eyebrow { color: var(--text-faint); }
.sign-workspace-card.is-disabled h2 { color: var(--ink); }
.sign-workspace-card.is-disabled p { color: var(--text-soft); }
.sign-workspace-card.is-disabled label.chk { color: var(--text-faint); border-color: var(--border); }
.sign-workspace-card.signed { grid-template-columns: minmax(0, 1fr) auto; border-color: var(--teal-border); background: var(--green-soft); color: var(--ink); box-shadow: var(--shadow-sm); }
.sign-workspace-card.signed .eyebrow { color: var(--teal-strong); }
.sign-workspace-card.signed h2 { color: var(--ink); }
.sign-workspace-card.signed p { color: var(--text-soft); }
.sign-workspace-card.signed > div { display: flex; align-items: flex-start; gap: 14px; }
.sign-workspace-card.signed .icon { margin-top: 4px; color: var(--teal); }

.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; margin-bottom: var(--space-sm); }
.resource-card { min-width: 0; min-height: 88px; display: flex; align-items: center; gap: 14px; padding: 17px; color: inherit; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, transform .12s; }
.resource-card:hover { text-decoration: none; border-color: var(--teal-border); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.resource-card-icon, .scope-tenant-icon, .scope-card-icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--teal-strong); }
.resource-card-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.resource-card-copy strong { overflow-wrap: anywhere; color: var(--ink); font-size: 15px; }
.resource-card-copy small { color: var(--text-faint); overflow-wrap: anywhere; }
.resource-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty.compact { padding: 22px 12px; }

.resource-comment { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.resource-comment:first-child { padding-top: 0; }
.resource-comment:last-of-type { border-bottom: 0; }
.comment-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--teal-strong); font-weight: 750; }
.resource-comment-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; }
.resource-comment-meta strong { color: var(--ink); }
.resource-comment-meta span, .resource-comment-meta time { color: var(--text-faint); font-size: 11.5px; overflow-wrap: anywhere; }
.resource-comment p, .history-comment p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.locked-hint { padding-top: 14px; border-top: 1px solid var(--border); }

/* Policy wizard — reference structure, tenant-aware content. */
.policy-wizard { display: grid; gap: 18px; }
.wiz-steps { display: flex; gap: 7px; padding: 7px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
.wiz-steps .wiz-step { justify-content: center; color: var(--text-faint); font-weight: 650; }
.wiz-steps .wiz-step span { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); }
.wiz-steps .wiz-step.active { color: var(--ink); background: var(--accent-soft); }
.wiz-steps .wiz-step.active span { color: var(--on-teal); border-color: var(--teal); background: var(--teal); }
.wiz-screen { display: grid; gap: 18px; }
.wiz-screen[hidden] { display: none !important; }
.app-picker-card { overflow: hidden; }
.app-picker-card .card-head { flex-wrap: wrap; }
.app-picker-card .search { width: min(310px, 100%); }
.app-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 9px; }
.app-sqcard { min-width: 0; min-height: 142px; }
.app-sqcard > span:not(.app-logo):not(.badge) { min-width: 0; display: flex; flex-direction: column; }
.app-sqcard strong, .app-sqcard small { overflow-wrap: anywhere; }
.app-sqcard small { color: var(--text-faint); }
.app-sqcard.disabled { cursor: not-allowed; opacity: .65; }
.app-logo { flex: none; width: 48px; height: 48px; display: inline-grid; place-items: center; border-radius: 12px; background: var(--surface-3); overflow: hidden; }
.app-logo:has(img), .scope-tenant-icon:has(img), .tenant-profile-logo:has(img) { background: #fff; }
.app-logo img { width: 100%; height: 100%; display: block; object-fit: contain; padding: 8px; }
.app-logo.small { width: 34px; height: 34px; border-radius: 9px; }
.app-initials { color: var(--teal-strong); font-weight: 800; letter-spacing: -.02em; }
.permission-list { display: grid; gap: 12px; }
.permission-app { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.permission-app > summary { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 14px 17px; cursor: pointer; list-style: none; }
.permission-app > summary::-webkit-details-marker { display: none; }
.permission-app > summary > span:not(.app-logo):not(.badge) { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.permission-app > summary small { color: var(--text-faint); overflow-wrap: anywhere; }
.permission-app[open] > summary > .icon { transform: rotate(90deg); }
.permission-app-body { border-top: 1px solid var(--border); }
.permission-row { min-width: 0; display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: center; gap: 20px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.permission-row:last-child { border-bottom: 0; }
.permission-copy { min-width: 0; display: flex; flex-direction: column; }
.permission-copy span { color: var(--text-soft); }
.permission-copy code { width: fit-content; max-width: 100%; margin-top: 4px; color: var(--text-faint); overflow-wrap: anywhere; }
.tri-state { display: flex; gap: 4px; min-width: 270px; margin: 0; padding: 3px; border: 0; border-radius: 10px; background: var(--surface-3); }
.tri-state label { flex: 1; cursor: pointer; }
.tri-state input { position: absolute; opacity: 0; pointer-events: none; }
.tri-state span { min-height: 36px; display: grid; place-items: center; padding: 6px 10px; border: 1px solid transparent; border-radius: 8px; color: var(--text-soft); font-size: 12px; font-weight: 700; }
.tri-state input:focus-visible + span { outline: 3px solid var(--accent-ring); outline-offset: 1px; }
.tri-state .allow input:checked + span { color: var(--teal-strong); border-color: var(--teal-border); background: var(--green-soft); }
.tri-state .ask input:checked + span { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, transparent); background: var(--amber-soft); }
.tri-state .block input:checked + span { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); background: var(--red-soft); }
.assignment-fields > .card { margin: 0; }
.assignment-fields > .field-error { grid-column: 1 / -1; }
.assignment-editor { margin-bottom: 0; }
.assignment-builder > label { display: block; margin-bottom: 6px; }
.assignment-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.assignment-entry .btn { min-height: var(--control-h); }
.assignment-editor .binding-list { min-height: 48px; margin: 14px 0 10px; align-content: flex-start; }
.binding-chip.editable { max-width: 100%; padding-right: 5px; }
.binding-chip.editable > span { min-width: 0; overflow-wrap: anywhere; }
.binding-remove { width: 26px; height: 26px; display: grid; place-items: center; flex: none; border: 0; border-radius: 50%; color: var(--text-faint); background: transparent; cursor: pointer; font: 700 17px/1 var(--font); }
.binding-remove:hover { color: var(--red); background: var(--red-soft); }
.binding-remove:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 1px; }
.policy-recap { margin: 0; }
.policy-recap .recap-row { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.policy-recap .recap-row:last-child { border-bottom: 0; }
.read-policy-grid { display: grid; gap: 12px; margin: 12px 0 22px; }
.read-policy-app { margin: 0; box-shadow: none; }
.read-policy-app .card-head { justify-content: flex-start; }
.read-decision { min-width: 0; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(120px, auto) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.read-decision:last-child { border-bottom: 0; }
.read-decision > span:first-child { display: flex; flex-direction: column; }
.read-decision small { color: var(--text-faint); }
.read-decision code { overflow-wrap: anywhere; }
.scope-pill.block { color: var(--red); background: var(--red-soft); border-color: transparent; }
.binding-list { display: flex; flex-wrap: wrap; gap: 8px; }
.binding-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.binding-chip small { padding: 2px 6px; border-radius: 999px; color: var(--teal-strong); background: var(--accent-soft); font-weight: 700; }
.binding-chip.group small { color: var(--amber); background: var(--amber-soft); }

.selected-app-field, .app-skill-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-head .app-skill-title { margin-bottom: 0; }
.selected-app-field > span:last-child, .app-skill-title > div { display: flex; flex-direction: column; }
.selected-app-field small { color: var(--text-faint); }
.markdown { max-width: 72ch; margin: 0; color: var(--text-soft); font-size: 14.5px; line-height: 1.72; white-space: normal; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h2, .markdown h3, .markdown h4, .markdown h5 { margin: 1.65em 0 .55em; color: var(--text); line-height: 1.28; letter-spacing: -.015em; }
.markdown h2 { font-size: 21px; font-weight: 720; }
.markdown h3 { font-size: 17px; font-weight: 700; }
.markdown h4, .markdown h5 { font-size: 14.5px; font-weight: 700; }
.markdown p { margin: 0 0 1em; }
.markdown ul, .markdown ol { margin: .6em 0 1.15em; padding-left: 1.55em; }
.markdown li { padding-left: .25em; }
.markdown li + li { margin-top: .55em; }
.markdown li::marker { color: var(--accent-strong); font-weight: 700; }
.markdown strong { color: var(--text); font-weight: 680; }
.markdown blockquote { margin: 1.25em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--teal-border); color: var(--text-faint); }
.markdown blockquote p { margin: 0; }
.markdown hr { margin: 1.8em 0; border: 0; border-top: 1px solid var(--border); }
.markdown pre {
  max-width: 100%; overflow: auto; margin: 1.35em 0; padding: 18px 20px 18px 22px;
  border: 1px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 82%, var(--surface)); box-shadow: inset 3px 0 0 var(--teal-border);
  font-size: 13px; line-height: 1.65; white-space: pre;
}
.markdown code { padding: .12em .35em; border-radius: 4px; background: var(--surface-3); color: var(--text); font-size: .9em; overflow-wrap: anywhere; }
.markdown pre code { padding: 0; border-radius: 0; background: transparent; color: inherit; font-size: inherit; }
.markdown-edit-toggle { display: flex; align-items: center; justify-content: center; width: max-content; margin: 0 0 18px auto; list-style: none; border-color: var(--teal-border); background: var(--accent-soft); color: var(--accent-strong); font-weight: 680; }
.markdown-document-editor > summary::-webkit-details-marker { display: none; }
.markdown-document-editor:not([open]) .markdown-editor-form, .markdown-document-editor[open] + .markdown-document-preview { display: none; }
.markdown-document-editor:not([open]) .markdown-edit-toggle { margin-bottom: 0; }
.markdown-document-editor:not([open]) + .markdown-document-preview { margin-top: 18px; }
.markdown-editor-form { padding-top: 2px; }
.markdown-document-preview { min-width: 0; padding: 8px 10px 18px; }
.policy-details-preview p { white-space: pre-wrap; }
.unsupported-data { margin-top: 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.unsupported-data summary { cursor: pointer; color: var(--text-soft); font-weight: 650; }
.unsupported-data pre { max-height: 260px; overflow: auto; white-space: pre-wrap; }

.template-hero { align-items: center; }
.category-form { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.category-form label { color: var(--text-faint); font-size: 12px; }
.category-form input { display: block; margin-top: 4px; }
.template-content { display: grid; gap: var(--space-sm); margin-top: var(--space-sm); }
.template-content .card + .card { margin-top: 0; }
.content-section { margin: 0; }
.content-section > summary { cursor: pointer; list-style: none; }
.content-section > summary::-webkit-details-marker, .content-section > summary::marker { display: none; content: ''; }
.content-section > summary:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.content-section:not([open]) > summary { border-bottom: 0; }
.content-section-summary { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.content-section-title { min-width: 0; display: flex; flex-direction: column; }
.content-section-title .sub { font-weight: 400; overflow-wrap: anywhere; }
.content-section-meta { display: flex; align-items: center; gap: 10px; }
.content-section-action { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text-soft); font-size: 11.5px; font-weight: 650; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.content-section > summary:hover .content-section-action { border-color: var(--teal-border); background: var(--accent-soft); color: var(--accent-strong); }
.content-section-close-label { display: none; }
.content-section-action > .icon { transition: transform .15s ease; }
.content-section[open] .content-section-open-label { display: none; }
.content-section[open] .content-section-close-label { display: inline; }
.content-section[open] > summary .content-section-action > .icon { transform: rotate(90deg); }
.skill-file-group { overflow: hidden; }
.skill-file-group > .skill-primary { border: 0; border-radius: 0; box-shadow: none; }
.skill-file-group > .skill-primary:not([open]) > summary { border-bottom: 1px solid var(--border); }
.skill-supporting-files { display: grid; gap: 8px; padding: 12px 16px 16px; background: var(--surface); }
.skill-supporting-files-head { color: var(--accent-strong); font-size: 12px; font-weight: 650; }
.skill-supporting-files .content-section { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: none; background: var(--surface); }
.skill-supporting-files .content-section > summary { padding: 12px 14px; }
.skill-supporting-files .content-section:not([open]) > summary { border-radius: var(--radius-lg); }
.skill-supporting-files .content-section[open] > summary { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.skill-supporting-files .content-section > summary:hover { background: var(--accent-soft); }
.skill-supporting-files .content-section .card-body { margin: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); background: var(--surface); }
.skill-supporting-files .card-head h2 { font-size: 14px; font-weight: 650; }
.document-metadata {
  max-width: 860px; margin: 0 0 30px; padding: 0; border-top: 1px solid var(--border-strong);
}
.document-metadata > div {
  min-width: 0; display: grid; grid-template-columns: minmax(120px, .32fr) minmax(0, 1fr);
  gap: 24px; padding: 14px 2px; border-bottom: 1px solid var(--border);
}
.document-metadata dt { color: var(--text-faint); font-size: 12px; font-weight: 680; }
.document-metadata dd { min-width: 0; margin: 0; color: var(--text-soft); overflow-wrap: anywhere; }
.document-metadata dd code {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  color: var(--accent-strong); background: var(--accent-soft); font-size: 12.5px; overflow-wrap: anywhere;
}
.document-metadata.compact { max-width: 680px; margin-bottom: 34px; }
.document-section { max-width: 760px; margin-top: 32px; }
.document-section > h3 {
  margin: 0 0 12px; color: var(--text-faint); font-size: 12px; font-weight: 700;
  letter-spacing: .02em; text-transform: uppercase;
}
.task-script {
  max-width: 100%; overflow: auto; margin: 0; padding: 18px 20px;
  border: 1px solid var(--border); border-radius: 12px; color: var(--text-soft);
  background: color-mix(in srgb, var(--surface-2) 82%, var(--surface)); box-shadow: inset 3px 0 0 var(--teal-border);
  font: 13px/1.65 var(--mono); white-space: pre;
}
.app-collapse > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; }
.app-collapse > div { padding: 0 0 12px; }
.capability-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.capability-row:last-child { border-bottom: 0; }
.capability-row span, .capability-row code { color: var(--text-faint); overflow-wrap: anywhere; }

/* History grouped by immutable cycle and individual asset. */
.history-timeline { position: relative; display: grid; gap: var(--space-sm); }
.history-cycle { margin: 0; overflow: hidden; }
.history-cycle-head { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 20px; border-bottom: 1px solid var(--border); }
.history-cycle-head h2 { margin: 1px 0 4px; font-size: 18px; }
.history-cycle-head p { margin: 0; color: var(--text-soft); }
.history-marker { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text-soft); }
.history-marker.signed { color: var(--teal-strong); background: var(--green-soft); }
.history-cycle-body { padding: 0 20px 20px; }
.history-section { border-bottom: 1px solid var(--border); }
.history-section:last-child { border-bottom: 0; }
.history-section > summary { display: flex; align-items: center; gap: 12px; padding: 16px 0; cursor: pointer; list-style: none; }
.history-section > summary::-webkit-details-marker, .history-asset > summary::-webkit-details-marker { display: none; }
.history-section > summary span { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.history-section[open] > summary > .icon, .history-asset[open] > summary > .icon { transform: rotate(90deg); }
.history-asset { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.history-asset > summary { display: flex; align-items: center; gap: 11px; padding: 11px 13px; cursor: pointer; list-style: none; background: var(--surface); }
.history-asset > summary > span:nth-child(2) { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.history-asset > summary strong, .history-asset > summary small { overflow-wrap: anywhere; }
.history-asset > summary small { color: var(--text-faint); }
.change-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.history-asset.added .change-dot { background: var(--teal); }
.history-asset.changed .change-dot { background: var(--amber); }
.history-asset.removed .change-dot { background: var(--red); }
.history-asset-body { padding: 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.asset-diff { max-height: 520px; margin: 0; }
.asset-preview { max-height: 360px; margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.asset-preview.removed { color: var(--text-faint); text-decoration-color: var(--red); }
.history-comments { display: grid; gap: 8px; padding-bottom: 12px; }
.history-comment { padding: 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.history-comment > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.history-comment span { color: var(--text-faint); font-size: 11.5px; overflow-wrap: anywhere; }

/* Admin scoping, tenant workspace, catalog and audit. */
.scope-card { display: flex; align-items: center; gap: 14px; margin-bottom: var(--space-sm); padding: 18px; color: inherit; border: 1px solid var(--teal-border); border-radius: var(--radius); background: var(--accent-soft); }
.scope-card:hover { text-decoration: none; }
.scope-card > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.scope-card small { color: var(--text-soft); }
.scope-tenant-list { display: flex; flex-direction: column; }
.tenant-list-filter { max-width: 420px; margin-bottom: var(--space-sm); }
.scope-tenant-row { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 14px 18px; color: inherit; border-bottom: 1px solid var(--border); }
.scope-tenant-row:last-child { border-bottom: 0; }
.scope-tenant-row:hover { text-decoration: none; background: var(--surface-2); }
.scope-tenant-row > span.grow { display: flex; flex-direction: column; }
.scope-tenant-row strong, .scope-tenant-row small { overflow-wrap: anywhere; }
.scope-tenant-row small { color: var(--text-faint); }
.scope-tenant-icon, .tenant-profile-logo { overflow: hidden; border-radius: 50%; font-weight: 750; }
.scope-tenant-icon:has(img) { padding: 4px; }
.tenant-profile-logo:has(img) { padding: 7px; }
.scope-tenant-icon img, .tenant-profile-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.tenant-profile-logo { flex: none; width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface-2); color: var(--teal-strong); font-size: 24px; }
.tenant-title { min-width: 0; display: flex; align-items: center; gap: 16px; }
.tenant-title > div { min-width: 0; }
.tenant-create-grid { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 14px; align-items: start; }
.tenant-create-grid .field { margin-bottom: 0; }
.tenant-create-grid > .btn { grid-column: 1 / -1; justify-self: end; }
.tenant-profile-card { margin-bottom: var(--space-sm); }
.tenant-archive, .tenant-danger { margin-top: var(--space-sm); }
.tenant-danger { border-color: var(--danger); }
.tenant-danger .card-head { background: var(--danger-subtle); }
.workspace-admin-hero { align-items: center; }
.tenant-workspace-controls { display: flex; align-items: center; gap: 10px; }
.tenant-logo-picker { position: relative; display: block; border-radius: 14px; cursor: pointer; }
.tenant-logo-picker:hover .tenant-profile-logo,
.tenant-workspace-controls input:focus-visible + .tenant-logo-picker .tenant-profile-logo { border-color: var(--action); box-shadow: 0 0 0 3px var(--accent-ring); }
.tenant-logo-edit { position: absolute; right: -5px; bottom: -5px; width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid var(--surface); border-radius: 50%; background: var(--action); color: var(--on-action); box-shadow: var(--shadow-sm); pointer-events: none; }
.tenant-workspace-controls .field-error { max-width: 180px; margin: 0; }
.tenant-switcher { width: min(320px, 100%); min-width: min(320px, 100%); }
.tenant-switcher-field { width: 100%; }
.signed-by { font-size: 12.5px; }
.reopen-form { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: var(--space-sm); padding: 16px 18px; border: 1px solid var(--teal-border); border-radius: var(--radius); background: var(--accent-soft); }
.reopen-form > div { display: flex; flex-direction: column; }
.reopen-form span { color: var(--text-soft); }
.shared-assignment { margin-top: var(--space-sm); }
.shared-assign-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.shared-assign-row:last-child { border-bottom: 0; }
.shared-assign-row > span { display: flex; flex-direction: column; }
.shared-assign-row small { color: var(--text-faint); }
.upload-form.card { margin-top: var(--space-sm); }
.reopen-confirm { margin: 16px 0; }
.signed-mutation-confirmation { margin: 18px 0; }
.signed-mutation-confirmation .banner { margin: 0 0 10px; }
.signed-mutation-confirmation .reopen-confirm { margin: 0; }
.signed-mutation-confirmation.compact { flex: 1 0 100%; margin: 8px 0; }
.signed-mutation-confirmation.compact .banner { padding: 10px 12px; }
.category-form .signed-mutation-confirmation { flex-basis: 100%; }

.catalog-list { display: flex; flex-direction: column; }
.catalog-row { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 12px 18px; color: inherit; border-bottom: 1px solid var(--border); }
.catalog-row:last-child { border-bottom: 0; }
.catalog-row:hover { text-decoration: none; background: var(--surface-2); }
.catalog-row.disabled { opacity: .68; }
.catalog-row > span.grow { display: flex; flex-direction: column; }
.catalog-row small { color: var(--text-faint); overflow-wrap: anywhere; }
.catalog-create { margin-top: var(--space-sm); }
.catalog-app-hero { align-items: center; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.catalog-app-hero .app-logo { width: 64px; height: 64px; }
.catalog-app-hero > div { flex: 1; }
.catalog-settings > .card { margin: 0; }
.catalog-actions { display: grid; gap: 12px; }
.catalog-action-form { padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.catalog-action-form.new { border-color: var(--teal-border); background: var(--accent-soft); }
.catalog-action-head, .catalog-action-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.catalog-action-controls { align-items: end; margin: 0; }
.catalog-action-controls > label:first-child { min-width: 180px; color: var(--text-faint); font-size: 12px; }
.catalog-action-controls select { display: block; margin-top: 4px; }
.catalog-presentation-actions { align-items: center; justify-content: space-between; flex-wrap: wrap; }

.audit-filters { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)) auto auto; gap: 10px; align-items: end; }
.audit-filters label { min-width: 0; color: var(--text-faint); font-size: 12px; }
.audit-filters select, .audit-filters input { margin-top: 4px; }
.audit-list { display: grid; gap: 10px; margin: var(--space-sm) 0; }
.audit-card { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.audit-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--teal-strong); background: var(--green-soft); }
.audit-copy > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.audit-copy > p { margin: 2px 0 10px; color: var(--text-faint); font-size: 12px; }
.audit-copy dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin: 0; }
.audit-copy dl div { min-width: 0; display: flex; flex-direction: column; }
.audit-copy dt { color: var(--text-faint); font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.audit-copy dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.audit-actor-role {
  display: inline-flex; margin-right: 3px; padding: 2px 7px; border: 1px solid var(--teal-border);
  border-radius: 999px; color: var(--accent-strong); background: var(--accent-soft);
  font-size: 10.5px; font-weight: 720; vertical-align: .08em;
}
.audit-actor-role.administrator {
  border-color: color-mix(in srgb, var(--ink) 22%, var(--border));
  color: var(--text-soft);
  background: color-mix(in srgb, var(--ink) 6%, var(--surface));
}
.audit-actor-role.system { border-color: var(--border-strong); color: var(--text-soft); background: var(--surface-2); }
.security-events > summary { cursor: pointer; list-style: none; }
.security-event-list { border-top: 1px solid var(--border); }
.security-audit-event { margin: 10px; }
.security-event { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.security-event:last-child { border-bottom: 0; }
.security-event > span:nth-child(2) { display: flex; flex-direction: column; }
.security-event small { color: var(--text-faint); }

@media (max-width: 1100px) {
  .audit-filters { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar-open .sidebar { display: flex; position: fixed; z-index: 30; inset: 0 auto 0 0; width: min(290px, calc(100vw - 52px)); box-shadow: 16px 0 40px rgba(0,0,0,.2); }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; z-index: 29; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(0,0,0,.36); cursor: default; }
  .sign-workspace-card { grid-template-columns: 1fr; }
  .permission-row { grid-template-columns: 1fr; }
  .tri-state { width: 100%; min-width: 0; }
  .read-decision { grid-template-columns: minmax(0, 1fr) auto; }
  .read-decision code { grid-column: 1 / -1; }
  .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-edit-grid { grid-template-columns: 68px minmax(100px, .8fr) minmax(180px, 1.5fr) 120px auto; }
  .timeline-edit-grid .details-field { grid-column: 2 / 5; }
}
@media (max-width: 640px) {
  .topbar { min-width: 0; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .topbar-left { width: 100%; align-items: flex-start; }
  .topbar-left > div:last-child { min-width: 0; }
  .topbar > .actions { width: 100%; min-width: 0; margin-left: 0; justify-content: space-between; flex-wrap: wrap; }
  .topbar .governance-viewer > span { display: none; }
  .topbar h1 { max-width: none; overflow-wrap: anywhere; white-space: normal; }
  .section-intro, .workspace-heading, .template-hero, .catalog-app-hero, .reopen-form { flex-direction: column; align-items: stretch; }
  .template-hero + .reveal-tabs.seg { overflow-x: auto; }
  .template-hero + .reveal-tabs.seg .reveal-tab { flex: 0 0 auto; white-space: nowrap; }
  .sign-workspace-card.signed { grid-template-columns: 1fr; }
  .wiz-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .wiz-steps .wiz-step {
    width: 100%; min-width: 0; min-height: 58px; display: grid; place-items: center; align-content: center;
    gap: 4px; padding: 6px 3px; font-size: 11.5px; line-height: 1.15; text-align: center; white-space: normal;
  }
  .app-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-sqcard { min-height: 140px; padding: 16px 8px; }
  .permission-app > summary { align-items: flex-start; flex-wrap: wrap; }
  .permission-app > summary > .badge { margin-left: 46px; }
  .permission-row { padding: 13px; }
  .tri-state span { min-height: 42px; padding-inline: 5px; }
  .wiz-nav { flex-wrap: wrap; justify-content: space-between; }
  .wiz-nav > .actions { width: 100%; justify-content: flex-end; }
  .read-decision { grid-template-columns: 1fr; }
  .document-metadata > div { grid-template-columns: 1fr; gap: 5px; }
  .manage-popover { right: 12px; width: calc(100% - 24px); }
  .manage-reset-form { grid-template-columns: 1fr; }
  .manage-reset-form .btn, .manage-quick-actions form, .manage-quick-actions .btn { width: 100%; }
  .category-form { width: 100%; align-items: stretch; flex-direction: column; }
  .category-form label { width: 100%; }
  .onboarding-card > .card-body { padding: 20px 16px; }
  .timeline-visual { min-height: 0; padding: 2px 0 8px; }
  .timeline-line { top: 20px; bottom: 28px; left: 17px; right: auto; width: 3px; height: auto; transform: none; }
  .timeline-line > span { width: 100%; height: var(--timeline-progress); }
  .onboarding-timeline { display: flex; flex-direction: column; min-height: 0; }
  .onboarding-step { min-height: 94px; display: grid; grid-template-columns: 42px minmax(0, 1fr); grid-template-rows: auto; align-items: start; justify-items: stretch; }
  .timeline-marker, .onboarding-step:nth-child(even) .timeline-marker { grid-column: 1; grid-row: 1; width: 34px; height: 34px; justify-self: start; }
  .timeline-copy, .onboarding-step:nth-child(even) .timeline-copy { grid-column: 2; grid-row: 1; align-self: start; padding: 0 0 22px 10px; }
  .timeline-config-row { align-items: stretch; flex-direction: column; }
  .timeline-config-row > form:last-child { align-self: flex-end; }
  .timeline-edit-grid { grid-template-columns: 72px minmax(0, 1fr); width: 100%; }
  .timeline-edit-grid .title-field, .timeline-edit-grid .details-field { grid-column: 1 / -1; }
  .timeline-edit-grid .status-field { grid-column: 2; }
  .timeline-edit-grid > .btn { grid-column: 2; justify-self: end; }
  .history-cycle-head { grid-template-columns: 38px minmax(0, 1fr); }
  .history-cycle-head > .badge { grid-column: 2; width: fit-content; }
  .history-cycle-body { padding-inline: 12px; }
  .history-comment > div { flex-direction: column; gap: 2px; }
  .history-asset > summary { align-items: flex-start; flex-wrap: wrap; }
  .history-asset > summary > .badge { margin-left: 19px; }
  .scope-tenant-row, .catalog-row { align-items: flex-start; flex-wrap: wrap; }
  .scope-tenant-row > .badge, .catalog-row > .badge { margin-left: 55px; }
  .tenant-create-grid { grid-template-columns: 1fr; }
  .tenant-create-grid > .btn { justify-self: end; }
  .shared-assign-row { align-items: stretch; flex-direction: column; }
  .catalog-action-controls { align-items: stretch; flex-direction: column; }
  .catalog-action-controls > label:first-child { min-width: 0; width: 100%; }
  .audit-filters { grid-template-columns: 1fr; }
  .audit-copy > div:first-child { align-items: flex-start; flex-direction: column; }
  .audit-copy dl { grid-template-columns: 1fr; }
  .security-event { grid-template-columns: auto minmax(0, 1fr); }
  .security-event > code { grid-column: 2; overflow-wrap: anywhere; }
}
@media (max-width: 375px) {
  .content { padding-inline: 10px; }
  .login-brand h1 { font-size: 36px; }
  .login-assurance { font-size: 11.5px; }
  .app-picker-grid { grid-template-columns: 1fr; }
  .tri-state { gap: 2px; }
  .resource-card { padding: 13px; }
  .history-cycle-head { padding: 14px; }
}
@media (max-width: 500px) {
  .dash-kpis { grid-template-columns: 1fr; }
  .dash-kpis > .kpi, .dash-kpis > .kpi:nth-child(2n), .dash-kpis > .kpi:nth-child(-n + 2) { border-right: 0; border-bottom: 1px solid var(--border); }
  .dash-kpis > .kpi:last-child { border-bottom: 0; }
}

/* ── Workspace Lens: customer-first shell and focused product surfaces ───── */
.customer-app { min-height: 100vh; background: var(--surface); }
.customer-header {
  position: sticky; z-index: 20; top: 0; min-height: 72px;
  display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(220px, 1fr);
  align-items: center; gap: 28px; padding: 0 clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.customer-brand { width: fit-content; color: inherit; }
.customer-brand:hover { text-decoration: none; }
.customer-brand .brand-wordmark, .login-header .brand-wordmark { width: 128px; height: 15px; }
.customer-brand .brand-wordmark img, .login-header .brand-wordmark img { width: 128px; height: 15px; }
.customer-nav { display: flex; align-items: stretch; align-self: stretch; gap: 28px; }
.customer-nav > a, .customer-materials > summary {
  position: relative; display: flex; align-items: center; min-height: 72px; padding: 0;
  color: var(--text-faint); border: 0; background: transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 600; list-style: none; text-decoration: none;
}
.customer-materials > summary::-webkit-details-marker,
.customer-account > summary::-webkit-details-marker,
.customer-dock-materials > summary::-webkit-details-marker,
.lens-plan > summary::-webkit-details-marker { display: none; }
.customer-materials > summary .icon { margin-left: 4px; transition: transform .14s ease; }
.customer-materials[open] > summary .icon { transform: rotate(90deg); }
.customer-nav > a::after, .customer-materials > summary::after {
  content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px;
  background: transparent;
}
.customer-nav > a:hover, .customer-materials > summary:hover,
.customer-nav > a.active, .customer-materials.active > summary { color: var(--ink); text-decoration: none; }
.customer-nav > a.active::after, .customer-materials.active > summary::after { background: var(--brand); }
.customer-materials { position: relative; }
.customer-materials > div {
  position: absolute; top: calc(100% - 9px); left: 50%; width: 248px; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow-md); transform: translateX(-50%);
}
.customer-materials > div a, .customer-dock-materials > div a {
  display: flex; align-items: center; gap: 10px; padding: 10px 11px;
  color: var(--text-soft); border-radius: var(--radius-sm); text-decoration: none;
}
.customer-materials > div a:hover, .customer-materials > div a.active,
.customer-dock-materials > div a:hover, .customer-dock-materials > div a.active {
  color: var(--accent-strong); background: var(--accent-soft);
}
.customer-header-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.customer-account { position: relative; }
.customer-account > summary {
  display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 3px 8px 3px 4px;
  border-radius: 11px; cursor: pointer; list-style: none;
}
.customer-account > summary:hover { background: var(--surface-2); }
.customer-account > summary > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.customer-account > summary strong, .customer-account > summary small {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.customer-account > summary strong { color: var(--ink); font-size: 12.5px; }
.customer-account > summary small { color: var(--text-faint); font-size: 10.5px; }
.customer-avatar {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border-radius: 50%; color: var(--ink); background: var(--brand); font-size: 12px; font-weight: 750;
}
.customer-account > div {
  position: absolute; top: calc(100% + 8px); right: 0; width: 250px; display: grid; gap: 13px;
  padding: 15px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-md);
}
.customer-account > div > span { color: var(--text-faint); font-size: 12px; overflow-wrap: anywhere; }
.customer-account > div .btn { width: 100%; }
.customer-main { min-width: 0; }
.customer-main .content { max-width: 1220px; margin: 0 auto; padding: 48px clamp(24px, 5vw, 64px) 80px; }
.customer-toolbar {
  max-width: 1220px; display: flex; justify-content: flex-end; gap: 8px;
  margin: 0 auto -24px; padding: 20px clamp(24px, 5vw, 64px) 0;
}
.customer-toolbar:empty { display: none; }
.customer-dock { display: none; }

.lens-heading { margin: 0 0 38px; padding: 0; }
.lens-heading .tenant-profile-logo { width: 52px; height: 52px; border-radius: 14px; }
.lens-heading h2 { max-width: 700px; font-size: clamp(34px, 4vw, 48px); letter-spacing: -.045em; }
.workspace-lens {
  display: grid; grid-template-columns: minmax(330px, .82fr) minmax(430px, 1.18fr);
  gap: clamp(34px, 5vw, 68px); align-items: start;
}
.lens-focus {
  min-width: 0; display: grid; gap: 28px; padding: 30px;
  border-top: 4px solid var(--brand); border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface-warm);
}
.lens-focus-kicker { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--text-soft); font-size: 12px; font-weight: 700; }
.lens-focus-kicker strong { color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.lens-milestone { color: var(--accent-strong); font-size: 13px; font-weight: 700; }
.lens-focus h2 { max-width: 15ch; margin: 7px 0 10px; font-size: clamp(26px, 3vw, 36px); line-height: 1.08; letter-spacing: -.04em; text-wrap: balance; }
.lens-focus p { max-width: 48ch; margin: 0; color: var(--text-soft); }
.lens-progress { display: flex; margin: 0; padding: 0; list-style: none; }
.lens-progress li { position: relative; flex: 1; }
.lens-progress li:not(:last-child)::after {
  content: ""; position: absolute; z-index: 0; top: 13px; left: 26px; width: calc(100% - 26px);
  height: 2px; background: var(--divider-solid); opacity: .45;
}
.lens-progress li.completed:not(:last-child)::after { background: var(--teal); opacity: 1; }
.lens-progress li > span {
  position: relative; z-index: 1; width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--divider-solid); border-radius: 50%; color: var(--text-faint);
  background: var(--surface-warm); font-size: 11px; font-weight: 750;
}
.lens-progress li.completed > span { color: var(--on-action); border-color: var(--action); background: var(--action); }
.lens-progress li.current > span { color: #fff; border-color: var(--highlight); background: var(--highlight); }
.lens-plan > summary { width: fit-content; color: var(--ink); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.lens-plan[open] > summary .icon { transform: rotate(90deg); }
.lens-plan-body { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--divider-solid); }
.lens-plan-body .timeline-visual { min-height: 0; padding: 0; }
.lens-plan-body .timeline-line { top: 18px; right: auto; bottom: 20px; left: 17px; width: 3px; height: auto; }
.lens-plan-body .timeline-line > span { width: 100%; height: var(--timeline-progress); }
.lens-plan-body .onboarding-timeline { display: flex; flex-direction: column; min-height: 0; }
.lens-plan-body .onboarding-step {
  min-height: 88px; display: grid; grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto; align-items: start; justify-items: stretch;
}
.lens-plan-body .timeline-marker, .lens-plan-body .onboarding-step:nth-child(even) .timeline-marker {
  grid-column: 1; grid-row: 1; width: 34px; height: 34px; justify-self: start; box-shadow: 0 0 0 4px var(--surface-warm);
}
.lens-plan-body .timeline-copy, .lens-plan-body .onboarding-step:nth-child(even) .timeline-copy {
  grid-column: 2; grid-row: 1; align-self: start; padding: 0 0 20px 9px;
}
.lens-materials { min-width: 0; display: grid; align-content: start; }
.lens-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.lens-section-head h2 { margin: 3px 0 0; font-size: clamp(24px, 2.5vw, 31px); letter-spacing: -.035em; }
.lens-total { color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.lens-material-list { border-top: 1px solid var(--border-strong); }
.lens-material-list > a {
  min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 15px;
  padding: 17px 2px; color: inherit; border-bottom: 1px solid var(--border); text-decoration: none;
}
.lens-material-list > a:hover { padding-inline: 10px; color: var(--accent-strong); background: var(--surface-2); }
.lens-material-list > a > span:first-child { min-width: 0; display: flex; flex-direction: column; }
.lens-material-list strong { color: currentColor; font-size: 15px; }
.lens-material-list small { color: var(--text-faint); }
.lens-material-count { min-width: 24px; color: var(--text-soft); font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; }
.lens-signing {
  display: grid; gap: 20px; margin-top: 26px; padding: 24px;
  border: 1px solid var(--teal-border); border-top: 3px solid var(--action);
  border-radius: var(--radius); color: var(--ink);
  background: linear-gradient(140deg, var(--surface) 0%, var(--accent-soft) 115%);
}
.lens-signing .eyebrow { color: var(--accent-strong); }
.lens-signing h2 { margin: 3px 0 7px; color: var(--ink); font-size: 22px; letter-spacing: -.025em; }
.lens-signing p { margin: 0; color: var(--text-soft); }
.lens-signing form { display: grid; gap: 13px; justify-items: start; }
.lens-signing label.chk { color: var(--ink); border-color: var(--border-strong); background: var(--surface); }
.lens-signing label.chk:has(input:checked) { color: var(--accent-strong); border-color: var(--action); background: var(--accent-soft); }
.lens-signing .btn.primary { color: var(--on-action); border-color: var(--action); background: var(--action); }
.lens-signing .btn.primary:hover { border-color: var(--action-hover); background: var(--action-hover); }
.lens-signing.is-disabled { color: var(--ink); border: 1px solid var(--border); background: var(--mint-fill); }
.lens-signing.is-disabled .eyebrow { color: var(--text-faint); }
.lens-signing.is-disabled h2 { color: var(--ink); }
.lens-signing.is-disabled p, .lens-signing.is-disabled label.chk { color: var(--text-soft); }
.lens-signing.is-disabled label.chk { border-color: var(--border); }
.lens-signing.signed { color: var(--ink); border: 1px solid var(--teal-border); background: var(--green-soft); }
.lens-signing.signed > div { display: flex; align-items: flex-start; gap: 12px; }
.lens-signing.signed > div > .icon { flex: none; margin-top: 4px; color: var(--action); }
.lens-signing.signed h2 { color: var(--ink); }
.lens-signing.signed p { color: var(--text-soft); }
.lens-signing.signed .eyebrow { color: var(--accent-strong); }

.portal-customer .resource-grid { display: block; margin-bottom: var(--space-sm); border-top: 1px solid var(--border-strong); }
.portal-customer .resource-card {
  min-height: 82px; padding: 16px 4px; border-width: 0 0 1px; border-radius: 0;
  box-shadow: none; transition: padding .12s, background .12s;
}
.portal-customer .resource-card:hover { padding-inline: 12px; border-color: var(--border); background: var(--surface-2); box-shadow: none; transform: none; }
.portal-customer .resource-card-icon { width: 38px; height: 38px; border-radius: 10px; }
.portal-customer .card { box-shadow: none; }
.portal-admin .audit-list { gap: 0; border-top: 1px solid var(--border); }
.portal-admin .audit-card { border-width: 0 0 1px; border-radius: 0; background: transparent; }
.portal-admin .content { max-width: 1280px; }

/* Sign-in is a product entry point, not a marketing hero. */
.login-screen { min-height: 100svh; background: var(--surface); }
.login-header {
  position: fixed; z-index: 5; top: 0; right: 0; left: 0; height: 72px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 4.5vw, 68px);
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.login-header .login-portal-label {
  display: inline-flex; align-items: center; gap: 10px; color: var(--ink);
  font-size: 15px; font-weight: 720; letter-spacing: -.018em;
}
.login-header .login-portal-label::before {
  content: ""; width: 17px; height: 5px; border-radius: 1px; background: var(--brand); transform: skew(-36deg);
}
.login-layout { min-height: 100svh; grid-template-columns: minmax(420px, .88fr) minmax(520px, 1.12fr); padding-top: 72px; background: var(--surface); }
.login-panel { order: 0; padding: clamp(52px, 7vw, 112px); background: var(--surface); }
.login-card {
  width: min(460px, 100%); padding: 0; border: 0; border-radius: 0;
  background: transparent; box-shadow: none;
}
.login-card .eyebrow { margin-bottom: 13px; color: var(--accent-strong); font-size: 12.5px; letter-spacing: .015em; }
.login-card h1 { margin: 0 0 11px; color: var(--ink); font-size: clamp(42px, 4.7vw, 58px); line-height: .98; letter-spacing: -.052em; text-wrap: balance; }
.login-card > p { margin: 0; color: var(--text-soft); }
.login-form { margin-top: 36px; }
.login-form .field { margin-bottom: 18px; }
.login-form .field label { margin-bottom: 8px; font-size: 13px; font-weight: 620; }
.login-form input[type=email], .login-form input[type=password] { min-height: 48px; padding-inline: 14px; border-radius: 11px; }
.login-form .login-submit { min-height: 48px; margin-top: 5px; border-radius: 11px; }
.login-context {
  --login-stage: var(--mint-fill); --login-stage-ink: var(--ink); --login-stage-muted: var(--text-soft); --login-stage-line: var(--border); --login-stage-accent: var(--brand);
  position: relative; min-width: 0; display: grid; grid-template-rows: auto minmax(210px, 1fr); overflow: hidden;
  margin: 18px 18px 18px 0; padding: clamp(44px, 6vw, 82px);
  border: 1px solid var(--login-stage-line); border-radius: 28px; background: var(--login-stage); color: var(--login-stage-ink);
  box-shadow: 0 18px 48px rgba(26, 22, 18, .08);
}
.login-context.admin {
  --login-stage: #101010; --login-stage-ink: #ffffff; --login-stage-muted: #b0b0b0; --login-stage-line: #343434; --login-stage-accent: #56edd6;
  box-shadow: 0 18px 52px rgba(0, 0, 0, .19);
}
.login-context-copy {
  position: relative; z-index: 2; display: grid; gap: 15px; align-content: start;
}
.login-context .login-kicker {
  margin: 0; color: var(--login-stage-accent); font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}
.login-context h2 {
  max-width: 12ch; margin: 0; color: var(--login-stage-ink);
  font-size: clamp(42px, 5vw, 72px); font-weight: 760; line-height: .95; letter-spacing: -.058em; text-wrap: balance;
}
.login-context.admin h2 { max-width: 10ch; }
.login-context-copy p {
  max-width: 43ch; margin: 3px 0 0; color: var(--login-stage-muted);
  font-size: 15.5px; line-height: 1.55; text-wrap: balance;
}
.login-brand-motif {
  position: relative; min-height: clamp(170px, 27vh, 240px); align-self: end; overflow: hidden;
  margin-top: clamp(42px, 7vh, 76px);
}
.login-brand-motif::before {
  content: ""; position: absolute; right: clamp(104px, 17vw, 164px); bottom: 30%; left: 0;
  height: 1px; background: var(--login-stage-line);
}
.login-brand-motif span {
  position: absolute; right: clamp(10px, 3vw, 34px); bottom: 0;
  width: clamp(104px, 15vw, 154px); height: clamp(132px, 21vw, 206px);
  clip-path: polygon(70% 0, 100% 0, 30% 100%, 0 100%);
  background: var(--login-stage-accent);
}

@media (max-width: 1080px) {
  .customer-header { grid-template-columns: auto 1fr auto; gap: 22px; padding-inline: 24px; }
  .customer-nav { justify-self: center; gap: 22px; }
  .customer-account > summary > span:nth-child(2), .customer-account > summary > .icon { display: none; }
  .workspace-lens { gap: 34px; }
}
@media (max-width: 860px) {
  .customer-header { min-height: 64px; grid-template-columns: 1fr auto; padding-inline: 20px; }
  .customer-nav { display: none; }
  .customer-main .content { padding: 36px 24px 112px; }
  .customer-toolbar { margin-bottom: -16px; padding: 18px 24px 0; }
  .customer-dock {
    position: fixed; z-index: 24; right: 14px; bottom: 12px; left: 14px;
    display: grid; grid-template-columns: repeat(3, 1fr); min-height: 62px;
    border: 1px solid var(--border); border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  .customer-dock > a, .customer-dock-materials > summary {
    height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 8px 4px; color: var(--text-faint); cursor: pointer; list-style: none;
    font-size: 10.5px; font-weight: 650; text-decoration: none;
  }
  .customer-dock > a.active, .customer-dock-materials.active > summary { color: var(--accent-strong); }
  .customer-dock-materials { position: static; }
  .customer-dock-materials > div {
    position: absolute; right: 8px; bottom: calc(100% + 9px); left: 8px; display: grid;
    grid-template-columns: 1fr 1fr; gap: 4px; padding: 8px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md);
  }
  .workspace-lens { grid-template-columns: 1fr; }
  .lens-focus h2 { max-width: 20ch; }
  .login-layout { grid-template-columns: 1fr; }
  .login-panel { min-height: auto; padding: 118px 32px 50px; }
  .login-context { min-height: 430px; margin: 0 24px 24px; padding: 46px; }
  .login-context h2 { max-width: 15ch; }
  .login-context.admin h2 { max-width: 12ch; }
  .login-brand-motif { min-height: 190px; margin-top: 42px; }
}
@media (max-width: 640px) {
  .customer-header { padding-inline: 16px; }
  .customer-header-actions { gap: 4px; }
  .customer-main .content { padding: 30px 16px 108px; }
  .customer-toolbar { padding-inline: 16px; }
  .customer-toolbar .actions, .customer-toolbar { flex-wrap: wrap; }
  .lens-heading { align-items: flex-start; margin-bottom: 28px; }
  .lens-heading .tenant-title { align-items: flex-start; }
  .lens-heading .tenant-profile-logo { width: 44px; height: 44px; border-radius: 12px; }
  .lens-heading h2 { font-size: 34px; }
  .lens-focus { gap: 23px; padding: 24px 20px; }
  .lens-focus h2 { font-size: 28px; }
  .lens-material-list > a { padding-block: 15px; }
  .lens-signing { padding: 20px; }
  .login-header { height: 66px; padding-inline: 20px; }
  .login-header .login-portal-label { font-size: 13px; }
  .login-header .login-portal-label::before { width: 13px; }
  .login-layout { padding-top: 66px; }
  .login-panel { padding: 76px 22px 42px; }
  .login-card { padding: 0; }
  .login-card h1 { font-size: 42px; }
  .login-context { min-height: 350px; margin: 0 12px 12px; padding: 32px 28px; border-radius: 22px; }
  .login-context h2 { font-size: 40px; }
  .login-context-copy p { font-size: 14px; }
  .login-brand-motif { min-height: 130px; margin-top: 28px; }
  .login-brand-motif::before { right: 88px; }
  .login-brand-motif span { right: 10px; width: 82px; height: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
