/* Tracer - Decision Foundry brand tokens (decisionfoundry.com):
   accent #00AAFF / accent-deep #0078C8, deep blue #002283; Mulish + Poppins. */
:root {
  color-scheme: light;
  --page: #f7f8fc;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eef1f7;
  --border: #e5e9f0;
  --border-strong: #d5dbe8;
  --text: #181818;
  --text-2: #4a5160;
  --muted: #7b8496;
  --brand: #0078c8;
  --brand-hover: #00629f;
  --brand-accent: #00aaff;
  --brand-deep: #002283;
  --brand-tint: #eef7fd;
  --good: #067647; --good-bg: #ecfdf3; --good-bd: #abefc6;
  --warn: #b54708; --warn-bg: #fffaeb; --warn-bd: #fedf89; --warn-dot: #f79009;
  --crit: #b42318; --crit-bg: #fef3f2; --crit-bd: #fecdca; --crit-dot: #d92d20;
  --none: #667085; --none-bg: #f2f4f7; --none-bd: #e4e7ec;
  /* layer slots L1-L5 (validated categorical palette) */
  --s1: #0078c8; --s2: #ff8b1a; --s3: #009767; --s4: #8c14fc; --s5: #e0457b;
  --grid: #eef1f6;
  --radius: 6px;
  --font: "Mulish", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Poppins", "Mulish", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* the hidden attribute always wins over display rules */
html, body { margin: 0; height: 100%; }
body { background: var(--page); color: var(--text); font: 13.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.82em; }
code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 16px; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
svg.lucide { width: 16px; height: 16px; stroke-width: 1.75; flex: none; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 228px; flex: none; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(145deg, var(--brand-deep), var(--brand)); display: grid; place-items: center; flex: none; }
.tracer-mark { width: 28px; height: 28px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--brand-deep); line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-group { margin-bottom: 14px; }
.nav-heading { font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; background: none;
  border-radius: var(--radius); cursor: pointer; color: var(--text-2); text-align: left; font-weight: 500; }
.nav-item svg.lucide { color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-tint); color: var(--brand-deep); font-weight: 600; }
.nav-item.active svg.lucide { color: var(--brand); }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--crit); background: var(--crit-bg); border-radius: 10px; padding: 0 7px; line-height: 18px; }
.layer-tag { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 4px; font-size: 10.5px; font-weight: 700;
  color: var(--lc); background: color-mix(in srgb, var(--lc) 12%, white); flex: none; }
.nav-item .status-dot { margin-left: auto; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; flex: none; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 0 24px; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumbs svg.lucide { width: 14px; height: 14px; }
.crumb-client { display: inline-flex; align-items: center; gap: 6px; }
.client-switch { padding: 5px 10px; margin-left: -10px; border: 0; background: transparent; font: inherit; color: var(--text); font-weight: 500; border-radius: var(--radius); cursor: pointer; }
.client-switch:hover, .client-switch[aria-expanded="true"] { background: var(--brand-tint); }
.client-switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.client-switch svg.lucide:first-child { color: var(--muted); }
.client-switch svg.lucide:last-child { width: 13px; height: 13px; opacity: .55; }
.client-menu { position: fixed; z-index: 1000; min-width: 240px; max-width: 320px; max-height: 60vh; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06); animation: client-menu-in .12s ease-out; }
@keyframes client-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.client-menu-head { padding: 6px 10px 8px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.client-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 7px; font: inherit; font-size: 13.5px; color: var(--text); text-align: left; cursor: pointer; }
.client-menu-item:hover, .client-menu-item:focus-visible { background: var(--brand-tint); outline: none; }
.client-menu-item.current { font-weight: 600; }
.client-menu-badge { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--none-bg); color: var(--muted); }
.client-menu-item.current .client-menu-badge { background: var(--brand-tint); color: var(--brand-deep); }
.client-menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-menu-item svg.lucide { width: 16px; height: 16px; color: var(--brand); }
.setup-steps { list-style: none; margin: 0; padding: 0; }
.setup-step { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--border); }
.setup-step:first-child { border-top: 0; }
.setup-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--brand-tint); color: var(--brand-deep); }
.setup-text { flex: 1; min-width: 0; }
.setup-text p { margin: 2px 0 0; color: var(--muted); }
.setup-act { flex: none; }
@media (max-width: 640px) { .setup-step { flex-wrap: wrap; } .setup-act { margin-left: 40px; } }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.content { flex: 1; overflow-y: auto; }
.page { padding: 24px 28px 48px; max-width: 1480px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--brand-deep); }
.page-desc { margin: 4px 0 0; color: var(--text-2); max-width: 820px; }

