/* ───────────────── Design system ───────────────── */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e6ec;
  --border-strong: #cdd3dc;
  --text: #1a1f2b;
  --muted: #6b7280;
  --accent: #2f6df6;
  --accent-weak: #e8f0fe;
  --good: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 12px rgba(16,24,40,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  /* surface badge colors */
  --b-brief: #2f6df6; --b-rule: #7c3aed; --b-new: #16a34a; --b-skill: #d97706; --b-bug: #dc2626;
}

* { box-sizing: border-box; }
/* `hidden` must win over the explicit display rules below (.modal/.workspace/.status-bar). */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 20px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
u { text-decoration-color: var(--accent); }
code { font-family: var(--mono); }

/* ───────────────── Topbar + tabs ───────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.brand-mark { color: var(--accent); font-size: 18px; }
.brand-name { letter-spacing: -.02em; }
.tabs { display: flex; gap: 4px; }
.tab {
  border: none; background: none; cursor: pointer; font: inherit; color: var(--muted);
  padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 550;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.is-active { background: var(--accent-weak); color: var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.view { display: none; }
.view.is-active { display: block; }

/* ───────────────── Cards + buttons ───────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-sm);
  padding: 9px 16px; border: 1px solid transparent; transition: .12s; white-space: nowrap;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(47,109,246,.25); }
.btn-primary:hover:not(:disabled) { background: #245fe0; box-shadow: 0 2px 8px rgba(47,109,246,.3); }
.btn-cta { padding: 10px 30px; font-size: 14px; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: none; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ───────────────── Upload card ───────────────── */
.upload-card { max-width: 720px; margin-inline: auto; padding: 22px 24px 24px; }
.upload-head { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
/* even vertical rhythm between the form's blocks */
.upload-card > .dropzone + .row,
.upload-card > .row,
.upload-card > .brief-block,
.upload-card > .advanced { margin-top: 18px; }
.upload-card > .form-footer { margin-top: 22px; display: flex; justify-content: flex-end; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); padding: 26px; cursor: pointer; transition: .14s; text-align: center;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-weak); }
.dz-icon { font-size: 22px; color: var(--accent); }
.dz-text { color: var(--muted); }
.dz-text.has-file { color: var(--text); font-weight: 600; }
.row { display: flex; gap: 14px; align-items: flex-end; }
.row .field { flex: 1; min-width: 0; }
@media (max-width: 560px) { .row { flex-direction: column; align-items: stretch; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field em { font-weight: 400; font-style: normal; opacity: .7; }
/* Gated-OFF field (a parent `enabled`/`cornerBars` toggle is unchecked): dark-grey + inert. */
.bf-disabled { opacity: .5; }
.bf-disabled > span { color: #6b7280; }
input:disabled, select:disabled {
  background: var(--surface-2); color: #6b7280; cursor: not-allowed; border-color: var(--border);
}
input[type=text], input[type=number], select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
.advanced { border-top: 1px solid var(--border); padding-top: 14px; }
.advanced > summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px;
  list-style: none; display: inline-flex; align-items: center; gap: 7px; user-select: none; }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "▸"; font-size: 10px; color: var(--muted); }
.advanced[open] > summary::before { content: "▾"; }
.advanced > summary:hover { color: var(--text); }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

/* ───────────────── Status bar ───────────────── */
.status-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.run-id { margin-left: auto; color: var(--muted); font-size: 12px; }
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border-strong);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error { border-color: #f3c2c2; background: #fdf2f2; }
.error pre { white-space: pre-wrap; color: var(--danger); font-size: 12px; }

/* ───────────────── Split workspace ───────────────── */
.workspace { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
/* Propose-a-rule/skill blocks (SME review submission — replaces the old staging rail) */
.propose-block { margin-top: 12px; }
.pb-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
#pd-type { margin-bottom: 8px; }
#pd-desc { width: 100%; }
.pb-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.propose-or { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: 11.5px; margin: 16px 0 4px; }
.propose-or::before, .propose-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.propose-or span { padding: 0 10px; }
.pane-stage { position: sticky; top: 80px; }
@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } .pane-stage { position: static; } }

.result-head, .result-actions { display: flex; align-items: center; gap: 8px; }
.result-head { justify-content: space-between; margin-bottom: 12px; }
.summary-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;
}
.summary-grid li { display: flex; justify-content: space-between; font-size: 13px;
  padding: 5px 0; border-bottom: 1px dashed var(--border); }
.summary-grid li span.k { color: var(--muted); }
.summary-grid li span.v { font-weight: 600; }
.summary-grid li .v.pass { color: var(--good); } .summary-grid li .v.fail { color: var(--danger); }

.section-head { display: flex; align-items: center; justify-content: space-between; }
details.card > summary.section-head { cursor: pointer; list-style: none; }
details.card > summary.section-head::-webkit-details-marker { display: none; }
details.card > summary.section-head h3::before {
  content: "▾"; color: var(--muted); font-size: 11px; font-weight: 600; margin-right: 8px; }
details.card:not([open]) > summary.section-head h3::before { content: "▸"; }
details.card > summary.section-head:hover h3::before { color: var(--text); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 2px; }
.seg-btn { border: none; background: none; font: inherit; font-weight: 600; font-size: 12px;
  color: var(--muted); padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.seg-btn.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.inputs-pane { margin-top: 12px; }
.agent-card .agent-msg, .inputs-pane pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap;
  max-height: 320px; overflow: auto; margin: 0;
}
.kv-group { margin-bottom: 10px; }
.kv-group > .kv-title { font-weight: 650; font-size: 13px; margin-bottom: 4px; }
.kv { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0;
  border-bottom: 1px dashed var(--border); }
.kv .kk { color: var(--muted); font-family: var(--mono); }
.kv .kv-val { font-weight: 600; }
.rule-row { display: flex; gap: 8px; align-items: baseline; font-size: 12px; padding: 6px 0;
  border-bottom: 1px solid var(--border); }
.rule-row .rid { font-weight: 650; }
.rule-row .rmeta { color: var(--muted); font-family: var(--mono); }

/* ───────────────── Feedback + suggestion cards ───────────────── */
.fb-input { display: flex; gap: 10px; margin: 12px 0; align-items: flex-start; }
.fb-input textarea { flex: 1; resize: vertical; }

/* feedback notes list + diagnose dropdown */
.fbnote-list { display: flex; flex-direction: column; gap: 6px; }
.fbnote-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13px; }
.fbnote-row.is-applied { opacity: .62; }
.fbnote-text { flex: 1; }
.fbnote-meta { color: var(--muted); font-size: 11px; font-family: var(--mono); white-space: nowrap; flex: none; }
.fbnote-del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13px;
  padding: 0 2px; line-height: 1; flex: none; }
