:root {
  color-scheme: light;
  --page: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #f2f4f7;
  --surface-active: #eaf1fb;
  --text: #17202d;
  --text-soft: #566273;
  --text-faint: #5f6b7c;
  --border: #d9dee7;
  --border-strong: #bdc6d3;
  --primary: #1e5aa8;
  --primary-hover: #174a8b;
  --primary-button: #1e5aa8;
  --primary-button-hover: #174a8b;
  --primary-soft: #e7f0fb;
  --focus-ring: #1e5aa8;
  --placeholder: #667385;
  --teal: #066b5c;
  --teal-soft: #e6f5f1;
  --amber: #a15c00;
  --amber-soft: #fff4df;
  --red: #b42318;
  --red-soft: #fdf0ef;
  --shadow: 0 12px 32px rgba(23, 32, 45, 0.12);
  --topbar-height: 64px;
  --sidebar-width: 212px;
  --form-width: 448px;
  --radius: 6px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111316;
  --surface: #1a1e23;
  --surface-muted: #242a31;
  --surface-active: #1d3140;
  --text: #f3f5f7;
  --text-soft: #a9b1bc;
  --text-faint: #a9b1bc;
  --border: #2b3138;
  --border-strong: #46505c;
  --primary: #75b5df;
  --primary-hover: #91c7e8;
  --primary-button: #2c79a9;
  --primary-button-hover: #246d9b;
  --primary-soft: #192d3b;
  --focus-ring: #75b5df;
  --placeholder: #a9b1bc;
  --teal: #61c5a2;
  --teal-soft: #17332b;
  --amber: #d7b267;
  --amber-soft: #362e1e;
  --red: #e28881;
  --red-soft: #3a2423;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a, label[role="button"] { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

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

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template: var(--topbar-height) minmax(0, 1fr) / var(--sidebar-width) minmax(0, 1fr);
}