/* ── Controls ──────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg.lucide { width: 15px; height: 15px; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; height: 32px; }
.segmented button { border: 0; background: var(--surface); padding: 0 12px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button.on { background: var(--brand-tint); color: var(--brand-deep); }
.select, .input { height: 32px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 0 10px; }
.select.sm, .input.sm { height: 28px; font-size: 12.5px; }
textarea.input { height: auto; padding: 8px 10px; width: 100%; resize: vertical; }
.select:focus, .input:focus, .btn:focus-visible, .segmented button:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 1px; }
.spinner { width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status ────────────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid; }
.pill .status-dot { width: 6px; height: 6px; }
.pill.plain { border-color: var(--border-strong); color: var(--muted); background: var(--surface); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--none); }
.st-PASS { color: var(--good); background: var(--good-bg); border-color: var(--good-bd); } .st-PASS .status-dot, .status-dot.st-PASS { background: var(--good); }
.st-WARN { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-bd); } .st-WARN .status-dot, .status-dot.st-WARN { background: var(--warn-dot); }
.st-FAIL { color: var(--crit); background: var(--crit-bg); border-color: var(--crit-bd); } .st-FAIL .status-dot, .status-dot.st-FAIL { background: var(--crit-dot); }
.st-NOT_CONNECTED { color: var(--none); background: var(--none-bg); border-color: var(--none-bd); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.prio { display: inline-grid; place-items: center; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.prio-P1 { background: var(--crit-dot); color: #fff; } .prio-P2 { background: var(--crit-bg); color: var(--crit); }
.prio-P3 { background: var(--warn-bg); color: var(--warn); } .prio-P4 { background: var(--none-bg); color: var(--none); }

/* ── Panels & tables ───────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.panel-title { font-weight: 700; font-size: 13.5px; }
.panel-sub { color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px; }
.panel-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
.grid-2.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--surface-2); }
.table tr.current td { background: var(--brand-tint); }
.table.compact td { padding: 7px 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.empty { color: var(--muted); text-align: center; padding: 32px 16px; }
.notice { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: var(--brand-tint); color: var(--brand-deep); border: 1px solid #cfe9fb; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.kv { display: flex; gap: 28px; flex-wrap: wrap; }
.kv-label { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

/* ── Overview ──────────────────────────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.metric { padding: 14px 18px; border-left: 1px solid var(--border); cursor: pointer; }
.metric:first-child { border-left: 0; }
.metric:hover { background: var(--surface-2); }
.metric-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.metric-value { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin-top: 4px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric-value.crit { color: var(--crit); }
.metric-foot { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.stage { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.stage:not(:last-child)::after { content: ""; position: absolute; right: -11px; top: 26px; width: 8px; height: 8px; border-top: 1.5px solid var(--border-strong);
  border-right: 1.5px solid var(--border-strong); transform: rotate(45deg); }
.stage-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; }
.stage-name { font-weight: 700; cursor: pointer; }
.stage-name:hover { color: var(--brand); }
.stage-body { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.stage-foot { border-top: 1px solid var(--border); padding: 8px 14px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.stage-counts { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.stage-counts span { display: inline-flex; align-items: center; gap: 4px; }

/* tool picker */
.picker { display: flex; flex-direction: column; gap: 4px; }
.picker-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.picker .select, .picker .multi-btn { width: 100%; }
.picker-hint { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.picker-hint .status-dot { width: 6px; height: 6px; }
.picker-hint.live { color: var(--good); }
.picker-hint.live .status-dot { background: var(--good); }
.multi { position: relative; }
.multi-btn { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; }
.multi-btn span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12); padding: 6px; }
.multi-pop label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.multi-pop label:hover { background: var(--surface-2); }
.multi-pop label .muted { margin-left: auto; font-size: 11px; }
.multi-pop-foot { display: flex; justify-content: flex-end; gap: 6px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }

/* layer health grid */
.hgrid { display: grid; gap: 3px; align-items: center; overflow-x: auto; }
.hgrid-head { font-size: 11px; color: var(--muted); text-align: center; }
.hgrid-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; white-space: nowrap; padding-right: 10px; }
.hcell { height: 22px; border-radius: 3px; cursor: pointer; border: 1px solid transparent; }
.hcell.st-PASS { background: #dcfae6; border-color: #abefc6; }
.hcell.st-WARN { background: #fef0c7; border-color: #fedf89; }
.hcell.st-FAIL { background: #fecdca; border-color: #fda29b; }
.hcell.st-NOT_CONNECTED { background: var(--none-bg); border-color: var(--none-bd); }
.hcell.current { box-shadow: 0 0 0 2px var(--brand-deep); }
.hcell:hover { filter: brightness(0.95); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .hcell { width: 12px; height: 12px; cursor: default; }
.summary-text { white-space: pre-wrap; color: var(--text-2); }

/* stacked status bar */
.stackbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stackbar span { display: block; height: 100%; }
.legend-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 16px; margin-top: 12px; font-size: 12.5px; }
.legend-grid div { display: flex; align-items: center; gap: 7px; }
.legend-grid b { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.big { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; }

/* ── Detail & triage ───────────────────────────────────────────────────── */
.detail { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); gap: 20px; align-items: start; }
.history { display: flex; gap: 3px; }
.history .hcell { width: 16px; height: 18px; cursor: default; }
.triage { display: flex; flex-direction: column; gap: 14px; }
.triage h4 { margin: 0; font-size: 14.5px; font-weight: 700; }
.section-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.hypo { border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius); padding: 10px 12px; }
.hypo.conf-high { border-left-color: var(--crit-dot); } .hypo.conf-medium { border-left-color: var(--warn-dot); } .hypo.conf-low { border-left-color: var(--border-strong); }
.hypo-title { font-weight: 600; }
.hypo-meta { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.steps { margin: 0; padding-left: 18px; }
.steps li { margin: 3px 0; }
.engine { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 10px; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.check-row { border-bottom: 1px solid var(--border); }
.check-row:last-child { border-bottom: 0; }
.check-row summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.check-row summary::-webkit-details-marker { display: none; }
.check-row summary svg.lucide { color: var(--muted); transition: transform 0.15s; }
.check-row[open] summary svg.lucide.chev { transform: rotate(90deg); }
.check-row .check-body { padding: 0 16px 16px 44px; }
.chart-box { position: relative; height: 300px; }
.layer-path { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.layer-path svg.lucide { width: 14px; height: 14px; color: var(--muted); }

/* ── Lineage ───────────────────────────────────────────────────────────── */
.lineage { overflow-x: auto; padding: 16px; }
.lin-node rect { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.lin-node.st-FAIL rect { stroke: var(--crit-dot); stroke-width: 1.5; fill: var(--crit-bg); }
.lin-node.st-WARN rect { stroke: var(--warn-dot); stroke-width: 1.5; fill: var(--warn-bg); }
.lin-node text { fill: var(--text); font-size: 11.5px; font-family: var(--font); }
.lin-node { cursor: pointer; }
.lin-node.selected rect { stroke: var(--brand); stroke-width: 2; }
.lin-edge { fill: none; stroke: var(--border-strong); stroke-width: 1; }
.lin-edge.hot { stroke: var(--crit-dot); stroke-width: 1.5; }
.lin-col { fill: var(--muted); font-size: 11.5px; font-weight: 600; font-family: var(--font); }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--brand-deep); color: #fff; padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; z-index: 50; opacity: 0; transform: translateY(8px); transition: all 0.2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1200px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric:nth-child(4) { border-left: 0; }
  .metric:nth-child(n+4) { border-top: 1px solid var(--border); }
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage::after { display: none; }
  .grid-2, .grid-2.even, .detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { width: 60px; }
  .sidebar .brand-text, .sidebar .nav-item span, .sidebar .nav-heading, .sidebar-foot, .sidebar-toggle { display: none; }
  .topbar { padding: 0 16px; } .page { padding: 16px; }
  .topbar-right .muted { display: none; }
  .metrics, .stages { grid-template-columns: minmax(0, 1fr); }
  .metric { border-left: 0; border-top: 1px solid var(--border); } .metric:first-child { border-top: 0; }
}

/* ── Money and the spend trace ─────────────────────────────────────────── */
.impact { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 700; white-space: nowrap;
  color: var(--crit); background: var(--crit-bg); border: 1px solid var(--crit-bd); font-variant-numeric: tabular-nums; }
.impact.leads { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-bd); }
.impact + .impact { margin-left: 4px; }
.impact-note { display: flex; gap: 8px; align-items: flex-start; color: var(--text-2); }
.impact-note svg.lucide { color: var(--crit); margin-top: 2px; }
.flow { display: flex; align-items: stretch; overflow-x: auto; padding: 16px; }
.flow-stage { flex: 1 1 0; min-width: 136px; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.flow-stage.bad { border-color: var(--crit-bd); background: var(--crit-bg); }
.flow-stage.first { outline: 2px solid var(--crit-dot); outline-offset: -1px; }
.flow-stage.off { background: var(--surface-2); color: var(--muted); }
.flow-label { font-size: 12px; font-weight: 600; color: var(--text-2); line-height: 1.35; overflow-wrap: anywhere; }
.flow-value { font-family: var(--font-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.flow-stage.off .flow-value { font: 600 13px/1.4 var(--font); }
.flow-flag { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; font-size: 12px; font-weight: 700; color: var(--crit); }
.flow-flag svg.lucide { width: 14px; height: 14px; }
.flow-link { flex: none; width: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.bad { color: var(--crit); }
.delta.ok { color: var(--good); font-weight: 600; }
.delta svg.lucide { width: 13px; height: 13px; }
.trace-cell.bad { background: var(--crit-bg); }
.trace-cell .delta { display: block; }
tr.trace-bad td { background: var(--crit-bg); }
.trace-break { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.trace-break:last-child { border-bottom: 0; padding-bottom: 0; }
.trace-break .row svg.lucide { width: 14px; height: 14px; color: var(--muted); }
.trace-why { display: flex; align-items: center; gap: 8px; color: var(--text); }
.trace-why:hover { text-decoration: none; color: var(--brand); }

/* Data volume */
.vol-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.spark { display: block; background: none; border: 0; }
.vol-table td.num { white-space: nowrap; }
.spark polyline { fill: none; stroke: var(--brand); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark.st-WARN polyline { stroke: var(--warn-dot); }
.spark.st-FAIL polyline { stroke: var(--crit-dot); }
.headroom-track { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.headroom-fill { height: 100%; background: var(--brand); border-radius: 3px; }
.headroom.near .headroom-fill { background: var(--warn-dot); }
.headroom.over .headroom-fill { background: var(--crit-dot); }
.headroom .cell-sub { margin-top: 4px; }
.vol-why { color: var(--warn); }
.crit-text { color: var(--crit); }
.warn-text { color: var(--warn); font-weight: 600; }

/* Collapsible sidebar */
.sidebar { transition: width .15s ease; overflow: hidden; }
.brand { position: relative; }
.sidebar-toggle { display: grid; place-items: center; width: 30px; height: 30px; margin-left: auto; flex: none; border: 0;
  border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }
.sidebar-toggle svg.lucide { width: 18px; height: 18px; }
/* Collapsed: the expand button sits over the logo and shows on hover or focus. */
.nav-collapsed .sidebar-toggle { position: absolute; left: 14px; top: 12px; width: 32px; height: 32px; margin: 0;
  background: var(--surface-2); color: var(--text); opacity: 0; transition: opacity .12s; }
.nav-collapsed .brand:hover .sidebar-toggle, .nav-collapsed .sidebar-toggle:focus-visible { opacity: 1; }
.nav-collapsed .sidebar { width: 60px; }
.nav-collapsed .brand { padding: 0 15px; }
.nav-collapsed .brand-text, .nav-collapsed .nav-heading, .nav-collapsed .sidebar-foot,
.nav-collapsed .nav-item > span:not(.layer-tag):not(.nav-count) { display: none; }
.nav-collapsed .nav { padding: 10px 8px 16px; }
.nav-collapsed .nav-group + .nav-group { border-top: 1px solid var(--border); padding-top: 10px; }
.nav-collapsed .nav-item { justify-content: center; padding: 0; position: relative; }
.nav-collapsed .nav-count { position: absolute; top: 1px; right: 1px; margin: 0; padding: 0 4px; font-size: 10px; line-height: 14px; }

/* Measured vs estimated money, spend trace rules */
.impact.est { color: var(--text-2); background: var(--none-bg); border-color: var(--none-bd); border-style: dashed; }
.impact-note.est { background: var(--none-bg); }
.flow-unit { font-size: 11px; color: var(--muted); margin-top: 2px; }
.trace-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; font-size: 13px; color: var(--text-2); }
.trace-rules > div { display: flex; gap: 10px; align-items: flex-start; }
.trace-rules svg.lucide { color: var(--brand); margin-top: 2px; }
.trace-rules b { color: var(--text); }
@media (max-width: 900px) { .trace-rules { grid-template-columns: 1fr; } }
.flow-basis { font-size: 10.5px; color: var(--muted); text-align: center; }

/* Rule book */
.rb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.rb-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.rb-card.off .rb-fields, .rb-card.off .rb-why { opacity: .5; }
.rb-card svg.lucide { color: var(--brand); }
.rb-why { font-size: 13px; color: var(--text-2); margin: 6px 0 0; line-height: 1.45; }
.rb-fields, .rb-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-top: 12px; }
.rb-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; min-width: 0; }
.rb-field .input, .rb-field .select { width: 100%; font-weight: 400; color: var(--text); }
.rb-field.wide { grid-column: 1 / -1; }
.rule-editor { padding: 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rb-ai { background: var(--brand-tint); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.rb-ai svg.lucide { color: var(--brand); }
.rb-ai textarea { flex: 1; }
.rb-form { margin-top: 0; margin-bottom: 10px; }
.cond .select[name="field"] { min-width: 160px; }
.cond .input { width: 180px; }
.rb-test { margin-top: 14px; }
.rb-tag { height: 18px; font-size: 11px; margin-left: 6px; text-decoration: none; vertical-align: middle; }
tr.muted-row td { opacity: .6; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 10px; transition: background .15s; }
.switch span::before { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand-accent); outline-offset: 1px; }
@media (max-width: 1000px) { .rb-grid, .rb-fields, .rb-form { grid-template-columns: 1fr; } }
.rb-settings { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.rb-settings summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 600; color: var(--brand); }
.rb-settings summary::-webkit-details-marker { display: none; }
.rb-settings summary svg.lucide { width: 14px; height: 14px; transition: transform .15s; }
.rb-settings[open] summary svg.lucide { transform: rotate(90deg); }
.rb-settings .rb-fields { margin-top: 10px; }

.page-head .btn.primary { align-self: flex-start; }
.so-list { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: var(--text-2); }
@media print {
  .sidebar, .topbar, .no-print, .toast { display: none !important; }
  .shell, .main, .content { display: block; height: auto; overflow: visible; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
}

/* Trust badges */
.badge-preview { display: block; }
.badge-help { margin: 0 16px 14px; }
.embed-menu { position: relative; display: inline-block; text-align: left; }
.embed-menu summary { list-style: none; }
.embed-menu summary::-webkit-details-marker { display: none; }
.embed-pop { position: absolute; right: 0; top: 34px; z-index: 20; display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16,24,40,.12); white-space: nowrap; }
.embed-pop .btn { justify-content: flex-start; }

/* ── Fixes ─────────────────────────────────────────────────────────────── */
.fix-counts { gap: 18px; margin-bottom: 14px; font-size: 13px; color: var(--text-2); }
.fix-step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); font-weight: 700; font-size: 12px; }
.fix-kind { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--surface-3); flex: none; }
.fix-row summary svg.lucide { width: 16px; height: 16px; }
.fix-row .pill svg.lucide { width: 12px; height: 12px; }
pre.diff { margin: 8px 0 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font: 12px/1.55 var(--mono); overflow-x: auto; white-space: pre; }
pre.diff .add { color: var(--good); background: var(--good-bg); display: inline-block; min-width: 100%; }
pre.diff .del { color: var(--crit); background: var(--crit-bg); display: inline-block; min-width: 100%; }
pre.diff .hunk { color: var(--muted); }
.fix-approve { gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.fix-approve .grow { min-width: 160px; }
.fix-outcome { padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--good-bd); background: var(--good-bg); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.fix-outcome.rejected { border-color: var(--none-bd); background: var(--none-bg); }
.fix-links { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.fix-link { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; font-size: 13px; }
.fix-link:hover { background: var(--surface-2); }
.fix-link svg.lucide { width: 15px; height: 15px; color: var(--muted); flex: none; }

/* ── Notify and Ask Tracer ─────────────────────────────────────────────── */
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-deep); font-weight: 700; font-size: 12px; flex: none; }
.notify-counts b { color: var(--text); }
.notify-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.notify-item.action { border-left: 3px solid var(--crit); }
.notify-item .pill svg.lucide { width: 12px; height: 12px; }
pre.notify-msg { white-space: pre-wrap; font-family: inherit; font-size: 13px; }
.people-table td { vertical-align: middle; }
.people-table .input, .people-table .select { width: 100%; min-width: 120px; }
label.check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.ask-box { border-color: #cfe9fb; }
.ask-form { gap: 10px; }
.ask-form > svg.lucide { color: var(--brand); width: 18px; height: 18px; flex: none; }
.ask-chip { cursor: pointer; border: 1px solid var(--border); background: var(--surface-2); }
.ask-chip:hover { border-color: var(--brand); color: var(--brand); }
.ask-answer { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13.5px; }
.ask-answer .pill { flex: none; }
.ask-lines { margin: 0; }

/* ── Data quality score ─────────────────────────────────────────────────── */
.score-card { display: grid; grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); }
.score-card.empty { display: block; padding: 18px; color: var(--muted); }
.score-main { display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-right: 1px solid var(--border); }
.score-dial { position: relative; width: 104px; height: 104px; flex: none; }
.score-ring { width: 100%; height: 100%; }
.score-ring circle { fill: none; stroke-width: 7; }
.score-ring .track { stroke: var(--grid); }
.score-ring .fill { stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.score-ring.tone-good .fill { stroke: var(--good); } .score-ring.tone-warn .fill { stroke: var(--warn-dot); } .score-ring.tone-crit .fill { stroke: var(--crit-dot); }
.score-num { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 34px; }
.score-num b { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.score-num span { font-size: 12px; color: var(--muted); margin-left: 1px; }
.score-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.score-grade { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.tone-good.score-grade { color: var(--good); } .tone-warn.score-grade { color: var(--warn); } .tone-crit.score-grade { color: var(--crit); }
.score-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.score-delta.up { color: var(--good); } .score-delta.down { color: var(--crit); }
.score-delta svg.lucide { width: 14px; height: 14px; }
.score-trend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.score-trend:hover { text-decoration: none; color: var(--brand); }
.score-layers { display: flex; flex-direction: column; padding: 10px 16px; }
.score-layer { display: grid; grid-template-columns: auto 120px minmax(60px, 1fr) 32px auto 16px; align-items: center; gap: 12px; padding: 6px 8px;
  border-radius: var(--radius); color: var(--text); font-size: 13px; }
.score-layer:hover { background: var(--surface-2); text-decoration: none; }
.score-layer > svg.lucide { color: var(--muted); width: 14px; height: 14px; }
.score-layer-name { font-weight: 600; }
.score-layer-val { text-align: right; font-variant-numeric: tabular-nums; }
.score-bar { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.score-bar i { display: block; height: 100%; border-radius: 3px; background: var(--none); }
.score-bar i.tone-good { background: var(--good); } .score-bar i.tone-warn { background: var(--warn-dot); } .score-bar i.tone-crit { background: var(--crit-dot); }
.score-how { font-size: 11.5px; padding: 6px 8px 2px; }
.metrics.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Undo the six-tile wrap rules (fourth tile starting a new row). */
.metrics.four .metric:nth-child(4) { border-left: 1px solid var(--border); border-top: 0; }
.metric-of { font-size: 13px; font-weight: 500; color: var(--muted); }
@media (max-width: 1100px) {
  .score-card { grid-template-columns: minmax(0, 1fr); }
  .score-main { border-right: 0; border-bottom: 1px solid var(--border); }
  .metrics.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics.four .metric:nth-child(3) { border-left: 0; }
  .metrics.four .metric:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 720px) {
  .score-layer { grid-template-columns: auto minmax(0, 1fr) 32px 16px; }
  .score-layer .score-bar, .score-layer .stage-counts { display: none; }
  .metrics.four { grid-template-columns: minmax(0, 1fr); }
  .metrics.four .metric { border-left: 0; border-top: 1px solid var(--border); } .metrics.four .metric:first-child { border-top: 0; }
}

/* ── How to use Tracer ─────────────────────────────────────────────────── */
.guide-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); counter-reset: step; }
.guide-step { padding: 16px; border-left: 1px solid var(--border); counter-increment: step; }
.guide-step:first-child { border-left: 0; }
.guide-step::before { content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; margin-bottom: 8px;
  border-radius: 3px; background: var(--brand-deep); color: #fff; font-size: 12px; font-weight: 700; }
.guide-step b { display: block; margin-bottom: 4px; }
.guide-step p { margin: 0; color: var(--text-2); font-size: 12.5px; }
.guide-list details { border-top: 1px solid var(--border); }
.guide-list details:first-child { border-top: 0; }
.guide-list summary { display: flex; align-items: center; gap: 10px; padding: 11px 16px; cursor: pointer; list-style: none; font-weight: 600; }
.guide-list summary::-webkit-details-marker { display: none; }
.guide-list summary .muted { font-weight: 400; }
.guide-list summary svg.lucide.chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
.guide-list details[open] summary svg.lucide.chev { transform: rotate(90deg); }
.guide-list .guide-body { padding: 0 16px 14px 42px; color: var(--text-2); }
.guide-list .guide-body p { margin: 0 0 8px; }
.guide-terms { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.guide-terms dt { font-weight: 600; } .guide-terms dd { margin: 0; color: var(--text-2); }
@media (max-width: 1100px) { .guide-steps { grid-template-columns: minmax(0, 1fr); } .guide-step { border-left: 0; border-top: 1px solid var(--border); } .guide-step:first-child { border-top: 0; } }
@media (max-width: 720px) { .sidebar .nav-item span.layer-tag { display: inline-grid; } .sidebar .nav-item .status-dot { display: none; } }
.nc-group { background: var(--surface-2); }
.nc-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.nc-list b { font-weight: 600; margin-right: 6px; }

/* Accounts */
.sidebar-account { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--border); }
.account-who { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; color: var(--text); }
.account-who:hover { text-decoration: none; }
.account-who:hover b { color: var(--brand); }
.account-avatar { width: 28px; height: 28px; background: var(--brand-deep); color: #fff; font-size: 11px; }
.account-text { display: grid; min-width: 0; line-height: 1.25; }
.account-text b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.icon-only { padding: 0 7px; }
.invite-link { display: flex; gap: 8px; margin-top: 8px; }
.invite-link .input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; }
details.collapsible > summary { cursor: pointer; list-style: none; gap: 8px; justify-content: flex-start; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible:not([open]) > summary { border-bottom: 0; }
@media (max-width: 720px) { .sidebar .account-text { display: none; } }

/* Live connections (Pipeline setup) */
details.conn { border-top: 1px solid var(--border); }
details.conn > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
details.conn > summary::-webkit-details-marker, .conn-more > summary::-webkit-details-marker { display: none; }
details.conn > summary:hover { background: var(--brand-tint); }
.conn-name { font-weight: 600; }
.conn-right { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
details.conn .chev, .conn-more .chev { width: 15px; height: 15px; color: var(--muted); transition: transform .15s; }
details.conn[open] > summary .chev, .conn-more[open] > summary .chev { transform: rotate(90deg); }
.conn-form { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 14px; }
.conn-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.conn-field.wide { grid-column: 1 / -1; }
.conn-field .input { width: 100%; }
.conn-help { font-size: 11.5px; color: var(--muted); }
.conn-sub { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.conn-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--brand-deep); font-weight: 600; margin-bottom: 8px; }
.conn-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conn-actions .right { margin-left: auto; }
.conn-result { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; border: 1px solid; }
.conn-result.ok { background: var(--good-bg, #ecfdf3); border-color: var(--good-bd, #b7ebc9); color: var(--good, #1a7f45); }
.conn-result.bad { background: var(--crit-bg, #fdecec); border-color: var(--crit-bd, #f5c2c2); color: var(--crit, #b42318); }
.conn-result svg.lucide { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.conn-notice { margin: 0 16px 12px; }
.conn-run { padding: 12px 16px 16px; }
.ok-text { color: var(--good, #1a7f45); }
.notice.small { font-size: 12.5px; padding: 8px 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--crit); }
.btn.ghost:hover { background: var(--crit-bg); }

/* Pipeline setup: tabs, layer rows */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 16px; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tab svg.lucide { width: 15px; height: 15px; }
.tab:hover { color: var(--brand-deep); }
.tab.on { color: var(--brand-deep); border-bottom-color: var(--brand); }
.layer-rows { list-style: none; margin: 0; padding: 0; }
.layer-row { display: grid; grid-template-columns: 40px minmax(200px, 1fr) minmax(0, 1.6fr); gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.layer-row:first-child { border-top: 0; }
.layer-row.off .layer-row-name { opacity: .55; }
.layer-row-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.layer-row-name > div { display: flex; flex-direction: column; min-width: 0; }
.layer-row-name .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row-tools { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.layer-row-tools .picker { width: 230px; }
.layer-row.custom .layer-row-tools { align-items: center; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: var(--border-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch-spacer { width: 34px; }
.add-layer { border-top: 1px solid var(--border); }
.add-layer > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 12px 16px; color: var(--brand-deep); font-weight: 600; }
.add-layer > summary::-webkit-details-marker { display: none; }
.add-layer > summary svg.lucide { width: 15px; height: 15px; }
.add-layer-form { padding: 0 16px 16px; }
.add-layer-form .picker { width: 220px; }
.settings-next { display: flex; justify-content: flex-end; }
.sched-toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.sched-toggle .switch { margin-top: 2px; }
.sched-toggle > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.sched-fields { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); transition: opacity .15s; }
.sched-fields .picker { width: 190px; }
.sched-fields .picker[hidden] { display: none; }
.sched-fields.off { opacity: .55; }
.sched-status { gap: 8px; flex-wrap: wrap; font-size: 12.5px; padding-top: 8px; padding-bottom: 8px; }
.sched-status svg.lucide, .runs-sched svg.lucide { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.sched-status .dot-sep { color: var(--border-strong); }
.runs-sched { align-self: center; margin-left: auto; white-space: nowrap; }
.picker-other { display: flex; gap: 6px; }
.picker-other .input { flex: 1; min-width: 0; }
.multi-add { display: flex; gap: 6px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.multi-add .input { flex: 1; min-width: 0; }
.dot-hollow { background: transparent !important; border: 1.5px solid var(--none, #98a2b3); }
.conn-gaps { border-top: 1px solid var(--border); padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.conn-gaps > div { display: flex; gap: 8px; align-items: flex-start; }
.conn-gaps svg.lucide { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--muted); }
@media (max-width: 900px) { .layer-row { grid-template-columns: 40px 1fr; } .layer-row-tools { grid-column: 2; justify-content: flex-start; } }
#nav-layers .nav-item > span:not(.layer-tag):not(.status-dot) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Issues ── */
.issue-summary { display: flex; align-items: center; gap: 28px; padding: 14px 18px; flex-wrap: wrap; }
.issue-stat { display: flex; align-items: baseline; gap: 7px; }
.issue-stat b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.issue-stat span { color: var(--muted); font-size: 13px; }
.issue-breakdown { position: relative; }
.issue-breakdown > summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--brand); display: inline-flex; align-items: center; gap: 4px; }
.issue-breakdown > summary::-webkit-details-marker { display: none; }
.issue-breakdown > summary .chev { width: 14px; height: 14px; transition: transform .15s; }
.issue-breakdown[open] > summary .chev { transform: rotate(180deg); }
.issue-breakdown-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; width: 480px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .12); }
.issue-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.issue-toolbar .segmented { height: 30px; }
.filter-menu { position: relative; }
.filter-menu > summary { list-style: none; }
.filter-menu > summary::-webkit-details-marker { display: none; }
.filter-menu > summary .nav-count { margin-left: 2px; color: var(--brand-deep); background: var(--brand-tint); }
.filter-menu > summary .nav-count:empty { display: none; }
.filter-row { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; display: flex; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .12); white-space: nowrap; }
.bulk-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius); background: var(--brand-tint); border: 1px solid #cfe9fb; font-size: 13px; font-weight: 600; color: var(--brand-deep); }
.bulk-bar[hidden] { display: none; }
.bulk-bar #bulk-n { margin-right: auto; }
.issue-list { display: flex; flex-direction: column; gap: 8px; }
.issue { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.issue > summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.issue > summary::-webkit-details-marker { display: none; }
.issue > summary:hover { background: var(--surface-2, #fafbfc); border-radius: 10px; }
.issue > summary .chev { width: 16px; height: 16px; flex: none; color: var(--muted); transition: transform .15s; }
.issue[open] > summary .chev { transform: rotate(90deg); }
.issue[open] > summary { border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.issue.handled { opacity: .72; }
.issue-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.issue-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-sub { font-size: 12.5px; color: var(--muted); }
.issue-impact { white-space: nowrap; }
.issue-progress { flex: none; display: inline-flex; align-items: center; gap: 8px; width: 150px; font-size: 12.5px; color: var(--muted); }
.issue-progress.done { color: var(--good); }
.issue-meter { flex: none; width: 48px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.issue-meter span { display: block; height: 100%; background: var(--good); }
.issue-body { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 12px; }
.issue-facts { display: flex; flex-direction: column; gap: 10px; }
.issue-body .table-scroll { border: 1px solid var(--border); border-radius: var(--radius); }
.issue-actions { display: flex; align-items: center; gap: 8px; }
.alert-status { display: inline-flex; align-items: center; gap: 7px; }
.panel-foot { display: flex; align-items: center; min-height: 38px; padding: 0 16px; border-top: 1px solid var(--border); }
@media (max-width: 760px) { .issue-progress, .issue-impact { display: none; } .issue-breakdown-pop { width: 300px; } .filter-row { flex-wrap: wrap; white-space: normal; width: 260px; } }
.btn.quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.quiet:hover { background: var(--surface-3); }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.danger:hover { filter: brightness(.92); }
.runs-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: -4px; }
.ret-note { margin: 10px 0 0; }
#ret-panel { margin-top: 16px; }
.issue-breakdown-pop { width: 380px; }
.issue-breakdown-pop .legend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }
