/* ============================================================
   Zakk Decision Engine — dense-ops design system
   Source: shared design specification (shared) + application design specification (app)
   Fonts loaded via <link> in App.razor head.
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  /* brand accents */
  --zakk-green:#0B593C; --zakk-green-light:#33B44A; --zakk-green-weak:#E9F3EE; --zakk-orange:#F2C641;

  /* Zakk accent mapping */
  --accent:var(--zakk-green); --accent-deep:#085030; --accent-weak:var(--zakk-green-weak);

  /* surfaces */
  --surface-page:#F8FAFC;
  --surface-card:#FFFFFF; --surface-subtle:#F7F8FA; --surface-hover:#F2F5F8;
  --border-default:#CFD1D2; --border-soft:#E5E7EB;

  /* text */
  --text-primary:#1F2933; --text-body:#44444D; --text-muted:#6B7280;

  /* state colours — case states */
  --state-receiving:#0B593C;
  --state-receiving-bg:#E9F3EE;
  --state-receiving-bd:#9FC9B3;
  --state-awaiting:#F2C641;
  --state-awaiting-text:#92400E;
  --state-awaiting-bg:#FBF3DE;
  --state-awaiting-bd:#ECC971;
  --state-approved:#33B44A;
  --state-approved-bg:#ECF7EF;
  --state-approved-bd:#A9DCB7;
  --state-released:#0B593C;
  --state-released-bg:#E9F3EE;
  --state-released-bd:#9FC9B3;
  --state-rejected:#DC3545;
  --state-rejected-bg:#FBECEA;
  --state-rejected-bd:#E6A89F;

  /* status (shared) */
  --status-success:#33B44A; --status-success-bg:#ECF7EF; --status-success-bd:#A9DCB7;
  --status-warning:#F2C641; --status-warning-text:#92400E; --status-warning-bg:#FBF3DE; --status-warning-bd:#ECC971;
  --status-error:#DC3545;   --status-error-bg:#FBECEA;   --status-error-bd:#E6A89F;

  /* type */
  --font-sans:"Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-mono:"JetBrains Mono","SF Mono",Consolas,"Liberation Mono",monospace;

  /* spacing — 4px base */
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:20px;
  --space-6:24px; --space-8:32px; --space-10:40px; --space-12:48px;

  /* radius — dense, restrained */
  --radius-control:4px; --radius-input:6px; --radius-card:8px; --radius-pill:999px;

  /* elevation */
  --shadow-subtle:0 1px 2px rgba(16,24,32,.05); --shadow-pop:0 8px 24px rgba(16,24,32,.12);

  /* motion */
  --ease:cubic-bezier(.23,1,.32,1);
  --t-micro:120ms; --t-ui:180ms; --t-panel:240ms;

  /* shell — unified model: dark brand-coloured rail + slim white topbar */
  --rail-width:220px; --rail-collapsed:64px; --topbar-height:56px; --content-max:1440px;

  /* legacy aliases used by existing page classes */
  --bg:var(--surface-page);
  --surface:var(--surface-card);
  --surface-2:var(--surface-subtle);
  --surface-3:var(--border-soft);
  --border:var(--border-default);
  --text:var(--text-primary);
  --text-sub:var(--text-body);
  --green:var(--status-success);
  --amber:var(--zakk-orange);
  --red:var(--status-error);
  --radius:var(--radius-control);
  --radius-lg:var(--radius-card);
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--surface-page);
}

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

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

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

/* ── Shell ───────────────────────────────────────────────── */
/* Light/white left sidebar + slim white topbar — matches the REAL Zakk.Admin
   product (~/git/zakk_app/Zakk.Admin), not an invented dark-rail treatment.
   Zakk.Admin's own --sidebar token is pure white (oklch(1 0 89.88)); brand
   green is used sparingly (logo mark, active nav state), not painted across
   the whole rail the way a blue brand would be. Rail = col 1 (all rows).
   Header = col 2 row 1. Body = col 2 row 2. */
/* !important on box-geometry only: MudBlazor's own breakpoint utility
   classes set width/margin at the same specificity and must not override
   this app's fixed shell dimensions. ─────────────────────────────────── */
.mud-drawer.tc-rail {
  width: var(--rail-width) !important;
  flex-shrink: 0;
  background: var(--surface-card);
  border-right: 1px solid var(--border-soft);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  margin-left: 0 !important;
  height: 100vh !important;
  overflow-y: auto;
  z-index: 100;
}

/* rail wordmark (replaces top-bar logo) */
.rail-wordmark {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  text-decoration: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-soft);
}

.rail-wordmark-icon {
  width: 28px;
  height: 28px;
  /* The real gradient logo mark carries its own colour — a plain light
     neutral container, not a coloured badge behind it (punch-list #13). */
  background: var(--surface-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Two-line name + subtitle — matches the sidebar pattern. A single-line
   "Zakk · Decision Engine" at 13px/700 overflows the 220px rail (172px
   text in ~158px available), pushing the text right up against the rail's
   edge with almost no clearance. */
.rail-wordmark-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.rail-wordmark-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.01em;
  line-height: 1.2;
}

.rail-wordmark-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: .04em;
  line-height: 1.2;
}

.rail-nav-section.mud-nav-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--space-3) var(--space-2);
  flex: 1;
}

.rail-navlink-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
}

.rail-nav-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.rail-navlink-label { flex: 1 1 auto; }

/* ── Slim white top context bar (MudAppBar) ──────────────── */
.mud-appbar.tc-header {
  /* position/top not !important — MudAppBar's own .mud-appbar-fixed-top
     already sets these; only left/margin-left fight the drawer-width
     utility classes. */
  left: var(--rail-width) !important;
  margin-left: 0 !important;
  right: 0;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  z-index: 90;
  box-shadow: none;
}

/* .rail-toggle visibility + mobile overrides live in app.css — it must load
   after MudBlazor.min.css (which this file loads before) to win the cascade
   against MudIconButton's own display rule. */

/* live indicator — topbar colour scheme (on white) */
.tc-live {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--status-success);
  flex-shrink: 0;
}

