/* dd web UI design system — review workspace, no external assets. */
:root {
  color-scheme: light;
  --code-keyword: #cf222e;
  --code-string: #0a3069;
  --code-constant: #0550ae;
  --code-title: #8250df;
  --code-variable: #953800;
  --code-comment: #6e7781;
  --page: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --tint: #edf6ff;
  --ink: #1f2328;
  --ink-2: #424a53;
  --dim: #6e7781;
  --line: #e1e6eb;
  --line-soft: #edf0f3;
  --accent: #0969da;
  --accent-dark: #0550ae;
  --dark: #101828;
  --dark-2: #1d2939;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --bad: #b42318;
  --bad-soft: #fef3f2;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --muted-soft: #f2f4f7;
  --appbar-bg: rgba(255, 255, 255, .98);
  --sticky-bg: rgba(255, 255, 255, .96);
  --page-sticky-bg: rgba(246, 248, 250, .96);
  --hint-bg: rgba(255, 255, 255, .94);
  --hover: #f6f8fa;
  --input-hover: #bdc7d6;
  --placeholder: #6e7781;
  --disabled-ink: #8995a8;
  --focus-ring: rgba(9, 105, 218, .12);
  --ok-line: #c9e5d4;
  --warn-line: #efddb4;
  --info-line: #cddfea;
  --bad-line: #ecc9c5;
  --danger-line: #ebc5c1;
  --danger-line-hover: #daa39d;
  --accent-line: #c9d7f6;
  --critical-bg: #8f1d1d;
  --success-panel: #f7fbf9;
  --success-panel-line: #cfe8dc;
  --skeleton-highlight: #f7f9fc;
  --code-soft: rgba(47, 98, 214, .08);
  --empty-icon: #8c98a8;
  --event-marker: #9aa5b5;
  --popover-shadow: 0 12px 30px rgba(31, 35, 40, .14);
  --radius-sm: 6px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(31, 35, 40, .04);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 22px;
  --text-2xl: 26px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --display: var(--sans);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --code-keyword: #ff7b72;
  --code-string: #a5d6ff;
  --code-constant: #79c0ff;
  --code-title: #d2a8ff;
  --code-variable: #ffa657;
  --code-comment: #8b949e;
  --page: #0d1117;
  --surface: #161b22;
  --surface-2: #11161d;
  --tint: #0d2744;
  --ink: #f0f6fc;
  --ink-2: #c9d1d9;
  --dim: #8b949e;
  --line: #30363d;
  --line-soft: #21262d;
  --accent: #58a6ff;
  --accent-dark: #79c0ff;
  --dark: #0d1117;
  --dark-2: #161b22;
  --ok: #56d364;
  --ok-soft: #12261b;
  --warn: #e3b341;
  --warn-soft: #2d2308;
  --bad: #ff7b72;
  --bad-soft: #2d1517;
  --info: #79c0ff;
  --info-soft: #0d2744;
  --muted-soft: #21262d;
  --appbar-bg: rgba(22, 27, 34, .98);
  --sticky-bg: rgba(22, 27, 34, .96);
  --page-sticky-bg: rgba(13, 17, 23, .96);
  --hint-bg: rgba(22, 27, 34, .94);
  --hover: #1c2128;
  --input-hover: #6e7681;
  --placeholder: #8b949e;
  --disabled-ink: #6e7681;
  --focus-ring: rgba(88, 166, 255, .22);
  --ok-line: #285c3a;
  --warn-line: #6d5622;
  --info-line: #274b75;
  --bad-line: #6e3434;
  --danger-line: #6e3434;
  --danger-line-hover: #8c4646;
  --accent-line: #274b75;
  --critical-bg: #b62324;
  --success-panel: #101f17;
  --success-panel-line: #285c3a;
  --skeleton-highlight: #30363d;
  --code-soft: rgba(88, 166, 255, .12);
  --empty-icon: #8b949e;
  --event-marker: #6e7681;
  --popover-shadow: 0 12px 30px rgba(0, 0, 0, .42);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--page); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: var(--text-base)/1.55 var(--sans);
  font-feature-settings: "cv05", "tnum";
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
main { max-width: 1600px; margin: 0 auto; padding: 0 28px 64px; }
.app-footer { max-width: 1600px; margin: 0 auto; padding: 0 28px 24px; color: var(--dim); font-size: var(--text-xs); }
h1, h2, h3, p { text-wrap: pretty; }
h1, h2, h3, strong { font-weight: var(--weight-semibold); }
h1 { margin: 0; font-size: var(--text-2xl); line-height: 1.2; letter-spacing: -.02em; }
h2 { margin: 0; font-size: var(--text-lg); line-height: 1.3; letter-spacing: -.01em; }
h3 { margin: 0; font-size: var(--text-md); line-height: 1.4; }
code, .mono { font-family: var(--mono); font-size: inherit; }
.display { font-family: var(--display); font-weight: var(--weight-semibold); letter-spacing: -.02em; }
.spacer { margin-left: auto; }
.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;
}

/* ─── app bar ─────────────────────────────────────────────────────────────── */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--appbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.appbar-inner {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 1600px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 28px;
}
.appbar-start { display: flex; align-items: center; min-width: 0; }
.brand {
  width: 54px;
  height: 64px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--ink);
  font: var(--weight-semibold) var(--text-base)/1 var(--sans);
  letter-spacing: -.02em;
}
.brand:hover { color: var(--accent); }
.brand img { display: block; width: 30px; height: 30px; }
.health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  flex: none;
  color: var(--ink-2);
  padding-left: 14px;
  font-size: var(--text-xs);
}
.health .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.health.ok .dot { background: #2aa96e; box-shadow: 0 0 0 3px rgba(42, 169, 110, .12); }
.health.bad .dot { background: #d64a3a; box-shadow: 0 0 0 3px rgba(214, 74, 58, .12); }
.bug-report-trigger { margin-left: 12px; flex: none; }
.theme-menu, .account-menu { position: relative; margin-left: 10px; flex: none; }
.theme-trigger {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}
.theme-trigger::-webkit-details-marker { display: none; }
.theme-trigger:hover, .theme-menu[open] .theme-trigger { border-color: var(--dim); background: var(--surface-2); color: var(--ink); }
.theme-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-trigger .icon { width: 17px; height: 17px; }
.theme-options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 2px;
  width: 148px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--popover-shadow);
}
.theme-option, .theme-option:hover:not(:disabled) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  transform: none;
}
.theme-option:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.theme-option.active { background: var(--tint); color: var(--accent); }
.theme-option.active::after { content: "✓"; margin-left: auto; }
.theme-option .icon { width: 16px; height: 16px; }
.avatar { flex: none; border-radius: 50%; background: var(--surface-2); object-fit: cover; }
.account-trigger {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  list-style: none;
}
.account-trigger::-webkit-details-marker { display: none; }
.account-trigger:hover, .account-menu[open] .account-trigger { border-color: var(--dim); background: var(--surface-2); }
.account-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-trigger .avatar { width: 26px; height: 26px; }
.account-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 280px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--popover-shadow);
}
.account-identity { display: flex; align-items: center; gap: 12px; }
.account-identity .avatar { width: 36px; height: 36px; }
.account-identity div { display: grid; gap: 2px; min-width: 0; }
.account-identity strong { font-size: var(--text-sm); color: var(--ink); }
.account-identity a { overflow: hidden; color: var(--dim); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.account-panel p { margin: 12px 0 0; color: var(--dim); font-size: var(--text-xs); line-height: 1.4; }
.account-panel .mono { overflow-wrap: anywhere; }
.account-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.user-chip img { width: 18px; height: 18px; }
.msg .who .user-chip img { width: 14px; height: 14px; }
.archive-by { display: flex; align-items: center; color: var(--dim); font-size: var(--text-xs); }

/* ─── login page ──────────────────────────────────────────────────────────── */
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { display: grid; gap: 14px; width: min(420px, 100%); margin: 0; padding: 32px; text-align: center; justify-items: center; }
.login-card h1 { margin: 0; }
.login-card p { margin: 0; color: var(--ink-2); line-height: 1.5; }
.login-logo { width: 48px; height: 48px; }
.login-button { min-height: 40px; padding: 0 18px; }

/* ─── shared surfaces ─────────────────────────────────────────────────────── */
.card, .panel {
  margin: 0 0 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}
.panel { padding: 24px; }
.dashboard-grid > .card,
.dashboard-side > .card,
.two-col > .card,
.overview-grid > .card { margin-bottom: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px var(--space-6) 18px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head > div { min-width: 0; }
.card-head h2 { margin: 0; }
.card-head p { margin: 4px 0 0; color: var(--dim); font-size: var(--text-sm); }
.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.dim { color: var(--dim); }
.error { color: var(--bad); font-size: var(--text-sm); }
.error:empty { display: none; }
.section-error { display: block; padding: 10px var(--space-6); }
.warn-box {
  padding: 10px 13px;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  font-size: var(--text-sm);
}
.helper-text { margin: 11px 0 0; color: var(--dim); font-size: var(--text-xs); }
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, .75fr);
  gap: 22px;
  align-items: start;
}

/* ─── dashboard workspace ─────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin: var(--space-6) 0;
}
.page-header .eyebrow { margin-bottom: 5px; }
.page-header p { max-width: 68ch; margin: 7px 0 0; color: var(--ink-2); }
.dashboard-header > div { min-width: 0; }
.dashboard-header > button, .dashboard-header > .linkbtn { width: 132px; flex: none; justify-content: center; }
.dashboard-header h1 { font-size: var(--text-2xl); }
.dashboard-header { margin: 18px 0; }
.dashboard-summary { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.dashboard-count { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-weight: var(--weight-medium); }
.dashboard-count .icon { width: 15px; height: 15px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; align-items: start; }
.project-list-card { overflow: hidden; }
.project-list { min-height: 160px; }
.project-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.project-table th { padding: 10px 24px; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--dim); background: var(--surface-2); text-align: left; }
.project-table th:first-child { width: 38%; }
.project-provider { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.contract-version { min-width: 34px; background: var(--surface-2); }
.project-table td { padding: 18px 24px; vertical-align: top; border-bottom: 1px solid var(--line-soft); font-size: var(--text-sm); }
.project-table :is(th, td) + :is(th, td) { border-left: 1px solid var(--line-soft); }
.project-table tbody tr:last-child td { border-bottom: 0; }
.project-table tbody tr { position: relative; }
.project-table .project-title::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.project-table tbody tr:hover { background: var(--surface-2); }
.project-table tbody tr:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }

.project-title { display: block; color: var(--ink); font-size: var(--text-base); font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.project-title:hover { color: var(--accent); text-decoration: underline; }
.project-note { color: var(--dim); font-size: var(--text-xs); margin-top: 8px; }
.project-note:empty { display: none; }
.project-list { overflow-x: auto; }
.project-row-loading { min-height: 110px; padding: 18px 24px; display: grid; grid-template-columns: 38% 31% 31%; border-bottom: 1px solid var(--line-soft); }
.project-row-loading .skeleton-block { width: 80%; }
@media (max-width: 700px) {
  .project-table { min-width: 650px; }
}
.cell-findings:empty { display: none; }
.finding-summary { display: inline-flex; align-items: center; gap: 7px; color: var(--dim); font-size: var(--text-xs); }
.project-progress { display: flex; align-items: center; width: 100%; max-width: 190px; min-height: 22px; flex: none; }
.project-progress .progress { width: 100%; }
.project-activity { color: var(--dim); font-size: var(--text-xs); }
.dashboard-side { position: sticky; top: 86px; display: grid; gap: 22px; align-items: start; }
.project-list-card > .card-head, .lanes-card > .card-head, .usage-card > .card-head { padding: 15px var(--space-6) 14px; }
.archive-link { width: 132px; justify-content: center; gap: 7px; flex: 0 0 132px; }
.archive-link-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--muted-soft);
  color: var(--dim);
  font-size: var(--text-xs);
}
.dashboard-side .lanes { grid-template-columns: 1fr; gap: 0; padding: 0 var(--space-6) 14px; }
.dashboard-side .provider-usage:has(> .dashboard-card-status),
.dashboard-side .lanes:has(> .dashboard-card-status) { padding-block: 7px; }
.dashboard-side .dashboard-card-status { min-width: 0; padding: 0; }
.dashboard-side .lane { min-height: 0; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: transparent; }
.dashboard-side .lane:last-child { border-bottom: 0; }
.dashboard-side .lane .lane-use { overflow: hidden; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.backend-pill, .contract-version { display: inline-flex; align-items: center; justify-content: center; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.contract-version.v4 {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-color: transparent;
  background: linear-gradient(135deg, #0369a1, #4f46e5 55%, #9333ea) border-box;
  color: #ffffff;
  font-weight: var(--weight-semibold);
}
.contract-version.v4::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, #ffffff 25%, transparent) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: version-glint 3.2s ease-in-out infinite;
}
@keyframes version-glint {
  0%, 60% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .contract-version.v4::after { display: none; }
}
.backend-pill { width: 62px; }
.backend-pill.claude { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.backend-pill.codex { border-color: var(--info-line); background: var(--info-soft); color: var(--info); }
.archive-list-card { overflow: hidden; }
.archive-list:empty { min-height: 120px; }
.archive-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px minmax(0, 150px) 64px 88px;
  gap: 16px;
  align-items: center;
  min-height: 76px;
  padding: 0 var(--space-6) 0 21px;
  border-bottom: 1px solid var(--line-soft);
  border-left: 3px solid var(--warn-line);
  background: color-mix(in srgb, var(--warn-soft) 52%, var(--surface));
}
.archive-row:last-child { border-bottom: 0; }
.archive-run { display: grid; align-content: center; gap: 4px; min-width: 0; min-height: 75px; color: inherit; }
.archive-run:hover { color: inherit; }
.archive-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--warn);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.archive-state > span { width: 7px; height: 7px; border-radius: 2px; background: var(--warn); }
.archive-updated { color: var(--dim); font-size: var(--text-xs); white-space: nowrap; }
.archive-row > .compact-button { width: 88px; }
/* ─── controls ────────────────────────────────────────────────────────────── */
button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.2;
  transition: border-color .12s, background .12s, color .12s, box-shadow .12s;
}
button:hover:not(:disabled) { border-color: var(--accent-dark); background: var(--accent-dark); }
button:disabled { border-color: var(--line); background: var(--muted-soft); color: var(--dim); cursor: default; }
button.secondary { border-color: var(--line); background: var(--surface); color: var(--ink-2); }
button.secondary:hover:not(:disabled) { border-color: var(--dim); background: var(--surface-2); color: var(--ink); }
button.danger { border-color: var(--danger-line); background: var(--surface); color: var(--bad); }
button.danger:hover:not(:disabled) { border-color: var(--danger-line-hover); background: var(--bad-soft); }
button.secondary:disabled, button.danger:disabled {
  border-color: var(--line);
  background: var(--muted-soft);
  color: var(--disabled-ink);
  opacity: .62;
}
.button-with-icon { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.compact-button { min-height: 34px; padding: 6px 13px; }
.icon-button { width: 34px; padding: 6px; }
/* Anchor styled as a secondary compact button (e.g. the Raw report link). */
.linkbtn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.2;
  transition: border-color .12s, background .12s, color .12s;
}
.linkbtn:hover { border-color: var(--dim); background: var(--surface-2); color: var(--ink); }
.linkbtn[aria-disabled="true"] { pointer-events: none; opacity: .48; }

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
textarea { line-height: 1.5; }
.clipboard-fallback { position: fixed; opacity: 0; pointer-events: none; }
input:hover, textarea:hover, select:hover { border-color: var(--input-hover); }
input:focus, textarea:focus, select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::placeholder { color: var(--placeholder); }
.form-card form { padding: 22px var(--space-6) var(--space-6); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.field-hint { color: var(--dim); font-size: var(--text-xs); font-weight: var(--weight-regular); line-height: 1.35; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ─── loading states ──────────────────────────────────────────────────────── */
.skeleton-block {
  display: block;
  width: 72%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--muted-soft), var(--skeleton-highlight), var(--muted-soft));
  background-size: 220% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}
.skeleton-block + .skeleton-block { margin-top: 14px; }
.skeleton-block.title { width: 46%; height: 20px; margin-bottom: 22px; }
.skeleton-block.wide { width: 88%; }
.skeleton-block.short { width: 38%; }
.archive-row-loading .skeleton-block { width: 100%; margin: 0; }
.archive-row-loading .skeleton-block.title { width: 65%; }
.finding-table-row > .skeleton-block { width: 100%; margin: 0; }
.overview-loading { min-height: 220px; }