.workspace, .sources-workspace, .operational-workspace, .situations-workspace, .documentation-workspace {
  scroll-margin-top: var(--topbar-height);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand-mark { display: block; width: 30px; height: 30px; flex: 0 0 30px; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 50%; background: #11171f; box-shadow: 0 1px 2px rgba(23, 32, 45, 0.14); }
.brand-mark-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.topbar-divider { width: 1px; height: 24px; background: var(--border); }
.section-name { color: var(--text-soft); font-size: 15px; }
.preference-controls { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.language-control { display: grid; grid-template-columns: 1fr 1fr; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.language-control button { min-width: 34px; min-height: 30px; padding: 0 7px; border: 0; border-radius: 4px; background: transparent; color: var(--text-faint); font-size: 10px; font-weight: 800; cursor: pointer; }
.language-control button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(23, 32, 45, 0.12); }
.preference-button { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-soft); font-size: 11px; font-weight: 700; cursor: pointer; }
.preference-button:hover { border-color: var(--border-strong); background: var(--surface-muted); color: var(--text); }
.auth-controls { display: flex; align-items: center; gap: 8px; }
.auth-state { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 13px; }
.auth-state.unlocked { color: var(--teal); }

.sidebar {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border-radius: var(--radius); color: var(--text-soft); text-decoration: none; font-weight: 600; }
.nav-item:hover { background: var(--surface-muted); color: var(--text); }
.nav-item.active { background: var(--surface-active); color: var(--primary); }
.nav-item-disabled { color: var(--text-faint); cursor: not-allowed; }
.nav-item-disabled:hover { background: transparent; color: var(--text-faint); }
.nav-item.nav-item-restricted { cursor: not-allowed; opacity: 0.62; }
.nav-item.nav-item-restricted:hover { background: transparent; color: var(--text-soft); }
.nav-item.nav-item-restricted::after { content: attr(data-restriction-label); margin-left: auto; color: var(--text-faint); font-size: 8px; line-height: 1; text-transform: uppercase; }
.sidebar-foot { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 12px; color: var(--text-faint); font-size: 12px; }

html[data-access-mode="judge_read_only"] [data-admin-only] { display: none !important; }

.situations-workspace {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: calc(100vh - var(--topbar-height));
  background: var(--page);
}

.situations-pane { min-width: 0; padding: 28px 30px 48px; }
.situations-header { margin-bottom: 20px; }
.situations-header .form-context { margin-bottom: 5px; color: var(--primary); }
.situation-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.situation-summary > div { min-width: 0; padding: 13px 16px; border-left: 1px solid var(--border); }
.situation-summary > div:first-child { border-left: 0; }
.situation-summary dt { color: var(--text-faint); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.situation-summary dd { margin: 3px 0 0; font-size: 20px; font-weight: 750; }
.situation-loading { min-height: 80px; display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-soft); }
.situation-board-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 390px); align-items: start; gap: 20px; }
.situation-board { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.situation-lane[hidden] { display: none; }
.situation-lane { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.lane-heading { min-height: 48px; display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 0 13px; border-bottom: 1px solid var(--border); }
.lane-heading h2 { min-width: 0; margin: 0; overflow: hidden; font-size: 13px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.lane-heading > span:last-child { display: grid; min-width: 23px; min-height: 23px; place-items: center; padding: 0 6px; border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 10px; font-weight: 800; }
.lane-signal { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.lane-attention .lane-signal { background: var(--red); }
.lane-working .lane-signal { background: var(--primary); }
.lane-monitoring .lane-signal { background: var(--amber); }
.lane-outcomes .lane-signal { background: var(--teal); }
.situation-list { min-height: 112px; }
.situation-list-empty { display: grid; min-height: 112px; place-items: center; padding: 18px; color: var(--text-faint); font-size: 11px; text-align: center; }
.situation-card { width: 100%; display: grid; gap: 8px; padding: 13px; border: 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.situation-card:first-child { border-top: 0; }
.situation-card:hover { background: var(--surface-muted); }
.situation-card.selected { background: var(--surface-active); box-shadow: inset 3px 0 0 var(--primary); }
.situation-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.situation-card-heading strong { min-width: 0; overflow: hidden; font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.situation-card p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--text-soft); font-size: 11px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.situation-card-meta { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-faint); font-size: 10px; }
.situation-card-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.situation-card-signals { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px 9px; color: var(--text-faint); font-size: 9px; font-weight: 700; }
.situation-card-signals span { position: relative; padding-left: 8px; }
.situation-card-signals span::before { position: absolute; top: 50%; left: 0; width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); content: ""; transform: translateY(-50%); }
.situation-card-next { display: grid; grid-template-columns: 14px minmax(0, 1fr); align-items: start; gap: 5px; padding-top: 7px; border-top: 1px solid var(--border); color: var(--primary); font-size: 10px; font-weight: 700; line-height: 1.4; }
.situation-card-next .icon { width: 13px; height: 13px; margin-top: 1px; }
.situation-badge { display: inline-flex; flex: 0 0 auto; align-items: center; min-height: 22px; padding: 0 7px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.severity-critical, .severity-high { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); background: var(--red-soft); color: var(--red); }
.severity-medium { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); background: var(--amber-soft); color: var(--amber); }
.severity-low { border-color: color-mix(in srgb, var(--teal) 45%, var(--border)); background: var(--teal-soft); color: var(--teal); }
.board-empty { grid-column: 1 / -1; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); text-align: center; }
.board-empty h2 { margin: 0; font-size: 16px; }
.board-empty p { max-width: 430px; margin: 7px 0 0; color: var(--text-soft); }
.situation-detail { position: sticky; top: calc(var(--topbar-height) + 20px); min-width: 0; min-height: 520px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.situation-detail .detail-placeholder { min-height: 518px; }
.situation-detail-content { min-width: 0; }
.situation-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 19px; border-bottom: 1px solid var(--border); }
.situation-detail-header > div { min-width: 0; }
.situation-detail-header h2 { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 17px; line-height: 1.35; }
.situation-detail-header p:last-child { margin: 6px 0 0; color: var(--text-soft); font-size: 11px; }
.situation-detail-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; }
.detail-tab { min-width: 0; min-height: 42px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface-muted); color: var(--text-soft); font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.detail-tab + .detail-tab { border-left: 1px solid var(--border); }
.detail-tab:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }
.detail-tab[aria-selected="true"] { border-bottom-color: var(--primary); background: var(--surface); color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }
.situation-detail-tab-panels { min-width: 0; }
.situation-overview-panel, .investigation-workspace, .evidence-workspace, .curator-workspace { min-width: 0; }
.situation-detail-grid { display: grid; grid-template-columns: 1fr 1fr; margin: 0; padding: 11px 19px; border-bottom: 1px solid var(--border); }
.situation-detail-grid > div { min-width: 0; padding: 8px 0; }
.situation-detail-grid dt { color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.situation-detail-grid dd { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--text-soft); font-size: 11px; }
.situation-detail-section { padding: 13px 19px; border-bottom: 1px solid var(--border); }
.situation-detail-section h3 { margin: 0 0 8px; color: var(--text-faint); font-size: 10px; text-transform: uppercase; }
.situation-authority-chain { padding: 15px 19px; border-bottom: 1px solid var(--border); }
.authority-chain-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.authority-chain-header .form-context { margin: 0; }
.authority-chain-header h3 { margin: 3px 0 0; font-size: 14px; }
.authority-chain-summary { flex: 0 0 auto; padding: 4px 7px; border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 10px; font-weight: 800; }
.authority-chain-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 13px 0 0; padding: 0; border-block: 1px solid var(--border); list-style: none; }
.authority-chain-step { display: grid; min-width: 0; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; padding: 12px 10px 12px 0; }
.authority-chain-step:nth-child(even) { padding-left: 10px; border-left: 1px solid var(--border); }
.authority-chain-step:nth-child(n + 3) { border-top: 1px solid var(--border); }
.authority-step-index { display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--text-faint); font-size: 9px; font-weight: 800; }
.authority-chain-step > div { min-width: 0; }
.authority-chain-step strong, .authority-chain-step span, .authority-chain-step small { display: block; overflow-wrap: anywhere; }
.authority-chain-step strong { font-size: 11px; }
.authority-chain-step div > span { margin-top: 2px; color: var(--text-soft); font-size: 11px; font-weight: 700; }
.authority-chain-step small { margin-top: 4px; color: var(--text-faint); font-size: 10px; line-height: 1.4; }
.authority-chain-step[data-state="ready"] .authority-step-index { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.authority-chain-step[data-state="warning"] .authority-step-index { border-color: var(--amber); background: var(--amber-soft); color: var(--amber); }
.authority-chain-step[data-state="blocked"] .authority-step-index { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.authority-chain-technical { margin-top: 10px; color: var(--text-soft); font-size: 10px; }
.authority-chain-technical summary { width: fit-content; cursor: pointer; font-weight: 800; }
.authority-chain-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 9px 0 0; padding-top: 8px; border-top: 1px solid var(--border); }
.authority-chain-facts > div { min-width: 0; padding: 5px 8px 5px 0; }
.authority-chain-facts dt { color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.authority-chain-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; color: var(--text-soft); font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.authority-chain-safety { margin: 9px 0 0; color: var(--text-faint); font-size: 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.detail-tag { display: inline-flex; max-width: 100%; min-height: 24px; align-items: center; padding: 0 7px; overflow: hidden; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font: 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.detail-empty { color: var(--text-faint); font-size: 11px; }
.detail-text-list { display: grid; gap: 5px; margin: 0; padding: 0 0 0 17px; color: var(--text-soft); font-size: 11px; }
.situation-blockers { min-height: 70px; }
.situation-next-action { padding: 15px 19px 18px; background: var(--primary-soft); }
.situation-next-action span { color: var(--primary); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.situation-next-action p { margin: 5px 0 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 700; }

.investigation-workspace, .evidence-workspace { min-height: 500px; background: var(--surface); }
.investigation-state { min-height: 54px; align-items: center; gap: 9px; padding: 11px 15px; border-bottom: 1px solid var(--border); font-size: 11px; }
.investigation-state:not([hidden]) { display: flex; }
.investigation-state > div { min-width: 0; flex: 1; }
.investigation-state p { margin: 2px 0 0; overflow-wrap: anywhere; }
.investigation-error { color: var(--red); background: var(--red-soft); }
.investigation-empty, .evidence-empty { display: flex; min-height: 360px; flex-direction: column; align-items: center; justify-content: center; padding: 28px 20px; text-align: center; }
.investigation-empty h3, .evidence-empty h3 { margin: 0; font-size: 14px; }
.investigation-empty p, .evidence-empty p { max-width: 360px; margin: 7px 0 0; color: var(--text-soft); font-size: 11px; }
.investigation-content, .evidence-content { min-width: 0; }
.case-picker { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-muted); color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.case-picker select { width: 100%; min-width: 0; min-height: 36px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); font-size: 11px; text-transform: none; }
.investigation-heading, .evidence-heading { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--border); }
.investigation-heading > div, .evidence-heading > div { min-width: 0; }
.investigation-heading span, .evidence-heading span { color: var(--primary); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.investigation-heading h3, .evidence-heading h3 { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.4; }
.investigation-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.evidence-heading p { max-width: 230px; margin: 0; padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--border)); border-radius: 4px; background: var(--amber-soft); color: var(--amber); font-size: 10px; font-weight: 700; line-height: 1.35; }
.investigation-metadata, .evidence-validation { display: grid; grid-template-columns: 1fr 1fr; margin: 0; padding: 10px 19px; border-bottom: 1px solid var(--border); }
.analysis-progress { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.analysis-progress span { position: relative; min-width: 0; padding: 11px 8px 10px 21px; overflow-wrap: anywhere; color: var(--text-faint); font-size: 12px; font-weight: 750; }
.analysis-progress span::before { position: absolute; top: 13px; left: 8px; width: 7px; height: 7px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); content: ""; }
.analysis-progress span[data-state="complete"] { color: var(--green); }
.analysis-progress span[data-state="complete"]::before { border-color: var(--green); background: var(--green); }
.analysis-progress span[data-state="active"] { color: var(--primary); background: var(--primary-soft); }
.analysis-progress span[data-state="active"]::before { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.investigation-metadata > div, .evidence-validation > div { min-width: 0; padding: 7px 0; }
.investigation-metadata dt, .evidence-validation dt { color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.investigation-metadata dd, .evidence-validation dd { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--text-soft); font-size: 11px; }
.investigation-section, .evidence-section { padding: 14px 19px; border-bottom: 1px solid var(--border); }
.investigation-section h4, .evidence-section h4 { margin: 0 0 8px; color: var(--text-faint); font-size: 10px; text-transform: uppercase; }
.workplan-legacy { margin: 16px 19px; padding: 13px 14px; border: 1px solid var(--border); border-left: 3px solid var(--amber); border-radius: 4px; background: var(--amber-soft); }
.workplan-legacy strong { font-size: 11px; }
.workplan-legacy p { margin: 4px 0 0; color: var(--text-soft); font-size: 11px; }
.workplan-summary { display: flex; min-height: 42px; align-items: center; gap: 8px; padding: 9px 19px; border-bottom: 1px solid var(--border); background: var(--surface-muted); font-size: 10px; }
.workplan-summary strong { color: var(--text); font-size: 11px; }
.workplan-summary span { padding-left: 8px; border-left: 1px solid var(--border-strong); color: var(--text-soft); }
.workplan-validation { padding: 13px 19px; border-bottom: 1px solid var(--border); background: var(--surface); }
.workplan-validation-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.workplan-validation-header > div { min-width: 0; }
.workplan-validation h4 { margin: 0; color: var(--text); font-size: 11px; }
.workplan-validation p { margin: 3px 0 0; color: var(--text-soft); font-size: 10px; line-height: 1.45; }
.workplan-validation-gates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 11px; }
.workplan-validation-gate { display: flex; min-height: 36px; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); font-size: 10px; }
.workplan-validation-gate strong { color: var(--text-soft); }
.workplan-validation-gate span { color: var(--text-faint); font-weight: 800; }
.workplan-validation-gate[data-state="passed"] span { color: var(--green); }
.workplan-validation-gate[data-state="blocked"] span { color: var(--red); }
.workplan-validation-issues { margin-top: 10px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--red) 35%, var(--border)); border-radius: 4px; background: var(--red-soft); }
.workplan-validation-issues strong { color: var(--red); font-size: 10px; }
.workplan-validation-issues ul { display: grid; gap: 7px; margin: 7px 0 0; padding-left: 17px; color: var(--text-soft); font-size: 10px; line-height: 1.45; }
.workplan-validation-technical { margin-top: 10px; }
.workplan-validation-technical summary { color: var(--primary); font-size: 10px; font-weight: 800; cursor: pointer; }
.workplan-validation-technical[open] summary { margin-bottom: 10px; }
.workplan-validation-technical .workplan-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.workplan-validation .button[aria-busy="true"] .button-label { display: none; }
.workplan-validation .button[aria-busy="true"] .button-progress { display: inline-flex; }
.sql-candidate-workspace { padding: 15px 19px 18px; border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.sql-candidate-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.sql-candidate-header h4, .sql-dry-run-result h4 { margin: 0; color: var(--text); font-size: 11px; }
.sql-candidate-header p { margin: 3px 0 0; color: var(--text-soft); font-size: 10px; }
.sql-candidate-error { margin-top: 10px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--red) 35%, var(--border)); border-radius: 4px; background: var(--red-soft); color: var(--red); font-size: 11px; }
.sql-candidate-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-top: 12px; }
.advanced-sql { margin-top: 12px; }
.advanced-sql summary { width: fit-content; color: var(--primary); font-size: 12px; font-weight: 800; cursor: pointer; }
.advanced-sql[open] summary { margin-bottom: 5px; }
.sql-candidate-form textarea { min-height: 148px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; tab-size: 2; }
.sql-candidate-form[aria-busy="true"] .button-label, .sql-candidate-toolbar .button[aria-busy="true"] .button-label { display: none; }
.sql-candidate-form[aria-busy="true"] .button-progress, .sql-candidate-toolbar .button[aria-busy="true"] .button-progress { display: inline-flex; }
.sql-candidate-empty { margin-top: 12px; padding: 12px; border: 1px dashed var(--border-strong); color: var(--text-soft); font-size: 11px; text-align: center; }
.sql-candidate-content { margin-top: 12px; border: 1px solid var(--border); background: var(--surface); }
.sql-candidate-toolbar { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.sql-candidate-toolbar .status[data-status="valid"] { color: var(--green); }
.sql-candidate-toolbar .status[data-status="blocked"] { color: var(--red); }
.sql-candidate-code { max-height: 260px; margin: 0; overflow: auto; padding: 14px; border-bottom: 1px solid var(--border); background: var(--surface-muted); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.sql-candidate-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 13px; border-bottom: 1px solid var(--border); }
.sql-candidate-content > .tag-list { padding: 12px 13px; border-bottom: 1px solid var(--border); }
.sql-candidate-issues { padding: 12px 13px; border-bottom: 1px solid var(--border); background: var(--red-soft); }
.sql-candidate-issues strong { color: var(--red); font-size: 10px; }
.sql-candidate-issues ul { display: grid; gap: 6px; margin: 7px 0 0; padding-left: 17px; color: var(--text-soft); font-size: 11px; }
.bounded-execution { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 13px; border-top: 1px solid var(--border); background: var(--primary-soft); }
.bounded-execution > div { min-width: 0; }
.bounded-execution h4 { margin: 0; font-size: 13px; }
.bounded-execution p { margin: 4px 0 0; color: var(--text-soft); font-size: 12px; line-height: 1.45; }
.bounded-execution .button[aria-busy="true"] .button-label, .execution-approval-dialog .button[aria-busy="true"] .button-label { display: none; }
.bounded-execution .button[aria-busy="true"] .button-progress, .execution-approval-dialog .button[aria-busy="true"] .button-progress { display: inline-flex; }
.execution-result { padding: 15px 13px; border-top: 1px solid var(--border); background: var(--surface); }
.execution-result-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.execution-result-heading .status[data-status="collected"] { color: var(--green); }
.execution-result-heading .status[data-status="blocked"], .execution-result-heading .status[data-status="failed"] { color: var(--red); }
.execution-result > .button { margin-top: 12px; }
.execution-approval-dialog { width: min(720px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.execution-approval-dialog::backdrop { background: rgba(24, 32, 43, 0.56); }
.execution-approval-dialog form { display: flex; max-height: calc(100dvh - 34px); flex-direction: column; }
.execution-approval-dialog .dialog-header { display: flex; min-height: 76px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.execution-approval-dialog .dialog-header h2 { margin: 2px 0 0; font-size: 18px; line-height: 1.3; }
.execution-approval-dialog .dialog-body { display: grid; min-height: 0; gap: 16px; overflow-y: auto; padding: 18px 20px 22px; }
.execution-approval-dialog .dialog-footer { display: flex; flex: 0 0 auto; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-muted); }
.approval-scope { min-width: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.approval-scope:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.approval-scope > header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.approval-scope h3 { margin: 2px 0 0; font-size: 14px; }
.approval-scope-mode { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border: 1px solid color-mix(in srgb, var(--teal) 35%, var(--border)); border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.approval-scope-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.approval-scope-summary > div { min-width: 0; padding: 11px 13px; border-top: 1px solid var(--border); }
.approval-scope-summary > div:nth-child(-n + 2) { border-top: 0; }
.approval-scope-summary > div:nth-child(even) { border-left: 1px solid var(--border); }
.approval-scope-summary dt, .approval-scope-technical dt { color: var(--text-faint); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.approval-scope-summary dd { margin: 4px 0 0; overflow-wrap: anywhere; color: var(--text); font-size: 12px; line-height: 1.45; }
.approval-scope-details { border-top: 1px solid var(--border); }
.approval-scope-details summary { padding: 11px 13px; color: var(--primary); font-size: 10px; font-weight: 800; cursor: pointer; }
.approval-scope-details[open] summary { border-bottom: 1px solid var(--border); }
.approval-scope-technical { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 4px 13px 14px; }
.approval-scope-technical > div { min-width: 0; padding: 10px 0; border-bottom: 1px solid var(--border); }
.approval-scope-technical > div:nth-child(odd) { padding-right: 12px; }
.approval-scope-technical > div:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--border); }
.approval-scope-technical dd { margin: 4px 0 0; overflow-wrap: anywhere; color: var(--text-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.approval-option { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 12px 0; border-top: 1px solid var(--border); cursor: pointer; }
.approval-option input { margin-top: 3px; }
.approval-option span { display: grid; gap: 4px; }
.approval-option small { color: var(--text-soft); line-height: 1.45; }
.approval-safety { margin: 0; padding: 11px 12px; border-left: 3px solid var(--primary); background: var(--primary-soft); color: var(--text-soft); font-size: 12px; line-height: 1.5; }
.sql-dry-run-result { padding: 13px; }
.sql-dry-run-result h4 { margin-bottom: 10px; }
.sql-dry-run-result .workplan-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.workplan-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.workplan-section { min-width: 0; padding: 15px 16px 17px; }
.workplan-section + .workplan-section { border-left: 1px solid var(--border); }
.workplan-section h4, .workplan-locked-section h3 { margin: 0 0 10px; color: var(--text-faint); font-size: 10px; text-transform: uppercase; }
.workplan-facts { display: grid; gap: 11px; margin: 0; }
.workplan-facts > div { min-width: 0; }
.workplan-facts dt { color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.workplan-facts dd { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--text-soft); font-size: 11px; line-height: 1.45; }
.workplan-technical { padding: 11px 19px 15px; border-bottom: 1px solid var(--border); }
.workplan-technical summary { color: var(--primary); font-size: 10px; font-weight: 800; cursor: pointer; }
.workplan-technical[open] summary { margin-bottom: 12px; }
.workplan-technical .workplan-facts { grid-template-columns: 1fr 1fr; }

.curator-workspace { display: grid; grid-template-rows: minmax(300px, 1fr) auto; min-height: 500px; background: var(--surface); }
.curator-history { position: relative; min-width: 0; min-height: 300px; max-height: 520px; overflow-y: auto; padding: 14px 15px 18px; }
.curator-state { min-height: 54px; align-items: center; gap: 9px; padding: 11px 15px; border-bottom: 1px solid var(--border); font-size: 11px; }
.curator-state:not([hidden]) { display: flex; }
.curator-error { color: var(--red); background: var(--red-soft); }
.curator-error > div { min-width: 0; flex: 1; }
.curator-error p { margin: 2px 0 0; overflow-wrap: anywhere; }
.curator-load-more { margin: 0 auto 14px; }
.icon-up { transform: rotate(-90deg); }
.curator-empty { display: flex; min-height: 260px; flex-direction: column; align-items: center; justify-content: center; padding: 22px 16px; text-align: center; }
.curator-empty .empty-icon { margin-bottom: 12px; }
.curator-empty h3 { margin: 0; font-size: 14px; }
.curator-empty p { max-width: 320px; margin: 7px 0 0; color: var(--text-soft); font-size: 11px; }
.curator-transcript { display: grid; gap: 13px; }
.curator-message { width: min(88%, 540px); min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.curator-message-user { justify-self: end; border-color: color-mix(in srgb, var(--primary) 32%, var(--border)); background: var(--primary-soft); }
.curator-message-assistant { justify-self: start; background: var(--surface); }
.curator-message-meta { display: flex; min-height: 16px; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-faint); font-size: 9px; font-weight: 800; }
.curator-message p { margin: 5px 0 0; overflow-wrap: anywhere; color: var(--text); font-size: 11px; white-space: pre-wrap; }
.curator-citations { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0 0; padding: 8px 0 0; border-top: 1px solid var(--border); list-style: none; }
.curator-citation { display: inline-flex; max-width: 100%; min-height: 28px; align-items: center; gap: 5px; padding: 0 7px; overflow: hidden; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--primary); font-size: 9px; }
.curator-citation span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.curator-citations .icon { width: 14px; height: 14px; }
.curator-proposal { margin-top: 14px; border: 1px solid var(--border-strong); border-left: 3px solid var(--teal); border-radius: var(--radius); background: var(--surface); }
.curator-proposal header { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.curator-proposal header > .icon { color: var(--teal); }
.curator-proposal header span { color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.curator-proposal h3 { margin: 2px 0 0; overflow-wrap: anywhere; font-size: 12px; }
.curator-proposal-fields { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.curator-proposal-fields div { min-width: 0; padding: 10px 12px; }
.curator-proposal-fields div + div { border-left: 1px solid var(--border); }
.curator-proposal-fields dt { color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.curator-proposal-fields dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 11px; }
.curator-proposal-rationale { margin: 0; padding: 10px 12px; border-top: 1px solid var(--border); color: var(--text-soft); font-size: 11px; line-height: 1.45; }
.curator-proposal-picker { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; padding: 10px 12px; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.curator-proposal-picker select { width: 100%; min-width: 0; min-height: 34px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); font-size: 10px; text-transform: none; }
.curator-proposal-actions { display: flex; justify-content: flex-end; gap: 7px; padding: 10px 12px; border-top: 1px solid var(--border); }
.curator-proposal-decision { margin: 0; padding: 10px 12px; border-top: 1px solid var(--border); color: var(--teal); font-size: 11px; font-weight: 700; }
.curator-proposal-warning { margin: 0; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 700; }
.curator-compose { min-width: 0; padding: 11px 14px 13px; border-top: 1px solid var(--border); background: var(--surface-muted); }
.curator-quick-prompts { display: flex; gap: 6px; padding-bottom: 9px; overflow-x: auto; scrollbar-width: thin; }
.curator-quick-prompts button { flex: 0 0 auto; min-height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text-soft); font-size: 9px; font-weight: 700; cursor: pointer; }
.curator-quick-prompts button:hover { border-color: var(--border-strong); color: var(--text); }
.curator-composer { display: grid; grid-template-columns: minmax(0, 1fr) 38px; align-items: end; gap: 8px; }
.curator-composer textarea { width: 100%; min-height: 58px; max-height: 150px; resize: vertical; padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 11px; line-height: 1.4; }
.curator-send { width: 38px; min-width: 38px; height: 38px; padding: 0; }
.curator-composer-note { margin: 7px 0 0; color: var(--text-faint); font-size: 9px; }

.situation-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.situation-dialog::backdrop { background: rgba(24, 32, 43, 0.52); }
.situation-dialog form { display: flex; max-height: calc(100vh - 34px); flex-direction: column; }
.situation-form-header { flex: 0 0 auto; }
.situation-form-body { min-height: 0; overflow-y: auto; padding: 20px 24px; }
.situation-form-grid { gap: 15px 12px; }
.situation-form-alert { margin: 0 0 16px; }
.situation-form-actions { flex: 0 0 auto; border-top: 1px solid var(--border); }
.situation-form-busy .button-label { display: none; }
.situation-form-busy .button-progress { display: inline-flex; }

.workplan-dialog { width: min(900px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.workplan-dialog::backdrop { background: rgba(24, 32, 43, 0.52); }
.workplan-dialog form { display: flex; max-height: calc(100vh - 34px); flex-direction: column; }
.workplan-form-header { flex: 0 0 auto; }
.workplan-step-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: 0 0 auto; border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.workplan-step-tabs button { min-height: 42px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-soft); font-size: 11px; font-weight: 800; cursor: pointer; }
.workplan-step-tabs button[aria-selected="true"] { border-bottom-color: var(--primary); background: var(--surface); color: var(--primary); }
.workplan-form-body { min-height: 0; overflow-y: auto; padding: 20px 24px 26px; }
.workplan-form-status { min-height: 18px; margin: 0 0 12px; color: var(--text-faint); font-size: 10px; }
.workplan-form-grid { gap: 15px 12px; }
.locked-reference { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; padding: 12px 13px; border: 1px solid var(--border); border-left: 3px solid var(--primary); background: var(--primary-soft); }
.locked-reference > .icon { flex: 0 0 auto; color: var(--primary); }
.locked-reference > div { min-width: 0; }
.locked-reference strong { font-size: 11px; }
.locked-reference p { margin: 3px 0 8px; color: var(--text-soft); font-size: 10px; }
.workplan-locked-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.workplan-option-fieldset { margin: 0 0 18px; padding: 0; border: 0; }
.workplan-option-fieldset legend { margin-bottom: 10px; color: var(--text-faint); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.workplan-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.workplan-option { display: flex; min-width: 0; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 11px; }
.workplan-option input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; accent-color: var(--primary); }
.workplan-execution-note { margin: 18px 0 0; padding: 12px 13px; border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--border)); border-radius: 4px; background: var(--amber-soft); color: var(--text-soft); font-size: 11px; }
.workplan-execution-note strong { color: var(--amber); }
.workplan-form-actions { flex: 0 0 auto; border-top: 1px solid var(--border); background: var(--surface); }
.workplan-form-busy .button-label { display: none; }
.workplan-form-busy .button-progress { display: inline-flex; }

.proposal-review-dialog { width: min(620px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.proposal-review-dialog::backdrop { background: rgba(24, 32, 43, 0.52); }
.proposal-review-dialog form { display: flex; max-height: calc(100vh - 34px); flex-direction: column; }
.proposal-review-body { min-height: 0; overflow-y: auto; padding: 20px 24px; }
.proposal-review-section { padding-bottom: 17px; }
.proposal-review-section h3 { margin: 0 0 7px; color: var(--text-faint); font-size: 10px; text-transform: uppercase; }
.proposal-review-section p { margin: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.proposal-effect { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 18px; padding: 12px; border: 1px solid var(--border); border-left: 3px solid var(--primary); background: var(--primary-soft); color: var(--primary); }
.proposal-effect p { margin: 0; color: var(--text); font-size: 11px; line-height: 1.5; }
.proposal-review-actions { border-top: 1px solid var(--border); }
.proposal-review-busy .button-label { display: none; }
.proposal-review-busy .button-progress { display: inline-flex; }

.workspace {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(520px, 1fr) var(--form-width);
  min-width: 0;
  min-height: calc(100vh - var(--topbar-height));
}

.connections-pane { min-width: 0; padding: 28px 30px 40px; background: var(--page); }
.settings-pane { align-content: start; }
.settings-tabs { display: inline-grid; grid-template-columns: repeat(3, minmax(0, auto)); gap: 3px; margin: 0 0 22px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.settings-tab { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--text-soft); font-weight: 700; cursor: pointer; }
.settings-tab:hover { color: var(--text); }
.settings-tab[aria-selected="true"] { border-color: var(--border); background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(23, 32, 45, 0.08); }
.settings-tab:focus-visible { outline-offset: 1px; }
.settings-view { min-width: 0; }
.workspace.settings-single-pane { grid-template-columns: minmax(0, 1fr); }
.workspace.settings-single-pane .settings-pane { grid-column: 1 / -1; }
.workspace.settings-single-pane .form-pane { display: none; }
.provider-settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 430px); align-items: start; gap: 18px; }
.settings-surface { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.settings-surface-header { display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.settings-surface-header h2 { margin: 0; font-size: 15px; }
.settings-surface-header p:not(.form-context) { margin: 3px 0 0; color: var(--text-soft); font-size: 12px; }
.provider-egress-notice strong { color: var(--text); }
.provider-runtime-boundary { align-items: flex-start; border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); background: color-mix(in srgb, var(--primary-soft) 52%, var(--surface)); }
.provider-runtime-boundary > div { display: grid; gap: 3px; }
.provider-runtime-boundary span { line-height: 1.45; }
.lifecycle-track { max-width: 190px; color: var(--text-faint); font-size: 10px; font-weight: 750; line-height: 1.45; text-align: right; }
.provider-list { display: grid; }
.provider-card { display: grid; gap: 13px; padding: 16px 18px; border-top: 1px solid var(--border); }
.provider-card:first-child { border-top: 0; }
.provider-card-header { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 14px; }
.provider-card-identity { display: flex; min-width: 0; align-items: flex-start; gap: 10px; }
.provider-card-identity > .icon { margin-top: 2px; color: var(--text-faint); }
.provider-card-identity > div { display: grid; min-width: 0; gap: 2px; }
.provider-card-identity strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.provider-card-identity span { color: var(--text-soft); font-size: 12px; overflow-wrap: anywhere; }
.provider-lifecycle { display: inline-flex; min-height: 25px; flex: 0 0 auto; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.provider-lifecycle::before { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); content: ""; }
.provider-lifecycle-verified::before { background: var(--primary); }
.provider-lifecycle-approved::before { background: var(--amber); }
.provider-lifecycle-active::before { background: var(--teal); }
.provider-lifecycle-failed::before, .provider-lifecycle-revoked::before { background: var(--red); }
.provider-card-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 0; }
.provider-card-facts div { min-width: 0; padding: 9px 10px; background: var(--surface-muted); }
.provider-card-facts dt { color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.provider-card-facts dd { margin: 3px 0 0; overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.provider-card-next { margin: 0; color: var(--text-soft); font-size: 12px; }
.provider-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.provider-card-actions .button { min-height: 32px; padding: 0 10px; font-size: 11px; }
.provider-card-actions .button:last-child { margin-left: auto; }
.provider-editor { position: sticky; top: calc(var(--topbar-height) + 16px); }
.provider-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; padding: 18px; }
.provider-form-grid .field-full { grid-column: 1 / -1; }
.provider-editor .form-alert { margin: 16px 18px 0; }
.local-binding-control { display: flex; grid-column: 1 / -1; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); cursor: pointer; }
.local-binding-control input { width: 18px; min-height: 18px; flex: 0 0 auto; margin-top: 2px; }
.local-binding-control > span { display: grid; gap: 2px; }
.local-binding-control small { color: var(--text-soft); font-weight: 400; }
.settings-editor-actions { display: flex; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); }
.provider-editor.form-busy .button-label { display: none; }
.provider-editor.form-busy .button-progress { display: inline-flex; }
.settings-empty { display: grid; min-height: 240px; place-items: center; align-content: center; gap: 8px; padding: 28px; color: var(--text-soft); text-align: center; }
.settings-empty > .icon { width: 25px; height: 25px; }
.settings-empty strong { color: var(--text); }
.settings-empty span { max-width: 310px; font-size: 12px; }
.role-assignment-list { display: grid; }
.role-assignment-row { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(180px, 1fr) minmax(210px, 1.15fr) minmax(150px, .7fr) auto; align-items: end; gap: 12px; padding: 15px 18px; border-top: 1px solid var(--border); }
.role-assignment-row:first-child { border-top: 0; }
.role-identity { align-self: center; min-width: 0; }
.role-identity strong { display: block; font-size: 13px; }
.role-identity span { display: block; margin-top: 3px; color: var(--text-soft); font-size: 11px; line-height: 1.45; }
.role-control { display: grid; min-width: 0; gap: 5px; }
.role-control > span { color: var(--text-faint); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.role-control select { min-width: 0; }
.role-state { display: grid; align-self: center; gap: 5px; }
.benchmark-state { display: inline-flex; width: fit-content; min-height: 24px; align-items: center; padding: 0 7px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.benchmark-pass { border-color: color-mix(in srgb, var(--teal) 42%, var(--border)); background: var(--teal-soft); color: var(--teal); }
.benchmark-fail { border-color: color-mix(in srgb, var(--red) 42%, var(--border)); background: var(--red-soft); color: var(--red); }
.benchmark-hold { border-color: color-mix(in srgb, var(--amber) 42%, var(--border)); background: var(--amber-soft); color: var(--amber); }
.role-state small { max-width: 220px; color: var(--text-soft); line-height: 1.35; }
.role-actions { display: flex; align-items: center; gap: 6px; }
.role-actions .button { min-height: 34px; padding: 0 10px; font-size: 11px; }
.provider-action-dialog { width: min(540px, calc(100% - 28px)); max-height: calc(100vh - 34px); padding: 0; overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.provider-action-dialog::backdrop { background: rgba(23, 32, 45, .46); }
.provider-action-dialog form { display: flex; max-height: calc(100vh - 34px); flex-direction: column; }
.provider-action-dialog .form-header { min-height: 80px; }
.provider-action-dialog .form-header .icon-button { display: inline-grid; }
.provider-action-body { display: grid; gap: 16px; min-height: 0; overflow-y: auto; padding: 20px 24px; }
.provider-action-body > p { margin: 0; color: var(--text-soft); line-height: 1.55; }
.provider-action-dialog .form-alert { margin: 0; }
.pane-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.pane-header h1 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 700; }
.pane-header p { margin: 5px 0 0; color: var(--text-soft); }
.header-actions { display: flex; align-items: center; gap: 8px; }

.button, .icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.button-primary { background: var(--primary-button); border-color: var(--primary-button); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--primary-button-hover); border-color: var(--primary-button-hover); }
.button-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.button-secondary:hover:not(:disabled) { background: var(--surface-muted); }
.button-danger { background: var(--surface); border-color: #e6aaa5; color: var(--red); }
.button-compact { min-height: 34px; padding: 0 11px; }
.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: 0.56; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; background: var(--surface); border-color: var(--border); color: var(--text-soft); }
.icon-button:hover:not(:disabled) { background: var(--surface-muted); color: var(--text); border-color: var(--border-strong); }

.notice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid; border-radius: var(--radius); }
.notice > .icon { margin-top: 1px; }
.notice > div { display: grid; gap: 2px; flex: 1; }
.notice span { font-size: 13px; }
.notice-error { background: var(--red-soft); border-color: #efc2be; color: var(--red); }
.notice-neutral { background: var(--surface); border-color: var(--border); color: var(--text); }
.notice-neutral > .icon { color: var(--text-soft); }

.list-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.search-control { position: relative; display: block; flex: 1; max-width: 360px; }
.search-control .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search-control input { padding-left: 38px; }
.select-control { margin-left: auto; }

input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
}

textarea { min-height: 64px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:hover, select:hover, textarea:hover { border-color: #95a2b2; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid var(--focus-ring); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.connections-table { width: 100%; min-width: 650px; border-collapse: collapse; table-layout: fixed; }
.connections-table th { height: 42px; padding: 0 14px; background: var(--surface-muted); color: var(--text-faint); text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.connections-table th:nth-child(1) { width: 30%; }
.connections-table th:nth-child(2) { width: 15%; }
.connections-table th:nth-child(3) { width: 18%; }
.connections-table th:nth-child(4) { width: 17%; }
.connections-table th:nth-child(5) { width: 20%; text-align: right; }
.connections-table td { height: 68px; padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.connections-table tr:hover td { background: var(--surface-muted); }
.connection-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.connection-identity > .icon { color: var(--text-faint); }
.identity-copy { min-width: 0; display: grid; gap: 2px; }
.identity-copy strong, .identity-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-copy strong { font-size: 13px; }
.identity-copy span { color: var(--text-faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.provider-tag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 8px; border: 1px solid; border-radius: 4px; font-size: 11px; font-weight: 700; }
.provider-bigquery { background: var(--primary-soft); border-color: #bed4ef; color: var(--primary); }
.provider-postgres { background: #e9f6f5; border-color: #b7dfda; color: #08776c; }
.provider-rest_api { background: var(--amber-soft); border-color: #e6c991; color: var(--amber); }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 12px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.status-healthy .status-dot { background: var(--teal); }
.status-warning .status-dot { background: var(--amber); }
.status-error .status-dot { background: var(--red); }
.status-testing .status-dot { background: var(--primary); animation: pulse 1s ease-in-out infinite; }
.status-inactive { color: var(--text-faint); }
.last-tested { color: var(--text-soft); font-size: 12px; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions .button { min-height: 32px; padding: 0 10px; }
.row-actions .status-action { width: 34px; padding: 0; }

.skeleton { display: block; height: 11px; border-radius: 3px; background: #e6e9ee; animation: skeleton 1.2s ease-in-out infinite alternate; }
.skeleton-wide { width: 75%; }
.skeleton-short { width: 52%; }

.empty-state { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 15px; border: 1px solid var(--border); border-radius: 50%; color: var(--text-soft); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-state h2 { margin: 0; font-size: 16px; }
.empty-state p { max-width: 360px; margin: 6px 0 18px; color: var(--text-soft); }

.form-pane { min-width: 0; background: var(--surface); border-left: 1px solid var(--border); }
.form-header { min-height: 91px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.form-context { margin: 0 0 2px; color: var(--text-faint); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.form-header h2 { margin: 0; font-size: 18px; }
.form-close { display: none; }
#connection-form { display: block; }
.form-section { margin: 0; padding: 20px 24px; border: 0; border-bottom: 1px solid var(--border); }
.form-section legend { width: 100%; padding: 0; margin: 0 0 12px; color: var(--text); font-size: 12px; font-weight: 700; }
.provider-section { padding-bottom: 18px; }
.segmented-control { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius); }
.segmented-control-three { grid-template-columns: repeat(3, 1fr); }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; width: 1px; min-height: 0; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.segmented-control span { display: grid; place-items: center; min-height: 34px; border: 1px solid transparent; border-radius: 4px; color: var(--text-soft); font-size: 13px; font-weight: 700; }
.segmented-control input:checked + span { background: var(--surface); border-color: var(--border-strong); color: var(--primary); box-shadow: 0 1px 2px rgba(23, 32, 45, 0.07); }
.segmented-control input:focus-visible + span { outline: 3px solid rgba(30, 90, 168, 0.28); outline-offset: 1px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field > span, .field > label { color: var(--text-soft); font-size: 12px; font-weight: 700; }
.field small { color: var(--text-faint); font-size: 11px; font-weight: 400; }
.field-full { grid-column: 1 / -1; }
.field-wide { grid-column: span 1; }
.field-narrow { grid-column: span 1; }
.field-error { display: block; min-height: 0; color: var(--red) !important; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 45px; }
.input-suffix > span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 11px; }

.file-drop { min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-muted); color: var(--text-soft); cursor: pointer; text-align: center; }
.file-drop:hover, .file-drop.dragging { border-color: var(--primary); background: var(--primary-soft); }
.file-drop input { position: absolute; width: 1px; min-height: 0; height: 1px; opacity: 0; pointer-events: none; }
.file-drop strong { color: var(--primary); }
.file-selection { display: flex; align-items: center; gap: 8px; min-height: 38px; margin-top: 8px; padding: 0 5px 0 10px; border: 1px solid #a8d7cd; border-radius: var(--radius); background: var(--teal-soft); color: var(--teal); }
.file-selection > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 12px; }
.file-selection .icon-button { width: 28px; height: 28px; margin-left: auto; background: transparent; border-color: transparent; }

.form-alert { margin: 16px 24px 0; padding: 10px 12px; border: 1px solid #efc2be; border-radius: var(--radius); background: var(--red-soft); color: var(--red); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 24px 24px; }
.button-progress { display: none; align-items: center; gap: 7px; }
.form-busy .button-label { display: none; }
.form-busy .button-progress { display: inline-flex; }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin 700ms linear infinite; }

.sources-workspace {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: calc(100vh - var(--topbar-height));
  background: var(--page);
}

.sources-pane { min-width: 0; padding: 28px 30px 48px; }
.sources-header { margin-bottom: 24px; }
.source-layout { display: grid; grid-template-columns: 336px minmax(0, 1fr); align-items: start; gap: 24px; }

.discovery-tool {
  min-width: 0;
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.tool-header { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.tool-header h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.discovery-provider { flex: 0 0 auto; }
.discovery-form-body { display: grid; gap: 18px; padding: 20px; }
.discovery-form-alert { margin: 0; }
.discovery-limits { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metadata-policy { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--teal); }
.metadata-policy > div { display: grid; gap: 1px; }
.metadata-policy strong { font-size: 12px; }
.metadata-policy span { color: var(--text-soft); font-size: 11px; }
.discovery-submit { width: 100%; min-height: 42px; }
.discovery-submit .button-label { display: inline-flex; align-items: center; gap: 8px; }
.discovery-form-busy .button-label { display: none; }
.discovery-form-busy .button-progress { display: inline-flex; }

.discovery-results { min-width: 0; }
.discovery-placeholder { min-height: 390px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: rgba(255, 255, 255, 0.55); text-align: center; }
.discovery-placeholder h2 { margin: 0; font-size: 17px; }
.discovery-placeholder p { max-width: 420px; margin: 7px 0 0; color: var(--text-soft); }
.discovery-placeholder .button { margin-top: 18px; }
.discovery-loading .empty-icon { color: var(--primary); }
.discovery-error .empty-icon { border-color: #efc2be; background: var(--red-soft); color: var(--red); }
.spinner-dark { border-color: rgba(30, 90, 168, 0.24); border-top-color: var(--primary); }

.discovery-output { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.run-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; padding: 22px 24px; background: var(--surface-muted); }
.run-summary h2 { margin: 7px 0 0; font-size: 19px; line-height: 1.3; }
.run-summary p { margin: 5px 0 0; color: var(--text-soft); }
.run-status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.run-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; }
.run-status-success { color: var(--teal); }
.run-status-success .status-dot { background: var(--teal); }
.run-status-warning { color: var(--amber); }
.run-status-warning .status-dot { background: var(--amber); }
.run-status-error { color: var(--red); }
.run-status-error .status-dot { background: var(--red); }
.run-status-working { color: var(--primary); }
.run-status-working .status-dot { background: var(--primary); }
.approval-indicator { min-height: 24px; display: inline-flex; align-items: center; padding: 0 8px; border: 1px solid #e4c277; border-radius: 4px; background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 700; }

.run-identifiers { flex: 0 1 270px; min-width: 0; margin: 0; display: grid; gap: 8px; }
.run-identifiers > div { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; }
.run-identifiers dt { color: var(--text-faint); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.run-identifiers dd { min-width: 0; margin: 0; overflow: hidden; color: var(--text-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.result-band { padding: 21px 24px 24px; border-top: 1px solid var(--border); }
.result-band-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.result-band-header-split { justify-content: space-between; }
.result-band-header h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.result-band-header > .icon { margin-left: auto; color: var(--text-faint); }
.result-count { color: var(--text-faint); font-size: 11px; font-weight: 700; }

.evidence-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.evidence-strip > div { min-width: 0; padding: 13px 14px; border-left: 1px solid var(--border); }
.evidence-strip > div:first-child { border-left: 0; }
.evidence-strip dt { color: var(--text-faint); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.evidence-strip dd { margin: 4px 0 0; overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.evidence-safe { color: var(--teal); }
.evidence-warning { color: var(--amber); }

.event-timeline { display: flex; min-width: 0; margin: 0; padding: 0; overflow-x: auto; list-style: none; }
.event-timeline li { position: relative; flex: 1 0 150px; min-width: 0; padding: 28px 12px 0 0; color: var(--text-soft); font-size: 11px; }
.event-timeline li::before { content: ""; position: absolute; top: 9px; left: 8px; right: 0; height: 1px; background: var(--border-strong); }
.event-timeline li::after { content: ""; position: absolute; top: 4px; left: 0; width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.event-timeline li:last-child::before { display: none; }
.event-timeline strong { display: block; overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.event-timeline span { display: block; margin-top: 2px; color: var(--text-faint); }

.inventory-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.inventory-table { width: 100%; min-width: 880px; border-collapse: collapse; table-layout: fixed; }
.inventory-table th { height: 38px; padding: 0 12px; background: #fafbfc; color: var(--text-faint); text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.inventory-table th:nth-child(1) { width: 32%; }
.inventory-table th:nth-child(2) { width: 13%; }
.inventory-table th:nth-child(3) { width: 13%; }
.inventory-table th:nth-child(4) { width: 13%; }
.inventory-table th:nth-child(5) { width: 14%; }
.inventory-table th:nth-child(6) { width: 18%; }
.inventory-table td { height: 56px; padding: 9px 12px; border-top: 1px solid var(--border); color: var(--text-soft); font-size: 12px; vertical-align: middle; }
.source-name { display: grid; min-width: 0; gap: 2px; }
.source-name strong, .source-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-name strong { color: var(--text); font-size: 12px; }
.source-name span { color: var(--text-faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.layer-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 7px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.layer-raw, .layer-stg { border-color: #efc2be; background: var(--red-soft); color: var(--red); }
.layer-mart, .layer-agg, .layer-fct, .layer-dim, .layer-curated_view { border-color: #a8d7cd; background: var(--teal-soft); color: var(--teal); }
.reusable-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.source-review-controls { display: grid; grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.3fr); gap: 12px; margin-bottom: 14px; }
.source-decision-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.source-decision-actions .button { width: 100%; min-width: 0; padding-inline: 9px; }
.reusable-eligible { color: var(--teal); }
.reusable-blocked { color: var(--red); }
.reusable-review { color: var(--amber); }

.validation-state { min-height: 24px; display: inline-flex; align-items: center; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-soft); font-size: 10px; font-weight: 700; }
.validation-valid { border-color: #a8d7cd; background: var(--teal-soft); color: var(--teal); }
.validation-invalid { border-color: #efc2be; background: var(--red-soft); color: var(--red); }
.issue-list { display: grid; gap: 0; margin: 0; padding: 0; border-top: 1px solid var(--border); list-style: none; }
.issue-list li { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.issue-severity { align-self: start; min-height: 23px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.issue-error { border-color: #efc2be; background: var(--red-soft); color: var(--red); }
.issue-warning { border-color: #e4c277; background: var(--amber-soft); color: var(--amber); }
.issue-copy { min-width: 0; display: grid; gap: 2px; }
.issue-copy strong { overflow-wrap: anywhere; font-size: 12px; }
.issue-copy span { color: var(--text-soft); font-size: 11px; overflow-wrap: anywhere; }
.issue-copy code { color: var(--text-faint); font-size: 10px; overflow-wrap: anywhere; }

.semantic-band { padding-bottom: 0; }
.semantic-json { max-height: 520px; margin: 0 -24px; overflow: auto; padding: 18px 24px 22px; border-top: 1px solid #334155; background: #17202d; color: #dce7f3; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }
.semantic-json code { font: inherit; white-space: pre; }
.inline-empty { padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-soft); text-align: center; }

.operational-workspace {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: calc(100vh - var(--topbar-height));
  background: var(--page);
}

.operational-pane { min-width: 0; padding: 28px 30px 48px; }
.operational-header { margin-bottom: 24px; }
.release-layout { display: grid; grid-template-columns: 370px minmax(0, 1fr); align-items: start; gap: 24px; }
.release-rail { min-width: 0; display: grid; gap: 18px; }
.operation-tool, .release-list-surface, .release-detail-surface, .audit-list-surface, .audit-detail-surface { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.operation-tool-body { display: grid; gap: 17px; padding: 18px 20px 20px; }
.operation-alert { margin: 0; }
.operation-submit { width: 100%; }
.operation-submit .button-label { display: inline-flex; align-items: center; gap: 8px; }
.operation-busy .button-label { display: none; }
.operation-busy .button-progress { display: inline-flex; }

.draft-summary { display: grid; gap: 4px; min-width: 0; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
.draft-summary > strong, .draft-summary > span { min-width: 0; overflow-wrap: anywhere; }
.draft-summary > strong { margin-top: 4px; font-size: 13px; }
.draft-summary > span:last-child { color: var(--text-soft); font-size: 11px; }

.surface-header { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.surface-header h2 { margin: 0; font-size: 16px; }
.compact-select { display: block; min-width: 0; }
.compact-select select { min-height: 34px; padding-block: 5px; font-size: 12px; }
.rail-state { min-height: 92px; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 18px; color: var(--text-soft); text-align: center; }
.rail-state-error { flex-wrap: wrap; color: var(--red); }
.rail-state-error .button { flex-basis: 100%; }
.release-list { max-height: 520px; overflow-y: auto; }
.release-list > div + div { border-top: 1px solid var(--border); }
.release-list-item { width: 100%; display: grid; gap: 6px; padding: 13px 15px; border: 0; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.release-list-item:hover { background: var(--surface-muted); }
.release-list-item.selected { background: var(--surface-active); box-shadow: inset 3px 0 0 var(--primary); }
.release-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.release-list-heading strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.release-list-meta { overflow: hidden; color: var(--text-faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.release-status { display: inline-flex; align-items: center; min-height: 23px; padding: 0 7px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-soft); font-size: 9px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.release-status-pending { border-color: #e4c277; background: var(--amber-soft); color: var(--amber); }
.release-status-approved { border-color: #a8d7cd; background: var(--teal-soft); color: var(--teal); }
.release-status-rejected { border-color: #efc2be; background: var(--red-soft); color: var(--red); }
.release-status-recorded { background: var(--surface-muted); color: var(--text-soft); }

.release-detail-surface { min-height: 560px; }
.detail-placeholder { min-height: 558px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; }
.detail-placeholder h2 { margin: 0; font-size: 17px; }
.detail-placeholder p { max-width: 430px; margin: 7px 0 0; color: var(--text-soft); }
.release-detail-content { min-width: 0; }
.release-summary { border-bottom: 0; }
.release-identifiers { flex-basis: 310px; }
.release-metadata-strip dd { font-size: 13px; }
.decision-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.export-controls { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: end; gap: 10px; }
.json-band { padding-bottom: 0; }
.bounded-json { max-width: none; max-height: 560px; margin: 0 -24px -24px; overflow: auto; padding: 18px 24px 22px; border-top: 1px solid #334155; background: #17202d; color: #dce7f3; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }
.bounded-json code { font: inherit; white-space: pre; }

.audit-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.audit-toolbar .search-control { max-width: 420px; }
.audit-layout { display: grid; grid-template-columns: minmax(620px, 1.25fr) minmax(340px, .75fr); align-items: start; gap: 24px; }
.audit-list-surface, .audit-detail-surface { min-height: 500px; }
.audit-table-wrap { overflow: auto; }
.audit-table { width: 100%; min-width: 620px; border-collapse: collapse; table-layout: fixed; }
.audit-table th { height: 40px; padding: 0 14px; background: var(--surface-muted); color: var(--text-faint); text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.audit-table th:nth-child(1) { width: 52%; }
.audit-table th:nth-child(2) { width: 20%; }
.audit-table th:nth-child(3) { width: 28%; }
.audit-table td { height: 56px; padding: 9px 14px; border-top: 1px solid var(--border); color: var(--text-soft); font-size: 11px; vertical-align: middle; }
.audit-table tr.selected td { background: var(--surface-active); }
.audit-event-button { max-width: 100%; padding: 3px 0; overflow: hidden; border: 0; background: transparent; color: var(--primary); font: 600 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.audit-event-button:hover { text-decoration: underline; }
.audit-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px; border-bottom: 1px solid var(--border); }
.audit-detail-header h2 { max-width: 100%; margin: 3px 0 0; overflow-wrap: anywhere; font-size: 16px; }
.audit-detail-header p:last-child { margin: 5px 0 0; color: var(--text-soft); font-size: 11px; }
.audit-identifiers { display: grid; margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.audit-identifiers > div { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 9px; padding: 4px 0; }
.audit-identifiers dt { color: var(--text-faint); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.audit-identifiers dd { min-width: 0; margin: 0; overflow: hidden; color: var(--text-soft); font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.audit-json { max-height: 430px; margin: 0; border-top: 0; }

.documentation-workspace {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: calc(100vh - var(--topbar-height));
  background: var(--page);
}

.documentation-pane { width: min(1320px, 100%); min-width: 0; margin: 0 auto; padding: 28px 30px 56px; }
.documentation-header { align-items: flex-start; margin-bottom: 20px; }
.documentation-header .form-context { margin-bottom: 5px; color: var(--primary); }
.docs-version { display: inline-flex; min-height: 30px; align-items: center; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-soft); font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.docs-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto; align-items: center; gap: 14px; margin-bottom: 12px; }
.docs-search { min-width: 0; min-height: 46px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-faint); }
.docs-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.docs-search input { width: 100%; min-width: 0; height: 42px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.docs-search input::placeholder { color: var(--placeholder); }
.docs-audience-tabs { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.docs-audience-tab { min-height: 38px; padding: 0 14px; border: 0; border-radius: 4px; background: transparent; color: var(--text-soft); font-size: 12px; font-weight: 750; cursor: pointer; }
.docs-audience-tab:hover { color: var(--text); }
.docs-audience-tab[aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(23, 32, 45, 0.12); }
.docs-truth-note { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 18px; padding: 12px 14px; border-left: 3px solid var(--primary); background: var(--primary-soft); color: var(--text-soft); }
.docs-truth-note .icon { margin-top: 1px; color: var(--primary); }
.docs-truth-note div { min-width: 0; display: grid; gap: 2px; }
.docs-truth-note strong { color: var(--text); font-size: 12px; }
.docs-truth-note span { font-size: 12px; }
.docs-layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); align-items: start; gap: 20px; }
.docs-index { position: sticky; top: calc(var(--topbar-height) + 20px); min-width: 0; display: grid; gap: 3px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.docs-index .form-context { margin: 2px 8px 8px; }
.docs-index button { width: 100%; min-height: 38px; padding: 7px 9px; overflow: hidden; border: 0; border-radius: 4px; background: transparent; color: var(--text-soft); font-size: 12px; font-weight: 650; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.docs-index button:hover { background: var(--surface-muted); color: var(--text); }
.docs-content { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.docs-results-line { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 22px; border-bottom: 1px solid var(--border); background: var(--surface-muted); color: var(--text-faint); font-size: 11px; }
.docs-results-line span:first-child { color: var(--text); font-weight: 750; }
.docs-article { min-width: 0; padding: 26px 28px 30px; scroll-margin-top: calc(var(--topbar-height) + 18px); }
.docs-article + .docs-article:not([hidden]) { border-top: 1px solid var(--border); }
.docs-article:focus { outline: 0; }
.docs-article:focus-visible { box-shadow: inset 3px 0 0 var(--focus-ring); }
.docs-article > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.docs-article h2 { margin: 2px 0 0; font-size: 21px; line-height: 1.3; }
.docs-article > p { max-width: 820px; margin: 0 0 16px; color: var(--text-soft); line-height: 1.6; }
.docs-status-group { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.docs-status { display: inline-flex; flex: 0 0 auto; min-height: 25px; align-items: center; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); color: var(--text-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.docs-status-implemented { border-color: color-mix(in srgb, var(--teal) 40%, var(--border)); background: var(--teal-soft); color: var(--teal); }
.docs-status-local { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--primary-soft); color: var(--primary); }
.docs-status-held { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); background: var(--amber-soft); color: var(--amber); }
.docs-status-disabled, .docs-status-planned { color: var(--text-faint); }
.docs-steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: docs-step; }
.docs-steps li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; min-height: 56px; padding: 12px 0 12px 42px; border-top: 1px solid var(--border); counter-increment: docs-step; }
.docs-steps li::before { content: counter(docs-step); position: absolute; top: 12px; left: 0; display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--primary); font-size: 10px; font-weight: 800; }
.docs-steps strong { font-size: 13px; }
.docs-steps span { color: var(--text-soft); font-size: 12px; line-height: 1.55; }
.docs-callout { display: grid; gap: 3px; margin-top: 16px; padding: 13px 15px; border-left: 3px solid var(--teal); background: var(--teal-soft); }
.docs-callout-warning { border-left-color: var(--amber); background: var(--amber-soft); }
.docs-callout strong { font-size: 12px; }
.docs-callout span { color: var(--text-soft); font-size: 12px; line-height: 1.55; }
.docs-checklist { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.docs-checklist li { position: relative; padding-left: 25px; color: var(--text-soft); font-size: 12px; line-height: 1.55; }
.docs-checklist li::before { content: ""; position: absolute; top: 4px; left: 1px; width: 9px; height: 5px; border-bottom: 2px solid var(--teal); border-left: 2px solid var(--teal); transform: rotate(-45deg); }
.docs-doctrine { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 18px 0 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.docs-doctrine span { min-width: 0; padding: 11px 8px; color: var(--text-soft); font-size: 10px; font-weight: 750; text-align: center; }
.docs-doctrine span + span { border-left: 1px solid var(--border); }
.docs-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.docs-table { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; }
.docs-table th { height: 40px; padding: 0 12px; background: var(--surface-muted); color: var(--text-faint); font-size: 10px; text-align: left; text-transform: uppercase; }
.docs-table th:nth-child(1) { width: 31%; }
.docs-table th:nth-child(2) { width: 18%; }
.docs-table td { padding: 12px; border-top: 1px solid var(--border); color: var(--text-soft); font-size: 11px; vertical-align: top; }
.docs-table td:first-child { color: var(--text); font-weight: 650; }
.docs-empty { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px; color: var(--text-soft); text-align: center; }
.docs-empty .icon { width: 28px; height: 28px; color: var(--text-faint); }
.docs-empty h2 { margin: 12px 0 0; color: var(--text); font-size: 18px; }
.docs-empty p { margin: 6px 0 0; }

.unlock-dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.unlock-dialog::backdrop { background: rgba(24, 32, 43, 0.46); }
.unlock-dialog form { padding: 28px; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 16px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary); }
.unlock-dialog h2 { margin: 0; font-size: 20px; }
.unlock-dialog p { margin: 7px 0 20px; color: var(--text-soft); font-size: 13px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: stretch; gap: 8px; margin-top: 20px; }
.dialog-actions .button { min-width: 0; flex: 1 1 170px; white-space: normal; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; width: min(360px, calc(100% - 40px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-strong); border-left: 4px solid var(--primary); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--text); animation: toast-in 180ms ease-out; }
.toast-success { border-left-color: var(--teal); }
.toast-error { border-left-color: var(--red); }
.toast strong { display: block; font-size: 13px; }
.toast span { display: block; margin-top: 1px; color: var(--text-soft); font-size: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes skeleton { to { background: #f1f3f6; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Readability baseline for desktop and laptop work sessions. */
:root { --topbar-height: 68px; --sidebar-width: 228px; --form-width: 480px; }
body { font-size: 15px; line-height: 1.5; }
.icon { width: 19px; height: 19px; }
.brand { font-size: 17px; }
.brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
.section-name { font-size: 16px; }
.language-control button { min-width: 38px; min-height: 34px; font-size: 11px; }
.preference-button { min-height: 38px; font-size: 12px; }
.nav-item { min-height: 46px; font-size: 14px; }
.sidebar-foot { font-size: 13px; }
.pane-header h1 { font-size: 28px; }
.pane-header p { font-size: 15px; }
.situation-summary dt { font-size: 11px; }
.situation-summary dd { font-size: 22px; }
.lane-heading { min-height: 52px; }
.lane-heading h2 { font-size: 14px; }
.lane-heading > span:last-child { min-width: 26px; min-height: 26px; font-size: 11px; }
.situation-list-empty { font-size: 13px; }
.situation-card { gap: 9px; padding: 15px; }
.situation-card-heading strong { font-size: 14px; }
.situation-card p { font-size: 13px; }
.situation-card-meta { font-size: 12px; }
.situation-badge { min-height: 24px; font-size: 10px; }
.situation-detail-header h2 { font-size: 19px; }
.situation-detail-header p:last-child { font-size: 13px; }
.detail-tab { min-height: 46px; font-size: 13px; }
.situation-detail-grid dt, .investigation-metadata dt, .evidence-validation dt, .workplan-facts dt { font-size: 10px; }
.situation-detail-grid dd, .investigation-metadata dd, .evidence-validation dd, .workplan-facts dd { font-size: 13px; }
.situation-detail-section h3, .investigation-section h4, .evidence-section h4, .workplan-section h4 { font-size: 11px; }
.authority-chain-header h3 { font-size: 15px; }
.authority-chain-summary, .authority-chain-step small, .authority-chain-technical, .authority-chain-safety { font-size: 11px; }
.authority-chain-step strong, .authority-chain-step div > span { font-size: 13px; }
.authority-chain-facts dt { font-size: 10px; }
.authority-chain-facts dd { font-size: 11px; }
.detail-text-list, .detail-empty, .workplan-legacy p { font-size: 13px; }
.detail-tag { min-height: 27px; font-size: 11px; }
.investigation-state, .curator-state { font-size: 13px; }
.case-picker { font-size: 10px; }
.case-picker select { min-height: 40px; font-size: 13px; }
.workplan-summary { min-height: 46px; font-size: 12px; }
.workplan-summary strong, .workplan-validation h4, .workplan-legacy strong { font-size: 13px; }
.workplan-validation p, .workplan-validation-gate, .workplan-validation-issues ul, .workplan-validation-technical summary { font-size: 12px; }
.sql-candidate-header h4, .sql-dry-run-result h4 { font-size: 13px; }
.sql-candidate-header p, .sql-candidate-error, .sql-candidate-empty, .sql-candidate-issues ul { font-size: 12px; }
.sql-candidate-form textarea, .sql-candidate-code { font-size: 13px; }
.curator-message p, .curator-proposal-fields dd, .curator-proposal-rationale { font-size: 13px; }
.curator-message-meta, .curator-proposal header span, .curator-proposal-fields dt, .curator-composer-note { font-size: 11px; }
.curator-proposal h3 { font-size: 14px; }
.curator-quick-prompts button { min-height: 40px; font-size: 12px; }
.curator-composer textarea { min-height: 68px; font-size: 13px; }
.button { min-height: 42px; padding-inline: 16px; font-size: 14px; }
.button-compact { min-height: 38px; }
.icon-button { width: 42px; height: 42px; }
input, select, textarea { min-height: 42px; padding: 9px 12px; }
.field > span, .field > label, .form-section legend { font-size: 13px; }
.field small, .form-context, .form-alert { font-size: 12px; }
.connections-table th, .inventory-table th, .audit-table th { height: 44px; font-size: 11px; }
.connections-table td { height: 72px; }
.identity-copy strong, .source-name strong, .release-list-heading strong { font-size: 14px; }
.identity-copy span, .source-name span, .release-list-meta { font-size: 12px; }
.provider-tag, .status, .last-tested, .run-status, .reusable-state { font-size: 13px; }
.inventory-table td, .audit-table td { height: 64px; font-size: 13px; }
.layer-tag, .validation-state, .issue-severity, .release-status { min-height: 26px; font-size: 11px; }
.result-band-header h3 { font-size: 17px; }
.result-count, .run-identifiers dd, .event-timeline li, .event-timeline strong { font-size: 12px; }
.issue-copy strong { font-size: 14px; }
.issue-copy span { font-size: 13px; }
.surface-header h2, .detail-placeholder h2 { font-size: 18px; }
.toast strong { font-size: 14px; }
.toast span { font-size: 13px; }

@media (max-width: 1340px) {
  :root { --sidebar-width: 204px; --form-width: 410px; }
  .sidebar { padding-inline: 12px; }
  .connections-pane { padding-inline: 22px; }
  .provider-settings-layout { grid-template-columns: minmax(0, 1fr); }
  .provider-editor { position: static; }
  .role-assignment-row { grid-template-columns: minmax(190px, .8fr) minmax(180px, 1fr) minmax(210px, 1.1fr); align-items: end; }
  .role-state { grid-column: 1 / 3; }
  .role-actions { grid-column: 3; justify-content: flex-end; }
  .situations-pane { padding-inline: 22px; }
  .sources-pane { padding-inline: 22px; }
  .operational-pane { padding-inline: 22px; }
  .documentation-pane { padding-inline: 22px; }
  .source-layout { grid-template-columns: 310px minmax(0, 1fr); gap: 18px; }
  .release-layout { grid-template-columns: 330px minmax(0, 1fr); gap: 18px; }
  .audit-layout { grid-template-columns: minmax(540px, 1fr) minmax(310px, .72fr); gap: 18px; }
  .situation-board-layout { grid-template-columns: minmax(0, 1fr); }
  .situation-detail { position: static; }
}

@media (max-width: 960px) {
  :root { --sidebar-width: 64px; }
  .topbar-divider, .section-name { display: none; }
  .sidebar { padding-inline: 10px; }
  .nav-item { justify-content: center; padding-inline: 0; }
  .nav-item span, .sidebar-foot span { display: none; }
  .sidebar-foot { justify-content: center; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .form-pane { position: fixed; inset: var(--topbar-height) 0 0 auto; z-index: 30; width: min(520px, calc(100vw - var(--sidebar-width))); overflow-y: auto; border-left: 1px solid var(--border); box-shadow: -16px 0 36px rgba(23, 32, 45, 0.13); transform: translateX(102%); visibility: hidden; transition: transform 180ms ease, visibility 180ms; }
  .form-pane.open { transform: translateX(0); visibility: visible; }
  .form-close { display: inline-grid; }
  .source-layout { grid-template-columns: minmax(0, 1fr); }
  .discovery-tool { position: static; }
  .discovery-form-body { grid-template-columns: 1fr 1fr; }
  .discovery-form-body > .field:first-of-type, .discovery-form-body > .field:nth-of-type(3), .discovery-form-alert, .metadata-policy, .discovery-submit { grid-column: 1 / -1; }
  .release-layout, .audit-layout { grid-template-columns: minmax(0, 1fr); }
  .situation-board { grid-template-columns: minmax(0, 1fr); }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-index { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-index .form-context { grid-column: 1 / -1; }
  .release-rail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .audit-detail-surface { min-height: 420px; }
}

@media (max-width: 680px) {
  :root { --topbar-height: 58px; }
  .app-shell { grid-template-columns: 1fr; padding-bottom: 62px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand-mark { width: 28px; height: 28px; flex-basis: 28px; }
  .brand-name { font-size: 14px; }
  .topbar-divider, .section-name, .auth-state { display: none; }
  .preference-button span { display: none; }
  .preference-button { width: 34px; justify-content: center; padding: 0; }
  .language-control button { min-width: 30px; padding-inline: 5px; }
  .auth-controls .button span { display: none; }
  .auth-controls .button { width: 38px; padding: 0; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 25; display: block; padding: 6px 10px; border-top: 1px solid var(--border); border-right: 0; }
  .sidebar nav { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .nav-item { min-height: 50px; flex-direction: column; gap: 2px; font-size: 10px; }
  .nav-item span { display: inline; max-width: 100%; overflow: visible; font-size: 8px; line-height: 1.05; text-align: center; white-space: normal; }
  .nav-item .icon { width: 17px; height: 17px; }
  .sidebar-foot { display: none; }
  .workspace, .sources-workspace, .operational-workspace, .situations-workspace, .documentation-workspace { grid-column: 1; }
  .situations-pane { padding: 20px 14px 30px; }
  .connections-pane { padding: 20px 14px 28px; }
  .settings-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; margin-bottom: 18px; }
  .settings-tab { min-width: 0; min-height: 46px; flex-direction: column; gap: 2px; padding: 4px; font-size: 10px; }
  .settings-tab .icon { width: 16px; height: 16px; }
  .provider-settings-layout { gap: 14px; }
  .settings-surface-header { min-height: 64px; padding: 13px 14px; }
  .lifecycle-track { display: none; }
  .provider-form-grid { grid-template-columns: 1fr; padding: 14px; }
  .provider-form-grid .field-full, .local-binding-control { grid-column: 1; }
  .provider-card { padding: 14px; }
  .provider-card-header { display: grid; }
  .provider-lifecycle { width: fit-content; }
  .provider-card-facts { grid-template-columns: 1fr; }
  .provider-card-actions .button { flex: 1 1 calc(50% - 6px); }
  .provider-card-actions .button:last-child { margin-left: 0; }
  .role-assignment-row { grid-template-columns: minmax(0, 1fr); align-items: stretch; padding: 14px; }
  .role-state, .role-actions { grid-column: 1; }
  .role-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .provider-action-dialog { width: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .provider-action-dialog form { min-height: 100dvh; max-height: 100dvh; }
  .sources-pane { padding: 20px 14px 30px; }
  .operational-pane { padding: 20px 14px 30px; }
  .documentation-pane { padding: 20px 14px 30px; }
  .documentation-header { align-items: flex-start; }
  .docs-toolbar { grid-template-columns: minmax(0, 1fr); }
  .docs-audience-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .docs-audience-tab { min-width: 0; padding-inline: 6px; }
  .docs-results-line { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: 10px; }
  .docs-article { padding: 22px 18px 26px; }
  .docs-article > header { flex-direction: column; gap: 10px; }
  .docs-status-group { justify-content: flex-start; }
  .docs-doctrine { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-doctrine span:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .docs-doctrine span:nth-child(odd) { border-left: 0; }
  .pane-header { align-items: center; margin-bottom: 18px; }
  .pane-header h1 { font-size: 21px; }
  .pane-header p { display: none; }
  .header-actions .button { width: 38px; padding: 0; }
  .header-actions .button span { display: none; }
  .list-toolbar { align-items: stretch; }
  .search-control { max-width: none; }
  .select-control { width: 132px; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  .connections-table { min-width: 0; }
  .connections-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .connections-table, .connections-table tbody, .connections-table tr, .connections-table td { display: block; width: 100%; }
  .connections-table tbody { display: grid; gap: 8px; }
  .connections-table tr { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
  .connections-table td { height: auto; padding: 0; border: 0; }
  .connections-table tr:hover td { background: transparent; }
  .connections-table td:nth-child(1) { grid-column: 1; }
  .connections-table td:nth-child(2) { grid-column: 2; grid-row: 1; }
  .connections-table td:nth-child(3) { grid-column: 1; }
  .connections-table td:nth-child(4) { grid-column: 2; color: var(--text-faint); text-align: right; }
  .connections-table td:nth-child(5) { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--border); }
  .row-actions .button:first-child { flex: 1; }
  .skeleton-row td:not(:first-child) { display: none; }
  .form-pane { width: 100vw; }
  .form-header { min-height: 76px; padding: 16px 18px; }
  .form-section { padding: 18px; }
  .form-alert { margin-inline: 18px; }
  .form-actions { position: sticky; bottom: 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  .form-actions .button { flex: 1; }
  .toast-region { right: 12px; bottom: 74px; width: calc(100% - 24px); }
  .source-layout { gap: 14px; }
  .tool-header { min-height: 72px; padding: 14px 16px; }
  .discovery-form-body { grid-template-columns: 1fr; padding: 16px; }
  .discovery-form-body > .field, .discovery-form-body > .field:first-of-type, .discovery-form-body > .field:nth-of-type(3), .discovery-form-alert, .metadata-policy, .discovery-submit { grid-column: 1; }
  .discovery-placeholder { min-height: 310px; }
  .run-summary { flex-direction: column; gap: 18px; padding: 19px 18px; }
  .run-identifiers { width: 100%; flex-basis: auto; }
  .result-band { padding: 19px 18px 21px; }
  .evidence-strip { grid-template-columns: 1fr 1fr; }
  .evidence-strip > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--border); }
  .evidence-strip > div:nth-child(4) { border-top: 1px solid var(--border); }
  .semantic-json { margin-inline: -18px; padding-inline: 18px; }
  .release-layout, .audit-layout { gap: 14px; }
  .release-rail { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .release-detail-surface, .audit-list-surface, .audit-detail-surface { min-height: 0; }
  .detail-placeholder { min-height: 320px; }
  .release-identifiers { width: 100%; flex-basis: auto; }
  .export-controls { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .export-controls .button { width: 100%; }
  .bounded-json { margin: 0 -18px -21px; padding-inline: 18px; }
  .audit-toolbar { align-items: stretch; flex-wrap: wrap; }
  .audit-toolbar .search-control { flex-basis: 100%; max-width: none; }
  .audit-toolbar .compact-select { flex: 1; }
  .audit-detail-header { padding: 18px; }
  .audit-identifiers { padding-inline: 18px; }
  .audit-json { margin: 0; }
  .situation-summary { grid-template-columns: 1fr 1fr; }
  .situation-summary > div:nth-child(3) { border-top: 1px solid var(--border); border-left: 0; }
  .situation-summary > div:nth-child(4) { border-top: 1px solid var(--border); }
  .situation-board-layout { gap: 14px; }
  .curator-workspace { min-height: 430px; }
  .curator-history { max-height: 460px; }
  .situation-dialog { width: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .situation-dialog form { min-height: 100dvh; max-height: 100dvh; }
  .workplan-dialog { width: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .workplan-dialog form { min-height: 100dvh; max-height: 100dvh; }
  .proposal-review-dialog { width: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .proposal-review-dialog form { min-height: 100dvh; max-height: 100dvh; }
  .execution-approval-dialog { width: 100%; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .execution-approval-dialog form { min-height: 100dvh; max-height: 100dvh; }
  .execution-approval-dialog .dialog-header { min-height: 66px; padding: 11px 14px; }
  .execution-approval-dialog .dialog-body { padding: 14px; }
  .execution-approval-dialog .dialog-footer { position: sticky; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .execution-approval-dialog .dialog-footer .button { flex: 1; }
  .approval-scope-summary, .approval-scope-technical { grid-template-columns: minmax(0, 1fr); }
  .approval-scope-summary > div:nth-child(-n + 2) { border-top: 1px solid var(--border); }
  .approval-scope-summary > div:first-child { border-top: 0; }
  .approval-scope-summary > div:nth-child(even), .approval-scope-technical > div:nth-child(even) { border-left: 0; }
  .approval-scope-technical > div:nth-child(odd), .approval-scope-technical > div:nth-child(even) { padding-inline: 0; }
  .situation-form-body { padding: 18px; }
  .workplan-form-body { padding: 18px; }
  .workplan-option-grid { grid-template-columns: 1fr; }
  .sql-candidate-workspace { padding-inline: 14px; }
  .sql-candidate-form { grid-template-columns: minmax(0, 1fr); }
  .sql-candidate-form .button { width: 100%; }
  .sql-candidate-toolbar { align-items: stretch; flex-direction: column; }
  .sql-candidate-toolbar .button { width: 100%; }
  .sql-candidate-facts, .sql-dry-run-result .workplan-facts { grid-template-columns: minmax(0, 1fr); }
  .analysis-progress { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analysis-progress span { display: flex; min-height: 57px; align-items: center; }
  .analysis-progress span::before { top: 24px; }
  .bounded-execution { align-items: stretch; flex-direction: column; }
  .bounded-execution .button { width: 100%; min-height: 44px; }
  .proposal-review-body { padding: 18px; }
  .situation-form-actions { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
  .workplan-form-actions { position: sticky; bottom: 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  .brand-name { max-width: 145px; overflow: hidden; text-overflow: ellipsis; }
  .list-toolbar { flex-direction: column; }
  .select-control { width: 100%; }
  .field-grid { grid-template-columns: 1fr; }
  .field, .field-full, .field-wide, .field-narrow { grid-column: 1; }
  .discovery-limits { grid-template-columns: 1fr; }
  .notice-neutral { flex-wrap: wrap; }
  .notice-neutral .button { width: 100%; }
  .run-status-line { align-items: flex-start; flex-direction: column; }
  .run-identifiers > div { grid-template-columns: 48px minmax(0, 1fr); }
  .event-timeline { display: grid; overflow: visible; }
  .event-timeline li { min-height: 50px; padding: 0 0 14px 29px; }
  .event-timeline li::before { top: 9px; bottom: 0; left: 7px; right: auto; width: 1px; height: auto; }
  .event-timeline li::after { top: 3px; }
  .result-band-header-split { align-items: flex-start; }
  .source-review-controls { grid-template-columns: minmax(0, 1fr); }
  .issue-list li { grid-template-columns: 68px minmax(0, 1fr); gap: 9px; }
  .segmented-control-three span { font-size: 11px; }
  .surface-header { align-items: flex-start; }
  .surface-header .compact-select { max-width: 140px; }
  .release-list { max-height: 430px; }
  .decision-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .decision-actions .button { width: 100%; }
  .audit-toolbar .compact-select, .audit-toolbar .button { width: 100%; flex-basis: 100%; }
  .audit-detail-header { flex-direction: column; }
  .docs-index { grid-template-columns: minmax(0, 1fr); }
  .docs-index .form-context { grid-column: 1; }
  .docs-article > header { flex-direction: column; gap: 9px; }
  .docs-status { align-self: flex-start; }
  .docs-truth-note { align-items: flex-start; }
  .dialog-actions { flex-direction: column; }
  .dialog-actions .button { width: 100%; min-height: 44px; flex: 0 0 auto; }
  .brand-name { display: none; }
  .topbar { padding-inline: 10px; gap: 7px; }
  .language-control button { min-width: 40px; min-height: 40px; }
  .auth-controls .button, .auth-controls .icon-button { width: 40px; min-height: 40px; height: 40px; }
  .situation-detail-header { flex-direction: column; }
  .situation-detail-header .button { width: 100%; }
  .situation-detail-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .authority-chain-header { flex-direction: column; }
  .authority-chain-steps, .authority-chain-facts { grid-template-columns: minmax(0, 1fr); }
  .authority-chain-step:nth-child(even) { padding-left: 0; border-left: 0; }
  .authority-chain-step:nth-child(n + 2) { border-top: 1px solid var(--border); }
  .case-picker { grid-template-columns: minmax(0, 1fr); }
  .investigation-heading, .evidence-heading { flex-direction: column; }
  .investigation-heading .button, .evidence-heading p { width: 100%; max-width: none; }
  .investigation-actions { width: 100%; }
  .investigation-actions .button { min-height: 44px; flex: 1; }
  .investigation-metadata, .evidence-validation { grid-template-columns: minmax(0, 1fr); }
  .workplan-summary { align-items: flex-start; flex-direction: column; gap: 3px; }
  .workplan-summary span { padding-left: 0; border-left: 0; }
  .workplan-validation-header { align-items: stretch; flex-direction: column; }
  .workplan-validation-header .button { width: 100%; min-height: 44px; }
  .workplan-validation-gates { grid-template-columns: minmax(0, 1fr); }
  .workplan-validation-technical .workplan-facts { grid-template-columns: minmax(0, 1fr); }
  .workplan-sections { grid-template-columns: minmax(0, 1fr); }
  .workplan-section + .workplan-section { border-top: 1px solid var(--border); border-left: 0; }
  .workplan-technical .workplan-facts { grid-template-columns: minmax(0, 1fr); }
  .curator-history { padding-inline: 12px; }
  .curator-message { width: 94%; }
  .curator-proposal-fields { grid-template-columns: minmax(0, 1fr); }
  .curator-proposal-fields div + div { border-top: 1px solid var(--border); border-left: 0; }
  .curator-proposal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .curator-proposal-actions .button { width: 100%; }
}

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