.tc-live .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--status-success);
  /* static — restraint: do not animate ambient elements operators watch all day */
}

/* shared keyframe — if tuned here, mirror to the counterpart */
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.35} }

/* topbar separator */
.topbar-sep {
  width: 1px;
  height: 16px;
  background: var(--border-soft);
  flex-shrink: 0;
}

/* ⌘K affordance — visual only; aria-hidden in markup (punch-list #14) */
.topbar-cmd {
  margin-left: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-input);
  padding: var(--space-1) var(--space-3);
  width: auto;
  /* not interactive: pointer-events: none ensures no cursor confusion */
  pointer-events: none;
  user-select: none;
}

.topbar-cmd-text {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
}

.topbar-cmd-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--border-soft);
  border-radius: 3px;
  padding: 1px 5px;
}

/* topbar breadcrumb (used in inner pages, replaces nav) */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-breadcrumb a { color: var(--text-body); }
.topbar-breadcrumb a:hover { color: var(--text-primary); text-decoration: none; }
.topbar-breadcrumb .sep { color: var(--border-default); }
.topbar-breadcrumb .cur { color: var(--text-primary); font-weight: 600; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* identity chip — on white topbar */
.topbar-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  white-space: nowrap;
}

/* Rail section label — on white surface, matches Zakk.Admin's BbSidebarGroupLabel */
.tc-rail-section {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-2) 10px var(--space-1);
  margin-top: var(--space-2);
}

.tc-rail-section:first-child { margin-top: 0; }

/* Rail nav links (MudNavLink) — on white surface. Real Zakk.Admin's
   BbSidebarMenuButton active state: light accent-tinted background + accent
   text, not white-on-dark (that was this app's own invented dark-rail
   treatment, not the real product). */
.rail-nav-section .mud-nav-link {
  color: var(--text-muted);
  border-radius: var(--radius-control);
  transition: background-color var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
  padding: 0;
}

.rail-nav-section .mud-nav-link:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.rail-nav-section .mud-nav-link.active {
  background: var(--zakk-green-weak);
  color: var(--zakk-green);
  font-weight: 600;
}

.rail-nav-section .mud-nav-link.active .rail-nav-icon { color: var(--zakk-green); }

/* ── Content well ────────────────────────────────────────── */
.mud-main-content.tc-main {
  margin-left: var(--rail-width) !important;
  margin-top: 0;
  width: calc(100% - var(--rail-width));
  max-width: calc(var(--content-max) + var(--rail-width));
  padding: var(--space-4) var(--space-5) var(--space-10);
  min-height: 100vh;
}

/* ── Page header ─────────────────────────────────────────── */
h1.tc-h {
  margin: 0 0 var(--space-1);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

.tc-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 var(--space-5);
}

/* ── KPI strip ───────────────────────────────────────────── */
.tc-kpis {
  display: flex;
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.tc-kpi {
  flex: 1;
  background: var(--surface-card);
  padding: var(--space-3) var(--space-4);
  min-width: 0;
  border-bottom: 2px solid transparent;
  box-shadow: none;
}

.tc-kpi .n {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1;
  color: var(--text-primary);
}

.tc-kpi .l {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

/* Total card: slightly stronger neutral so the bottom rule is visible (punch-list #10) */
.tc-kpi.total     { border-bottom-color: var(--text-muted); }
.tc-kpi.receiving { border-bottom-color: var(--state-receiving); }
.tc-kpi.receiving .n { color: var(--state-receiving); }
.tc-kpi.awaiting  { border-bottom-color: var(--state-awaiting); }
.tc-kpi.awaiting  .n { color: var(--state-awaiting-text); }
/* Approved accent bar stays bright green; number text uses darker forest green
   (#0B593C, 7.47:1 on white) — #33B44A alone is only ~2.7:1, below WCAG AA
   large-text 3:1 minimum. Border-bottom accent (decorative) stays bright. */
.tc-kpi.approved  { border-bottom-color: var(--state-approved); }
.tc-kpi.approved  .n { color: var(--state-released); }
.tc-kpi.released  { border-bottom-color: var(--state-released); }
.tc-kpi.released  .n { color: var(--state-released); }

/* ── Cards / panels ──────────────────────────────────────── */
.tc-card,
.tc-section-card,
.tc-info-panel,
.tc-action-zone,
.tc-auditcard,
.tc-verdict-card,
.tc-artifact-link {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  /* box-shadow removed: border + --surface-page (#F8FAFC) vs card (#FFF) is sufficient elevation */
}

.tc-section-card,
.validator-grid > *,
.sanitized-item,
.missing-card {
  min-width: 0;
}

/* ── Table card (cases list) ─────────────────────────────── */
.tc-card {
  overflow: hidden;
}

.tc-pager {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-subtle);
}

.tc-pager-summary,
.tc-pager-controls {
  color: var(--text-muted);
  font-size: 12px;
}

.tc-pager-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tc-page-size {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  min-height: 28px;
  padding: 2px 6px;
}

/* ── Tables ──────────────────────────────────────────────── */
.tc-table,
.validator-table {
  width: 100%;
  border-collapse: collapse;
}

.tc-table thead th,
.validator-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
  background: var(--surface-subtle);
  position: sticky;
  top: 0;
}

.tc-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background-color 80ms var(--ease);
}

/* .tc-table also backs read-only tables (CaseDetail's validator/submission
   tables) that don't navigate on click — scope the pointer cursor to rows
   that actually do, not every .tc-table row. */
.tc-table tbody tr.clickable-row {
  cursor: pointer;
}

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

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

.tc-table td,
.validator-table td {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-body);
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}

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

.tc-table th[style*="text-align:right"],
.tc-table td[style*="text-align:right"],
.tc-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Mono / ref ──────────────────────────────────────────── */
.tc-ref,
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.tc-ref {
  color: var(--accent);
  font-weight: 600;
}

.tc-ref:hover { text-decoration: underline; }

.tc-muted, .tc-td-muted { color: var(--text-muted); }

/* ── Badges ──────────────────────────────────────────────── */
.tc-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: var(--radius-control);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
  letter-spacing: .02em;
}

/* badge dot */
.tc-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* state badges (used via class like tc-badge st-Receiving) */
.tc-badge.ok,
.tc-badge.st-Approved,
.tc-badge.st-Released,
.tc-badge.st-Closed {
  color: var(--state-released);
  background: var(--state-released-bg);
  border-color: var(--state-released-bd);
}
.tc-badge.ok::before,
.tc-badge.st-Approved::before,
.tc-badge.st-Released::before,
.tc-badge.st-Closed::before { background: var(--state-released); }

.tc-badge.warn,
.tc-badge.st-AwaitingApproval {
  color: var(--state-awaiting-text);
  background: var(--state-awaiting-bg);
  border-color: var(--state-awaiting-bd);
}
.tc-badge.warn::before,
.tc-badge.st-AwaitingApproval::before { background: var(--state-awaiting); }

.tc-badge.err,
.tc-badge.st-Rejected,
.tc-badge.st-Expired {
  color: var(--state-rejected);
  background: var(--state-rejected-bg);
  border-color: var(--state-rejected-bd);
}
.tc-badge.err::before,
.tc-badge.st-Rejected::before,
.tc-badge.st-Expired::before { background: var(--state-rejected); }

.tc-badge.info,
.tc-badge.st-Created,
.tc-badge.st-Receiving {
  color: var(--state-receiving);
  background: var(--state-receiving-bg);
  border-color: var(--state-receiving-bd);
}
.tc-badge.info::before,
.tc-badge.st-Created::before,
.tc-badge.st-Receiving::before { background: var(--state-receiving); }

/* verdict labels (inline span) — a single coloured shape-icon (✓/✗/⚠) gives
   deuteranopes and other colour-blind users a non-colour cue alongside the
   hue, without a redundant second dot duplicating the same colour. */
.v-Met {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  color: var(--text-body);
}
.v-Met::after {
  content: ' ✓';
  color: var(--state-approved);
  font-size: 11px;
}

.v-NotMet {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  color: var(--text-body);
}
.v-NotMet::after {
  content: ' ✗';
  color: var(--state-rejected);
  font-size: 11px;
}

.v-Insufficient {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  color: var(--text-body);
}
.v-Insufficient::after {
  content: ' ⚠';
  color: var(--state-awaiting-text);
  font-size: 11px;
}

/* ── Empty / error state ─────────────────────────────────── */
/* No border/card treatment — matches the .empty-state pattern: a bordered box
   around one line of "nothing here" text is clutter, not content. */
.tc-empty {
  color: var(--text-muted);
  padding: 48px 20px;
  font-size: 14px;
  text-align: center;
}

/* ── Buttons ─────────────────────────────────────────────── */
.tc-btn,
button.tc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-control);
  background: var(--surface-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--t-micro) var(--ease),
              border-color var(--t-micro) var(--ease),
              transform var(--t-micro) var(--ease);
  white-space: nowrap;
}

.tc-btn:hover {
  background: var(--surface-subtle);
  border-color: #AEB5BB;
  text-decoration: none;
}

.tc-btn:active { transform: scale(.97); }

.tc-btn:disabled,
button.tc-btn:disabled {
  color: var(--text-muted);
  background: var(--surface-subtle);
  border-color: var(--border-soft);
  cursor: not-allowed;
  transform: none;
}

.tc-btn.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.tc-btn.primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.tc-btn.primary:disabled {
  background: var(--surface-subtle);
  border-color: var(--border-soft);
  color: var(--text-muted);
  opacity: .65;
}

.tc-btn.danger {
  color: #fff;
  background: var(--status-error);
  border-color: var(--status-error);
}

.tc-btn.ghost {
  border-color: transparent;
  color: var(--accent);
  background: transparent;
}

.tc-btn.ghost:hover { background: var(--accent-weak); }

.tc-btn.sm { min-height: 28px; padding: 4px 10px; font-size: 12px; }
.tc-btn.full { width: 100%; margin-top: var(--space-3); }

.tc-action-note {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: var(--space-2);
}

/* ── Case detail ─────────────────────────────────────────── */
.validator-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-card);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.validator-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.validator-hero h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: -.01em;
}

.validator-meta,
.validator-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.validator-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) 380px;
  gap: var(--space-4);
  align-items: start;
}

.validator-span { grid-column: 1; }
.validator-result { grid-column: 2; grid-row: 1 / span 3; }

/* ── Section cards ───────────────────────────────────────── */
.tc-section-head {
  padding: 8px var(--space-4);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-subtle);
}

.tc-section-head h2,
.tc-section-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  color: var(--text-primary);
}

.tc-section-head span { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.tc-section-body { padding: var(--space-4); }

/* ── Sanitized payload ───────────────────────────────────── */
.sanitized-stack {
  display: grid;
  gap: var(--space-3);
}

.sanitized-item {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  padding: var(--space-3);
  background: var(--surface-subtle);
}

.sanitized-item-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  font-size: 12px;
}

.sanitized-text {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

/* redaction tokens — mono, muted background */
.redacted-token {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--border-soft);
  border-radius: 3px;
  padding: 1px 4px;
}

.sanitized-redactions {
  margin-top: 8px;
  color: var(--status-error);
  font-size: 12px;
  font-weight: 600;
}

.sanitized-redactions.muted { color: var(--text-muted); font-weight: 400; }

/* ── Readiness / validation sidebar ─────────────────────── */
.readiness-summary {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
}

.readiness-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-control);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.readiness-summary.needs .readiness-icon { background: var(--state-awaiting); }
.readiness-summary.ready .readiness-icon { background: var(--state-approved); }

.readiness-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}

.readiness-subtitle { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.result-metric {
  border-top: 1px solid var(--border-soft);
  padding: var(--space-2) var(--space-4);
  display: flex;
  gap: var(--space-3);
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.result-metric strong {
  margin-left: auto;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.result-metric.metric-blocked strong { color: var(--state-rejected); }
.result-metric.metric-warn strong { color: var(--state-awaiting-text); }
.result-metric.metric-ok strong { color: var(--state-approved); }

/* ── Missing data ────────────────────────────────────────── */
.missing-stack {
  display: grid;
  gap: var(--space-2);
}

.missing-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2) var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  padding: var(--space-3);
  background: var(--surface-subtle);
}

.missing-card.ready {
  display: block;
  border-color: var(--state-approved-bd);
  background: var(--state-approved-bg);
}

.missing-card span,
.missing-card p {
  color: var(--text-muted);
  margin: 0;
  font-size: 13px;
}

.missing-card p { grid-column: 1 / -1; }
.missing-card .remedy { color: var(--text-body); }
.missing-card strong { overflow-wrap: anywhere; font-size: 13px; color: var(--text-primary); }

/* ── Response JSON ───────────────────────────────────────── */
.response-json {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-subtle);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  max-height: 260px;
  overflow: auto;
}

/* ── Audit trail ─────────────────────────────────────────── */
.tc-audit {
  padding: var(--space-4);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 12px;
  display: grid;
  gap: var(--space-2);
  overflow-wrap: anywhere;
  max-height: 300px;
  overflow-y: auto;
}

/* ── Table utilities ─────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
.validator-table { min-width: 900px; }
.is-good { color: var(--state-approved); font-weight: 600; }
.is-warning { color: var(--state-awaiting-text); font-weight: 600; }

/* ── Artifact / verification view ────────────────────────── */
.tc-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.tc-breadcrumb .sep { color: var(--border-default); }
.tc-breadcrumb .cur { color: var(--text-primary); font-weight: 600; }

.tc-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.tc-onprem-notice {
  background: var(--surface-subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.tc-arti-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.tc-arti-section {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-soft);
}

.tc-arti-section:last-child { border-bottom: none; }

.tc-arti-section h3 {
  margin: 0 0 var(--space-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tc-arti-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}

.tc-arti-row:last-child { border-bottom: none; }

.tc-arti-row .lbl {
  width: 160px;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.tc-arti-row .val { color: var(--text-primary); }
.tc-arti-row .val.redacted { color: var(--text-muted); font-style: italic; }
.tc-arti-row .val.mono { font-family: var(--font-mono); font-size: 12px; }

.tc-divider {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 0;
}

/* verdict card in artifact view */
.tc-verdict-card {
  overflow: hidden;
}

.tc-verdict-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border-soft);
}

.tc-verdict-card-head.is-met { background: var(--state-approved-bg); }
.tc-verdict-card-head.is-notmet { background: var(--state-rejected-bg); }
.tc-verdict-card-head.is-insuf { background: var(--state-awaiting-bg); }

.tc-verdict-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.tc-verdict-card-body {
  padding: var(--space-3) var(--space-4);
  display: grid;
  gap: var(--space-1);
}

.tc-crit-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--text-body);
}

.tc-crit-row .mark {
  font-weight: 700;
  flex-shrink: 0;
  width: 14px;
}

.tc-crit-row.ok .mark { color: var(--state-approved); }
.tc-crit-row.no .mark { color: var(--state-rejected); }
.tc-crit-row.out .mark { color: var(--text-muted); }

/* ── Blazor error UI ─────────────────────────────────────── */
#blazor-error-ui {
  background: var(--state-awaiting-bg);
  bottom: 0;
  /* border-top replaces box-shadow (punch-list #11: borders over shadow-soup) */
  border-top: 1px solid var(--border-soft);
  display: none;
  left: 0;
  padding: var(--space-3) var(--space-4);
  position: fixed;
  width: 100%;
  z-index: 1000;
  font-size: 13px;
  color: var(--state-awaiting-text);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 980px) {
  /* Collapse to single-column: rail hidden, header + body stack vertically */
  .tc-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
  }

  .tc-rail {
    display: none;
  }

  /* Header and body both in col 1 now that rail is gone */
  .tc-header {
    grid-column: 1;
    grid-row: 1;
  }

  .tc-body {
    grid-column: 1;
    grid-row: 2;
  }

  .tc-main { padding: var(--space-3) var(--space-4) var(--space-8); }

  .tc-kpis { flex-wrap: wrap; }
  .tc-kpi { min-width: calc(50% - 1px); }

  .validator-hero { align-items: flex-start; flex-direction: column; }
  .validator-grid { grid-template-columns: 1fr; }
  .validator-result { grid-column: 1; grid-row: auto; }
  .validator-hero-actions { flex-wrap: wrap; }
  .tc-section-head { align-items: flex-start; flex-direction: column; }
  .tc-section-head span { margin-left: 0; }
  .readiness-title { font-size: 15px; overflow-wrap: anywhere; }
  .result-metric strong { text-align: right; }

  /* Checklist: collapse owner legend on small screens */
  .req-legend { display: none; }
}