/* ─── badges ──────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.35;
  white-space: nowrap;
}
.project-tabs .nav-icon { width: 17px; height: 17px; color: var(--dim); }
.project-tabs button.active .nav-icon { color: var(--accent); }
.pill.approved, .pill.succeeded { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.pill.approved-with-constraints, .pill.canceled { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.pill.need-more-info { border-color: var(--info-line); background: var(--info-soft); color: var(--info); }
.pill.blocked, .pill.failed, .pill.interrupted { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad); }
.pill.discovery, .pill.running, .pill.accepted-risk { border-color: var(--accent-line); background: var(--tint); color: var(--accent); }
.pill.queued { background: var(--muted-soft); }
.pill.review { border-color: var(--line); background: var(--panel); color: var(--ink-2); }
.sev {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.sev-key { font-size: 9px; opacity: .78; }
.sev.critical { background: var(--critical-bg); color: #fff; }
.sev.high { background: var(--bad-soft); color: var(--bad); }
.sev.medium { background: var(--warn-soft); color: var(--warn); }
.sev.low { background: var(--info-soft); color: var(--info); }
.sev.info, .sev.none { background: var(--muted-soft); color: var(--dim); }
.sev.closed { background: var(--muted-soft); color: var(--dim); text-decoration: line-through; }
.cell-findings { white-space: nowrap; }
.pill-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ─── project workspace navigation ────────────────────────────────────────── */
.run-shell { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 30px; }
.run-workspace { min-width: 0; }
.case-sidebar {
  min-height: calc(100vh - 64px);
  padding: 0 18px 0 0;
  border-right: 1px solid var(--line);
}
.case-sidebar-sticky {
  position: sticky;
  top: 64px;
  padding: 28px 0;
}
.case-sidebar-label {
  display: block;
  margin: 0 10px 8px;
  color: var(--dim);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.project-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.project-tabs button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  transition: none;
  white-space: nowrap;
}
.project-tabs button:hover:not(:disabled) { border: 0; background: var(--surface); color: var(--ink); }
.project-tabs button.active, .project-tabs button.active:hover:not(:disabled) { background: var(--tint); color: var(--accent-dark); font-weight: var(--weight-medium); }
.project-tabs button > span:not(.n) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.project-tabs button:focus-visible { outline-offset: -2px; }
.project-tabs button.active::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}
.project-tabs button .n { min-width: 21px; margin-left: auto; padding: 0 5px; border-radius: 999px; background: var(--muted-soft); color: var(--ink-2); font-family: var(--sans); font-size: inherit; font-weight: var(--weight-regular); line-height: 18px; text-align: center; }
.project-tabs button.active .n { background: var(--tint); color: var(--accent-dark); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─── architecture diagram ───────────────────────────────────────────────── */
.diagram-card { overflow: hidden; }
.diagram-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.diagram-viewport {
  min-height: 420px;
  max-height: calc(100vh - 205px);
  padding: var(--space-6);
  overflow: auto;
  background: var(--surface-2);
  overscroll-behavior: contain;
}
.diagram-viewport .placeholder { display: grid; min-height: 370px; place-items: center; color: var(--dim); text-align: center; }
.diagram-viewport .empty { max-width: 620px; margin: auto; }

/* ─── worker lanes ────────────────────────────────────────────────────────── */
.lanes-card { overflow: hidden; }
.lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: 0 var(--space-6) var(--space-6); }
.lane {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  min-height: 88px;
  padding: 15px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--text-sm);
}
.lane .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.lane.ok .dot { background: #2aa96e; }
.lane.busy .dot { background: #d9a422; box-shadow: 0 0 0 3px rgba(217, 164, 34, .12); }
.lane.dead .dot { background: #d64a3a; }
.lane .name { color: var(--ink); font-weight: var(--weight-medium); }
.lane-state { grid-column: 3; grid-row: 1; color: var(--dim); font-size: var(--text-xs); white-space: nowrap; }
.lane-use { grid-column: 2 / -1; min-width: 0; color: var(--dim); font-size: var(--text-xs); line-height: 1.45; }
.lane-activity, .lane-alert {
  grid-column: 2 / -1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.lane-activity { display: grid; gap: 2px; border-left: 2px solid var(--accent); background: var(--tint); color: var(--ink-2); }
.lane-activity .job-name { color: var(--ink); font-weight: var(--weight-medium); }
.lane-alert { background: var(--bad-soft); color: var(--bad); }
.lane-error { padding: 14px 0; }

/* ─── provider usage ─────────────────────────────────────────────────────── */
.usage-card { overflow: hidden; }
.provider-usage { display: grid; padding: 0 var(--space-6) 14px; }
.provider { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.provider:last-child { border-bottom: 0; }
.provider-name { font-weight: var(--weight-medium); }
.provider-state { color: var(--dim); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.provider.limited .provider-state { color: var(--bad); }
.provider.available .provider-state { color: var(--ok); }
.provider-details { grid-column: 1 / -1; display: grid; gap: 6px; font-size: var(--text-xs); }
.usage-window { display: grid; gap: 4px; }
.usage-window progress { width: 100%; height: 5px; border: 0; border-radius: 999px; appearance: none; background: var(--muted-soft); }
.usage-window progress::-webkit-progress-bar { background: var(--muted-soft); }
.usage-window progress::-webkit-progress-value { background: var(--accent); }
.usage-window progress::-moz-progress-bar { background: var(--accent); }
.provider.limited .usage-window progress::-webkit-progress-value { background: var(--bad); }
.provider.limited .usage-window progress::-moz-progress-bar { background: var(--bad); }

/* ─── workflow progress ───────────────────────────────────────────────────── */
.progress { display: flex; align-items: center; gap: 9px; min-width: 132px; }
.progress .track { flex: 1; height: 6px; overflow: hidden; border: 0; border-radius: 999px; appearance: none; background: var(--muted-soft); }
.progress .track::-webkit-progress-bar { background: var(--muted-soft); }
.progress .track::-webkit-progress-value { background: var(--accent); transition: width .3s; }
.progress .track::-moz-progress-bar { background: var(--accent); transition: width .3s; }
.progress .track.full::-webkit-progress-value { background: var(--ok); }
.progress .track.full::-moz-progress-bar { background: var(--ok); }
.progress .label { color: var(--dim); font: var(--weight-regular) var(--text-xs)/1 var(--sans); white-space: nowrap; }

/* ─── run overview ────────────────────────────────────────────────────────── */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr); gap: 20px; align-items: start; }
.overview-main, .case-details { padding: var(--space-6); }
.overview-error-state { display: grid; min-height: 220px; place-items: center; }
.case-details { position: sticky; top: 86px; }
.verdict-callout {
  margin-bottom: 20px;
  padding: 4px 0 18px 18px;
  border: 0;
  border-left: 3px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.verdict-callout.approved { border-color: var(--ok); }
.verdict-callout.approved-with-constraints { border-color: var(--warn); }
.verdict-callout.need-more-info { border-color: var(--info); }
.verdict-callout.blocked { border-color: var(--bad); }
.verdict-callout .v { margin: 0 0 7px; font-size: var(--text-xl); line-height: 1.2; text-transform: capitalize; }
.verdict-callout p { max-width: 72ch; margin: 0; color: var(--ink-2); }
.verdict-callout .verdict-summary { margin-bottom: 12px; }
.verdict-details { margin: 8px 0 12px; }
.verdict-details summary, .more-questions summary { color: var(--accent); cursor: pointer; font-size: var(--text-xs); font-weight: var(--weight-medium); }
.verdict-details p { margin-top: 10px; }
.verdict-link { display: inline-flex; margin-top: 2px; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.severity-row { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 20px; }
.human-review-summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 0 20px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.human-review-summary > div:first-child { display: grid; gap: 4px; }
.human-review-decisions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; color: var(--ink-2); font-size: var(--text-sm); }
.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px 14px; margin: 14px 0 0; font-size: var(--text-sm); }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.intent-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.intent-block h2 { margin-bottom: 7px; font-size: var(--text-base); }
.intent-markdown { color: var(--ink-2); font-size: var(--text-sm); }
.intent-markdown > :first-child { margin-top: 0; }
.intent-markdown > :last-child { margin-bottom: 0; }
.intent-markdown h2, .intent-markdown h3, .intent-markdown h4,
.intent-markdown h5 { margin: 12px 0 5px; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.intent-markdown p { margin: 0 0 8px; }
.intent-markdown ul, .intent-markdown ol { margin: 6px 0 8px; padding-left: 18px; }
.intent-markdown code { overflow-wrap: anywhere; }
.oq-list { margin: 10px 0 0; padding-left: 20px; }
.oq-list li { margin-bottom: 8px; color: var(--ink-2); }
.questions-block h2 { display: flex; align-items: center; gap: 8px; }
.questions-block h2 span { min-width: 24px; padding: 1px 7px; border-radius: 999px; background: var(--muted-soft); color: var(--dim); font: var(--weight-regular) var(--text-xs)/1.5 var(--sans); text-align: center; }
.more-questions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* ─── pipeline ────────────────────────────────────────────────────────────── */
.section-card { overflow: hidden; }
.pipeline-controls {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px var(--space-6) 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.pipeline-primary-actions { display: flex; align-items: flex-start; gap: 9px; width: 100%; flex-wrap: wrap; }
.button-group { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.control-field { display: grid; gap: 4px; color: var(--dim); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.pipeline-provider select { width: auto; min-width: 112px; min-height: 38px; padding: 8px 28px 8px 10px; }
.pipeline-primary-actions > .button-group:not(:has(button:not([hidden]))) { display: none; }
.action-dialog {
  width: min(460px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--popover-shadow);
  color: var(--ink);
}
.action-dialog::backdrop { background: rgba(1, 4, 9, .62); backdrop-filter: blur(2px); }
.action-dialog-frame {
  display: grid;
  gap: 16px;
  padding: 24px;
}
.action-dialog-head { display: grid; gap: 4px; }
.action-dialog-head h2 { margin: 0; font-size: var(--text-lg); }
.action-dialog p { margin: 0; color: var(--ink-2); }
.action-dialog .control-field { gap: 6px; }
.action-dialog .control-field select { width: 100%; }
.action-dialog textarea { resize: vertical; }
.action-dialog-note { padding: 10px 12px; border: 1px solid var(--warn-line); border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn) !important; }
.action-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.action-dialog .error:empty { display: none; }
.control-error { flex-basis: 100%; }
.pipeline-card .job-chip { flex: none; color: var(--dim); font-size: var(--text-xs); }
.pipeline-summary { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: var(--muted-soft); color: var(--dim); font-weight: var(--weight-medium); }
.pipeline-summary.complete { background: var(--ok-soft); color: var(--ok); }
.pipeline-summary .icon { width: 14px; height: 14px; }
.section-card > .two-col { padding: 18px var(--space-6) var(--space-6); grid-template-columns: minmax(0, 1.65fr) minmax(270px, .7fr); }
/* Pipeline: the stepper is a narrow fixed rail; the live log gets the rest. */
.section-card > .pipeline-grid { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); align-items: stretch; }
.pipeline-grid .log { max-height: 62vh; }
.pipeline-activity { display: flex; min-width: 0; }
.pipeline-activity:has(> .pipeline-empty-state.is-complete) { align-self: start; }
.pipeline-activity > .pipeline-empty-state,
.pipeline-activity > .console { width: 100%; min-height: 220px; }
.pipeline-activity > .pipeline-empty-state.is-complete { min-height: 0; }
.pipeline-activity > .console { display: flex; flex-direction: column; }
.pipeline-activity > .console.collapsed { min-height: 0; }
.pipeline-activity > .console.empty { display: none; }
.pipeline-activity > .console .log { flex: 1; min-height: 0; }
.pipeline-empty-state {
  display: grid;
  place-content: center;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.pipeline-empty-state p { max-width: 440px; margin: 0 auto; }
.pipeline-empty-state.is-complete {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 14px;
  padding: 18px 20px;
  place-content: center normal;
  align-items: center;
  border-style: solid;
  border-color: var(--success-panel-line);
  background: var(--success-panel);
  text-align: left;
}
.pipeline-empty-state.is-complete .empty-icon {
  grid-row: 1 / 3;
  margin: 0;
  color: var(--ok);
}
.pipeline-empty-state.is-complete .big { grid-column: 2; margin: 0; color: var(--ink); }
.pipeline-empty-state.is-complete p { grid-column: 2; margin: 2px 0 0; }
.pipeline-empty-state.is-complete .empty-actions {
  grid-column: 3;
  grid-row: 1 / 3;
  margin: 0;
}
.pipeline-phases { min-width: 0; }
.pipeline-phases > summary {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.pipeline-phases[open] > summary { margin-bottom: 12px; }
.empty-actions { display: flex; justify-content: center; gap: 9px; margin-top: 18px; }
.linkbtn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.linkbtn.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); color: #fff; }
.stepper { list-style: none; margin: 0; padding: 2px 0; }
.stepper li { display: flex; align-items: center; gap: 11px; min-height: 34px; position: relative; }
.stepper li::before { content: ""; position: absolute; left: 9px; top: -8px; bottom: -8px; width: 1px; background: var(--line); }
.stepper li:first-child::before { top: 50%; }
.stepper li:last-child::before { bottom: 50%; }
.stepper .node {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  flex: none;
  z-index: 1;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: #fff;
  font-size: 10px;
}
.stepper li.done .node { border-color: var(--ok); background: var(--ok); }
.stepper li.done .node::after { content: "✓"; }
.stepper li.running .node { border-color: var(--accent); }
.stepper li.running .node::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.stepper li.failed .node { border-color: var(--bad); background: var(--bad); }
.stepper li.failed .node::after { content: "×"; }
.stepper li.loading .node { border-color: var(--line-soft); background: var(--muted-soft); }
.skeleton-line {
  width: min(170px, 70%);
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--muted-soft), var(--skeleton-highlight), var(--muted-soft));
  background-size: 220% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}
@keyframes skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.stepper .name { color: var(--ink); font: var(--weight-medium) var(--text-sm)/1.35 var(--sans); }
.stepper li.pending .name { color: var(--dim); font-weight: var(--weight-regular); }
.stepper .meta { color: var(--dim); font-size: var(--text-xs); }
.console { overflow: hidden; border: 1px solid #091326; border-radius: var(--radius); background: #0d172a; }
.console .bar { display: flex; align-items: center; gap: 8px; padding: 8px 13px; background: #17243d; color: #95a6c3; font: var(--text-xs)/1.4 var(--mono); }
.console-toggle { min-height: 0; padding: 2px 7px; border: 0; background: transparent; color: #b6c4dc; font: inherit; }
.console-toggle:hover:not(:disabled) { border: 0; background: rgba(255,255,255,.08); color: #fff; transform: none; }
.console.collapsed .log { display: none; }
.log { max-height: 47vh; margin: 0; padding: 13px 15px; overflow: auto; background: #0d172a; color: #cbd6e9; font: var(--text-xs)/1.65 var(--mono); white-space: pre-wrap; word-break: break-word; }
.log.small { max-height: 22vh; }
.console.empty { display: none; }

/* ─── chat and discovery ──────────────────────────────────────────────────── */
.chat-wrap { overflow: hidden; }
#tab-chat .chat-wrap { max-width: none; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 255px); min-height: 460px; }
.read-only-badge, .file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--dim);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.read-only-badge { margin-left: auto; background: var(--surface-2); }
.read-only-badge .icon, .file-chip .icon { width: 14px; height: 14px; }
.file-chip { color: var(--ink-2); font-family: var(--mono); font-weight: var(--weight-regular); }
.chat-prompts { display: flex; align-items: center; gap: 7px; padding: 11px var(--space-6) 0; overflow-x: auto; color: var(--dim); font-size: var(--text-xs); white-space: nowrap; }
.prompt-chip {
  min-height: 29px;
  padding: 4px 9px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
}
.prompt-chip:hover:not(:disabled) { border-color: var(--input-hover); background: var(--surface-2); color: var(--ink); }
.chat-messages { display: flex; flex-direction: column; gap: 11px; min-height: 230px; max-height: 56vh; margin: 0 26px; padding: 18px 2px 10px; overflow: auto; }
.chat-card .chat-messages { flex: 1; min-height: 0; max-height: none; }
.msg { max-width: min(72ch, 90%); padding: 11px 14px; border-radius: 13px; white-space: normal; word-break: break-word; }
.msg.user { align-self: flex-end; max-width: min(60ch, 72%); border-radius: 13px 13px 4px 13px; background: var(--accent); color: #fff; }
.msg.assistant { align-self: flex-start; border: 1px solid var(--line); border-radius: 13px 13px 13px 4px; background: var(--surface-2); }
.msg.system { align-self: stretch; max-width: none; padding: 8px 0; border-radius: 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: none; color: var(--dim); font-size: var(--text-xs); text-align: center; }
.msg .who { display: flex; align-items: center; gap: 5px; margin-bottom: 5px; font-size: var(--text-xs); opacity: .72; }
.msg .who img, .msg .who .icon { width: 14px; height: 14px; }
.msg.failed { border-color: var(--bad-line); }
.msg .md p { margin: 0 0 9px; color: inherit; }
.msg .md p:last-child { margin-bottom: 0; }
.msg .md ul, .msg .md ol { margin: 7px 0 9px; padding-left: 20px; }
.msg .md h2, .msg .md h3, .msg .md h4, .msg .md h5 { margin: 14px 0 7px; font-size: var(--text-base); }
.msg .md code { padding: 1px 4px; border-radius: 4px; background: var(--code-soft); font-size: inherit; }
.msg .md pre { margin: 7px 0 9px; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font: var(--text-xs)/1.6 var(--mono); white-space: pre; }
.msg .md pre code { padding: 0; background: none; }
.thinking { display: flex; align-items: center; gap: 9px; margin: 0 26px 10px; color: var(--dim); font-size: var(--text-xs); }
.thinking .pulse { color: var(--accent); }
.chat-form { display: flex; align-items: flex-end; gap: 10px; margin-top: 10px; padding: 17px var(--space-6) 22px; border-top: 1px solid var(--line-soft); background: var(--surface-2); }
.chat-card .chat-form { margin-top: 0; }
.chat-form textarea { min-height: 52px; max-height: 144px; resize: none; overflow-y: hidden; background: var(--surface); }
.chat-form textarea.scrollable { overflow-y: auto; }
.chat-form button { height: 42px; flex: none; }
.composer-input { display: grid; flex: 1; min-width: 0; }
.composer-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 0; }
.composer-form > .composer-input { display: contents; }
.composer-form .composer-input textarea { grid-column: 1; grid-row: 1; }
.composer-form .composer-hint { grid-column: 1; grid-row: 2; }
.composer-form > button { grid-column: 2; grid-row: 1; align-self: stretch; height: auto; }
.composer-input textarea { padding-bottom: 10px; }
.composer-hint { margin: 4px 2px 0; color: var(--dim); font-size: var(--text-xs); line-height: 1.2; text-align: right; pointer-events: none; }
.chat-wrap > .error { display: block; margin: -10px var(--space-6) 16px; }
details.activity { margin: -7px var(--space-6) 20px; }
details.activity summary { color: var(--dim); cursor: pointer; font-size: var(--text-xs); user-select: none; }
details.activity .console { margin-top: 9px; }
.side-card { position: sticky; top: 86px; padding: 22px; }
.side-card h2 { margin-bottom: 14px; }
.checklist-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.checklist-head h2 { margin-bottom: 0; }
.checklist-head p { margin: 3px 0 0; color: var(--dim); font-size: var(--text-xs); }
.checklist-head span { color: var(--dim); font-size: var(--text-xs); white-space: nowrap; }
.checklist { list-style: none; margin: 0 0 16px; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 9px; padding: 7px 0; color: var(--dim); font-size: var(--text-xs); line-height: 1.35; }
.checklist li .tick { width: 18px; height: 18px; display: grid; place-items: center; flex: none; border: 1.5px solid var(--line); border-radius: 50%; color: #fff; font-size: 10px; }
.checklist li.ok { color: var(--ink); }
.checklist li.ok .tick { border-color: var(--ok); background: var(--ok); }
.checklist li.ok .tick::after { content: "✓"; }

/* ─── findings ────────────────────────────────────────────────────────────── */
.findings-queue {
  overflow: hidden;
}
.findings-queue-heading {
  gap: 28px;
}
.findings-queue-summary { display: flex; align-items: center; gap: 20px; }
.findings-progress { display: grid; min-width: 180px; gap: 2px; color: var(--dim); font-size: var(--text-xs); text-align: right; }
.findings-progress strong { color: var(--ink); font-size: var(--text-sm); }
.progress-track { display: block; width: 180px; height: 4px; margin-top: 5px; overflow: hidden; border: 0; border-radius: 999px; appearance: none; background: var(--muted-soft); }
.progress-track::-webkit-progress-bar { background: var(--muted-soft); }
.progress-track::-webkit-progress-value { background: var(--accent); transition: width .2s ease; }
.progress-track::-moz-progress-bar { background: var(--accent); transition: width .2s ease; }
.findings-actions { display: flex; gap: 8px; }
.toolbar {
  padding: 12px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.findings-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px 155px auto auto;
  gap: 8px;
}
.findings-toolbar input, .findings-toolbar select { min-height: 38px; padding: 8px 10px; font-size: var(--text-sm); }
.findings-toolbar .text-button { justify-self: start; padding-inline: 4px; }
.findings-filter-summary { display: flex; align-items: center; gap: 8px; min-height: 38px; color: var(--dim); font-size: var(--text-xs); white-space: nowrap; }
.findings-filter-summary:not(:has(> :not([hidden]))) { display: none; }
.findings-extra { display: flex; align-items: flex-end; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filter-field { display: grid; gap: 4px; color: var(--dim); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.findings-extra select { width: 170px; min-height: 36px; padding: 7px 10px; font-size: var(--text-sm); font-weight: var(--weight-regular); }
.findings-table-head,
.finding-table-row {
  display: grid;
  grid-template-columns: 70px minmax(320px, 1fr) 145px 105px 18px;
  gap: 16px;
  align-items: center;
}
.findings-table-head {
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.findings-list { min-height: 68px; }
.findings-queue.single-finding .findings-toolbar,
.findings-queue.single-finding .findings-extra { display: none; }
.findings-queue.single-finding .findings-list { min-height: 68px; }
.findings-queue.empty-state .findings-toolbar,
.findings-queue.empty-state .findings-table-head { display: none; }
.findings-queue.empty-state .findings-list { min-height: 180px; }
.finding-table-row {
  width: 100%;
  min-height: 0;
  padding: 15px 24px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.finding-table-row:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.finding-table-row:focus-visible { z-index: 1; outline-offset: -2px; }
.finding-cell { min-width: 0; }
.finding-cell strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: var(--text-base); font-weight: var(--weight-semibold); line-height: 1.35; }
.finding-cell small { display: block; overflow: hidden; color: var(--dim); font-size: var(--text-xs); font-weight: var(--weight-regular); text-overflow: ellipsis; white-space: nowrap; }
.finding-updated { overflow: hidden; color: var(--ink-2); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.workflow-state {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--muted-soft);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  white-space: nowrap;
}
.workflow-state.in-progress { background: var(--info-soft); color: var(--info); }
.workflow-state.done { background: var(--ok-soft); color: var(--ok); }
.finding-arrow { width: 17px; height: 17px; color: var(--dim); }
.decision-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.decision-state::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--dim); }
.decision-state.pending { color: var(--warn); }
.decision-state.pending::before { background: var(--warn); }
.decision-state.confirmed::before, .decision-state.remediated::before { background: var(--ok); }
.decision-state.confirmed, .decision-state.remediated { color: var(--ok); }
.decision-state.false-positive::before { background: var(--dim); }
.decision-state.accepted-risk::before { background: var(--accent); }
.decision-state.accepted-risk { color: var(--accent); }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--muted-soft);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: .02em;
  line-height: 1.5;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.finding-detail {
  min-width: 0;
  margin: 0;
  padding: 0 0 56px;
}
.finding-detail-header { overflow: hidden; }
.finding-review-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px var(--space-6);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.text-button { min-height: 0; padding: 6px 0; border: 0; background: transparent; color: var(--accent); }
.text-button:hover:not(:disabled) { border: 0; background: transparent; color: var(--accent-dark); }
.finding-review-nav { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: var(--text-xs); }
.finding-review-position { min-width: 52px; text-align: center; white-space: nowrap; }
.finding-review-actions { display: flex; justify-content: flex-end; gap: 8px; margin-left: auto; }
.finding-detail-error { flex: 1 1 220px; text-align: right; }
.finding-detail-error:empty { display: none; }
.finding-review-heading { padding: 20px var(--space-6) 16px; }
.finding-review-heading h2 { max-width: 980px; margin: 8px 0 0; font-size: var(--text-xl); line-height: 1.3; }
.finding-review-heading p { max-width: 900px; margin: 0; color: var(--ink-2); font-size: var(--text-base); }
.finding-document { min-width: 0; overflow: hidden; }
.finding-section { padding: var(--space-6); }
.finding-section + .finding-section { border-top: 1px solid var(--line); }
.finding-section h3 { margin-bottom: 10px; font-size: var(--text-md); }
.finding-section p { max-width: 82ch; margin: 0; color: var(--ink-2); }
.finding-section p + p { margin-top: 10px; }
.finding-root-cause, .finding-scenario-block { margin-top: 20px; }
.finding-root-cause h4, .finding-scenario-block h4 { margin: 0 0 8px; font-size: var(--text-sm); }
.finding-scenario { margin: 0; padding-left: 22px; color: var(--ink-2); }
.finding-scenario li + li { margin-top: 8px; }
.finding-verification-state { margin-left: 7px; color: var(--accent); white-space: nowrap; }
.evidence-list { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); }
.evidence-list li { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.evidence-list li > span { color: var(--dim); font-size: var(--text-xs); }
.evidence-list code { overflow-wrap: anywhere; color: var(--ink-2); }
.evidence-list a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.evidence-command { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.evidence-command button { min-width: 58px; }
.source-references { margin-top: 14px; }
.source-references summary { color: var(--accent); cursor: pointer; font-size: var(--text-xs); font-weight: var(--weight-medium); }
.source-references ul { list-style: none; margin: 10px 0 0; padding: 0; color: var(--ink-2); }
.source-references li { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.source-references code { min-width: 0; overflow-wrap: anywhere; }
.reference-actions { display: flex; flex: none; align-items: center; gap: 10px; }
.reference-actions .text-button { color: var(--accent); font-size: var(--text-xs); white-space: nowrap; }
.decision-help { margin: 6px 0 0; color: var(--dim); font-size: var(--text-xs); line-height: 1.4; }
.saved-status { min-height: 18px; color: var(--ok); font-size: var(--text-xs); text-align: center; }

/* ─── run events ──────────────────────────────────────────────────────────── */
.events-card { overflow: hidden; }
.events-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.events-actions input { width: 220px; height: 34px; min-height: 34px; padding: 6px 10px; }
.events-list { list-style: none; margin: 0; padding: 0; }
.event-row {
  display: grid;
  grid-template-columns: 140px 10px minmax(0, 1fr);
  gap: 12px;
  padding: 14px var(--space-6);
  border-top: 1px solid var(--line-soft);
}
.event-row:first-child { border-top: 0; }
.event-row > time { padding-top: 2px; color: var(--dim); font-size: var(--text-xs); white-space: nowrap; }
.event-marker { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--event-marker); }
.event-row.ok .event-marker { background: var(--ok); }
.event-row.bad .event-marker { background: var(--bad); }
.event-content { min-width: 0; }
.event-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.event-title strong { color: var(--ink); font-size: var(--text-base); }
.event-title span {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--muted-soft);
  color: var(--dim);
  font-size: var(--text-xs);
}
.event-meta { margin-top: 2px; color: var(--dim); font-size: var(--text-xs); }
.event-content > p {
  display: -webkit-box;
  max-width: 90ch;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: var(--text-sm);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.event-details { margin-top: 6px; }
.event-details > summary { width: max-content; color: var(--accent); cursor: pointer; font-size: var(--text-xs); }
.event-details pre { max-height: 300px; margin: 8px 0 0; padding: 12px; overflow: auto; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); font: var(--text-xs)/1.55 var(--mono); white-space: pre-wrap; }

/* ─── artifacts ───────────────────────────────────────────────────────────── */
.artifacts-card { overflow: visible; }
#tab-artifacts .artifacts-card > .card-head {
  position: sticky;
  top: 64px;
  z-index: 8;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--sticky-bg);
  backdrop-filter: blur(10px);
}
.artifacts-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; padding: 18px var(--space-6) var(--space-6); align-items: start; }
.artifact-sidebar { position: sticky; top: 140px; min-width: 0; }
.artifact-filter { min-height: 36px; margin-bottom: 8px; padding: 7px 10px; background: var(--surface); font-size: var(--text-sm); }
.file-tree { max-height: calc(100vh - 205px); padding: 8px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.file-tree details { margin-bottom: 4px; }
.file-tree summary { padding: 6px 7px; color: var(--dim); cursor: pointer; font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: .05em; text-transform: uppercase; user-select: none; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list button {
  width: 100%;
  min-height: 0;
  padding: 6px 8px 6px 20px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font: var(--text-xs)/1.45 var(--mono);
  text-align: left;
  overflow-wrap: anywhere;
}
.file-list button:hover:not(:disabled) { background: var(--tint); color: var(--accent-dark); transform: none; }
.file-list button.active, .file-list button.active:hover:not(:disabled) { background: var(--tint); color: var(--accent-dark); box-shadow: inset 3px 0 0 var(--accent); font-weight: var(--weight-medium); }
.file-empty { padding: 24px 10px; color: var(--dim); font-size: var(--text-xs); text-align: center; }
.artifact-view { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.artifact-view .file-head { display: flex; align-items: center; gap: 10px; min-height: 47px; padding: 7px 10px 7px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font: var(--text-xs)/1.4 var(--mono); }
.artifact-view .file-head > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-view .file-head button, .artifact-view .file-head a { flex: none; font-family: var(--sans); }
.artifact-warning { margin: 10px 14px 0; }
.artifact-view .body { max-height: calc(100vh - 205px); overflow: auto; }
.artifact-view pre { margin: 0; padding: 15px 17px; font: var(--text-xs)/1.65 var(--mono); white-space: pre-wrap; }
.artifact-view .md { max-width: 84ch; padding: 20px 24px; }
.artifact-view .md p { color: var(--ink-2); }
.artifact-view .md pre { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); white-space: pre; }
.artifact-view .md code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }
.artifact-view .md pre code { padding: 0; background: none; }
.artifact-view .md h2, .artifact-view .md h3 { margin-top: 22px; }
.artifact-view .placeholder { padding: 46px 20px; color: var(--dim); text-align: center; }

/* ─── empty states ────────────────────────────────────────────────────────── */
.empty { padding: 42px 20px; color: var(--dim); text-align: center; }
.empty .big { margin-bottom: 6px; color: var(--ink-2); font-size: var(--text-md); font-weight: var(--weight-medium); }
.empty-icon { display: block; width: 28px; height: 28px; margin: 0 auto 12px; color: var(--empty-icon); stroke-width: 1.5; }

@media (max-width: 1120px) {
  .project-picker select { width: min(250px, 26vw); }
  .run-shell { grid-template-columns: 168px minmax(0, 1fr); gap: 22px; }
  .findings-queue-heading { align-items: flex-start; }
  .findings-queue-summary { align-items: flex-end; flex-direction: column; gap: 10px; }
  .findings-toolbar { grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(130px, .6fr)) auto auto; }
  .findings-table-head, .finding-table-row { grid-template-columns: 70px minmax(300px, 1fr) 145px 105px 18px; }
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-side { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .two-col, .overview-grid, .artifacts-grid, .section-card > .two-col,
  .section-card > .pipeline-grid { grid-template-columns: 1fr; }
  .section-card > .pipeline-grid { grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .run-shell { display: block; }
  .case-sidebar { min-height: 0; padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .case-sidebar-sticky { position: static; padding: 0; }
  .case-sidebar-label { display: none; }
  .project-tabs {
    flex-direction: row;
    gap: 2px;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 12px;
    scrollbar-width: none;
  }
  .project-tabs::-webkit-scrollbar { display: none; }
  .project-tabs button { width: auto; flex: none; padding-inline: 12px; }
  .project-tabs button.active::after { top: auto; right: 10px; bottom: 0; left: 10px; width: auto; height: 2px; }
  .file-tree { max-height: 36vh; }
  .run-context { flex-wrap: wrap; }
  .pipeline-empty-state.is-complete { grid-template-columns: auto minmax(0, 1fr); }
  .pipeline-empty-state.is-complete .empty-actions { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; margin-top: 14px; }
}

@media (max-width: 620px) {
  .appbar-inner { padding: 0 12px; }
  .brand { width: 44px; height: 56px; }
  .health { padding-left: 6px; }
  .health span:last-child { display: none; }
  .bug-report-trigger { margin-left: 6px; }
  .theme-menu, .account-menu { margin-left: 6px; }
  .account-panel { position: fixed; top: 64px; right: 12px; width: calc(100vw - 24px); }
  main { padding: 0 12px 40px; }
  .app-footer { padding: 0 12px 20px; }
  .card, .panel { margin-bottom: 14px; }
  .panel { padding: 18px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  .dashboard-side { grid-template-columns: 1fr; }
  .card-head { align-items: flex-start; padding: 17px 18px 13px; }
  .form-card .card-head { align-items: center; }
  .form-card form { padding: 18px; }
  .lanes { padding: 2px 18px 10px; }
  .lane { grid-template-columns: 9px 1fr auto; gap: 8px 10px; padding: 10px 0; }
  .project-row { padding: 15px 18px; }
  .archive-row { grid-template-columns: minmax(0, 1fr) 88px; gap: 4px 12px; min-height: 82px; padding: 0 12px 0 15px; }
  .archive-run { grid-column: 1; grid-row: 1; min-height: 48px; align-self: end; }
  .archive-state { grid-column: 1; grid-row: 2; align-self: start; }
  .archive-updated, .archive-by { display: none; }
  .archive-row > .compact-button { grid-column: 2; grid-row: 1 / span 2; }
  .overview-main, .case-details { padding: 19px; }
  .section-card > .two-col, .pipeline-controls { padding-left: 18px; padding-right: 18px; }
  .chat-messages { margin: 0 18px; }
  .chat-form { padding: 15px 18px 18px; }
  .chat-form button { padding-left: 13px; padding-right: 13px; }
  .thinking { margin-left: 18px; margin-right: 18px; }
  .chat-wrap > .error, details.activity { margin-left: 18px; margin-right: 18px; }
  .run-context { min-height: 58px; }
  .run-context-error { text-align: left; }
  .archive-notice-copy > span { display: none; }
  .findings-queue-heading { display: grid; }
  .findings-queue-summary { align-items: stretch; }
  .findings-progress { text-align: left; }
  .findings-actions { flex-wrap: wrap; }
  .findings-toolbar { grid-template-columns: 1fr 1fr; }
  .findings-toolbar input { grid-column: 1 / -1; }
  .findings-extra { align-items: stretch; flex-direction: column; padding-inline: 18px; }
  .findings-extra select { width: 100%; }
  .findings-table-head { display: none; }
  .finding-table-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 9px 12px;
    padding: 16px 18px;
  }
  .finding-table-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .finding-table-row > :nth-child(2) { grid-column: 2 / 3; grid-row: 1; }
  .finding-table-row > :nth-child(3) { grid-column: 1 / 3; grid-row: 2; }
  .finding-table-row > :nth-child(4) { grid-column: 3; grid-row: 2; justify-self: end; }
  .finding-table-row > :nth-child(5) { grid-column: 3; grid-row: 1; justify-self: end; }
  .finding-cell small { white-space: normal; }
  .finding-review-bar { flex-wrap: wrap; }
  .finding-detail-error { order: 4; flex-basis: 100%; text-align: left; }
  .finding-review-heading h2 { font-size: var(--text-xl); }
  .finding-review-bar { align-items: flex-start; }
  .section-card > .pipeline-grid { grid-template-columns: 1fr; }
  .pipeline-controls { align-items: stretch; flex-direction: column; }
  .pipeline-primary-actions { align-items: stretch; flex-direction: column; }
  .pipeline-provider select { width: 100%; }
  .pipeline-rerun-trigger { align-self: stretch; justify-content: center; }
  .card-actions { align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
  .events-card .card-head { display: grid; }
  .events-actions { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .events-actions input { width: 100%; }
  .event-row { grid-template-columns: 10px minmax(0, 1fr); gap: 8px 12px; }
  .event-row > time { grid-column: 2; grid-row: 1; }
  .event-marker { grid-column: 1; grid-row: 2; }
  .event-content { grid-column: 2; grid-row: 2; }
  .artifacts-grid { padding: 6px 18px 18px; }
  .diagram-viewport { min-height: 320px; max-height: 70vh; padding: 16px; }
  .diagram-viewport .placeholder { min-height: 270px; }
}

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

/* ─── markdown tables (report / artifact viewer) ───────────────────────────── */
.md .md-table { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 9px; }
.md .md-table.scrollable::before {
  content: "Scroll →";
  position: sticky;
  left: calc(100% - 72px);
  z-index: 2;
  display: block;
  width: max-content;
  margin: 7px 7px -28px auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--hint-bg);
  color: var(--dim);
  font-size: var(--text-xs);
  pointer-events: none;
}
.md .md-table.scrollable { box-shadow: inset -18px 0 18px -20px var(--ink); }
.md table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
.md th, .md td { text-align: left; vertical-align: top; padding: 8px 12px;
  border-bottom: 1px solid var(--line); }
.md th { background: var(--surface-2); color: var(--ink-2); font-weight: var(--weight-semibold);
  white-space: nowrap; }
.md tbody tr:last-child td { border-bottom: 0; }
.md blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--line);
  color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ─── report reading typography ────────────────────────────────────────────── */
.report-card { overflow: visible; }
.report-card > .card-head {
  flex-wrap: wrap;
  position: sticky;
  top: 64px;
  z-index: 10;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--sticky-bg);
  backdrop-filter: blur(10px);
}
.file-meta { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-size: var(--text-xs); white-space: nowrap; }
.file-meta .icon { width: 14px; height: 14px; }
.report-version { width: auto; max-width: 260px; min-height: 34px; padding: 6px 30px 6px 10px; font-size: var(--text-sm); }
.report-card .card-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.report-action-group > :is(button, a, select) { min-height: 34px; white-space: nowrap; flex-shrink: 0; }
.report-action-group { display: flex; align-items: center; gap: 8px; }
.report-action-group + .report-action-group { border-left: 1px solid var(--line); padding-left: 16px; margin-left: 7px; }
.report-action-group:not(:has(> :not([hidden]))) { display: none; }
#report-error { flex-basis: 100%; }
#report-error:empty { display: none; }
.report-frame { border: 0; }
.report-frame .body { max-height: none; }
.artifact-view .report-md, .report-frame .md {
  width: 100%; max-width: none; margin: 0; padding: 24px var(--space-6) 48px;
  font-size: var(--text-base); line-height: 1.7;
}
.report-frame .md > p, .report-frame .md > h2, .report-frame .md > h3,
.report-frame .md > h4, .report-frame .md > h5, .report-frame .md > ul,
.report-frame .md > ol, .report-frame .md > blockquote, .report-frame .md > hr {
  width: 100%;
  max-width: 780px;
  margin-left: 0;
  margin-right: auto;
}
.report-frame .md > .md-table { width: 100%; max-width: none; margin: 20px 0 28px; }
.report-frame .md > .md-table th { white-space: normal; }
.artifact-view .md h2, .report-frame .md h2 { font-size: var(--text-xl); margin: 8px 0 16px; letter-spacing: -.015em; }
.artifact-view .md h3, .report-frame .md h3 { font-size: var(--text-md); margin: 30px 0 10px; letter-spacing: -.01em; }
.artifact-view .md h4, .report-frame .md h4 { font-size: var(--text-base); margin: 22px 0 8px; }
.artifact-view .md h5, .report-frame .md h5 { font-size: var(--text-sm); margin: 18px 0 6px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.artifact-view .md p, .artifact-view .md li { color: var(--ink-2); }
.artifact-view .md li { margin: 5px 0; }
.artifact-view .md strong { color: var(--ink); }
.card-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }

/* ─── compact run context ──────────────────────────────────────────────────── */
.archive-notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 58px;
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn);
}
.archive-notice-copy { display: flex; align-items: center; gap: 8px; min-width: 0; margin-right: auto; }
.archive-notice-copy .icon { width: 16px; height: 16px; flex: none; color: var(--warn); }
.archive-notice-copy strong { color: var(--warn); font-weight: var(--weight-medium); white-space: nowrap; }
.archive-notice-copy > span { color: var(--warn); opacity: .82; white-space: nowrap; }
.archive-notice-error { flex-basis: 100%; }
.archive-notice-error:empty { display: none; }
.run-context {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  min-height: 98px;
  margin-bottom: 16px;
  padding: 20px 0;
}
.run-context h1 {
  min-width: 0;
  overflow: visible;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  white-space: normal;
}
.run-context-error { flex-basis: 100%; margin: -12px 0 0; text-align: right; }

/* ─── finding re-check controls ────────────────────────────────────────────── */
button.recheck {
  min-height: 38px;
  padding: 7px 11px;
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
button.recheck:hover:not(:disabled) { border-color: var(--accent); background: var(--tint); color: var(--accent); }
.badge.recheck-live { display: inline-flex; align-items: center; gap: 6px;
  background: var(--tint); color: var(--accent); }

/* ─── chat bubbles: whitespace + pending state ─────────────────────────────── */
.msg .mtext { white-space: pre-wrap; }
.msg .mtext.md { white-space: normal; }
.msg.pending { opacity: .65; }

html { scrollbar-gutter: stable; }
.project-heading { display: grid; gap: 10px; min-width: 0; }
.project-metadata { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; font-size: var(--text-sm); }
.project-metadata > div { display: flex; gap: 6px; align-items: baseline; }
.project-metadata dt { color: var(--dim); }
.project-metadata dd { margin: 0; color: var(--ink-2); font-weight: var(--weight-medium); }
.project-heading-actions { display: flex; flex: none; align-items: center; gap: 8px; margin-left: auto; }
.project-heading-actions > :is(button, .linkbtn) { min-height: 34px; padding: 6px 13px; }
button, input, textarea, select, .linkbtn { font-feature-settings: inherit; }
input, textarea, select { font-family: var(--sans); font-size: var(--text-base); font-weight: var(--weight-regular); }
.checklist-status { margin-left: auto; font-size: var(--text-xs); white-space: nowrap; }
.checklist .ok .checklist-status { color: var(--ok); }
.checklist li:not(.ok) .checklist-status { color: var(--warn); }
.action-dialog-actions > :is(button, .linkbtn) { min-height: 38px; justify-content: center; }
.next-step { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.next-step h2 { font-size: var(--text-md); }
.next-step p { margin: 4px 0 0; color: var(--ink-2); }
.next-step .linkbtn { flex: none; }
.project-next-step { display: flex; align-items: center; gap: 8px; width: 100%; color: var(--ink-2); font-size: var(--text-xs); }
.project-next-step .icon { margin-left: auto; }
.report-contents { padding: 12px 16px; margin: 20px var(--space-6) 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--text-sm); }
.report-contents > summary { cursor: pointer; font-weight: var(--weight-medium); }
.report-contents nav { display: grid; justify-items: start; gap: 6px; padding-top: 12px; }
#report-view :is(h2, h3) { scroll-margin-top: 90px; }
.pulse.queued { animation: none; background: var(--dim); }
/* Finding controls and history */
.state-chip, .inline-select { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1.5; white-space: nowrap; }
.inline-select { cursor: pointer; }
.inline-select:hover { border-color: var(--input-hover); background: var(--surface-2); }
.inline-select.disabled { opacity: .55; pointer-events: none; }
.state-chip::before, .inline-select::before { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); content: ""; }
.inline-select::after { flex: none; width: 5px; height: 5px; margin-top: -3px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; color: var(--dim); transform: rotate(45deg); content: ""; }
.inline-select select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; appearance: none; -webkit-appearance: none; }
.inline-select:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
:is(.state-chip, .inline-select):is(.critical, .blocked)::before { background: var(--critical-bg); }
:is(.state-chip, .inline-select).high::before { background: var(--bad); }
:is(.state-chip, .inline-select):is(.medium, .pending, .stale, .approved-with-constraints)::before { background: var(--warn); }
:is(.state-chip, .inline-select):is(.low, .in-progress, .need-more-info)::before { background: var(--info); }
:is(.state-chip, .inline-select):is(.confirmed, .remediated, .done, .approved, .current)::before { background: var(--ok); }
:is(.state-chip, .inline-select):is(.accepted-risk, .discovery, .running, .claude, .codex)::before { background: var(--accent); }
.finding-id { color: var(--dim); font-size: var(--text-xs); }
.finding-review .finding-review-heading h2 { margin: 6px 0 14px; }
.finding-controls { margin-bottom: 12px; }
.finding-controls > div { align-items: center; }
.finding-metadata a { color: var(--accent); }
.finding-review .finding-section > .md, .finding-root-cause, .finding-scenario-block { max-width: 88ch; line-height: 1.65; }
.finding-review .finding-section p { max-width: none; }
.finding-review .md p, .finding-review .md li { color: var(--ink-2); }
.finding-review .md p + p, .finding-review .md ul, .finding-review .md ol { margin-top: 10px; }
.finding-review .md ul, .finding-review .md ol { margin-bottom: 0; padding-left: 22px; }
.finding-review .md ul { list-style: disc; }
.finding-review .md ul + p, .finding-review .md ol + p { margin-top: 10px; }
.finding-review .md li + li { margin-top: 6px; }
.finding-review .md p + ul, .finding-review .md p + ol { margin-top: 6px; }
.finding-review .md code { padding: 1px 5px; border-radius: 4px; background: var(--code-soft); font-size: 92%; overflow-wrap: anywhere; }
.finding-review .md strong { color: var(--ink); }
.finding-review .evidence-list li { grid-template-columns: 64px minmax(0, 1fr); align-items: center; }
.finding-review .evidence-command { align-items: center; }
.finding-review .evidence-list code { display: block; padding: 8px 10px; overflow-x: auto; border-radius: var(--radius-sm); background: var(--surface-2); white-space: pre; }
.finding-review .evidence-list a code { color: var(--accent); }

/* History timeline */
.finding-history h3 { display: flex; align-items: center; gap: 8px; }
.history-count { display: inline-grid; place-items: center; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--muted-soft); color: var(--dim); font: var(--weight-regular) var(--text-xs)/1.5 var(--sans); }
.history-timeline { position: relative; margin: 16px 0 0; padding: 0; list-style: none; }
.history-timeline::before { position: absolute; top: 10px; bottom: 10px; left: 13px; width: 2px; background: var(--line-soft); content: ""; }
.history-entry { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; align-items: start; list-style: none; }
.history-entry + .history-entry { margin-top: 16px; }
.history-change + .history-change { margin-top: 6px; }
.history-marker { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--dim); }
.history-marker .icon { width: 14px; height: 14px; }
.history-avatar { overflow: hidden; border-color: var(--line); background: var(--muted-soft); color: var(--ink-2); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.history-avatar::before { content: attr(data-initial); }
.history-avatar img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.history-handle { color: var(--ink); font-weight: var(--weight-medium); text-decoration: none; }
.history-handle:hover { color: var(--accent); text-decoration: underline; }
.history-card-head .history-handle { font-size: var(--text-sm); }
.history-card-entry > .history-marker, .history-composer > .history-marker { margin-top: 3px; }
.history-line { margin: 0; padding: 4px 0 4px 15px; color: var(--ink-2); font-size: var(--text-sm); line-height: 1.5; }
.history-line strong, .history-card-head strong { color: var(--ink); font-weight: var(--weight-medium); }
.history-diff { display: inline-block; margin: 0 4px; padding: 1px 7px; border-radius: 5px; background: var(--muted-soft); color: var(--ink-2); font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; }
.history-diff.confirmed, .history-diff.remediated, .history-diff.done { background: var(--ok-soft); color: var(--ok); }
.history-diff.pending, .history-diff.medium { background: var(--warn-soft); color: var(--warn); }
.history-diff.critical, .history-diff.high { background: var(--bad-soft); color: var(--bad); }
.history-diff.low, .history-diff.in-progress { background: var(--info-soft); color: var(--info); }
.history-diff.accepted-risk { background: var(--tint); color: var(--accent); }
.history-recheck .history-marker { border-color: var(--accent-line); background: var(--tint); color: var(--accent); }
.history-recheck .history-card { border-color: var(--accent-line); }
.history-recheck .history-card-head { border-bottom-color: var(--accent-line); background: var(--tint); }
.history-recheck .history-kind { background: var(--surface); color: var(--accent); }
.history-verdict { color: var(--ok); }
.history-verdict.refuted { color: var(--bad); }
.history-verdict.unclear { color: var(--warn); }
.history-line time, .history-card-head time { color: var(--dim); font-size: var(--text-xs); white-space: nowrap; }
.history-line time { margin-left: 6px; }
.history-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.history-card-head { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); color: var(--dim); font-size: var(--text-xs); }
.history-card-head strong { font-size: var(--text-sm); }
.history-card-head time { margin-left: auto; }
.history-kind { padding: 1px 6px; border-radius: 999px; background: var(--muted-soft); color: var(--dim); font: var(--weight-regular) var(--text-xs)/1.5 var(--sans); }
.history-card .md { padding: 12px 14px; overflow-wrap: anywhere; }
.history-card .md p { margin: 0; }
.history-card .md p + p, .history-card .md ul { margin-top: 8px; }
.history-composer { margin-top: 20px; }
.history-composer .history-marker { border-color: var(--accent-line); color: var(--accent); }
.history-form textarea { min-height: 84px; resize: vertical; }
.history-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: var(--text-xs); }
.history-form-actions strong { color: var(--ink-2); font-weight: var(--weight-medium); }
@media (max-width: 620px) {
  .history-card-head { flex-wrap: wrap; }
  .history-card-head time { margin-left: 0; flex-basis: 100%; }
}

/* Shared simplifications across flows */
.intent-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.intent-section h2 { margin: 0 0 8px; font-size: var(--text-md); }
.intent-section .md p { margin: 0; color: var(--ink-2); }
.intent-section .md code { padding: 1px 5px; border-radius: 4px; background: var(--code-soft); font-size: 92%; }
.project-fact { color: var(--ink-2); font-size: var(--text-sm); white-space: nowrap; }
.project-meta .state-chip, .card-actions .state-chip { padding: 1px 9px 1px 8px; font-size: var(--text-xs); }
.msg .who img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.msg .md p { margin: 0; }
.msg .md code { padding: 1px 4px; border-radius: 4px; background: var(--code-soft); }
.queue-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 var(--space-6) 14px; padding: 8px 8px 8px 14px; border: 1px solid var(--ok-line); border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--ok); font-size: var(--text-sm); }
.queue-notice > span { display: inline-flex; align-items: center; gap: 8px; }
.findings-queue .findings-table-head, .findings-queue .finding-table-row { grid-template-columns: 96px minmax(0, 1fr) 160px 24px; }
.pipeline-phases h3 { margin: 0 0 12px; color: var(--dim); font-size: var(--text-xs); font-weight: var(--weight-medium); letter-spacing: .04em; text-transform: uppercase; }
.project-metadata > div:has(.inline-select:not(.text)) { align-items: center; }
.inline-select.text { gap: 5px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--ink-2); }
.inline-select.text::before { display: none; }
.inline-select.text::after { margin-top: -2px; }
.inline-select.text:hover { background: transparent; color: var(--ink); }
.inline-select.text.disabled { opacity: 1; }
.inline-select.text.disabled::after { display: none; }
.console .bar .dim { margin-left: auto; font-size: var(--text-xs); }
.events-timeline { max-width: none; margin: 0; padding: 18px var(--space-6) 22px; }
.events-timeline::before { top: 28px; bottom: 32px; left: calc(var(--space-6) + 13px); }
.event-entry + .event-entry { margin-top: 12px; }
.event-body { min-width: 0; }
.event-entry .history-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0 0; }
.event-entry .history-line time { margin-left: auto; }
.event-meta { color: var(--dim); font-size: var(--text-xs); }
.event-text { margin: 2px 0 0; color: var(--ink-2); font-size: var(--text-sm); }
.event-entry .event-details { margin-top: 4px; }
.event-entry .event-details summary { color: var(--accent); cursor: pointer; font-size: var(--text-xs); font-weight: var(--weight-medium); }
.event-entry .event-details pre { margin: 8px 0 0; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font: var(--text-xs)/1.6 var(--mono); }
.event-entry.ok .history-marker { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.events-timeline .empty { padding: 20px 0 0 42px; }

.event-entry.bad .history-marker { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad); }
@media (max-width: 620px) {
  .findings-queue .finding-table-row { grid-template-columns: 70px minmax(0, 1fr) 18px; }
  .finding-table-row > :nth-child(4) { grid-column: 3; grid-row: 1; }
  .queue-notice { flex-wrap: wrap; }
}