.fbnote-del:hover { color: var(--danger); }
.fbnote-row.is-unsaved { border-style: dashed; border-color: var(--border-strong); }
.fbnote-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.fbnote-savehint { font-size: 12px; }
.diag-select { flex: 1; padding: 9px 10px; font: inherit; font-size: 13px; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.diag-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.scard {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
  display: flex; gap: 10px; align-items: flex-start; transition: .12s; background: var(--surface);
}
.scard.sel { border-color: var(--accent); background: var(--accent-weak); }
.scard input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.scard-body { flex: 1; min-width: 0; }
.scard-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 7px; border-radius: 999px; color: #fff; }
.badge.brief { background: var(--b-brief); } .badge.rule { background: var(--b-rule); }
.badge.rule_new, .badge.component_new { background: var(--b-new); }
.badge.skill { background: var(--b-skill); } .badge.tool_bug { background: var(--b-bug); }
.badge.geo-warn { background: var(--warn); }
.badge.geo-ok { background: var(--good); }
/* Pre-flight input geometry-integrity caution banner */
.geo-caution { border: 1px solid var(--warn); background: rgba(217, 119, 6, .08);
  border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; font-size: 13px; }
.geo-caution > strong { color: var(--warn); }
.geo-caution.muted { border-color: var(--muted); background: rgba(120, 120, 120, .06); }
.geo-caution.muted > strong { color: var(--muted); }
.geo-caution-msg { margin-top: 3px; color: var(--fg, inherit); }
.geo-caution-why { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.scard .tgt { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.diff { font-family: var(--mono); font-size: 12px; }
.diff .old { color: var(--danger); text-decoration: line-through; opacity: .8; }
.diff .arrow { color: var(--muted); margin: 0 5px; }
.diff .new { color: var(--good); font-weight: 700; }
.scard .why { color: var(--muted); font-size: 12px; margin-top: 4px; }
.run-by { margin-top: 6px; }
.run-author { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; }
.run-author.muted-author { color: var(--muted); font-weight: 550; font-style: italic; }
.conf { font-size: 11px; color: var(--muted); margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.conf .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }

/* ───────────────── Staging panel ───────────────── */
.stage-card { padding: 16px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pill { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px; }
.staged-list { display: flex; flex-direction: column; gap: 8px; min-height: 60px; margin-bottom: 14px; }
.staged-item { display: flex; gap: 8px; align-items: flex-start; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.staged-item .si-body { flex: 1; min-width: 0; }
.staged-item .si-x { border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 15px; line-height: 1; padding: 0 2px; }
.staged-item .si-x:hover { color: var(--danger); }
.stage-actions { display: flex; flex-direction: column; gap: 8px; }
.stage-actions .btn { width: 100%; justify-content: center; }
.iterations { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.iter-chip { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; }
.iter-chip.cur { color: var(--accent); border-color: var(--accent); background: var(--accent-weak); }

/* ───────────────── Review ───────────────── */
.review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.review-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
/* filters size to their label (no truncation), share the buttons' height */
.review-actions select { width: auto; min-width: 168px; height: 38px; padding: 0 32px 0 12px; cursor: pointer; }
.review-actions .btn { height: 38px; }
.review-cards .scard .meta { font-size: 11px; color: var(--muted); margin-top: 6px; font-family: var(--mono); }
.bundle-card { cursor: pointer; }
.bundle-card:hover { border-color: var(--accent); background: var(--accent-weak); }
.bundle-card .v.pass { color: var(--good); } .bundle-card .v.fail { color: var(--danger); }
.bundle-card .v { font-size: 12px; font-weight: 700; }
.dl-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }

/* ───────────────── Toast + modal ───────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow); z-index: 50; animation: rise .2s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.4); display: flex;
  align-items: center; justify-content: center; z-index: 60; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 22px;
  max-width: 420px; width: 90%; box-shadow: var(--shadow); }
.modal-box p { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-lg { max-width: 720px; width: 92%; max-height: 82vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head-actions { display: flex; gap: 6px; align-items: center; }
.trace-body { overflow: auto; }
.trace-verify { padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.trace-verify.ok { background: #eafaf0; color: var(--good); }
.trace-verify.bad { background: #fdf2f2; color: var(--danger); }
.trace-verify span { color: var(--muted); font-weight: 500; }
.trace-issues { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; }
.trace-issues li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.trace-issues .ic { font-family: var(--mono); font-weight: 700; color: var(--b-rule); margin-right: 6px; }
.trace-raw summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12px; margin-top: 8px; }
.trace-raw pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; max-height: 300px; overflow: auto; }

/* ───────────────── Brief: upload JSON · or · fill a form ───────────────── */
.brief-block .req,
.field .req { color: var(--danger); font-style: normal; font-weight: 600; }
.field-label { font-size: 13px; font-weight: 650; color: var(--text); }
.brief-pane { margin-top: 12px; }
.brief-pane[hidden] { display: none; }
/* tame the native file picker so it matches the styled controls */
input[type="file"] {
  font: inherit; color: var(--muted); font-size: 13px; max-width: 100%;
}
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; margin-right: 12px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  transition: .12s;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
/* Shaft fields + corbel blocks flow as ONE static section (no inner scroll — the page scrolls). */
#brief-form-fields { display: flex; flex-direction: column; gap: 8px; padding: 2px 2px; }
.bf-sec { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  padding: 10px 12px; }
.bf-sec > summary { cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--text);
  list-style: none; display: flex; align-items: center; gap: 6px; user-select: none; }
.bf-sec > summary::-webkit-details-marker { display: none; }
.bf-sec > summary::before { content: "▸"; color: var(--muted); font-size: 10px; transition: transform .12s; }
.bf-sec[open] > summary::before { content: "▾"; }
.bf-sec > summary:hover { color: var(--accent); }
.bf-sec[open] > summary { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.bf-sec .adv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; margin-top: 0; }
@media (max-width: 620px) { .bf-sec .adv-grid { grid-template-columns: 1fr 1fr; } }
.bf-bool { flex-direction: row; align-items: center; gap: 8px; }
.bf-bool input { width: auto; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; display: block; }
.hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* ───────────────── Panel headings ───────────────── */
.panel-h { color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; }

/* ───────────────── ① Root cause panel ───────────────── */
.rootcause {
  margin-top: 14px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.rc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rc-head .panel-h { margin: 0; flex: 0 0 auto; }
.rc-head #share-dev-btn { margin-left: auto; }
.rc-conf { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.rc-high { background: rgba(22,163,74,.12); color: var(--good); }
.rc-medium { background: rgba(217,119,6,.12); color: var(--warn); }
.rc-low { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.rc-summary { font-weight: 650; margin: 4px 0; }
.rc-summary.sm { font-weight: 550; font-size: 12.5px; color: var(--text); margin-top: 6px; }
.rc-detail { color: var(--text); margin: 6px 0; white-space: pre-wrap; }

.attr-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.attr-chip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; }
.attr-kind { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 7px; border-radius: 999px; margin-right: 8px; color: #fff; }
.attr-kind.tool { background: var(--b-bug); }
.attr-kind.hard_rule { background: var(--b-rule); }
.attr-kind.skill { background: var(--b-skill); }
.attr-kind.rule { background: var(--b-brief); }
.attr-name { font-family: var(--mono); font-weight: 700; font-size: 12.5px; }
.attr-iter { font-size: 11px; color: var(--muted); margin-left: 8px; }
.attr-ev { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

/* ───────────────── Status badges (runs / developer) ───────────────── */
.badge.status-completed, .badge.status-resolved { background: rgba(22,163,74,.12); color: var(--good); }
.badge.status-running, .badge.status-in_progress { background: rgba(47,109,246,.12); color: var(--accent); }
.badge.status-failed { background: rgba(220,38,38,.12); color: var(--danger); }
.badge.status-open { background: rgba(217,119,6,.12); color: var(--warn); }

/* ───────────────── Developer status switcher ───────────────── */
.dev-status-row { display: flex; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.dev-st { border: 1px solid var(--border-strong) !important; text-transform: capitalize; }
.dev-st.is-active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

/* ───────────────────────── SME correction workflow (journey / picker / timeline / change-plan) ───────────────────────── */

/* Journey strip: input → v1 → v2 … */
.journey-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.journey-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.journey-strip { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }
.jchip { display: flex; flex-direction: column; gap: 2px; padding: 7px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface-2); text-decoration: none; color: var(--text); min-width: 92px; }
.jchip:hover { border-color: var(--accent); background: var(--accent-weak); }
.jchip.is-latest { border-color: var(--accent); background: var(--accent-weak); box-shadow: var(--shadow); }
.jchip-name { font-weight: 700; font-size: 13px; }
.jchip-delta { font-size: 11px; color: var(--muted); }
.jchip .jv.pass { color: var(--good); } .jchip .jv.fail { color: var(--danger); }
.jarrow { align-self: center; color: var(--muted); font-size: 13px; }

/* SME cards (numbered steps) */
.sme-card .sme-head { display: flex; gap: 12px; align-items: flex-start; }
.sme-step { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff;
  font-weight: 700; font-size: 14px; display: grid; place-items: center; margin-top: 2px; }
.sme-head h3 { margin: 0; }

/* Component picker */
.comp-pick { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.comp-select { flex: 1 1 260px; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; color: var(--text); }
.comp-legend { font-size: 12.5px; color: var(--muted); }
.comp-legend .legend-miss { color: var(--warn); font-weight: 600; }

/* Root-cause timeline */
.verdict { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 9px;
  border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.verdict.v-never_placed, .verdict.v-placed_but_verify_failed { background: rgba(220,38,38,.12); color: var(--danger); }
.verdict.v-placed_ok { background: rgba(22,163,74,.12); color: var(--good); }
.verdict.v-hard_rule_seeded { background: rgba(124,58,237,.12); color: #7c3aed; }
.verdict.v-not_applicable, .verdict.v-unknown_component { background: var(--surface-2); color: var(--muted); }
.timeline { margin: 12px 0 4px; }
.tl-row { display: flex; gap: 10px; align-items: flex-start; padding: 2px 0; }
.tl-dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; margin-top: 4px; background: var(--border-strong); box-shadow: 0 0 0 3px var(--surface); }
.tl-row.tl-placed .tl-dot, .tl-row.tl-clean .tl-dot { background: var(--good); }
.tl-row.tl-absent .tl-dot, .tl-row.tl-failed .tl-dot { background: var(--danger); }
.tl-row.tl-required .tl-dot { background: var(--accent); }
.tl-row.tl-hard_rule .tl-dot { background: #7c3aed; }
.tl-link { width: 1px; height: 8px; background: var(--border-strong); margin-left: 5px; }
.tl-stage { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.tl-fact { font-size: 13.5px; color: var(--text); margin-top: 1px; }
.tl-cite { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.rc-foot { font-size: 11.5px; margin-top: 8px; }

/* Change plan */
.changeplan { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.cp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cp-head .panel-h { margin: 0; }
.cp-badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; }
.cp-badge.quick { background: rgba(22,163,74,.12); color: var(--good); }
.cp-badge.full { background: rgba(217,119,6,.12); color: var(--warn); }
.cp-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cp-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.cp-main { font-size: 14px; }
.cp-main code { font-family: var(--mono); font-size: 12.5px; background: var(--surface); padding: 1px 5px; border-radius: 4px; }
.cp-main .old { color: var(--muted); text-decoration: line-through; }
.cp-main .arrow { margin: 0 6px; color: var(--muted); }
.cp-main .new { color: var(--good); font-weight: 700; }
.cp-meta { display: flex; gap: 10px; align-items: center; margin-top: 5px; }
.cp-aff { font-size: 12px; color: var(--muted); }
.cp-mode { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.cp-mode.quick { background: rgba(22,163,74,.12); color: var(--good); }
.cp-mode.full { background: rgba(217,119,6,.12); color: var(--warn); }
.cp-why { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.cp-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Diagnose card + version detail */
.diag-card .sme-step { background: linear-gradient(135deg,#2f6df6,#7c3aed); }
.cp-none { font-size: 13.5px; color: var(--muted); padding: 10px 0 2px; }
.vd-sec { margin-bottom: 16px; }
.vd-sec .panel-h { margin: 0 0 6px; }
.vd-list { list-style: none; margin: 0; padding: 0; }
.vd-list li { font-size: 13.5px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.vd-diff { display: flex; gap: 12px; font-size: 13px; }
.vd-diff .d-add { color: var(--good); } .vd-diff .d-rem { color: var(--danger); } .vd-diff .d-mov { color: var(--warn); }
.vd-issues { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text); }
.vd-issues li { padding: 2px 0; }
.vd-actions { margin-top: 12px; }
.vd-feedback { margin: 0; padding: 8px 12px; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 6px; font-style: italic; color: var(--text); font-size: 13.5px; }
.vd-cause { list-style: none; margin: 8px 0 0; padding: 0; }
.vd-cause li { font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--border); color: var(--text); }
.vd-stage { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); margin-right: 6px; }
.vd-conf { margin: 6px 0 0; font-size: 12px; }

/* ── Rules / Skills suggestion panel ───────────────────────────────── */
.seg-btn .pill { background: rgba(0,0,0,.12); color: inherit; margin-left: 4px;
  min-width: 16px; height: 16px; line-height: 16px; padding: 0 5px; }
.seg-btn.is-active .pill { background: var(--accent); color: #fff; }
.badge.mine { background: var(--accent); }
.hint.dev-route { color: var(--warn); font-weight: 600; }
.prop-pane { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.add-manual { align-self: flex-start; border: 1px dashed var(--border-strong);
  color: var(--muted); }
.add-manual:hover { color: var(--accent); border-color: var(--accent); }
.manual-form { display: flex; flex-direction: column; gap: 8px; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.manual-form .mf-row { display: flex; gap: 8px; }
.manual-form .mf-row > * { flex: 1; min-width: 0; }
.manual-form input, .manual-form textarea { font: inherit; font-size: 13px; padding: 7px 9px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); }
.manual-form textarea { resize: vertical; }
.mf-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Review tab — grouped by run ───────────────────────────────────── */
.review-run { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.review-run > details > summary { list-style: none; cursor: pointer; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-run > details > summary::-webkit-details-marker { display: none; }
.review-run > details[open] > summary { border-bottom: 1px solid var(--border); }
.review-run summary:hover { background: var(--accent-weak); }
.rr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.rr-counts { display: inline-flex; gap: 6px; }
.cnt { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; }
.cnt.rule { background: var(--b-rule); } .cnt.skill { background: var(--b-skill); }
.rr-meta { font-size: 11.5px; color: var(--muted); }
.rr-run { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; }
.rr-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 14px; }
.ri-group .ri-title { font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.ri-sub { margin-top: 8px; }
.ri-sub:first-of-type { margin-top: 0; }
.ri-subtitle { font-size: 11px; font-weight: 600; color: var(--text); margin: 0 0 5px 2px;
  display: flex; align-items: center; gap: 6px; }
.ri-subtitle::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--muted); }
.ri-sub--brief .ri-subtitle::before { background: var(--b-brief); }
.ri-sub--team  .ri-subtitle::before { background: var(--b-rule); }
.ri-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
/* Workspace Rules tab — brief vs team-rule subgroups */
.prop-sub + .prop-sub { margin-top: 10px; }
.prop-subtitle { font-size: 11px; font-weight: 600; color: var(--text); margin: 0 0 6px 2px;
  display: flex; align-items: center; gap: 6px; }
.prop-subtitle::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--muted); }
.prop-sub--brief .prop-subtitle::before { background: var(--b-brief); }
.prop-sub--team  .prop-subtitle::before { background: var(--b-rule); }
.ri-row { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); }
.ri-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ri-why { color: var(--muted); font-size: 12px; margin-top: 4px; }
.rr-actions { display: flex; justify-content: flex-end; }

/* ── Bundle modal: reinforcement version history ───────────────────── */
.ver-list { display: flex; flex-direction: column; gap: 6px; }
.ver-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  transition: border-color .12s, box-shadow .12s, background .12s; }
.ver-row:hover { border-color: var(--border-strong); background: var(--surface); box-shadow: var(--shadow); }
.ver-actions .btn { font-weight: 600; }
.ver-actions .btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }
.ver-tag { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-weak); padding: 1px 7px; border-radius: 6px; flex: none; }
.ver-label { font-weight: 600; font-size: 13px; }
.ver-meta { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.ver-verify { margin-left: auto; font-size: 13px; font-weight: 700; }
.ver-verify.pass { color: var(--good); } .ver-verify.fail { color: var(--danger); }
.ver-actions { display: inline-flex; gap: 6px; flex: none; }

/* ───────────────── Rules library (reinforce screen, right-docked) ───────────────── */
.reinforce-layout { display: grid; grid-template-columns: minmax(0, 700px) 400px; gap: 20px;
  justify-content: center; align-items: start; }
.reinforce-layout > .upload-card { max-width: none; margin-inline: 0; }
.pane-rules { position: sticky; top: 80px; }
@media (max-width: 1120px) {
  .reinforce-layout { grid-template-columns: 1fr; }
  .reinforce-layout > .upload-card { max-width: 700px; margin-inline: auto; }
  .pane-rules { position: static; max-width: 700px; margin-inline: auto; width: 100%; }
}
.rules-card { padding: 18px; display: flex; flex-direction: column;
  max-height: calc(100vh - 104px); }
@media (max-width: 1040px) { .rules-card { max-height: none; } }
.rules-head h3 { margin: 0 0 3px; }
.rules-head .muted { font-size: 12px; margin: 0; }
.rules-controls { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 6px; }
#rules-elem-seg { align-self: flex-start; }
.rules-search { width: 100%; padding: 7px 10px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.rules-search:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.rules-body { overflow-y: auto; margin: 6px -6px 0; padding: 2px 6px 4px; flex: 1; }

/* collapsible section */
.rules-sec { border-top: 1px solid var(--border); }
.rules-sec > summary { cursor: pointer; list-style: none; display: flex; align-items: center;
  gap: 8px; padding: 11px 2px; font-weight: 650; font-size: 13px; }
.rules-sec > summary::-webkit-details-marker { display: none; }
.rules-sec > summary::before { content: "▸"; color: var(--muted); font-size: 10px; }
.rules-sec[open] > summary::before { content: "▾"; }
.rules-sec > summary:hover { color: var(--accent); }
.rules-sec .sec-count { margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--muted); font-weight: 600; background: var(--surface-2);
  padding: 1px 7px; border-radius: 10px; }
.rules-sec .sec-body { padding: 0 2px 12px; }
.sec-note { font-size: 11.5px; color: var(--muted); margin: 0 0 8px; }

/* one selection / validation rule as a card */
.ruleC { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 11px;
  margin-bottom: 8px; background: var(--surface); }
.ruleC:hover { border-color: var(--border-strong); }
.ruleC-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.ruleC-name { font-weight: 650; font-size: 12.5px; }
.ruleC-when { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.ruleC-when .tk-when { color: var(--muted); font-weight: 600; }
.ruleC-when .tk-act { font-weight: 650; }
.ruleC-when .tk-arrow { color: var(--accent); font-weight: 700; padding: 0 3px; }
.ruleC-when b { font-weight: 700; }
.ruleC-more { margin-top: 7px; }
.ruleC-more > summary { cursor: pointer; font-size: 11.5px; color: var(--accent); font-weight: 600;
  list-style: none; }
.ruleC-more > summary::-webkit-details-marker { display: none; }
.ruleC-more[open] > summary { margin-bottom: 6px; }
.ruleC-desc { font-size: 12px; color: var(--muted); line-height: 1.55; margin: 0 0 7px;
  white-space: pre-line; }
.ruleC-mech { font-family: var(--mono); font-size: 11px; color: var(--muted);
  word-break: break-word; }
.ruleC-mech b { color: var(--text); }

/* precedence + gate badges (reuse .badge geometry from the feedback section) */
.badge.prec-hard_rule { background: var(--b-rule); }
.badge.prec-soft_default { background: var(--accent); }
.badge.prec-advisory, .badge.gate-advisory { background: var(--muted); }
.badge.prec-validation, .badge.gate-hard_gate { background: var(--danger); }
.badge.prec-always { background: var(--good); }
.sev { font-size: 10.5px; font-weight: 600; color: var(--muted); margin-left: auto;
  text-transform: uppercase; letter-spacing: .03em; }

/* cover face chips */
.cover-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cover-chip { font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 8px; }
.cover-chip b { font-family: var(--mono); }

/* row-wise rule tables (one row per rules.yaml entry) */
.rules-tbl { width: 100%; border-collapse: collapse; font-size: 11px; table-layout: fixed; }
.rules-tbl th { text-align: left; font-weight: 700; color: var(--muted); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .04em; padding: 5px 5px;
  border-bottom: 1.5px solid var(--border-strong); }
.rules-tbl td { padding: 7px 5px; border-bottom: 1px solid var(--border); vertical-align: top;
  line-height: 1.45; overflow-wrap: break-word; word-break: normal; hyphens: none; }
.rules-tbl tbody .rt-row { cursor: pointer; }
.rules-tbl tbody .rt-row:hover > td { background: var(--surface-2); }
.rt-name { font-weight: 650; color: var(--text); }
.rt-act { font-weight: 600; }
.rt-row .rt-name::before { content: "▸"; color: var(--muted); font-size: 9px; margin-right: 3px; }
/* Sentence rows — one plain-English rule per row (SME Rules library redesign) */
.rules-sent td { padding: 8px 6px; }
.rules-sent .rs-text { color: var(--text); line-height: 1.5; font-size: 11.5px; }
.rules-sent .rs-text b { font-weight: 650; color: var(--text); }
.rules-sent .rt-row .rs-text::before { content: "▸"; color: var(--muted); font-size: 9px; margin-right: 5px; }
.rules-sent .rs-chip { text-align: right; white-space: nowrap; }
/* Add-a-rule-for-this-run form: description on its own row, then dropdown + Add button */
.rsel-addgrid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 4px; }
.rsel-addgrid > #rsel-summary { flex: 1 1 100%; min-height: 68px; resize: vertical; line-height: 1.45; }
.rsel-addgrid > #rsel-prec { flex: 1 1 60%; }
.rsel-addgrid > #rsel-add-btn { flex: 0 0 auto; }
/* category sub-header inside the read-only "Default rules" section */
.rules-sent .rs-sub td { padding: 10px 6px 3px; font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; border-bottom: none; }
.rules-sent .rs-sub:first-child td { padding-top: 2px; }
.rt-row.rt-open .rt-name::before { content: "▾"; color: var(--accent); }
.rt-row.rt-open > td { background: var(--accent-weak); }
.rules-tbl .badge { font-size: 9px; padding: 2px 5px; letter-spacing: .02em; }
.rules-tbl .tk-when { color: var(--muted); font-weight: 600; }
.rt-more > td { background: var(--surface-2); padding: 9px 10px; }
.rt-more .ruleC-desc, .rt-more .ruleC-mech { margin: 0 0 6px; }
.rt-more .ruleC-desc:last-child, .rt-more .ruleC-mech:last-child { margin-bottom: 0; }
.rt-more .ruleC-desc { white-space: normal; color: var(--text); }
/* reference tables (materials / shapes / recipes) — content-sized, scroll if too wide */
.rules-tbl-wrap { overflow-x: auto; margin-bottom: 8px; }
.rules-tbl-auto { table-layout: auto; }
.rules-tbl-auto th, .rules-tbl-auto td { white-space: normal; padding: 5px 10px 5px 0; }
.ref-sub { font-weight: 650; font-size: 12px; margin: 12px 0 4px; color: var(--text); }
.muted-dash { color: var(--border-strong); }

/* ───────────────── Feedbacks tab (run → versions → feedback map) ───────────────── */
.fbmap-card { padding: 16px 18px; }
.fbmap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fbmap-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fbmap-open { font-family: var(--mono); font-weight: 700; color: var(--accent); text-decoration: none; }
.fbmap-open:hover { text-decoration: underline; }
.fbmap-meta { font-size: 12px; color: var(--muted); }
.fbmap-sec { font-weight: 650; font-size: 12.5px; margin: 14px 0 6px; }
.fbmap-sec .muted { font-weight: 400; font-size: 12px; }
.fbmap-versions, .fbmap-notes { display: flex; flex-direction: column; gap: 4px; }
/* version row: the whole row downloads that version's IFC */
.fbmap-vrow { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text); text-decoration: none; cursor: pointer; transition: border-color .12s, background .12s; }
.fbmap-vrow:hover { border-color: var(--accent); background: var(--accent-weak); }
.fbmap-fb { flex: 1; min-width: 0; font-weight: 600; }
.fbmap-label { flex: 1; }
.fbmap-bars { flex: none; font-size: 11.5px; font-family: var(--mono); }
.fbmap-verify { flex: none; font-weight: 700; }
.fbmap-vrow .ver-tag { flex: none; }
.fbmap-dl { flex: none; font-weight: 700; font-size: 12px; color: var(--accent); text-decoration: none;
  padding: 2px 6px; border-radius: 6px; }
.fbmap-dl:hover { background: var(--surface); text-decoration: underline; }
/* feedback row: the whole row opens the run to act on it */
.fbmap-note { display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 8px 10px; border: 1px solid transparent; border-bottom: 1px dashed var(--border);
  border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: background .12s, border-color .12s; }
.fbmap-note:hover { background: var(--surface-2); border-color: var(--border-strong); }
.fbmap-note-text { flex: 1; }
.fbmap-note-st { flex: none; font-size: 11px; font-family: var(--mono); color: var(--muted); }
.fbmap-note-st.done { color: var(--good); font-weight: 700; }
.fbmap-note-go { flex: none; font-size: 11px; color: var(--accent); font-weight: 600; opacity: 0; transition: opacity .12s; }
.fbmap-note:hover .fbmap-note-go { opacity: 1; }

/* Auto-build (column) — resolve-geometry result panel */
.autobrief-result { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border, #d0d7de);
  border-radius: 8px; background: var(--panel, #f6f8fa); }
.autobrief-result .ok { margin: 0 0 6px; color: var(--ok, #1a7f37); font-weight: 600; }
.autobrief-result .err { margin: 0; color: var(--err, #cf222e); }
.corbel-list { margin: 4px 0 8px; padding-left: 18px; }
.corbel-list li { margin: 2px 0; }
.corbel-list .muted { font-size: 0.85em; opacity: 0.7; }

/* Column corbel repeater (auto-built from geometry) */
.corbel-blocks { margin-top: 12px; }
.cb-head { margin: 14px 0 6px; font-size: 0.95em; }
.cb-block { margin: 8px 0; border: 1px solid var(--border, #d0d7de); border-radius: 8px; padding: 6px 10px; }
.cb-block > summary { cursor: pointer; font-weight: 600; }
.cb-label { font-weight: 400; opacity: 0.75; margin-left: 6px; font-size: 0.9em; }
.cb-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0; padding: 8px 10px;
  background: var(--panel, #f6f8fa); border-radius: 6px; }
.cb-locked { display: flex; flex-direction: column; gap: 2px; }
.cb-lk { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.6; }
.cb-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.cb-chip { font-size: 0.78em; padding: 1px 7px; border-radius: 10px; background: var(--chip, #eaeef2);
  border: 1px solid var(--border, #d0d7de); }
.cb-axis { margin: 8px 0; }
.cb-axis-h { font-size: 0.82em; font-weight: 600; opacity: 0.8; margin-bottom: 4px; }

/* Nested form groups — mirror the brief JSON hierarchy (links → recipe → zoning, etc.) */
.bf-group { margin: 8px 0 8px 10px; padding: 6px 10px; border-left: 2px solid var(--border, #d0d7de);
  border-radius: 0 6px 6px 0; background: color-mix(in srgb, var(--panel, #f6f8fa) 55%, transparent); }
.bf-group-h { font-size: 0.8em; font-weight: 600; letter-spacing: 0.02em; opacity: 0.75; margin: 2px 0 6px; }
.bf-group .bf-group { margin-left: 8px; }

/* ───────────────── Column skills panel (Default tasks + Task-specific tuneable) ───────────────── */
.sk-card { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  margin-bottom: 8px; }
.sk-card:hover { border-color: var(--border-strong); }
.sk-card.sk-off { opacity: .55; }
.sk-card-main { flex: 1 1 auto; min-width: 0; }
.sk-title { font-weight: 600; font-size: 13.5px; color: var(--text); display: flex; align-items: center; gap: 7px; }
.sk-summary { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.sk-actions { flex: 0 0 auto; }
.sk-badge { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.sk-badge-edit { background: var(--accent-weak); color: var(--accent); }
.sk-toggle-wrap { flex: 0 0 auto; padding-top: 2px; }
.sk-toggle { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* Skill reader / editor popup */
#skill-modal .modal-box { display: flex; flex-direction: column; max-height: 86vh; }
.skill-md { overflow-y: auto; padding: 4px 2px 2px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.skill-md h1 { font-size: 18px; margin: 0 0 10px; }
.skill-md h2 { font-size: 14.5px; margin: 16px 0 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.skill-md h1 + h2, .skill-md h2:first-child { border-top: none; padding-top: 0; }
.skill-md h3 { font-size: 13px; margin: 12px 0 3px; color: var(--muted); }
.skill-md p { margin: 4px 0; }
.skill-md ul { margin: 4px 0; padding-left: 20px; }
.skill-md li { margin: 2px 0; }
.skill-md code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.skill-md strong { color: var(--text); }
.skill-edit { flex: 1 1 auto; min-height: 46vh; resize: vertical; width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }
#skill-modal-foot { justify-content: flex-end; align-items: center; gap: 10px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border); }
#skill-modal-foot #skill-edit-note { margin-right: auto; }

/* Caution / capability banner in the skill editor (runtime files only) */
.skill-warn { margin: 2px 0 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: #fff6e6; border: 1px solid #f0d9a8; color: #7a5b12; font-size: 12.5px; line-height: 1.5; }
.skill-warn strong { color: #6a4e0e; }
@media (prefers-color-scheme: dark) {
  .skill-warn { background: #2c2410; border-color: #5a4a1e; color: #e8cf94; }
  .skill-warn strong { color: #f2dfa6; }
}

/* Column auto-build status line (top of the brief form) */
.autobrief-status { margin: 0 0 10px; padding: 8px 11px; border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.45; font-weight: 500; }
.autobrief-status.is-loading { background: var(--accent-weak); color: var(--accent); }
.autobrief-status.is-ok { background: #e7f6ec; color: #1b7a3d; border: 1px solid #b7e0c4; }
.autobrief-status.is-err { background: #fdecec; color: #b3261e; border: 1px solid #f5c2c0; }
@media (prefers-color-scheme: dark) {
  .autobrief-status.is-ok { background: #12261a; color: #7fd39b; border-color: #2c5138; }
  .autobrief-status.is-err { background: #2a1414; color: #f0a19b; border-color: #5a2a28; }
}

/* Informational note lists in the column Rules-library ("What happens" / "Not covered yet") */
.rl-notes { margin: 2px 0 4px; padding-left: 18px; }
.rl-notes li { margin: 5px 0; font-size: 12.5px; line-height: 1.5; color: var(--text); }
.rl-notes.rl-notes-warn li::marker { color: var(--warn); }
.rl-notes.rl-notes-warn li { color: var(--muted); }

/* Column 2D section viewer (eye button + modal) */
.bf-eye { margin-left: 8px; padding: 0 7px; font-size: 13px; line-height: 1.6; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.bf-eye:hover { background: var(--accent-weak); border-color: var(--accent); }
.bf-group-h { display: flex; align-items: center; }
#sec2d-modal .modal-box { display: flex; flex-direction: column; max-height: 92vh; width: min(1240px, 96vw); }
.sec2d-body { overflow: auto; padding: 4px 2px; min-height: 40vh; display: flex; align-items: center; justify-content: center; }
.sec2d-img { max-width: 100%; height: auto; display: block; }
.sec2d-legend { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); }