/* ── SufficiencyMeter (03-progress-sufficiency.md §2) ───────── */
.sufficiency-meter {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sm-fraction {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
  font-size: 13px;
  line-height: 1;
}

.sm-n {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.sm-sep, .sm-m { font-size: 15px; font-weight: 400; color: var(--text-muted); }
.sm-label      { font-size: 12px; color: var(--text-muted); margin-left: var(--space-1); align-self: center; }

[data-state="ready"]   .sm-n { color: var(--status-success); }
[data-state="partial"] .sm-n { color: var(--text-primary); }
[data-state="empty"]   .sm-n { color: var(--text-muted); }

/* Segmented track */
.sm-track {
  display: flex;
  gap: 2px;
  height: 6px;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.sm-seg {
  flex: 1;
  border-radius: 0;
  transition: background-color var(--t-ui) var(--ease);
}

.sm-seg--met   { background: var(--status-success); }
.sm-seg--unmet { background: var(--border-soft); }

/* Bar fallback for M > 16 */
.sm-track--bar { border-radius: var(--radius-pill); }
.sm-track--bar .sm-seg--met:first-child   { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.sm-track--bar .sm-seg--unmet:last-child  { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }

/* HS confidence sub-line */
.sm-confidence {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.sm-conf-val.conf-ok   { color: var(--status-success); font-weight: 600; }
.sm-conf-val.conf-warn { color: var(--status-warning); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .sm-seg { transition: none; }
}

/* ── RequirementsChecklist (03-progress-sufficiency.md §3) ─── */
.req-checklist {
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: var(--space-2);
}

.req-group {
  padding: 0 0 var(--space-1);
}

.req-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: var(--space-2) var(--space-4) var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
}

.req-group-line summary { cursor: pointer; }
.req-group-line summary::-webkit-details-marker { display: none; }

.req-line-ok {
  font-size: 10px;
  font-weight: 600;
  color: var(--status-success);
  text-transform: none;
  letter-spacing: 0;
}

.req-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px var(--space-4);
  font-size: 12px;
  line-height: 1.4;
  border-radius: var(--radius-control);
  transition: background-color var(--t-panel) var(--ease);
}

/* Unmet backgrounds — fill over border (bans: no left-border accent bar) */
.req-row.req-met                      { background: transparent; }

.req-indicator {
  width: 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  transition: color var(--t-micro) var(--ease);
}

.req-met              .req-indicator { color: var(--status-success); }

.req-field  { flex: 1; min-width: 0; font-size: 12px; }
.req-source { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

.req-owner-badge { font-size: 11px; flex-shrink: 0; }

/* Owner legend — one-line key below checklist */
.req-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
  padding: var(--space-2) var(--space-4);
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-soft);
}

@media (prefers-reduced-motion: reduce) {
  .req-row, .req-indicator { transition: none; }
}

/* ── Unlock line (03-progress-sufficiency.md §4b) ───────────── */
/* Sits directly above the gated primary action (shared design specification: disabled action must show reason) */
.unlock-line {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
  font-size: 11px;
}

.unlock-item         { color: var(--text-muted); }
.unlock-blocked      { color: var(--status-error); font-weight: 600; }
.unlock-met          { color: var(--status-success); font-weight: 600; }
.unlock-config       { color: var(--text-muted); }

/* Pixel-perfection follow-ups (workflow verdict H1, H3) */
.tc-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.readiness-summary.blocked .readiness-icon { background: var(--status-error); }
.readiness-summary.blocked .readiness-title { color: var(--status-error); }

/* H6 — ⌘K is a future affordance (no handler yet): lower visual weight so it doesn't read as a present control */
.topbar-cmd { opacity: .55; }

/* ── Transparency log (submissions & audit) ─────────────────── */
.tl-section { display: flex; flex-direction: column; gap: var(--space-5); }

/* Empty state */
.tl-empty { padding: var(--space-3) var(--space-4); margin: 0; }

/* Submission list */
.tl-submissions { display: flex; flex-direction: column; gap: var(--space-2); }

.tl-submission {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-subtle);
}

.tl-submission-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: var(--text-body);
  user-select: none;
  transition: background var(--t-micro) var(--ease);
}
.tl-submission-summary::-webkit-details-marker { display: none; }
.tl-submission-summary::before {
  content: "▶";
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--t-micro) var(--ease);
  flex-shrink: 0;
}
details[open] > .tl-submission-summary::before { transform: rotate(90deg); }
.tl-submission-summary:hover { background: var(--surface-hover); }

@media (prefers-reduced-motion: reduce) {
  .tl-submission-summary, .tl-submission-summary::before { transition: none; }
}