/* Report context and decision requirements. */
.report-update-notice { padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--warn-soft); color: var(--warn); font-size: var(--text-sm); }
.report-progress { display: flex; gap: 12px; align-items: flex-start; padding: 12px 24px; border-bottom: 1px solid var(--info-line); border-left: 4px solid var(--info); background: var(--info-soft); color: var(--ink); font-size: var(--text-sm); }
.report-progress strong { display: block; color: var(--info); }
.report-progress .icon { flex: none; margin-top: 2px; color: var(--info); animation: report-progress-spin 1.2s linear infinite; }
@keyframes report-progress-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .report-progress .icon { animation: none; } }
.report-passport { margin: 20px 0; padding: 16px; font-size: var(--text-sm); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.report-passport dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 24px; margin: 0; }
.report-passport dt, .report-requirement dt { color: var(--dim); font-size: var(--text-xs); margin-bottom: 4px; }
.report-passport dd, .report-requirement dd { margin: 0; overflow-wrap: anywhere; }
.report-passport details { margin-top: 16px; font-size: var(--text-xs); }
.report-passport code { overflow-wrap: anywhere; }
.report-limits { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.report-limits ul { padding-left: 20px; margin-bottom: 0; }
.report-requirements { margin: 16px 0 28px; border-top: 1px solid var(--line); }
.report-requirement { border-bottom: 1px solid var(--line); }
.report-requirement > summary { display: flex; align-items: baseline; gap: 16px; padding: 16px 0; color: var(--ink); cursor: pointer; }
.report-requirement > summary::before { content: "▸"; color: var(--dim); }
.report-requirement[open] > summary::before { content: "▾"; }
.requirement-title { flex: 1; font-weight: var(--weight-medium); }
.requirement-kind { color: var(--dim); font-size: var(--text-xs); }
.requirement-owner { width: 160px; font-size: var(--text-sm); color: var(--ink-2); }
.report-requirement dl { margin: 0 0 20px 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 32px; }
@media (max-width: 1100px) {
  .report-passport dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .report-passport dl, .report-requirement dl { grid-template-columns: 1fr; }
  .report-requirement > summary { flex-wrap: wrap; gap: 8px; }
  .requirement-title { flex-basis: 85%; }
  .requirement-owner { width: auto; }
}

/* Protocol map: location lanes, typed relationships, persistent context. */
.diagram-card { padding: 0; }
.diagram-card > .card-head { padding: 20px 24px; margin: 0; border-bottom: 1px solid var(--line); }
#map-controls { position: relative; padding: 10px 24px; }
.map-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.map-mode { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; background: var(--surface-2); flex: 0 0 auto; }
.map-mode-button { border: 0; border-radius: 7px; background: transparent; color: var(--dim); padding: 6px 14px; font-size: 12px; cursor: pointer; }
.map-mode-button.is-active { background: var(--accent); color: var(--accent-ink, #fff); }
.map-mode-button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.map-process-label { flex: 0 1 260px; min-width: 160px; }
.map-process-label select { width: 100%; min-height: 32px; font-size: 12px; margin: 0; }
.map-search-label { font-size: 11px; color: var(--dim); flex: 1; min-width: 180px; }
.map-search-label input { margin-top: 0; width: 100%; min-height: 32px; font-size: 12px; }
.map-tools .diagram-toolbar { padding-bottom: 1px; margin-left: auto; }
.map-context { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.map-context p { margin: 0; color: var(--dim); font-size: 12px; line-height: 1.5; }
.map-context button { flex-shrink: 0; }
.map-hidden { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; color: var(--dim); font-size: 12px; }
.map-hidden[hidden] { display: none; }
.map-hidden button { font-size: 11px; }
.map-detail-close { float: right; margin: 0 0 8px 12px; }
.map-detail-hide { margin: 0 0 8px; }
.map-search-results { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 12px; max-height: 150px; overflow: auto; }
.map-search-results[hidden] { display: none; }
.map-workspace { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); }
.map-workspace:has(.map-details:not([hidden])) { grid-template-columns: minmax(0, 1fr) 380px; }
.map-canvas-column { min-width: 0; }
#protocol-map .diagram-viewport { padding: 0; min-height: 420px; height: 65vh; max-height: 820px; border: 0; border-radius: 0; background: var(--surface-2); overflow: auto; overscroll-behavior: contain; cursor: grab; user-select: none; -webkit-user-select: none; }
#protocol-map .diagram-viewport:active { cursor: grabbing; }
.map-canvas { display: block; max-width: none; touch-action: pan-x pan-y; }
.map-canvas text { user-select: none; -webkit-user-select: none; pointer-events: none; }
.map-arrow { fill: context-stroke; }
.map-region > rect { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.map-region-title { fill: var(--dim); font: 600 13px var(--sans); }
.map-region-count { fill: var(--dim); font: 11px var(--mono); }
.map-node { cursor: pointer; --node-fill: var(--info-soft); --node-stroke: var(--info-line); }
.map-kind-committee { --node-fill: var(--warn-soft); --node-stroke: var(--warn-line); }
.map-kind-external-protocol { --node-fill: var(--ok-soft); --node-stroke: var(--ok-line); }
.map-kind-off-chain-service, .map-kind-other, .map-kind-eoa, .map-kind-multisig, .map-kind-timelock, .map-kind-governor { --node-fill: var(--muted-soft); --node-stroke: var(--line); }
.map-kind-library { --node-fill: var(--tint); --node-stroke: var(--accent-line); }
.map-node rect { fill: var(--node-fill); stroke: var(--node-stroke); stroke-width: 1.3; }
.map-node:hover rect, .map-node:focus-visible rect { stroke: var(--accent); stroke-width: 1.8; }
.map-node.is-selected rect { stroke: var(--accent); stroke-width: 2.4; }
.map-node.is-controller rect { stroke: var(--warn); stroke-dasharray: 4 3; }
.map-node.is-unresolved rect { stroke: var(--bad); stroke-dasharray: 4 3; }
.map-node.is-dim { opacity: .45; }
.map-node.is-dim:hover, .map-node.is-dim:focus-visible { opacity: 1; }
.map-node:focus { outline: none; }
.map-node-label { fill: var(--ink); font: 600 13px var(--sans); }
.map-node-meta { fill: var(--dim); font: 11px var(--mono); }
.map-node-badge { fill: var(--warn); font: 700 10.5px var(--sans); }
.map-stage { fill: var(--accent); }
.map-stage-number { fill: var(--accent-ink, #fff); font: 700 10px var(--sans); }
.map-finding-dot { fill: #475467; stroke: var(--surface); stroke-width: 1; }
.map-finding-dot.map-risk-critical { fill: #8f1d1d; }
.map-finding-dot.map-risk-high { fill: #b42318; }
.map-finding-dot.map-risk-medium { fill: #854d0e; }
.map-finding-dot.map-risk-low { fill: #175cd3; }
.map-finding-count { fill: #fff; font: 700 12px var(--sans); }
.map-bundle { fill: none; opacity: .45; }
.map-bundle.is-single { opacity: .22; }
.map-bundle.is-dim { opacity: .07; }
.map-bundle-count rect { fill: var(--surface-2); }
.map-bundle-count text { fill: var(--dim); font: 10px var(--mono); }
.map-edge { fill: none; stroke-width: 1.8; }
.map-edge.is-authority { stroke-dasharray: 6 4; }
.map-rel-call { stroke: var(--rel-call); } .map-rel-cross-chain-message { stroke: var(--rel-cross); } .map-rel-event { stroke: var(--rel-event); }
.map-rel-role, .map-rel-grant { stroke: var(--rel-role); } .map-rel-owner { stroke: var(--rel-owner); } .map-rel-upgrade { stroke: var(--rel-upgrade); }
.map-rel-config { stroke: var(--rel-config); } .map-rel-emergency { stroke: var(--rel-emergency); } .map-rel-other { stroke: var(--dim); }
#protocol-map { --rel-call: #7f8fb3; --rel-cross: #3f9d8f; --rel-event: #5f8f6a; --rel-role: #c98c2f; --rel-owner: #b85c85; --rel-upgrade: #d14848; --rel-config: #7a6fc4; --rel-emergency: #c9a227; }
html[data-theme="dark"] #protocol-map { --rel-call: #8f9fc3; --rel-cross: #4fb3a5; --rel-event: #7fb08a; --rel-role: #e0a458; --rel-owner: #c86b8f; --rel-upgrade: #e05c5c; --rel-config: #8a7fd4; --rel-emergency: #f0c04a; }
.map-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.map-legend-item { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: 10px; }
.map-legend-item::before { content: ""; width: 12px; height: 3px; border-radius: 2px; background: currentColor; }
.map-legend-item.map-rel-call::before { background: var(--rel-call); } .map-legend-item.map-rel-cross-chain-message::before { background: var(--rel-cross); }
.map-legend-item.map-rel-role::before, .map-legend-item.map-rel-grant::before { background: var(--rel-role); }
.map-legend-item.map-rel-event::before { background: var(--rel-event); } .map-legend-item.map-rel-owner::before { background: var(--rel-owner); }
.map-legend-item.map-rel-upgrade::before { background: var(--rel-upgrade); } .map-legend-item.map-rel-config::before { background: var(--rel-config); }
.map-legend-item.map-rel-emergency::before { background: var(--rel-emergency); }
.map-legend-note { font-size: 10px; color: var(--dim); }
.map-details { min-width: 0; padding: 20px; border-left: 1px solid var(--line); max-height: min(calc(65vh + 80px), 900px); overflow: auto; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.map-details[hidden] { display: none; }
.map-details h3 { font-size: 18px; line-height: 1.4; margin: 0 0 4px; color: var(--ink); }
.map-detail-header { margin-bottom: 8px; }
.map-detail-meta { color: var(--dim); font-size: 12px; margin: 0 0 8px; }
.map-detail-lead { color: var(--dim); font-size: 12px; margin: 0 0 10px; }
.map-detail-section { color: var(--dim); text-transform: uppercase; letter-spacing: .04em; font-size: 11px; margin: 16px 0 6px; }
.map-detail-list { list-style: none; margin: 0; padding: 0; }
.map-detail-item { padding: 7px 9px; border-radius: 6px; background: var(--surface-2); margin-bottom: 5px; font-size: 12.5px; color: var(--ink); }
.map-detail-item.is-link { cursor: pointer; }
.map-detail-item.is-link:hover, .map-detail-item.is-link:focus-visible { outline: 1px solid var(--accent); }
.map-detail-item strong { font-weight: 600; }
.map-detail-meta { display: block; }
.map-detail-item .map-detail-meta { color: var(--dim); font-size: 11.5px; margin: 2px 0 0; }
.map-detail-empty { color: var(--dim); font-size: 12px; }
.map-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; margin: 2px 0 0 6px; border: 1px solid var(--line); color: var(--dim); vertical-align: middle; }
.map-tag.map-rel-role, .map-tag.map-rel-grant { color: var(--rel-role); } .map-tag.map-rel-owner { color: var(--rel-owner); } .map-tag.map-rel-upgrade { color: var(--rel-upgrade); }
.map-tag.map-rel-config { color: var(--rel-config); } .map-tag.map-rel-emergency { color: var(--rel-emergency); }
.map-authority-list { border-top: 1px solid var(--line-soft); }
.map-authority-item { margin: 0; padding: 9px 2px; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: transparent; }
.map-authority-line { display: flex; min-width: 0; align-items: center; gap: 7px; }
.map-authority-line strong { min-width: 0; overflow-wrap: anywhere; }
.map-authority-line .map-tag { flex: none; margin: 0 0 0 auto; }
.map-authority-line .map-tag + .map-tag { margin-left: 0; }
.map-authority-direction { width: 12px; flex: none; color: var(--dim); font: 600 12px var(--mono); text-align: center; }
.map-authority-item .map-authority-action { margin: 3px 0 0 19px; line-height: 1.45; }
.map-authority-scope { display: block; margin: 5px 0 0 19px; color: var(--dim); font: 11px/1.5 var(--mono); overflow-wrap: anywhere; }
.map-authority-scope summary { cursor: pointer; }
.map-authority-scope code { display: block; margin: 3px 0; }
.map-authority-item.is-link:hover { outline: 0; background: var(--surface-2); }
.map-authority-item.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.map-address { display: block; margin: 8px 0; font: 11px/1.6 var(--mono); overflow-wrap: anywhere; }
.map-explorer-link { display: inline-block; margin-left: 8px; font: 10px var(--sans); color: var(--accent); }
.map-component-role { line-height: 1.6; margin: 8px 0 0; }
.map-risk-critical { --node-fill: var(--critical-bg); --node-stroke: var(--bad); --risk-ink: var(--bad); }
.map-risk-high { --node-fill: var(--bad-soft); --node-stroke: var(--bad); --risk-ink: var(--bad); }
.map-risk-medium { --node-fill: var(--warn-soft); --node-stroke: var(--warn); --risk-ink: var(--warn); }
.map-risk-low { --node-fill: var(--info-soft); --node-stroke: var(--info); --risk-ink: var(--info); }
.map-risk-info { --node-fill: var(--muted-soft); --node-stroke: var(--dim); --risk-ink: var(--dim); }
.map-warnings { margin: 0; padding: 10px 24px; color: var(--warn); background: var(--warn-soft); font-size: 12px; }
.map-fullpage { inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--surface); }
.map-fullpage::backdrop { background: var(--surface); }
.diagram-card.is-expanded { display: flex; flex-direction: column; position: fixed; inset: 0; margin: 0; border: 0; border-radius: 0; z-index: 150; overflow: hidden; background: var(--surface); }
.diagram-card.is-expanded > .card-head, .diagram-card.is-expanded > #map-controls { flex: 0 0 auto; }
.diagram-card.is-expanded .map-workspace { min-height: 0; flex: 1; }
.diagram-card.is-expanded .map-canvas-column { display: flex; flex-direction: column; min-height: 0; }
#protocol-map.is-expanded .diagram-viewport { min-height: 150px; height: auto; max-height: none; flex: 1; }
.diagram-card.is-expanded .map-details { max-height: 100%; }
#protocol-map.is-expanded > .card-head { padding: 10px 16px; }
#protocol-map.is-expanded > .card-head h2 { font-size: 16px; }
#protocol-map.is-expanded > .card-head p { display: none; }
#protocol-map > .card-head { flex-wrap: wrap; gap: 12px; }
#protocol-map > .card-head .card-actions { flex-shrink: 0; flex-wrap: wrap; max-width: 100%; }
#protocol-map > .card-head .card-actions > * { white-space: nowrap; }
@media (max-width: 1050px) {
  .map-workspace:has(.map-details:not([hidden])) { grid-template-columns: minmax(0, 1fr) 320px; }
  .map-details { padding: 14px; }
}
@media (max-width: 760px) {
  .map-workspace:has(.map-details:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .map-details { border-left: 0; border-top: 1px solid var(--line); max-height: 400px; }
  #map-controls { padding: 12px; }
  .diagram-card > .card-head { padding: 16px 12px; }
  #protocol-map .diagram-viewport { height: 55vh; min-height: 300px; }
  .map-tools { gap: 8px; }
  .map-search-label { flex-basis: 100%; }
  .map-footer { padding: 10px 12px; }
  .diagram-card.is-expanded .map-details { max-height: 30vh; }
  #protocol-map.is-expanded #diagram-source { display: none; }
}
.map-flow-coloured, .map-flow-key { --flow-colour: hsl(var(--flow-hue) 62% var(--flow-lightness)); }
.map-flow-shared { --flow-colour: var(--dim); }
.map-flow-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.map-flow-key::before { content: ""; width: 14px; height: 3px; background: var(--flow-colour); border-radius: 2px; flex: 0 0 auto; }
.map-layer:has(input:checked) { background: color-mix(in srgb, var(--flow-colour) 13%, var(--surface)); border-color: var(--flow-colour); color: var(--ink); }
.map-layer:has(input:checked):hover { background: color-mix(in srgb, var(--flow-colour) 20%, var(--surface)); }
.map-layer .map-flow-key { font-size: 12px; gap: 7px; }
.map-layer .map-flow-key::before { width: 7px; height: 7px; border-radius: 50%; }
.map-flow-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.map-flow-legend[hidden] { display: none; }
.map-flow-legend .map-flow-key { font-size: 10px; font-weight: 400; }

/* Keep map controls independent of the primary-button hover treatment. */
#protocol-map .map-layer-scroll:hover:not(:disabled),
#protocol-map .map-overview:hover:not(:disabled) { background: var(--tint); color: var(--ink); border-color: transparent; }
#protocol-map .map-overview[aria-pressed="true"]:hover { border-color: var(--accent); }
#protocol-map .map-finding:hover:not(:disabled),
#protocol-map .map-detail-link:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
#protocol-map .map-detail-back:hover:not(:disabled) { background: transparent; color: var(--accent); text-decoration: underline; border-color: transparent; }
#protocol-map .map-finding:active:not(:disabled),
#protocol-map .map-detail-link:active:not(:disabled) { background: var(--tint); }
#protocol-map .map-view-options > summary:hover,
#protocol-map .map-detail-section > summary:hover { color: var(--ink); background: transparent; }
#protocol-map .map-focus-label:has(input:disabled) { color: var(--disabled-ink); }
#protocol-map .map-finding:focus-visible { outline-offset: -2px; }
#protocol-map .map-edge:is(:hover, :focus-visible, .is-selected) .map-edge-line { stroke-width: 2.2; opacity: 1; }
.map-layer-tooltip { position: absolute; top: 100%; z-index: 4; width: 320px; max-width: calc(100% - 16px); padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink-2); box-shadow: 0 8px 20px rgba(0,0,0,.12); pointer-events: none; }
.map-layer-tooltip[hidden] { display: none; }
.map-layer-tooltip p { margin: 8px 0 0; font-size: 12px; line-height: 1.6; }
.map-layer-tooltip small { display: block; margin-top: 8px; color: var(--dim); font-size: 10px; }

.map-layer-scroll[hidden] { display: none; }
#protocol-map .map-layer-scroll:disabled { border-color: transparent; background: transparent; color: var(--disabled-ink); opacity: .4; }

.map-node-badge rect { fill: var(--node-stroke); stroke: none; }
.map-node-badge text { fill: #fff; font: 700 10px var(--mono); }
.map-risk-none .map-node-badge rect, .map-risk-info .map-node-badge rect { fill: var(--dim); }
.map-explorer-link { display: block; padding: 3px 0; font-size: 11px; }
.map-explorer-link::after { content: " ↗"; }
.map-component-role { color: var(--ink-2); }
.map-component-notes { color: var(--dim); font-size: 12px; border-left: 2px solid var(--line); padding-left: 10px; }
.map-details > .map-source-link { margin-top: 18px; }

.map-zoom-input { display: flex; align-items: center; gap: 4px; color: var(--dim); font-size: 12px; }
.map-zoom-input input { width: 70px; min-height: 32px; padding: 6px; text-align: right; font-size: 12px; }
#protocol-map .map-edge.is-preview .map-edge-line { stroke-width: 3; animation: map-relationship-pulse .8s ease-in-out infinite alternate; }
@keyframes map-relationship-pulse { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #protocol-map .map-edge.is-preview .map-edge-line { animation: none; opacity: 1; }
}

.map-node.map-risk-critical { --node-fill: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.map-node .map-node-kind { fill: var(--dim); font-size: 9px; letter-spacing: .4px; text-transform: uppercase; }

/* Saving feedback stays visible above the workspace without moving content. */
.action-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 10000; overflow: hidden; pointer-events: none; background: var(--info-soft); }
.action-progress::after { content: ""; display: block; width: 35%; height: 100%; background: var(--accent); animation: action-progress 1.1s ease-in-out infinite; }
@keyframes action-progress { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .action-progress::after { animation: none; width: 100%; } }

.history-changes { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.history-field-change { display: inline-flex; align-items: baseline; gap: 4px; }

/* Compact worker rows keep task activity under its owner. */
.dashboard-side #lanes .lane { gap: 6px 10px; }
#lanes .lane-state { padding: 2px 7px; border-radius: 5px; background: var(--surface-2); }
#lanes .lane.busy .lane-state { background: var(--warn-soft); color: var(--warn); }
#lanes .lane.dead .lane-state { background: var(--bad-soft); color: var(--bad); }
#lanes .lane-activity { padding: 6px 9px; }

/* Code colour: token classes of the vendored highlight.js (ADR-21). */
.hljs-keyword, .hljs-doctag, .hljs-template-tag, .hljs-type { color: var(--code-keyword); }
.hljs-title, .hljs-title.class_, .hljs-title.function_ { color: var(--code-title); }
.hljs-attr, .hljs-attribute, .hljs-literal, .hljs-meta, .hljs-number, .hljs-operator, .hljs-variable, .hljs-selector-attr, .hljs-selector-class, .hljs-selector-id { color: var(--code-constant); }
.hljs-string, .hljs-regexp, .hljs-meta .hljs-string { color: var(--code-string); }
.hljs-built_in, .hljs-symbol, .hljs-bullet { color: var(--code-variable); }
.hljs-comment, .hljs-code, .hljs-formula { color: var(--code-comment); }