.tl-version    { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.tl-kind-badge { flex-shrink: 0; }
.tl-ts         { font-size: 11px; color: var(--text-muted); }
.tl-redaction  { font-size: 11px; color: var(--text-muted); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tl-pii-badge  { flex-shrink: 0; }

.tl-payload-body {
  border-top: 1px solid var(--border-soft);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tl-copy-row { display: flex; justify-content: flex-end; }
.tl-copy-btn { font-size: 11px; }

.tl-json {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-card);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  max-height: 400px;
  overflow: auto;
  white-space: pre;
  overflow-wrap: normal;
}

/* Raw audit log */
.tl-audit-log {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-top: 1px solid var(--border-soft);
  padding-top: var(--space-4);
}

.tl-audit-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.tl-audit-entries {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.tl-audit-entry {
  display: grid;
  grid-template-columns: minmax(150px, max-content) minmax(150px, max-content) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  color: var(--text-body);
  background: var(--surface-subtle);
  overflow-wrap: anywhere;
}
.tl-audit-entry:nth-child(even) { background: var(--surface-card); }

.tl-audit-ts    { font-size: 11px; color: var(--text-muted); }
.tl-audit-event { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.tl-audit-detail { font-size: 12px; color: var(--text-body); min-width: 0; overflow-wrap: anywhere; }

.tc-filter-panel {
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: var(--surface-subtle);
}

.tc-filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) repeat(2, minmax(150px, 1fr)) repeat(2, minmax(110px, .7fr)) repeat(2, minmax(140px, 1fr)) auto;
  gap: var(--space-2);
  align-items: end;
}

.tc-filter-summary { margin-top: var(--space-2); color: var(--text-muted); font-size: 12px; }

@media (max-width: 1100px) {
  .tc-filter-row { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}

@media (max-width: 620px) {
  .tc-filter-row { grid-template-columns: 1fr; }
  .tl-audit-entry { grid-template-columns: 1fr; gap: 2px; }
}
.topbar-cmd:hover { opacity: .7; }

/* ═══════════════════════════════════════════════════════════
   MudBlazor component density overrides
   Align MudTable / MudSimpleTable / MudChip to the dense-ops
   design spec (shared design specification §Layout System: 36px rows, 8px 12px
   cell padding, 11px uppercase sticky header, no zebra stripes).
   Token values match the :root block above — no new numbers.
   ═══════════════════════════════════════════════════════════ */

/* ── MudTable (Dashboard case list) ─────────────────────── */
/* Elevation-0 removes MudBlazor's default box-shadow; our
   .tc-card wrapper already provides the 1px border + radius. */
.tc-mud-table.mud-table {
  background: transparent;
  /* Ensure table fills its .tc-card wrapper */
  width: 100%;
}

/* Header cells — match custom .tc-table thead th spec */
.tc-mud-table .mud-table-head .mud-table-cell {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);   /* 8px 12px */
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

/* Body cells — 13px body text, same 8px 12px rhythm */
.tc-mud-table .mud-table-body .mud-table-cell {
  font-size: 13px;
  color: var(--text-body);
  padding: 8px 12px;
  line-height: 1.3;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}

/* Last body row: no double border */
.tc-mud-table .mud-table-body tr:last-child .mud-table-cell {
  border-bottom: none;
}

/* Hover row — matches existing .tc-table tbody tr:hover */
.tc-mud-table .mud-table-body .mud-tr:hover .mud-table-cell,
.tc-mud-table .mud-table-body .mud-tr.mud-tr-hover:hover .mud-table-cell {
  background: var(--surface-hover);
}

/* Clickable rows get pointer cursor via MudBlazor's own .mud-clickable,
   but reinforce it here so it's explicit and doesn't rely on MudBlazor internals */
.tc-mud-table .mud-table-body .mud-tr.mud-clickable {
  cursor: pointer;
}

/* Pager — compact, muted styling matching tc-pager */
.tc-mud-table + .mud-table-pagination,
.tc-mud-table .mud-table-pagination {
  border-top: 1px solid var(--border-default);
  background: var(--surface-subtle);
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 var(--space-3);
  min-height: 40px;
}

/* Sort label — inherits from header cell, no added weight */
.tc-mud-table .mud-table-sort-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.tc-mud-table .mud-table-sort-label:hover { color: var(--text-primary); }

/* ── MudSimpleTable (CaseDetail declaration lines + provenance) ── */
/* MudSimpleTable Dense gives ~4px 16px padding by default.
   Override to match our 8px 12px design spec. */
.tc-simple-table.mud-simple-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);   /* 8px 12px */
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
  background: var(--surface-subtle);
}

.tc-simple-table.mud-simple-table td {
  font-size: 13px;
  color: var(--text-body);
  padding: 8px 12px;
  line-height: 1.3;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}

/* Last row in MudSimpleTable: no double border at card bottom */
.tc-simple-table.mud-simple-table tbody tr:last-child td {
  border-bottom: none;
}

/* Hover for MudSimpleTable Hover prop */
.tc-simple-table.mud-simple-table-hover tbody tr:hover td {
  background: var(--surface-hover);
}

/* No zebra — override MudBlazor's Striped if it gets applied */
.tc-simple-table.mud-simple-table-striped tbody tr:nth-child(even) td {
  background: transparent;
}

/* Validator table: min-width for horizontal scroll (same as old .validator-table) */
.tc-simple-table--validator { min-width: 900px; }

/* Mono columns within MudSimpleTable — preserves existing .mono class */
.tc-simple-table .mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

/* ── MudChip state/kind chips ────────────────────────────── */
/* "No PII visible" and submission-kind badges converted from
   <span class="tc-badge"> to MudChip. Size.Small + Variant.Outlined
   gives border + text colouring; we override to match design tokens
   exactly (Success → zakk-green scale, Info → state-receiving scale).
   DisableRipple removes the Material ink splash (dense-ops, not Material). */

/* Remove excess internal margin MudBlazor adds around chip content */
.tc-chip-kind.mud-chip {
  height: auto;
  min-height: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  border-radius: var(--radius-control);   /* 4px, not the theme's 8px default */
  padding: 2px 7px;
  margin: 0;
  line-height: 1.4;
}

/* "No PII visible" — GDPR trust signal: must have at least as much
   visual weight as body text.  Promoted from 11px / corner badge to
   13px / weight-600 chip that sits at the same level as the page h1.
   Kept as MudChip so it inherits the outlined success-green palette. */
.tc-chip-pii.mud-chip {
  height: auto;
  min-height: 22px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  border-radius: var(--radius-control);
  padding: 3px 10px;
  margin: 0;
  line-height: 1.4;
}

/* "No PII visible" — maps to state-approved palette (success green) */
.tc-chip-pii.mud-chip-outlined {
  color: var(--state-released) !important;
  border-color: var(--state-released-bd) !important;
  background: var(--state-released-bg) !important;
}

/* Submission kind — maps to state-receiving palette (info blue) */
.tc-chip-kind.mud-chip-outlined {
  color: var(--state-receiving) !important;
  border-color: var(--state-receiving-bd) !important;
  background: var(--state-receiving-bg) !important;
}

/* Suppress the mud-chip-root hover transform on display-only chips */
.tc-chip-pii.mud-chip:hover,
.tc-chip-kind.mud-chip:hover {
  transform: none;
  box-shadow: none;
}

/* MudChip spans: remove extra internal margin */
.tc-chip-pii .mud-chip-content,
.tc-chip-kind .mud-chip-content {
  padding: 0;
}

/* ── Policy detail: condition outline, requirements, dry run ──────────────
   A condition is a tree, so the outline leans on indentation and a left rule
   to show nesting. Leaves carry an inline Unknown note because three-valued
   logic reads wrongly to anyone who assumes true/false. */

.tc-section-title {
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0 0 .25rem;
  color: var(--text);
}

.cond-group { margin: .45rem 0; }

.cond-group-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: .02em;
  margin-bottom: .25rem;
}

.cond-combinator {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-control);
}

.cond-combinator.all {
  background: var(--zakk-green-weak);
  color: var(--zakk-green);
  border: 1px solid var(--state-receiving-bd);
}

.cond-combinator.any {
  background: var(--state-awaiting-bg);
  color: #7A5800;
  border: 1px solid var(--state-awaiting-bd);
}

.cond-combinator.not {
  background: var(--state-rejected-bg);
  color: var(--status-error);
  border: 1px solid var(--state-rejected-bd);
}

.cond-children {
  list-style: none;
  margin: .35rem 0 .35rem 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--border);
  position: relative;
}

.cond-children > li {
  margin: .35rem 0;
  position: relative;
}

.cond-leaf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .4rem .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  transition: background var(--t-micro) var(--ease), border-color var(--t-micro) var(--ease);
}

.cond-leaf:hover {
  background: var(--surface-hover);
  border-color: var(--border-default);
}

.cond-leaf code {
  font-family: var(--font-mono);
  font-size: .8rem;
}

.cond-leaf code.cond-path {
  font-weight: 600;
  color: var(--text-primary);
}

.cond-leaf code.cond-val {
  background: var(--surface-card);
  padding: 1px 5px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
}

.cond-op {
  color: var(--text-muted);
  font-size: .78rem;
  font-style: italic;
  font-weight: 500;
}

/* The whole reason the outline exists: say which leaves can go Unknown, and
   which decide even without their fact. */
.cond-unknown-note,
.cond-unknown-badge {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: var(--radius-control);
  white-space: nowrap;
  font-weight: 500;
}

.cond-unknown-badge.unknown,
.cond-unknown-note:not(.decides) {
  background: var(--state-awaiting-bg);
  color: #7A5800;
  border: 1px solid var(--state-awaiting-bd);
}

.cond-unknown-badge.decides,
.cond-unknown-note.decides {
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
}

.req-block {
  padding: .6rem 0;
  border-top: 1px solid var(--border);
}

.req-block:first-of-type { border-top: 0; }

.req-head {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.req-head code {
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
}

/* Facts the policy actually reads are the ones worth toggling first. */
tr.fact-referenced code { font-weight: 600; }

.evidence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: .78rem;
}

.evidence-list li {
  display: flex;
  gap: .4rem;
  align-items: baseline;
}

.evidence-list code { font-family: var(--font-mono); }

.ev-ok { color: var(--green); }
.ev-no { color: var(--red); }

/* ── Condition editor (ConditionEditor.razor) ─────────────────────────────
   The writable twin of the outline above, so it borrows the outline's shapes:
   the same left-ruled .cond-children for nesting, the same .cond-unknown-note
   for the Kleene annotations. What is added here is the machinery an editor
   needs — controls, per-child tools, chips, and a problem line that says what
   will not save while there is still time to fix it. No new colours, no new
   type scale: every value below is a token already defined at the top. */

.cond-editor { display: flex; flex-direction: column; gap: .3rem; }

/* A leaf is one condition, so it reads as one object — matching .cond-leaf in
   the outline. A group is scaffolding and stays flat, or nesting would stack a
   box inside a box inside a box at every level. */
.cond-editor.is-leaf {
  padding: .4rem .5rem;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.cond-bar,
.cond-row,
.cond-notes,
.cond-add-row,
.cond-path,
.cond-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.cond-notes { gap: var(--space-1) var(--space-3); }

/* The outline right-aligns its single note; a row of them reads left-to-right. */
.cond-notes .cond-unknown-note { margin-left: 0; }

/* ── Controls ─────────────────────────────────────────────────────────── */
.cond-select,
.cond-input {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  min-height: 28px;
  padding: 2px 6px;
  max-width: 100%;
  min-width: 0;
}

.cond-select.mono,
.cond-input.mono { font-family: var(--font-mono); }

.cond-kind-select { font-weight: 600; }
.cond-op-select { font-style: italic; color: var(--text-muted); }
.cond-input-num { width: 6rem; }
.cond-chip-input { width: 9rem; }

/* Registry metadata beside a path: what the fact is declared to be. */
.cond-type {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--border-soft);
  border-radius: 3px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.cond-label { font-size: 11px; color: var(--text-muted); }

.cond-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  color: var(--text-body);
}

/* Text-weight control for a mode switch that is not a primary action. */
.cond-linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
}

.cond-linkbtn:hover { text-decoration: underline; }

/* ── Children ─────────────────────────────────────────────────────────── */
.cond-child {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.cond-child-body { flex: 1; min-width: 0; }

.cond-child-tools {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  padding-top: .35rem;
}

.cond-tool {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-card);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}

.cond-tool:hover:not(:disabled) { background: var(--surface-hover); color: var(--text-primary); }
.cond-tool.is-danger:hover:not(:disabled) { color: var(--status-error); border-color: var(--status-error-bd); }
.cond-tool:disabled { opacity: .35; cursor: not-allowed; }

.cond-add-row { padding-left: .9rem; }

/* ── Chip list (In / NotIn / ContainsAny / ContainsAll / EqualsSet) ───── */
.cond-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-card);
  padding: 1px 3px 1px 7px;
  font-size: 11px;
  color: var(--text-primary);
  max-width: 14rem;
  overflow-wrap: anywhere;
}

.cond-chip-x {
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0 3px;
}

.cond-chip-x:hover { color: var(--status-error); }

/* ── Boolean segmented control (IsTrue / IsFalse) ─────────────────────── */
.cond-bool { display: inline-flex; }

.cond-seg {
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  min-height: 28px;
  padding: 2px 10px;
  cursor: pointer;
}

.cond-seg:first-child { border-radius: var(--radius-input) 0 0 var(--radius-input); }
.cond-seg:last-child { border-radius: 0 var(--radius-input) var(--radius-input) 0; border-left: 0; }

.cond-seg.is-on {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ── Tolerance sub-form (AmountMatches only) ──────────────────────────── */
.cond-tolerance {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-card);
}

/* ── Notes and problems ───────────────────────────────────────────────── */
/* A note explains; a problem is something that will not do what the author
   means — an empty group the validator rejects, or a condition the evaluator
   can only ever answer Unknown for. Both belong beside the control, not in a
   dialog at save time. */
.cond-note {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 0;
  overflow-wrap: anywhere;
}

.cond-problem {
  font-size: 11px;
  color: var(--status-error);
  background: var(--status-error-bg);
  border-radius: 3px;
  padding: 1px 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .cond-tool { transition: none; }
}

/* Setup flow: one clear path through configuration. */
.setup-hero { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; }
.tc-eyebrow { display:block; margin-bottom:6px; color:var(--accent); font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.setup-flow { display:grid; grid-template-columns:repeat(4,1fr); gap:0; margin-top:24px; padding:8px; }
.setup-flow-step { position:relative; display:grid; grid-template-columns:32px 1fr; gap:10px; min-height:118px; padding:18px 16px; border-right:1px solid var(--border-soft); }
.setup-flow-step:last-child { border-right:0; }
.setup-step-number { display:grid; place-items:center; width:28px; height:28px; border-radius:50%; color:var(--accent); background:var(--accent-weak); font-weight:700; }
.setup-flow-step strong { display:block; margin-top:3px; color:var(--text-primary); }
.setup-flow-step p { margin:5px 0 12px; color:var(--text-muted); font-size:13px; line-height:1.45; }
.setup-flow-step a { grid-column:2; font-size:13px; font-weight:600; }
.setup-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-top:16px; }
.setup-card { min-height:172px; padding:20px; }
.setup-card-heading { display:flex; align-items:center; gap:12px; }
.setup-card-heading .mud-icon-root { color:var(--accent); }
.setup-card-heading h2 { margin:0; font-size:16px; }
.setup-card-heading span { color:var(--text-muted); font-size:12px; }
.setup-card p { min-height:42px; margin:15px 0 8px; }
.setup-advanced-link { font-size:13px; font-weight:600; }
.setup-advanced-link small, .rail-advanced-link small { color:var(--text-muted); font-size:10px; font-weight:500; }
.setup-note { margin-top:16px; }
.authoring-step { display:flex; align-items:flex-start; gap:12px; }
.authoring-step-number { display:grid; place-items:center; flex:0 0 28px; width:28px; height:28px; border-radius:50%; background:var(--accent-weak); color:var(--accent); font-weight:700; font-size:13px; }
.authoring-step .tc-section-title { margin:0; }
.authoring-step p { margin:4px 0 0; }
.binding-summary { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:14px 16px; border:1px solid var(--border-soft); border-radius:var(--radius-card); background:var(--surface-subtle); }
.binding-summary strong, .binding-summary span { display:block; }
.binding-summary span { margin-top:3px; color:var(--text-muted); font-size:13px; }
.binding-summary code { color:var(--accent); white-space:nowrap; }
.advanced-panel { border-top:1px solid var(--border-soft); padding-top:12px; }
.advanced-panel summary { color:var(--text-muted); font-size:13px; font-weight:600; }
@media (max-width: 650px) { .binding-summary { align-items:flex-start; flex-direction:column; } }
@media (max-width: 800px) { .setup-hero { align-items:flex-start; flex-direction:column; } .setup-flow { grid-template-columns:1fr; } .setup-flow-step { min-height:0; border-right:0; border-bottom:1px solid var(--border-soft); } .setup-flow-step:last-child { border-bottom:0; } .setup-grid { grid-template-columns:1fr; } .setup-card { min-height:0; } .setup-card p { min-height:0; } }

/* Administrative console polish: preserve dense layout while making long,
   live and incomplete states explicit. */
.loading-skeleton { display:block; height:10px; border-radius:var(--radius-control); background:var(--border-soft); animation:console-skeleton 1.2s ease-in-out infinite; }
.loading-skeleton-title { width:min(18rem, 70%); height:16px; margin-bottom:var(--space-2); }
.loading-skeleton-line { width:min(28rem, 90%); margin-top:var(--space-2); }
.loading-skeleton-line.is-short { width:min(12rem, 55%); }
.loading-state-message { display:block; margin-top:var(--space-3); color:var(--text-body); }
@keyframes console-skeleton { 0%,100% { opacity:.55; } 50% { opacity:1; } }
.completeness-builder { min-height:44px; border:1px solid var(--border-default); border-radius:var(--radius-card); background:var(--surface-subtle); }
.completeness-progress { display:flex; align-items:center; gap:var(--space-2); max-width:34rem; color:var(--text-muted); font-size:11px; }
.completeness-progress-label { flex:0 0 auto; }
.completeness-progress-track { flex:1; min-width:6rem; height:6px; overflow:hidden; border:1px solid var(--border-default); border-radius:var(--radius-pill); background:var(--surface-card); }
.completeness-progress-track span { display:block; height:100%; background:var(--accent); transition:width var(--t-ui) var(--ease); }
.payload-tools { display:flex; align-items:center; justify-content:space-between; gap:var(--space-2); min-width:0; }
.copy-feedback { color:var(--status-success); font-size:12px; font-weight:600; }
.diff-explanation { display:flex; flex-wrap:wrap; gap:var(--space-2); align-items:baseline; margin:var(--space-3) 0 var(--space-2); padding:var(--space-2) var(--space-3); border:1px solid var(--border-default); border-radius:var(--radius-control); background:var(--surface-subtle); color:var(--text-body); font-size:12px; }
.diff-explanation strong { color:var(--text-primary); }
.evaluate-workbench.is-busy .evaluate-workbench-input { opacity:.82; }
.cond-field-label { display:block; margin-bottom:2px; color:var(--text-muted); font-size:10px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; }
.cond-operator-field { display:flex; min-width:10rem; flex-direction:column; }
.cond-operator-field > *:last-child { min-width:0; }
.cond-select:focus-visible, .cond-input:focus-visible, .cond-tool:focus-visible, .cond-chip-x:focus-visible, .cond-seg:focus-visible { outline:3px solid color-mix(in srgb, var(--accent) 28%, transparent); outline-offset:1px; }
.cond-combinator, .cond-unknown-note, .cond-unknown-badge { border-width:1px; border-style:solid; }
@media (max-width:650px) { .payload-tools { align-items:flex-start; flex-direction:column; } .completeness-progress { align-items:flex-start; flex-direction:column; } .completeness-progress-track { width:100%; } .cond-operator-field { width:100%; } }
@media (prefers-reduced-motion:reduce) { .loading-skeleton, .completeness-progress-track span { animation:none; transition:none; } }
