/* TraceProof web – design system */
:root {
  /* TraceProof design system – calm, data-first, enterprise. One brand blue, neutral slate, semantic colours only for status. */
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", ui-monospace, monospace;
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #fafbfc; --surface-3: #f1f3f6;
  --border: #e3e6eb; --border-strong: #cdd3dc;
  --text: #0e1726; --text-2: #3e4a5c; --muted: #657186; --faint: #98a2b3;
  --accent: #2457d6; --accent-hover: #1d49b8; --accent-2: #3d6ad9; --accent-soft: #edf2fd; --accent-text: #1e4bbe;
  --ink: #0f1a2e; --ink-2: #172642; --ink-text: #e8edf7; --ink-muted: #a9b6cf;
  --grad: linear-gradient(180deg, #2b60e0 0%, #2457d6 100%);
  --pass: #0f7b46; --pass-bg: #e8f5ee; --fail: #c8322b; --fail-bg: #fdeeec; --warn: #b95a06; --warn-bg: #fef4e6;
  --error: #8f1d16; --info: #2457d6; --info-bg: #edf2fd; --skip: #98a2b3;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05); --shadow: 0 2px 8px -2px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 18px 44px -14px rgba(15,23,42,.22);
  --radius: var(--r-md); --radius-sm: var(--r-sm);
  /* type scale – every font size in the app is one of these */
  --fs-2xs: 10.5px; --fs-xs: 11.5px; --fs-sm: 12.5px; --fs-base: 13.5px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 19px; --fs-2xl: 24px;
  /* corner radii */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px; --sidebar: 252px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0d1117; --surface: #151a22; --surface-2: #1a2029; --surface-3: #212833;
  --border: #2a3240; --border-strong: #3a4454;
  --text: #e6eaf0; --text-2: #b3bcc9; --muted: #8a94a6; --faint: #5d6778;
  --accent: #5b8def; --accent-hover: #7aa3f3; --accent-2: #6f9af0; --accent-soft: #16233f; --accent-text: #8fb2f5;
  --ink: #0b1220; --ink-2: #111c31;
  --grad: linear-gradient(180deg, #4f84ea 0%, #4677e0 100%);
  --pass: #3fb27a; --pass-bg: #0e2a1c; --fail: #f0625b; --fail-bg: #2e1513; --warn: #e3923f; --warn-bg: #2d1f0c; --info: #5b8def; --info-bg: #16233f;
  --shadow-sm: none; --shadow: 0 2px 10px -2px rgba(0,0,0,.5); --shadow-lg: 0 18px 44px -14px rgba(0,0,0,.65);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; font-variant-numeric: tabular-nums; letter-spacing: -.003em;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
code, pre, .mono { font-family: var(--mono); font-size: var(--fs-sm); }
::selection { background: var(--accent-soft); }

/* ---------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; transition: grid-template-columns .2s; }
.shell.collapsed { --sidebar: 68px; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: var(--fs-xl); letter-spacing: -.02em; }
.brand .logo { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--ink); display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); flex: none; }
.brand .logo svg { width: 18px; height: 18px; color: #fff; }
.brand b { color: var(--accent); }
.nav-group { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
  padding: 14px 10px 6px; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2);
  font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-item.active svg { opacity: 1; }
.shell.collapsed .nav-group, .shell.collapsed .nav-item span, .shell.collapsed .brand span, .shell.collapsed .side-foot { display: none; }
.side-foot { margin-top: auto; padding: 10px; font-size: var(--fs-sm); color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border); }
.topbar .crumb { font-weight: 600; color: var(--text); font-size: var(--fs-lg); white-space: nowrap; }
.topbar .crumb small { color: var(--muted); font-weight: 500; margin-left: 8px; }
.topbar .spacer { flex: 1; }
.content { padding: 28px; max-width: 1480px; width: 100%; margin: 0 auto; }

/* ---------- page header */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.025em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); max-width: 820px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: var(--fs-sm); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.section-title { font-size: var(--fs-base); font-weight: 600; color: var(--text); margin: 4px 0 8px; display: flex; align-items: center; gap: 8px; }
.section-title small { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); } .small { font-size: var(--fs-sm); } .tiny { font-size: var(--fs-xs); }
.hr { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------- forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); min-width: 160px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px 11px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
textarea { font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.55; resize: vertical; min-height: 120px; width: 100%; }
select { padding-right: 28px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-base); color: var(--text-2); cursor: pointer; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; height: 36px; padding: 0 14px; font: inherit;
  font-weight: 600; font-size: var(--fs-base); border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; transition: all .15s; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--fail); }
.btn.sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn.lg { height: 42px; padding: 0 20px; font-size: var(--fs-md); }
.btn.block { width: 100%; }
.icon-btn { width: 36px; padding: 0; }

/* ---------- badges, pills */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs);
  font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-PASS { color: var(--pass); background: var(--pass-bg); border-color: color-mix(in srgb, var(--pass) 25%, transparent); }
.b-FAIL { color: var(--fail); background: var(--fail-bg); border-color: color-mix(in srgb, var(--fail) 25%, transparent); }
.b-WARN { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.b-ERROR { color: var(--error); background: var(--fail-bg); border-color: color-mix(in srgb, var(--error) 25%, transparent); }
.b-INFO { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.b-SKIPPED, .b- { color: var(--muted); background: var(--surface-3); border-color: var(--border); }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--border);
  background: var(--surface); font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pill svg { width: 15px; height: 15px; flex: none; color: var(--accent); }
.pill.ok .dot { background: var(--pass); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pass) 20%, transparent); }
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; }

/* ---------- KPIs + verdict */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.kpi .l { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .l i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); }
.kpi .v { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .d { font-size: var(--fs-sm); color: var(--muted); }
.kpi::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--c, transparent); opacity: .7; }
.verdict { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: var(--radius); border: 1px solid; }
.verdict .ic { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; }
.verdict .ic svg { width: 22px; height: 22px; }
.verdict h3 { margin: 0; font-size: var(--fs-lg); }
.verdict p { margin: 2px 0 0; font-size: var(--fs-base); color: var(--text-2); }
.verdict.bad { background: var(--fail-bg); border-color: color-mix(in srgb, var(--fail) 25%, transparent); }
.verdict.bad .ic { background: var(--fail); color: #fff; } .verdict.bad h3 { color: var(--fail); }
.verdict.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.verdict.warn .ic { background: var(--warn); color: #fff; } .verdict.warn h3 { color: var(--warn); }
.verdict.good { background: var(--pass-bg); border-color: color-mix(in srgb, var(--pass) 25%, transparent); }
.verdict.good .ic { background: var(--pass); color: #fff; } .verdict.good h3 { color: var(--pass); }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); font-size: var(--fs-base); }
.banner svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.banner .actions { margin-left: auto; display: flex; gap: 8px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: var(--fs-base); border: 1px solid; }
.alert.err { background: var(--fail-bg); color: var(--fail); border-color: color-mix(in srgb, var(--fail) 25%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.ok { background: var(--pass-bg); color: var(--pass); border-color: color-mix(in srgb, var(--pass) 25%, transparent); }
.alert.info { background: var(--info-bg); color: var(--accent-text); border-color: color-mix(in srgb, var(--info) 25%, transparent); }

/* ---------- tabs (segmented) */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: var(--r-md); flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: var(--r-sm); font-size: var(--fs-base); font-weight: 500; color: var(--text-2); cursor: pointer; border: none;
  background: none; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.tab .count { font-size: var(--fs-xs); padding: 0 6px; border-radius: var(--r-pill); background: var(--fail-bg); color: var(--fail); }

/* ---------- tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 460px; background: var(--surface); }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-sm); }
table.data th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--text-2);
  padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 7px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
table.data td.wrap { white-space: normal; min-width: 260px; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tr.click { cursor: pointer; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.changed { background: var(--fail-bg) !important; color: var(--fail); font-weight: 600; }
table.data td.null { color: var(--faint); font-style: italic; }
.table-foot { display: flex; align-items: center; gap: 10px; padding: 8px 2px 0; font-size: var(--fs-sm); color: var(--muted); }

/* ---------- code */
pre.code { margin: 0; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: auto; max-height: 420px; line-height: 1.6; color: var(--text); white-space: pre; }
.k { color: #7c3aed; font-weight: 600; } .s { color: #059669; } .n { color: #c2410c; } .c { color: var(--faint); font-style: italic; }
[data-theme="dark"] .k { color: #b39dff; } [data-theme="dark"] .s { color: #5fd3a3; } [data-theme="dark"] .n { color: #ffa86b; }
details.fold { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
details.fold > summary { cursor: pointer; padding: 10px 14px; font-weight: 500; font-size: var(--fs-base); list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold > summary::before { content: "›"; font-size: var(--fs-lg); color: var(--muted); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > .inner { padding: 0 14px 14px; }

/* ---------- diff */
table.diff { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: var(--fs-sm); }
table.diff td { padding: 1px 8px; vertical-align: top; white-space: pre-wrap; word-break: break-word; width: 50%; }
table.diff td.no { width: 36px; color: var(--faint); text-align: right; user-select: none; }
table.diff tr.insert td.new, table.diff tr.replace td.new { background: var(--pass-bg); }
table.diff tr.delete td.old, table.diff tr.replace td.old { background: var(--fail-bg); }

/* ---------- test case card */
.tc { border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: var(--radius); background: var(--surface); }
.tc-head { display: flex; gap: 10px; align-items: center; padding: 12px 16px; cursor: pointer; }
.tc-head .id { font-family: var(--mono); font-size: var(--fs-sm); color: var(--muted); }
.tc-head .t { font-weight: 600; flex: 1; min-width: 0; }
.tc-body { padding: 0 16px 16px; display: none; }
.tc.open .tc-body { display: block; }
.tc .meta { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); margin: 2px 0 12px; }
.tc .meta b { color: var(--muted); font-weight: 500; }
.box { border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-base); }
.box .t { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.box.why { background: var(--fail-bg); } .box.next { background: var(--accent-soft); }
.ai-answer { border: 1px solid color-mix(in srgb, var(--accent-2) 30%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent-2) 6%, var(--surface)), var(--surface));
  border-radius: var(--radius); padding: 14px 16px; font-size: var(--fs-md); }
.ai-answer h1, .ai-answer h2, .ai-answer h3, .ai-answer h4 { font-size: var(--fs-md); margin: 10px 0 4px; }
.ai-answer ul { margin: 4px 0; padding-left: 20px; }
.btn.ai:not(.primary) { border-color: color-mix(in srgb, var(--accent-2) 40%, var(--border)); color: var(--accent-2); }
.btn.ai:not(.primary) svg { color: var(--accent-2); }
.ai-chat { display: flex; flex-direction: column; gap: 10px; }
.ai-chat .q { align-self: flex-end; max-width: 80%; background: var(--accent-soft); border-radius: 12px 12px 2px 12px; padding: 8px 12px; font-size: var(--fs-md); }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- lineage canvas */
.canvas-wrap { position: relative; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius);
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 9%, transparent) 1px, transparent 0) 0 0/18px 18px, var(--surface-2);
  padding: 18px; min-height: 160px; }
.canvas-tools { position: absolute; right: 12px; top: 12px; display: flex; gap: 6px; z-index: 3; }
.canvas { position: relative; transform-origin: 0 0; transition: transform .15s; }
.canvas > svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.edge { fill: none; stroke: var(--border-strong); stroke-width: 1.6; transition: stroke .15s; }
.edge.hot { stroke: var(--accent); stroke-width: 2.4; }
.edge-lab { position: absolute; transform: translate(-50%,-50%); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); padding: 0 8px; font-size: var(--fs-2xs); font-weight: 600; color: var(--text-2); white-space: nowrap; }
.node { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 11px 12px 10px;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s, border-color .15s; overflow: hidden; }
.node::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--faint)); }
.node:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.node.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent), var(--shadow); }
.node.dim { opacity: .5; border-style: dashed; }
.node .k { display: flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.node .k svg { width: 13px; height: 13px; }
.node .k .badge { margin-left: auto; font-size: var(--fs-2xs); padding: 0 7px; letter-spacing: .02em; }
.node .t { font-weight: 650; font-size: var(--fs-md); margin: 5px 0 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .r { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.node .r b { font-size: var(--fs-lg); color: var(--text); }
.node .dn { color: var(--fail); font-weight: 600; } .node .up { color: var(--warn); font-weight: 600; }
.node .bar { display: flex; height: 4px; border-radius: var(--r-xs); overflow: hidden; background: var(--surface-3); margin: 7px 0 5px; }
.node .bar i { height: 100%; }
.node .f { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; }
.node .acts button { font: 500 11px var(--font); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: var(--r-sm); padding: 4px 2px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .acts button:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.node .acts button.bad { color: var(--fail); background: var(--fail-bg); border-color: color-mix(in srgb, var(--fail) 25%, transparent); }
.legend { display: flex; gap: 16px; font-size: var(--fs-sm); color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- drawer, modal, toast */
.scrim { position: fixed; inset: 0; background: rgba(15,23,42,.38); z-index: 40; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.scrim.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: auto; background: var(--bg); z-index: 41; box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.drawer.show { transform: none; }
.drawer-head { display: flex; align-items: flex-start; gap: 14px; padding: 18px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: var(--fs-xl); letter-spacing: -.02em; }
.drawer-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.drawer-tabs { padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow: auto; padding: 20px 24px 40px; }
.modal { position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%,-48%) scale(.98); opacity: 0; transition: all .2s;
  width: min(1100px, 94vw); max-height: 88vh; display: flex; flex-direction: column; background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal.show { opacity: 1; transform: translate(-50%,-50%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: 16px 16px 0 0; }
.modal-head h3 { margin: 0; font-size: var(--fs-lg); }
.modal-head > svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.modal-body { overflow: auto; padding: 18px 22px 24px; }
.scrim.top { z-index: 50; }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: var(--r-md); font-size: var(--fs-base); box-shadow: var(--shadow-lg);
  animation: up .2s ease-out; max-width: 420px; }
.toast.err { background: var(--fail); color: #fff; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---------- progress, skeleton, empty */
.progress { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.progress.indet i { width: 35% !important; animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 18px 4px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; color: var(--faint); margin-bottom: 8px; }
.empty h3 { color: var(--text); margin: 0 0 4px; font-size: var(--fs-lg); }

/* ---------- misc layouts */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.side-card { position: sticky; top: 76px; }
.cte-row { display: grid; grid-template-columns: 1fr 260px; gap: 14px; }
@media (max-width: 1000px) { .cte-row { grid-template-columns: 1fr; } }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.filters { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.filters .frow { display: grid; grid-template-columns: 1.3fr 1fr 1.6fr 32px; gap: 8px; }
.filters input, .filters select { height: 32px; padding: 4px 8px; font-size: var(--fs-sm); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid var(--border-strong);
  font-size: var(--fs-sm); cursor: pointer; background: var(--surface); user-select: none; }
.chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-text); }
.tree { font-size: var(--fs-base); }
.tree .tnode { padding: 6px 10px; border-left: 2px solid var(--border); margin-left: 10px; }
.tree .tnode .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: var(--fs-base); }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.fade-in { animation: up .25s ease-out; }

/* ---------- on/off switch */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-base); font-weight: 500; cursor: pointer; user-select: none; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { position: relative; width: 34px; height: 20px; border-radius: var(--r-pill); background: var(--border); transition: background .15s; flex: none; }
.switch .track::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,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- sign-in page */
[hidden] { display: none !important; }
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(420px, 1fr); background: var(--bg); }
.signin-hero { position: relative; overflow: hidden; color: #fff; padding: 44px 56px; display: flex;
  background: radial-gradient(900px 520px at 0% 0%, rgba(61,106,217,.38) 0%, transparent 62%), radial-gradient(800px 600px at 100% 100%, rgba(36,87,214,.22) 0%, transparent 60%), linear-gradient(160deg, #0f1a2e 0%, #142443 100%); }
.signin-hero::before { content: ""; position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 36px 36px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); }
.hero-inner { position: relative; display: flex; flex-direction: column; gap: 30px; width: 100%; max-width: 560px; margin: auto 0; }
.hero-brand { padding: 0; color: #fff; }
.hero-brand .logo { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(6px); }
.hero-brand b { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--ink-muted); }
.hero-copy h1 { margin: 0 0 14px; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -.035em; font-weight: 700; }
.hero-copy h1 span { color: #c9d2ff; }
.hero-copy p { margin: 0; font-size: var(--fs-lg); line-height: 1.6; color: rgba(255,255,255,.82); max-width: 470px; }
.hero-art { width: 100%; max-width: 470px; height: auto; padding: 16px; border-radius: var(--r-lg); background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(8px); box-shadow: 0 30px 60px -30px rgba(10,10,60,.6); }
.ha-link { fill: none; stroke: rgba(255,255,255,.28); stroke-width: 1.6; }
.ha-flow { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 10 260; stroke-dashoffset: 270; animation: haflow 2.6s ease-in-out infinite; }
@keyframes haflow { to { stroke-dashoffset: 0; } }
.ha-node { opacity: 0; animation: hanode .5s ease-out forwards; }
.ha-node rect { fill: rgba(255,255,255,.12); stroke: rgba(255,255,255,.35); }
.ha-node.target rect { fill: rgba(255,255,255,.95); stroke: none; }
.ha-node text { font: 500 11px var(--font); fill: #fff; }
.ha-node text.n { font-family: var(--font); font-weight: 600; font-variant-numeric: tabular-nums; fill: rgba(255,255,255,.8); }
.ha-node.target text { fill: var(--accent); } .ha-node.target text.n { fill: var(--accent); }
@keyframes hanode { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hero-points li { display: flex; align-items: center; gap: 12px; font-size: var(--fs-md); color: rgba(255,255,255,.9); }
.hero-points svg { width: 30px; height: 30px; padding: 7px; border-radius: var(--r-sm); background: rgba(255,255,255,.14); flex: none; }
.hero-foot { font-size: var(--fs-sm); color: rgba(255,255,255,.6); }

.signin-main { position: relative; display: flex; align-items: center; justify-content: center; padding: 48px 24px; overflow-y: auto; }
.signin-theme { position: absolute; top: 18px; right: 18px; }
.signin-card { width: 100%; max-width: 440px; animation: up .35s ease-out; }
.signin-card h2 { margin: 0; font-size: var(--fs-2xl); letter-spacing: -.03em; }
.signin-card .lead { margin: 6px 0 24px; }
.mobile-brand { display: none; padding: 0 0 22px; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-md); }
.seg-item { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 6px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.seg-item svg { width: 14px; height: 14px; flex: none; }
.seg-item:hover { color: var(--text); }
.seg-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.connect-form { gap: 14px; }
.secure-note { display: flex; gap: 6px; align-items: flex-start; }
.secure-note svg { width: 13px; height: 13px; flex: none; margin-top: 2px; }

.recent { display: grid; gap: 8px; }
.recent-title { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.recent-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color .15s, box-shadow .15s, transform .15s; }
.recent-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); transform: translateY(-1px); }
.recent-item.busy { opacity: .6; pointer-events: none; }
.ri-ic { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.ri-ic svg { width: 17px; height: 17px; }
.ri-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ri-txt b { font-weight: 600; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-txt small { color: var(--muted); font-size: var(--fs-sm); }
.ri-go { width: 16px; height: 16px; color: var(--faint); flex: none; }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--faint); font-size: var(--fs-sm); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.signin-links { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dot-sep { color: var(--faint); }

@media (max-width: 960px) {
  .signin { grid-template-columns: 1fr; }
  .signin-hero { display: none; }
  .mobile-brand { display: flex; }
  .signin-main { align-items: flex-start; padding: 56px 16px 32px; }
}
@media (max-width: 420px) { .seg { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { .ha-flow, .ha-node, .signin-card { animation: none; opacity: 1; } }

/* ---------- signed-in user: avatar, menu, account page */
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--ink); color: #fff;
  font-size: var(--fs-sm); font-weight: 600; letter-spacing: .02em; }
.avatar.lg { width: 40px; height: 40px; font-size: var(--fs-md); }
.avatar.xl { width: 76px; height: 76px; font-size: var(--fs-2xl); box-shadow: 0 0 0 4px var(--surface), var(--shadow); }
.user-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 3px; border: 1px solid transparent; border-radius: var(--r-pill);
  background: transparent; color: var(--text); font: inherit; font-size: var(--fs-base); font-weight: 500; cursor: pointer; }
.user-btn:hover { background: var(--surface); border-color: var(--border); }
.user-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-caret { width: 14px; height: 14px; color: var(--muted); }
@media (max-width: 900px) { .user-name, .user-caret { display: none; } }
.menu-pop { position: fixed; z-index: 45; width: 270px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: up .15s ease-out; }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head b { display: block; font-size: var(--fs-md); }
.menu-head > div { min-width: 0; } .menu-head .small, .menu-head .tiny { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--text); font: inherit; font-size: var(--fs-md); cursor: pointer; text-align: left; }
.menu-item svg { width: 16px; height: 16px; color: var(--muted); }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger, .menu-item.danger svg { color: var(--fail); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

.account-head { overflow: hidden; }
.account-hero { height: 86px; background: radial-gradient(900px 520px at 0% 0%, rgba(61,106,217,.38) 0%, transparent 62%), radial-gradient(800px 600px at 100% 100%, rgba(36,87,214,.22) 0%, transparent 60%), linear-gradient(160deg, #0f1a2e 0%, #142443 100%); }
.account-id { display: flex; align-items: center; gap: 18px; padding: 14px 24px 20px; flex-wrap: wrap; }
.account-id .avatar.xl { margin-top: -52px; align-self: flex-start; }
.account-id h2 { margin: 0; font-size: var(--fs-xl); letter-spacing: -.02em; }
.account-tags { margin-top: 8px; gap: 6px; }
.account-grid { align-items: start; }
@media (max-width: 1000px) { .account-grid { grid-template-columns: 1fr; } }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; }
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv span { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kv b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); }

/* ---------- welcome screen (before the sign-in page) */
.welcome { position: fixed; inset: 0; z-index: 30; overflow: auto; color: #fff; display: flex; flex-direction: column; align-items: center; padding: 48px 16px 28px;
  background: radial-gradient(900px 520px at 0% 0%, rgba(61,106,217,.38) 0%, transparent 62%), radial-gradient(800px 600px at 100% 100%, rgba(36,87,214,.22) 0%, transparent 60%), linear-gradient(160deg, #0f1a2e 0%, #142443 100%);
  transition: opacity .38s ease, transform .38s ease; }
.welcome::before { content: ""; position: absolute; inset: 0; opacity: .12; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 40px 40px; mask-image: radial-gradient(ellipse at 50% 45%, #000 15%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 15%, transparent 70%); }
.welcome-glow { position: absolute; width: 620px; height: 620px; left: 50%; top: 42%; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(120,160,255,.18), transparent 65%); filter: blur(24px); animation: glow 9s ease-in-out infinite alternate; }
@keyframes glow { to { transform: translate(-44%, -56%) scale(1.12); } }
.welcome.leaving { opacity: 0; transform: scale(1.03); }
.welcome-inner { position: relative; margin: auto; width: 100%; max-width: 640px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.welcome-inner > * { animation: up .6s cubic-bezier(.2,.8,.2,1) both; }
.welcome-inner > :nth-child(2) { animation-delay: .08s; } .welcome-inner > :nth-child(3) { animation-delay: .16s; } .welcome-inner > :nth-child(4) { animation-delay: .24s; }
.welcome-inner > :nth-child(5) { animation-delay: .32s; } .welcome-inner > :nth-child(6) { animation-delay: .42s; } .welcome-inner > :nth-child(7) { animation-delay: .5s; }
.welcome-mark { width: 76px; height: 76px; border-radius: var(--r-xl); display: grid; place-items: center; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3); backdrop-filter: blur(8px); box-shadow: 0 20px 50px -18px rgba(10,10,70,.7), inset 0 1px 0 rgba(255,255,255,.25); }
.welcome-mark svg { width: 40px; height: 40px; color: #fff; }
.welcome-word { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; margin-top: -4px; }
.welcome-word b { color: #c9d2ff; }
.welcome h1 { margin: 6px 0 0; font-size: clamp(32px, 5.4vw, 56px); line-height: 1.05; letter-spacing: -.04em; font-weight: 700; }
.welcome h1 span { color: #c9d2ff; display: inline-block; }
.welcome p { margin: 0; max-width: 520px; font-size: var(--fs-lg); line-height: 1.6; color: rgba(255,255,255,.82); }
.welcome .hero-art { max-width: 500px; margin-top: 8px; }
.welcome-go { margin-top: 10px; display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 30px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: #fff; color: var(--ink); font: inherit; font-size: var(--fs-lg); font-weight: 600; box-shadow: 0 14px 34px -14px rgba(0,0,0,.6);
  transition: transform .15s ease, box-shadow .15s ease; }
.welcome-go svg { width: 18px; height: 18px; transition: transform .15s ease; }
.welcome-go:hover { transform: translateY(-2px); box-shadow: 0 24px 46px -14px rgba(10,10,70,.8); }
.welcome-go:hover svg { transform: translateX(3px); }
.welcome-go:focus-visible { outline: 3px solid rgba(255,255,255,.6); outline-offset: 3px; }
.welcome-hint { font-size: var(--fs-sm); color: rgba(255,255,255,.55); margin-top: -6px; }
.welcome-foot { position: relative; margin-top: 28px; font-size: var(--fs-sm); color: rgba(255,255,255,.55); text-align: center; }
.signin.entering { animation: signin-in .45s cubic-bezier(.2,.8,.2,1); }
@keyframes signin-in { from { opacity: 0; transform: scale(.985); } }
@media (prefers-reduced-motion: reduce) { .welcome-glow, .welcome-inner > *, .signin.entering { animation: none; } .welcome { transition: none; } }
@media (max-height: 860px) { .welcome { padding-top: 24px; padding-bottom: 18px; } .welcome-inner { gap: 12px; } .welcome .hero-art { max-width: 400px; } .welcome-mark { width: 60px; height: 60px; border-radius: var(--r-lg); } .welcome-mark svg { width: 32px; height: 32px; } }
.current-session { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface)); border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--r-lg); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.current-session:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.current-session:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.current-session .ri-txt b { font-size: var(--fs-lg); }
.current-session .ri-go { color: var(--accent); width: 18px; height: 18px; }
.recent + div { margin-top: 18px; }

/* ---------- collapsible card + custom test cases */
.collapse-card { overflow: hidden; }
.collapse-head { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 20px; border: 0; background: transparent; color: var(--text);
  font: inherit; text-align: left; cursor: pointer; }
.collapse-head:hover { background: var(--surface-2); }
.collapse-head h3 { margin: 0; font-size: var(--fs-lg); display: flex; align-items: center; gap: 8px; }
.collapse-head .sub { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.ch-ic { width: 34px; height: 34px; padding: 8px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-text); flex: none; }
.ch-caret { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; flex: none; }
.collapse-card.open .ch-caret { transform: rotate(180deg); }
.ch-badges { display: flex; gap: 6px; }
.count-chip { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-3);
  color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; }
.collapse-body { display: none; padding: 4px 20px 20px; border-top: 1px solid var(--border); }
.collapse-card.open .collapse-body { display: block; animation: up .2s ease-out; }
.ct-toolbar { align-items: center; margin: 14px 0; }
.ct-list { display: flex; flex-direction: column; gap: 8px; }
.ct-row { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.ct-row.off { opacity: .55; }
.ct-row > div:last-child:not(.ct-main) { padding: 0 14px; }
.ct-row > div:last-child:not(:empty):not(.ct-main) { padding: 0 14px 14px; }
.ct-main { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.ct-status { width: 84px; flex: none; padding-top: 1px; }
.ct-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ct-actions { display: flex; gap: 4px; flex: none; }
.warn-tag { background: var(--warn-bg); color: var(--warn); }

.ct-form { display: flex; flex-direction: column; gap: 12px; padding: 16px; margin-bottom: 14px; border-radius: var(--r-md);
  border: 1.5px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.ct-form-head { display: flex; align-items: baseline; gap: 10px; }
textarea.mono { font-family: var(--mono); font-size: var(--fs-sm); }
.ct-result { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); }
.ct-result.ok { background: var(--pass-bg); } .ct-result.bad { background: var(--fail-bg); } .ct-result.err { background: var(--warn-bg); }
@media (max-width: 760px) { .ct-main { flex-wrap: wrap; } .ct-actions { width: 100%; } .ct-status { width: auto; } }
.topbar .crumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar > * { flex-shrink: 0; } .topbar > .crumb, .topbar > .spacer { flex-shrink: 1; }
@media (max-width: 1180px) { .user-name, .user-caret { display: none; } .user-btn { padding: 0 3px; } }

/* ---------- Excel report dialog */
.xl-scopes { display: grid; gap: 8px; }
.xl-scope, .xl-model { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.xl-scope:hover, .xl-model:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.xl-scope.on, .xl-model.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.xl-scope input, .xl-model input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.xl-scope b { display: block; margin-bottom: 2px; }
.xl-models { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding: 2px; }
.xl-model { padding: 10px 12px; align-items: center; }
.xl-model .grow { min-width: 0; } .xl-model b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .xl-models { grid-template-columns: 1fr; } }
.xl-model .badge { flex: none; }
.tc-head .nm { font-weight: 600; color: var(--accent-text); white-space: nowrap; }

/* ---------- record journey */
.jr-controls { align-items: flex-end; flex-wrap: wrap; }
.jr-summary { font-size: var(--fs-md); } .jr-lost { color: var(--fail); font-weight: 600; }
.jr-strip { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 4px 2px 10px; }
.jr-arrow { display: flex; align-items: center; padding: 0 4px; color: var(--faint); flex: none; }
.jr-arrow svg { width: 18px; height: 18px; } .jr-arrow.faded { opacity: .35; }
.jr-step { flex: none; width: 168px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 10px 12px;
  border: 1.5px solid var(--border); border-left-width: 4px; border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
  transition: transform .12s, box-shadow .12s; }
.jr-step:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.jr-step.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.jr-step.t-ok { border-left-color: var(--pass); } .jr-step.t-warn { border-left-color: var(--warn); } .jr-step.t-bad { border-left-color: var(--fail); }
.jr-step.t-info { border-left-color: var(--info); } .jr-step.t-off { border-left-color: var(--border-strong); opacity: .7; }
.jr-layer { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.jr-name { font-weight: 600; font-size: var(--fs-base); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-count { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; }
.jr-via { font-size: var(--fs-xs); color: var(--accent-text); }
.jr-pill { display: inline-block; padding: 1px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; vertical-align: middle; }
.jr-pill.t-ok { background: var(--pass-bg); color: var(--pass); } .jr-pill.t-warn { background: var(--warn-bg); color: var(--warn); }
.jr-pill.t-bad { background: var(--fail-bg); color: var(--fail); } .jr-pill.t-info { background: var(--info-bg); color: var(--info); }
.jr-pill.t-off { background: var(--surface-3); color: var(--muted); }
.jr-pill.t-violet { background: color-mix(in srgb, var(--accent-2) 12%, var(--surface)); color: var(--accent-2); }
.jr-pill.t-teal { background: color-mix(in srgb, #0e9384 12%, var(--surface)); color: #0e9384; }
.jr-detail-card { border-left: 4px solid var(--border-strong); }
.jr-detail-card.t-ok { border-left-color: var(--pass); } .jr-detail-card.t-warn { border-left-color: var(--warn); }
.jr-detail-card.t-bad { border-left-color: var(--fail); } .jr-detail-card.t-info { border-left-color: var(--info); }
.jr-what { margin-top: 10px; font-size: var(--fs-md); }
.jr-where { margin-top: 8px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-md); }
.jr-where.t-bad { background: var(--fail-bg); } .jr-where.t-warn { background: var(--warn-bg); }
.jr-ctes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: var(--fs-sm); color: var(--muted); }
.jr-ctes svg { width: 12px; height: 12px; }
.jr-cte { padding: 2px 8px; border-radius: var(--r-sm); background: var(--surface-3); } .jr-cte.hit { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.jr-detail { display: block; margin-top: 3px; font-size: var(--fs-sm); color: var(--muted); font-family: var(--mono); word-break: break-word; }
.jr-table td { vertical-align: top; }
.jr-table tr.t-row-bad td:first-child { box-shadow: inset 3px 0 0 var(--fail); } .jr-table tr.t-row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* ---------- record journey: all tables, one after another */
.jr-views { width: auto; grid-template-columns: repeat(2, auto); }
.jr-full { display: flex; flex-direction: column; }
.jr-sec { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 10px; }
.jr-sec.t-ok { border-left-color: var(--pass); } .jr-sec.t-warn { border-left-color: var(--warn); } .jr-sec.t-bad { border-left-color: var(--fail); }
.jr-sec.t-info { border-left-color: var(--info); } .jr-sec.t-off { opacity: .8; }
.jr-sec-head { display: flex; align-items: center; gap: 12px; }
.jr-sec-head h3 { margin: 0; font-size: var(--fs-lg); display: flex; align-items: center; gap: 8px; }
.jr-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text);
  font-weight: 700; font-size: var(--fs-base); flex: none; }
.jr-sec-count { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; text-align: right; line-height: 1; }
.jr-sec-count small { display: block; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.jr-sec .jr-what { margin-top: 0; }
.jr-note { display: flex; gap: 6px; align-items: center; font-size: var(--fs-base); color: var(--accent-text); } .jr-note svg { width: 14px; height: 14px; }
.jr-empty { padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--muted); font-size: var(--fs-base); }
.jr-rows th.ch { box-shadow: inset 0 -3px 0 currentColor; }
.jr-rows th.ch.t-bad, .jr-rows td.ch.t-bad { color: var(--fail); } .jr-rows th.ch.t-warn, .jr-rows td.ch.t-warn { color: var(--warn); }
.jr-rows th.ch.t-info, .jr-rows td.ch.t-info { color: var(--info); } .jr-rows th.ch.t-violet, .jr-rows td.ch.t-violet { color: var(--accent-2); }
.jr-rows th.ch.t-teal, .jr-rows td.ch.t-teal { color: #0e9384; }
.jr-rows td.ch.t-bad { background: var(--fail-bg); } .jr-rows td.ch.t-warn { background: var(--warn-bg); }
.jr-rows td.ch.t-violet { background: color-mix(in srgb, var(--accent-2) 7%, var(--surface)); } .jr-rows td.ch.t-teal { background: color-mix(in srgb, #0e9384 7%, var(--surface)); }
.jr-rows td.ch.t-info { background: var(--info-bg); }
.jr-th-tag { display: block; font-size: var(--fs-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .9; }
.jr-notes { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.jr-notes-title { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.jr-note-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: var(--fs-base); }
.jr-note-row .jr-detail { margin: 0; flex-basis: 100%; padding-left: 4px; }
@media (min-width: 900px) { .jr-note-row .jr-detail { flex-basis: auto; } }
.jr-down { display: flex; align-items: center; gap: 8px; padding: 8px 0 8px 18px; color: var(--muted); font-size: var(--fs-sm); }
.jr-down svg { width: 16px; height: 16px; transform: rotate(90deg); color: var(--accent); }
.jr-down.faded svg { color: var(--fail); }
.pk-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: var(--fs-base); }
.pk-line > svg { width: 16px; height: 16px; color: var(--accent-2); }
.btn.pk-set { color: var(--accent-text); font-weight: 600; }
.resume { display: flex; align-items: center; gap: 12px; margin: 0 20px 20px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.resume > svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.keys-box { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface); }
.keys-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.keys-head > svg { width: 18px; height: 18px; color: var(--accent-2); }
.keys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.keys-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); min-width: 0; }
.keys-row.on { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border)); background: color-mix(in srgb, var(--accent-2) 5%, var(--surface)); }
.keys-row .grow { min-width: 0; } .keys-row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-base); }

/* ---------- record journey: animated record flow */
.jr-anim:empty { display: none; }
.jr-anim { border: 1px solid var(--border); border-radius: var(--r-lg); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 4%, var(--surface)), var(--surface));
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ja-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ja-speed { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.ja-speed select { height: 30px; padding: 0 26px 0 8px; font-size: var(--fs-sm); }
.ja-stage { position: relative; overflow-x: auto; padding: 6px 4px 44px; }
.ja-track { display: flex; align-items: center; width: max-content; min-width: 100%; }
.ja-node { position: relative; flex: none; width: 150px; padding: 9px 11px; border-radius: var(--r-md); border: 1.5px solid var(--border); background: var(--surface);
  transition: border-color .3s, box-shadow .3s, background .3s; }
.ja-node.on { box-shadow: var(--shadow); }
.ja-node.on.t-ok { border-color: var(--pass); } .ja-node.on.t-warn { border-color: var(--warn); background: var(--warn-bg); }
.ja-node.on.t-bad { border-color: var(--fail); background: var(--fail-bg); } .ja-node.on.t-info { border-color: var(--info); background: var(--info-bg); }
.ja-layer { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.ja-name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ja-count { font-size: var(--fs-sm); color: var(--text-2); min-height: 16px; }
.ja-link { flex: 1 0 36px; height: 2px; background: var(--border-strong); position: relative; min-width: 36px; }
.ja-link i { position: absolute; right: -2px; top: -4px; border: 5px solid transparent; border-left-color: var(--border-strong); }
.ja-dot { position: absolute; left: 0; top: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--pass); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pass) 25%, transparent);
  pointer-events: none; z-index: 2; }
.ja-dot.t-warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }
.ja-dot.t-bad { background: var(--fail); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fail) 25%, transparent); }
.ja-dot.t-info { background: var(--info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 25%, transparent); }
.ja-dot.big { width: 18px; height: 18px; margin: -3px 0 0 -3px; }
.ja-x { position: absolute; right: 8px; top: 6px; color: var(--fail); font-weight: 800; font-size: var(--fs-lg); }
.ja-caption { min-height: 24px; }
.ja-cap { display: inline-block; padding: 4px 10px; border-radius: var(--r-sm); font-size: var(--fs-md); font-weight: 500; animation: up .25s ease-out; }
.ja-cap.t-ok { background: var(--pass-bg); color: var(--pass); } .ja-cap.t-warn { background: var(--warn-bg); color: var(--warn); }
.ja-cap.t-bad { background: var(--fail-bg); color: var(--fail); } .ja-cap.t-info { background: var(--info-bg); color: var(--info); }
.ja-log { margin: 0; padding-left: 20px; font-size: var(--fs-sm); color: var(--text-2); display: flex; flex-direction: column; gap: 2px; }
.ja-log:empty { display: none; }
.ja-log li.t-bad { color: var(--fail); font-weight: 600; } .ja-log li.t-warn { color: var(--warn); }

/* ---------- lineage / CTE cards: a symbol per type; CTE steps look different from tables */
.node .k { gap: 7px; }
.node .ti, .lg-type .ti { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-sm); flex: none;
  background: var(--tc-bg, var(--surface-3)); color: var(--tc, var(--muted)); }
.node .k .ti svg { width: 13px; height: 13px; }
.node .kl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ty-source { --tc: #475467; --tc-bg: #eef1f5; } .ty-input { --tc: #475467; --tc-bg: #eef1f5; }
.ty-view { --tc: #0b7d72; --tc-bg: #e2f4f1; } .ty-table { --tc: var(--accent); --tc-bg: var(--accent-soft); }
.ty-target { --tc: #ffffff; --tc-bg: var(--ink); }
.ty-import, .ty-join, .ty-filter, .ty-dedupe, .ty-aggregate, .ty-union, .ty-transform { --tc: #3d6ad9; --tc-bg: #f1ebff; }
.ty-final { --tc: #067647; --tc-bg: #e3f5ea; }
[data-theme="dark"] .ty-source, [data-theme="dark"] .ty-input { --tc: #b4bccd; --tc-bg: #232c40; }
[data-theme="dark"] .ty-view { --tc: #5fd6c4; --tc-bg: #12302d; } [data-theme="dark"] .ty-table { --tc: #9fb0ff; --tc-bg: #1d2445; }
[data-theme="dark"] .ty-import, [data-theme="dark"] .ty-join, [data-theme="dark"] .ty-filter, [data-theme="dark"] .ty-dedupe,
[data-theme="dark"] .ty-aggregate, [data-theme="dark"] .ty-union, [data-theme="dark"] .ty-transform { --tc: #c4a8ff; --tc-bg: #2a2144; }
[data-theme="dark"] .ty-final { --tc: #6ce0a3; --tc-bg: #0f2a1f; }
/* CTE steps: tinted card, rounder, the tag says CTE */
.node.is-cte { background: var(--surface); border-radius: var(--r-md);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
.node.ty-final { background: linear-gradient(180deg, color-mix(in srgb, var(--pass) 7%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--pass) 30%, var(--border)); }
.node.ty-input { background: var(--surface-2); border-style: dashed; }
.node.ty-target { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.cte-tag { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; padding: 1px 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-text); flex: none; }
.role-tag { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-2xs); padding: 1px 6px; border-radius: var(--r-pill); background: var(--warn-bg); color: var(--warn); flex: none; }
.role-tag svg { width: 10px; height: 10px; }
.legend { align-items: center; }
.legend-sep { width: 1px; height: 16px; background: var(--border); }
.lg-type { display: inline-flex; align-items: center; gap: 6px; }
.lg-type .ti { width: 18px; height: 18px; border-radius: var(--r-xs); }
.lg-type .ti svg { width: 11px; height: 11px; }
.node .ti { width: 24px; height: 24px; }
.node .k .ti svg { width: 15px; height: 15px; stroke-width: 2.3; }
.lg-type .ti svg { stroke-width: 2.3; }

/* ---------- CTE workspace: step list + selected step */
.cw-head { align-items: center; }
.cw-views { width: auto; grid-template-columns: repeat(2, auto); }
.cw-grid { display: grid; grid-template-columns: minmax(220px, 250px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cw-grid { grid-template-columns: 1fr; } }
.cw-list { display: flex; flex-direction: column; position: sticky; top: 0; max-height: 72vh; overflow: auto; padding: 2px; outline: none; }
.cw-conn { width: 2px; height: 10px; margin-left: 23px; background: var(--border-strong); }
.cw-step { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; text-align: left; font: inherit; color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; }
.cw-step:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.cw-step.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.cw-ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); flex: none; background: #f1ebff; color: #3d6ad9; }
.cw-ic svg { width: 15px; height: 15px; stroke-width: 2.2; }
.k-final .cw-ic, .cw-ic.k-final { background: #e3f5ea; color: #067647; }
[data-theme="dark"] .cw-ic { background: #2a2144; color: #c4a8ff; } [data-theme="dark"] .k-final .cw-ic, [data-theme="dark"] .cw-ic.k-final { background: #0f2a1f; color: #6ce0a3; }
.cw-ic.big { width: 38px; height: 38px; border-radius: var(--r-md); } .cw-ic.big svg { width: 20px; height: 20px; }
.cw-main { flex: 1; min-width: 0; }
.cw-name { font-weight: 600; font-size: var(--fs-md); display: flex; gap: 6px; align-items: baseline; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cw-num { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.cw-sub { font-size: var(--fs-xs); color: var(--muted); }
.cw-counts { text-align: right; flex: none; }
.cw-io { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; } .cw-io b { color: var(--text); }
.cw-chg { display: inline-block; margin-top: 2px; font-size: var(--fs-xs); font-weight: 600; padding: 0 6px; border-radius: var(--r-pill); }
.cw-chg.down { background: var(--fail-bg); color: var(--fail); } .cw-chg.up { background: var(--warn-bg); color: var(--warn); } .cw-chg.same { color: var(--faint); }
.cw-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; } .cw-dot.none { background: transparent; }
.cw-panel { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 16px; min-width: 0; }
.cw-phead { display: flex; align-items: center; gap: 12px; }
.cw-phead h3 { margin: 0; font-size: var(--fs-lg); display: flex; align-items: center; gap: 8px; }
.cw-tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: 14px 0; }
.cw-tab { border: 0; background: none; font: inherit; font-size: var(--fs-base); font-weight: 500; color: var(--muted); padding: 8px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cw-tab:hover { color: var(--text); } .cw-tab.on { color: var(--accent-text); border-bottom-color: var(--accent); }
.cw-step { padding: 8px 9px; gap: 8px; }
.cw-ic { width: 26px; height: 26px; }
.cw-panel { padding: 14px; }
.cw-panel .table-wrap td.wrap, .cw-panel td.wrap { min-width: 220px; }
/* CTE workspace: every section one after another; the tab bar stays on top and jumps to them */
.cw-tabs.sticky { position: sticky; top: -16px; z-index: 3; background: var(--surface); padding-top: 4px; }
.cw-secs { display: flex; flex-direction: column; gap: 22px; }
.cw-sec { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 60px; }
.cw-sec + .cw-sec { border-top: 1px dashed var(--border); padding-top: 18px; }
.cw-sec-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cw-sec-title span { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.cw-sec-title small { font-size: var(--fs-sm); color: var(--muted); }
.cw-name { white-space: normal; overflow: visible; word-break: break-word; line-height: 1.25; }

/* ---------- breakdown by column (any record list) + dropped-records summary */
.bd { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.bd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bd-list { display: flex; flex-direction: column; gap: 3px; max-height: 300px; overflow: auto; }
.bd-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(80px, 2fr) 70px 50px auto; align-items: center; gap: 10px; width: 100%;
  padding: 5px 8px; border: 0; border-radius: var(--r-sm); background: transparent; font: inherit; font-size: var(--fs-base); color: var(--text); text-align: left; cursor: pointer; }
.bd-row:hover { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.bd-row.static { cursor: default; } .bd-row.static:hover { background: transparent; box-shadow: none; }
.bd-v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: var(--fs-sm); }
.bd-row.static .bd-v { font-family: inherit; white-space: normal; }
.bd-bar { height: 8px; border-radius: var(--r-xs); background: var(--surface-3); overflow: hidden; }
.bd-bar i { display: block; height: 100%; border-radius: var(--r-xs); background: var(--accent); }
.bd-bar.bad i { background: var(--fail); }
.bd-n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bd-p { text-align: right; color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.drop-sum { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--fail-bg); }
.drop-big { font-size: var(--fs-2xl); font-weight: 750; letter-spacing: -.03em; color: var(--fail); line-height: 1; }
@media (max-width: 700px) { .bd-row { grid-template-columns: 1fr 70px 50px; } .bd-row .bd-bar { display: none; } }
.lazy-slot { min-height: 440px; display: flex; align-items: flex-start; padding-top: 8px; }
/* full-screen table panel: the header uses the width (tiles in one row) and the content gets the height */
.drawer-head, .drawer-tabs { padding-left: 32px; padding-right: 32px; }
.drawer-body { padding: 20px 32px 48px; }
.drawer .kpis { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.drawer .kpi { padding: 9px 12px; } .drawer .kpi .v { font-size: var(--fs-xl); margin-top: 2px; } .drawer .kpi .d { font-size: var(--fs-xs); }
.drawer .cw-grid { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
.modal.full { max-height: 95vh; height: 95vh; }
.modal.full .modal-body { flex: 1; }
/* CTE workspace, diagram view: the picture stays on top, the clicked step's details below */
.cw-diagram { display: flex; flex-direction: column; gap: 6px; }
.cw-diagram .legend { margin-top: 0; }

/* ---------- table panel header: the name stands out, the numbers take one slim line */
.drawer-head { align-items: center; gap: 14px; padding-top: 14px; padding-bottom: 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--dh, var(--accent)) 12%, var(--surface)) 0%, var(--surface) 70%);
  border-bottom: 1px solid var(--border); box-shadow: inset 4px 0 0 var(--dh, var(--accent)); }
.drawer-head.t-target { --dh: var(--accent); } .drawer-head.t-table { --dh: var(--accent); } .drawer-head.t-view { --dh: #0e9384; } .drawer-head.t-db { --dh: #475467; }
.dh-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-md); flex: none; color: #fff;
  background: var(--dh, var(--accent)); box-shadow: 0 6px 16px -6px var(--dh, var(--accent)); }
.drawer-head.t-target .dh-ic { background: var(--ink); }
.dh-ic svg { width: 22px; height: 22px; stroke-width: 2.2; }
.dh-kind { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--dh, var(--accent)); }
.drawer-head h2 { font-size: var(--fs-xl); letter-spacing: -.025em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dh-stats { padding: 8px 32px 10px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.hstats { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; }
.hstat { display: flex; align-items: baseline; gap: 6px; padding: 2px 16px 2px 0; margin-right: 16px; border-right: 1px solid var(--border); font-size: var(--fs-base); white-space: nowrap; }
.hstat:last-child { border-right: 0; }
.hstat .hl { color: var(--muted); font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: 4px; }
.hstat .hl svg { width: 13px; height: 13px; color: var(--accent-2); }
.hstat b { font-size: var(--fs-lg); letter-spacing: -.01em; }
.hstat .hs { color: var(--muted); font-size: var(--fs-sm); }
.hstat.bad b { color: var(--fail); } .hstat.warn b { color: var(--warn); } .hstat.ok b { color: var(--pass); }
.hstat.key { align-items: center; } .hstat.key .btn { height: 26px; padding: 0 8px; }
.dh-why { font-size: var(--fs-sm); color: var(--muted); }

/* CTE workspace: the context bar (mini flow + selected step + section tabs) stays pinned while you scroll */
.cw-context { position: sticky; top: -21px; z-index: 5; margin: -14px -14px 0; padding: 10px 14px 0; background: var(--surface);
  border-radius: 14px 14px 0 0; box-shadow: 0 8px 12px -12px rgba(16,24,40,.35); display: flex; flex-direction: column; gap: 8px; }
.cw-context .cw-tabs { margin: 2px 0 0; }
.cw-flow { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding-bottom: 6px; border-bottom: 1px dashed var(--border); scrollbar-width: thin; }
.cw-fl-in { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; padding: 3px 8px; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); }
.cw-fl-in svg { width: 12px; height: 12px; }
.cw-fl-arr svg { width: 12px; height: 12px; color: var(--faint); }
.cw-fl { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border)); border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface)); font: inherit; font-size: var(--fs-sm); color: var(--text); cursor: pointer; white-space: nowrap; }
.cw-fl svg { width: 13px; height: 13px; color: #3d6ad9; stroke-width: 2.2; }
.cw-fl:hover { border-color: var(--accent); }
.cw-fl.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 10px -4px var(--accent); }
.cw-fl.on svg, .cw-fl.on .cw-fl-n, .cw-fl.on .cw-fl-c { color: #fff; }
.cw-fl.on .cw-chg { background: rgba(255,255,255,.22); color: #fff; }
.cw-fl.fail:not(.on) { border-color: color-mix(in srgb, var(--fail) 45%, var(--border)); }
.cw-fl-n { font-weight: 700; color: var(--muted); font-size: var(--fs-xs); }
.cw-fl-t { font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.cw-fl-c { color: var(--muted); font-variant-numeric: tabular-nums; }
.cw-fl .cw-chg { margin-top: 0; }
.cw-io-big { font-size: var(--fs-base); font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cw-phead h3 { flex-wrap: wrap; }
.cw-sec { scroll-margin-top: 170px; }
/* mini flow = the real DAG in miniature: columns like the diagram, parallel steps stacked, curved lines between */
.cw-flow { display: block; }
.cw-mini-cols { position: relative; display: flex; align-items: center; gap: 30px; width: max-content; padding: 2px 4px 2px 2px; }
.cw-mini-col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cw-mini-lines { position: absolute; left: 0; top: 0; z-index: 0; overflow: visible; pointer-events: none; }
.cw-mini-lines path { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.cw-mini-lines path.hot { stroke: var(--accent); stroke-width: 2; }
.cw-mini-col .cw-fl, .cw-mini-col .cw-fl-in { padding: 2px 7px; }
.cw-mini-col .cw-fl-in { background: var(--surface); }
.cw-mini-col .cw-fl { background: var(--surface); } .cw-mini-col .cw-fl.on { background: var(--accent); }

/* ---------- CTE full-screen view: the step + flow on top, one section at a time filling the rest */
.modal.cte-focus .modal-body { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 12px 20px 16px; }
.cw-focus { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.cw-context.focus { position: static; margin: 0; padding: 0 0 2px; box-shadow: none; border-radius: 0; }
.cw-focus-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 2px 4px; }
.cw-focus-body .cw-sec { border: 0; padding: 0; }
.cw-sumcard { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--r-lg); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.cw-sumcard h3 { margin: 0; font-size: var(--fs-lg); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- trace a record inside a model's CTEs */
.cw-fl-tr { display: inline-flex; align-items: center; gap: 3px; margin-left: 2px; padding: 0 6px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; }
.cw-fl-tr svg { width: 11px; height: 11px; }
.cw-fl-tr.t-ok { background: var(--pass-bg); color: var(--pass); } .cw-fl-tr.t-warn { background: var(--warn-bg); color: var(--warn); }
.cw-fl-tr.t-bad { background: var(--fail-bg); color: var(--fail); }
.cw-fl.on .cw-fl-tr { background: #fff; }
.tr-sum { padding: 10px 12px; border-radius: var(--r-md); font-weight: 600; font-size: var(--fs-md); }
.tr-sum.ok { background: var(--pass-bg); color: var(--pass); } .tr-sum.warn { background: var(--warn-bg); color: var(--warn); } .tr-sum.bad { background: var(--fail-bg); color: var(--fail); }
.tr-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-base); }
.tr-steps > svg { width: 14px; height: 14px; color: var(--faint); }
.tr-step { padding: 5px 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); }
.tr-step.ok { border-color: color-mix(in srgb, var(--pass) 40%, var(--border)); } .tr-step.warn { border-color: var(--warn); background: var(--warn-bg); }
.tr-step.bad { border-color: var(--fail); background: var(--fail-bg); } .tr-step.off { opacity: .6; }
.tr-step small { color: var(--muted); }
.cw-secs table.data tbody tr.click:hover td, .cw-focus-body table.data tbody tr.click:hover td { background: var(--accent-soft); cursor: pointer; }
.cw-fl-tr.t-off { background: var(--surface-3); color: var(--muted); }
/* ---------- Modify & run: verdict + column changes */
.sb-verdict { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); font-weight: 600; font-size: var(--fs-md); }
.sb-verdict svg { width: 16px; height: 16px; flex: none; }
.sb-verdict.changed { background: var(--warn-bg); color: var(--warn); } .sb-verdict.same { background: var(--pass-bg); color: var(--pass); }
.sb-cols { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); font-size: var(--fs-base); }
.sb-col { display: inline-block; margin: 0 4px 0 0; padding: 1px 8px; border-radius: var(--r-sm); font-family: var(--mono); font-size: var(--fs-sm); }
.sb-col.rem { background: var(--fail-bg); color: var(--fail); text-decoration: line-through; } .sb-col.add { background: var(--pass-bg); color: var(--pass); }

/* ---------- floating window (Modify & run): move, resize, minimise to the dock, maximise */
.fwin { position: fixed; z-index: 60; display: flex; flex-direction: column; min-width: 380px; min-height: 180px; max-width: 98vw; max-height: 96vh;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: 0 30px 60px -20px rgba(16,24,40,.45), 0 0 0 1px rgba(16,24,40,.04);
  resize: both; overflow: hidden; animation: up .18s ease-out; }
.fwin-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border);
  cursor: move; user-select: none; }
.fwin-head > svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.fwin-title { font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fwin-head .btn { width: 30px; height: 30px; cursor: pointer; }
.fwin-body { flex: 1; overflow: auto; padding: 14px 16px 18px; min-height: 0; }
.fwin.min { display: none; }
.fwin.max { left: 1vw !important; top: 2vh !important; width: 98vw !important; height: 96vh !important; resize: none; }
body.dragging { cursor: move; user-select: none; }
body.dragging iframe { pointer-events: none; }
.fwin-dock { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 70; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 90vw; }
.fwin-tab { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-base); font-weight: 600; cursor: pointer; box-shadow: var(--shadow-lg); }
.fwin-tab svg { width: 15px; height: 15px; color: var(--accent); }
.fwin-tab:hover { border-color: var(--accent); }
.toasts { z-index: 100; }

/* ---------- pipeline at a glance: the welcome-screen look, with the real pipeline */
.glance { position: relative; overflow: hidden; display: flex; gap: 20px; align-items: stretch; padding: 18px 20px; border-radius: var(--r-lg); color: #fff;
  background: radial-gradient(900px 520px at 0% 0%, rgba(61,106,217,.38) 0%, transparent 62%), radial-gradient(800px 600px at 100% 100%, rgba(36,87,214,.22) 0%, transparent 60%), linear-gradient(160deg, #0f1a2e 0%, #142443 100%);
  box-shadow: var(--shadow); }
.glance::before { content: ""; position: absolute; inset: 0; opacity: .1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px); background-size: 32px 32px; }
.glance-side { position: relative; flex: none; width: 220px; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.glance-kicker { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #c9d2ff; }
.glance-target { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; word-break: break-word; }
.glance-sub { font-size: var(--fs-sm); color: rgba(255,255,255,.75); }
.glance-pill { align-self: flex-start; margin-top: 4px; padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 700; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); }
.glance-pill.t-bad { background: #fde2df; color: #b42318; border-color: transparent; } .glance-pill.t-warn { background: #fff1dc; color: #b54708; border-color: transparent; }
.glance-pill.t-ok { background: #dcfae6; color: #067647; border-color: transparent; }
.glance-hint { font-size: var(--fs-xs); color: rgba(255,255,255,.55); margin-top: 2px; }
.glance-map-wrap { position: relative; flex: 1; min-width: 0; overflow-x: auto; padding: 10px; border-radius: var(--r-md); background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(6px); display: flex; align-items: center; scrollbar-width: thin; }
.glance-map { display: block; max-height: 260px; width: auto; flex: none; }
.gl-node { cursor: pointer; outline: none; }
.gl-node:hover rect, .gl-node:focus rect { fill: rgba(255,255,255,.24); }
.gl-node.target:hover rect { fill: #fff; }
.gl-node.fail rect { stroke: #ff8a80; stroke-width: 2; } .gl-node.warn rect { stroke: #ffc46b; stroke-width: 2; }
.gl-node.target.fail rect { stroke: #f04438; }
@media (max-width: 760px) { .glance { flex-direction: column; } .glance-side { width: auto; } }
.hstat.bad .hs { color: var(--fail); font-weight: 600; } .hstat.warn .hs { color: var(--warn); font-weight: 600; }

/* ---------- old vs new: key check, columns, breakdown */
.ok-key { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-md); }
.ok-key > svg { width: 18px; height: 18px; color: var(--accent-2); flex: none; margin-top: 2px; }
.ok-key.bad { background: var(--fail-bg); border-color: color-mix(in srgb, var(--fail) 35%, var(--border)); } .ok-key.good { background: var(--pass-bg); border-color: color-mix(in srgb, var(--pass) 35%, var(--border)); }
.on-tbl td.chg { background: var(--warn-bg); }
.on-tbl tr.has-chg td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.ond-old { color: var(--muted); text-decoration: line-through; }
.ond { font-size: var(--fs-xs); font-weight: 700; padding: 0 5px; border-radius: var(--r-pill); }
.ond.up { background: var(--warn-bg); color: var(--warn); } .ond.dn { background: var(--fail-bg); color: var(--fail); }
.ob-bar { display: inline-block; width: 60px; height: 6px; margin-right: 8px; border-radius: var(--r-xs); background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.ob-bar i { display: block; height: 100%; } .ob-bar i.old { background: var(--faint); } .ob-bar i.new { background: var(--accent); }

/* ---------- pipeline at a glance: records dropped / added, animated */
.glance-right { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.glance-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--fs-xs); color: rgba(255,255,255,.75); }
.glance-legend span { display: inline-flex; align-items: center; gap: 6px; }
.glance-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.glance-legend .lg-lost { background: #ff6b5e; box-shadow: 0 0 0 3px rgba(255,107,94,.25); } .glance-legend .lg-added { background: #ffb547; box-shadow: 0 0 0 3px rgba(255,181,71,.25); }
.gl-badge text { font: 700 10px var(--font); fill: #fff; }
.gl-badge.lost rect { fill: #e5484d; } .gl-badge.added rect { fill: #f59e0b; } .gl-badge.grouped rect { fill: rgba(255,255,255,.22); }
.gl-badge.lost { animation: gl-pulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes gl-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.gl-fall, .gl-pop { transform-box: fill-box; transform-origin: center; opacity: 0; pointer-events: none; }
.gl-fall { fill: #ff6b5e; animation: gl-fall 2.8s ease-in infinite; }
@keyframes gl-fall { 0% { opacity: 0; transform: translateY(-4px) scale(.6); } 15% { opacity: 1; } 70% { opacity: .9; } 100% { opacity: 0; transform: translateY(22px) scale(.4); } }
.gl-pop { fill: #ffb547; animation: gl-pop 2.6s ease-out infinite; }
@keyframes gl-pop { 0% { opacity: 0; transform: translate(0, 0) scale(.4); } 20% { opacity: 1; transform: translate(4px, -6px) scale(1); } 100% { opacity: 0; transform: translate(14px, -16px) scale(.5); } }
@media (prefers-reduced-motion: reduce) { .gl-fall, .gl-pop, .gl-badge.lost { animation: none; } .gl-fall { opacity: .8; transform: translateY(8px); } }

/* ---------- modern tab buttons (table panel and every tab bar) */
.tabs { gap: 6px; padding: 0; background: transparent; border-radius: 0; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px 0 6px; border-radius: var(--r-md); font-size: var(--fs-base); font-weight: 600;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(16,24,40,.06);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s, color .15s; }
.tab svg { width: 24px; height: 24px; padding: 5px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-text); stroke-width: 2.1; flex: none; }
.tab:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  box-shadow: var(--shadow-sm); color: var(--text); }
.tab.active { color: var(--accent-text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: none; }
.tab.active svg { background: transparent; color: var(--accent); }
.tab .count { font-size: var(--fs-xs); font-weight: 700; min-width: 20px; padding: 1px 6px; border-radius: var(--r-pill); background: var(--fail); color: #fff; text-align: center; }
.tab.active .count { background: #fff; color: var(--fail); }
.tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
/* tab bars without icons (small switches like Original SQL / Deployed table) stay compact */
.tab:not(:has(svg)) { padding: 0 13px; height: 32px; }
.drawer-tabs { padding: 10px 32px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-tabs .tabs { flex-wrap: wrap; }
[data-theme="dark"] .tab { box-shadow: none; }
.hstat.key .btn { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--accent-text); background: var(--surface); font-weight: 600; }
.hstat.key .btn:hover { background: var(--accent-soft); }

/* test scope – only a set of records */
.scope-box .keys-head { flex-wrap: wrap; }
.scope-seg { width: auto; min-width: 440px; }
.scope-detail:empty { display: none; }
.scope-detail { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.scope-detail textarea { width: 100%; min-width: 260px; font-family: var(--mono, monospace); }
.scope-banner { border-color: color-mix(in srgb, var(--info) 45%, var(--border)); background: color-mix(in srgb, var(--info) 8%, var(--surface)); }
@media (max-width: 700px) { .scope-seg { min-width: 0; width: 100%; } }
.scope-title { min-width: 220px; }
.scope-seg { min-width: 0; width: 460px; max-width: 100%; }
.scope-detail .row { gap: 10px; }

/* confirm dialog – a destructive action is a solid red button on the right, Cancel next to it */
.btn.danger-solid { background: var(--fail); border-color: transparent; color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); background: var(--fail); }
.confirm-actions { justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* empty states: .empty (centred, a page or card with nothing yet) and .empty.compact (a list inside a card) */
.empty-action { margin-top: 14px; }
.empty.compact { display: flex; gap: 14px; align-items: center; text-align: left; padding: 16px 18px; margin: 4px 0;
  border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--text); }
.empty.compact > svg { width: 28px; height: 28px; margin: 0; flex: none; }
.empty.compact b { font-size: var(--fs-md); }
.card-head > svg { width: 18px; height: 18px; flex: none; color: var(--accent-2); }
/* every icon has a sensible default size; any more specific rule (buttons, empty states…) still wins – :where() adds no specificity */
:where(svg[data-ic]) { width: 18px; height: 18px; flex: none; }
:where(.section-title) > svg[data-ic] { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; color: var(--accent-2); }
.file-drop > svg[data-ic] { width: 28px; height: 28px; color: var(--faint); }

/* layout helpers (instead of inline styles) */
.row.center { align-items: center; }
.stack.gap-4 { gap: 4px; } .stack.gap-6 { gap: 6px; } .stack.gap-8 { gap: 8px; } .stack.gap-10 { gap: 10px; } .stack.gap-14 { gap: 14px; }
.mt-6 { margin-top: 6px; } .mt-8 { margin-top: 8px; } .mt-10 { margin-top: 10px; }
.flush { margin: 0 !important; }
.page-cta { margin: 16px 0; }
.file-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; border-style: dashed; cursor: pointer; text-align: center; }
.node .k .st-dot { width: 9px; height: 9px; border-radius: var(--r-pill); margin-left: auto; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, var(--surface)); }
/* a card head with tabs: the title first, the tabs move under it when there's no room – a tab never breaks its label */
.card-head { flex-wrap: wrap; row-gap: 10px; }
.card-head .right { flex-wrap: wrap; justify-content: flex-end; }
.tab { white-space: nowrap; }

/* hover card – detail for a cell or chip */
.hovercard { position: fixed; z-index: 400; width: min(420px, calc(100vw - 16px)); max-height: 60vh; overflow: auto; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow);
  font-size: var(--fs-sm); color: var(--text-2); line-height: 1.5; animation: up .14s ease-out; }
.hc-title { font-weight: 600; color: var(--text); margin-bottom: 6px; }
.hc-list { display: flex; flex-direction: column; gap: 8px; }
.hc-item + .hc-item { border-top: 1px solid var(--border); padding-top: 8px; }
.hc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text); }
.hc-why { margin-top: 2px; }
.hc-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--muted); }
/* count check + tests chip in the row-count table */
.cc-pill, .tests-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill); font: inherit;
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; border: 1px solid transparent; cursor: help; }
.tests-chip { cursor: pointer; }
.cc-pill svg, .tests-chip svg { width: 12px; height: 12px; stroke-width: 2.4; }
.cc-pill.t-ok, .tests-chip.t-ok { background: var(--pass-bg); color: var(--pass); }
.cc-pill.t-warn, .tests-chip.t-warn { background: var(--warn-bg); color: var(--warn); }
.cc-pill.t-bad, .tests-chip.t-bad { background: var(--fail-bg); color: var(--fail); }
.tests-chip:hover { border-color: currentColor; }
.rec-cell { white-space: nowrap; }
.rec-ch { margin-left: 8px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }  /* coloured only when the count check flags it */
.rec-ch.dn { color: var(--fail); } .rec-ch.up { color: var(--warn); }

/* the verdict opens the run's breakdown */
.verdict-btn { width: 100%; font: inherit; text-align: left; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.verdict-btn:hover { box-shadow: var(--shadow); }
.verdict-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.verdict-more { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; opacity: .85; }
.verdict-more svg { width: 16px; height: 16px; transition: transform .2s; }
.verdict-btn[aria-expanded="true"] .verdict-more svg { transform: rotate(180deg); }
.kpi-btn { cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.kpi-btn:hover { border-color: var(--c); box-shadow: var(--shadow-sm); }
.breakdown { animation: up .18s ease-out; }
.bd-status { display: flex; gap: 8px; flex-wrap: wrap; }
.bd-st { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); font: inherit; cursor: pointer; }
.bd-st b { font-size: var(--fs-md); }
.bd-st.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.bd-group { display: flex; flex-direction: column; gap: 8px; }
.bd-ghead { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.bd-ghead > svg { color: var(--accent-2); }
.bd-count { font-size: var(--fs-xs); font-weight: 700; padding: 0 8px; border-radius: var(--r-pill); background: var(--surface-3); }
.bd-ghead .btn { margin-left: auto; }
/* test case: the reason under a failed / warning test (hidden once the card is open – the body tells the whole story) */
.tc-why { padding: 0 16px 12px; margin-top: -4px; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-why b { color: var(--c); }
.tc.open .tc-why { display: none; }
.tc-head { flex-wrap: wrap; row-gap: 4px; }
.tc-head .t { flex: 1 1 240px; }
.card-head .sub { flex: 1 1 220px; min-width: 0; }

/* pick test cases to run */
.bd-item { display: flex; gap: 10px; align-items: flex-start; }
.bd-item > input[type=checkbox] { margin-top: 15px; flex: none; }
.bd-item > .tc { flex: 1; min-width: 0; }
.bd-ghead > input[type=checkbox] { flex: none; }
.pick-bar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px;
  border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px);
  border-radius: 0 0 var(--radius) var(--radius); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* data first: the two ways to start */
.run-choice { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
@media (max-width: 760px) { .run-choice { grid-template-columns: 1fr; } }
.run-opt { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: box-shadow .15s, border-color .15s, filter .15s; }
.run-opt > svg { width: 22px; height: 22px; flex: none; color: var(--accent-2); }
.run-opt b { display: block; font-size: var(--fs-md); }
.run-opt span { display: block; font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.run-opt:hover:not(:disabled) { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.run-opt.primary-opt { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow); }
.run-opt.primary-opt > svg, .run-opt.primary-opt span { color: rgba(255,255,255,.88); }
.run-opt.primary-opt:hover:not(:disabled) { filter: brightness(1.06); }
.run-opt:disabled { opacity: .5; cursor: not-allowed; }
/* after a data-only run */
.run-tests { display: flex; align-items: center; gap: 16px; padding: 18px 20px; flex-wrap: wrap;
  border-color: var(--border); border-left: 3px solid var(--accent); background: var(--surface); }
.rt-ic { width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow-sm); flex: none; }
.rt-ic svg { width: 22px; height: 22px; color: var(--accent-2); }
.run-tests h3 { margin: 0; font-size: var(--fs-lg); }
.run-tests p { margin: 3px 0 0; font-size: var(--fs-base); color: var(--text-2); }
.rt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* the test picker */
.picker .pk-types { display: flex; gap: 6px; flex-wrap: wrap; }
.pk-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.pk-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; cursor: pointer; font-size: var(--fs-base); }
.pk-row + .pk-row { border-top: 1px solid var(--border); }
.pk-row:hover { background: var(--surface-2); }
.pk-row > input { margin-top: 2px; flex: none; }
.pk-id { font-family: var(--mono); font-size: var(--fs-sm); color: var(--muted); flex: none; margin-top: 1px; }
.pk-case { color: var(--text-2); }
.pk-why { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.pk-row .tag { flex: none; }
label.bd-ghead { cursor: pointer; }
.picker .pick-bar { border-radius: 0; margin: 0 -22px -24px; bottom: -24px; }

/* sidebar: what every page is for */
.nav-item { align-items: flex-start; }
.nav-item svg { margin-top: 2px; }
.nav-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.nav-txt small { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; white-space: normal; }
.nav-item.active .nav-txt small { color: color-mix(in srgb, var(--accent-text) 70%, var(--muted)); }
/* breadcrumb */
.crumb-sep { color: var(--faint); margin: 0 8px; font-weight: 400; }
.crumb-mid { color: var(--text-2); font-weight: 500; }
.crumb-now { color: var(--accent-text); font-weight: 600; }

/* the step bar – where am I, what now */
.stepbar { position: sticky; top: 60px; z-index: 15; margin: -4px 0 16px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; }
.steps { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; flex: 1 1 0; min-width: 112px; }
.step .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li + li::before { content: ""; width: 14px; height: 2px; background: var(--border-strong); margin-right: 4px; flex: none; }
.step { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px 6px 6px; border: 1px solid transparent; border-radius: var(--r-pill);
  background: transparent; font: inherit; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; text-align: left; }
.step .n { width: 24px; height: 24px; border-radius: var(--r-pill); display: grid; place-items: center; flex: none; font-weight: 700; font-size: var(--fs-xs);
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-strong); }
.step .n svg { width: 13px; height: 13px; stroke-width: 3; }
.step:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.step.done .n { background: var(--pass-bg); color: var(--pass); border-color: color-mix(in srgb, var(--pass) 40%, transparent); }
.step.now { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.step.now .n { background: var(--accent); color: #fff; border-color: transparent; }
.step.off { opacity: .45; cursor: not-allowed; }
.step-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); padding-top: 8px; border-top: 1px solid var(--border); }
.hint-k { font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text); white-space: nowrap; }
.step-hint .grow { min-width: 220px; }
.step-links { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; font-size: var(--fs-sm); }
.jump { padding: 2px 10px; border-radius: var(--r-pill); color: var(--text-2); text-decoration: none; border: 1px solid transparent; }
.jump:hover { background: var(--surface-3); color: var(--text); }
.jump.on { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 600; }
#sec-pick, #sec-lineage, #sec-run, #sec-data, #sec-results, #sec-map, #sec-custom, #sec-whole, .breakdown { scroll-margin-top: 150px; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 30% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 30%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 760px) { .stepbar { position: static; } .steps li { min-width: 46%; } .steps li + li::before { display: none; } }
.picker-min { padding: 10px 16px; }
.picker-min > .row > svg { color: var(--accent-2); }
.stepbar.compact { padding: 6px 12px; gap: 4px; }
.stepbar.compact .step-hint { display: none; }
.stepbar.compact .step { padding-top: 3px; padding-bottom: 3px; }
/* a CTE's records inline in "SQL & data" */
.cte-data { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border-strong); display: flex; flex-direction: column; gap: 10px; animation: up .16s ease-out; }
.cte-data-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cte-data-head > svg { color: var(--accent-2); }

/* ---- polish: compact pipeline header, one results card, calm lineage cards ---- */
.head-target { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.head-target svg { width: 16px; height: 16px; color: var(--accent-2); }
.head-target b { color: var(--text); }
.head-target .muted { font-size: var(--fs-sm); }
.results-card { overflow: hidden; }
.results-card > .verdict { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); }
.results-body { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.results-card .kpi { box-shadow: none; background: var(--surface-2); padding: 12px 14px; }
.results-card .kpi .v { font-size: var(--fs-xl); }
.results-body > .btn, .results-body > div > .btn.ai { align-self: flex-start; }
.node .acts { position: absolute; left: 8px; right: 8px; bottom: 8px; margin: 0; padding: 6px; z-index: 2;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .15s, transform .15s; }
.node:hover .acts, .node:focus-within .acts { opacity: 1; transform: none; pointer-events: auto; }
.head-target .btn.sm { height: 26px; padding: 0 8px; margin-left: 4px; }
.page-head > div:first-child { min-width: 0; }
.btn.has-menu > svg:last-child { width: 14px; height: 14px; margin-left: -2px; opacity: .7; }
.menu-pop.menu-sm { width: 300px; }
.menu-sm .menu-item { height: auto; min-height: 40px; padding: 8px 10px; text-align: left; align-items: flex-start; }
.menu-sm .menu-item svg { margin-top: 2px; }
.menu-sm .menu-item small { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; margin-top: 1px; }

/* ================================================================ TraceProof enterprise finish
   Calm surfaces, hairline borders, one accent. Loaded last, so it refines what came before. */
h1, h2, h3, .page-head h1, .drawer-head h2, .glance-target, .kpi .v { font-family: var(--font-display); }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -.02em; }
.card { border-color: var(--border); box-shadow: var(--shadow-sm); }
.card-head h3 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; }
.btn { font-weight: 550; border-radius: var(--r-sm); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); filter: none; }
.btn:focus-visible, .tab:focus-visible, .step:focus-visible, .run-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.ai:not(.primary) { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); color: var(--accent-text); }
.btn.ai:not(.primary) svg { color: var(--accent); }
/* sidebar: quieter, one clear active state */
.sidebar { background: var(--surface); }
.nav-item { border-radius: var(--r-sm); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 3px 0 0 var(--accent); }
.nav-group { letter-spacing: .08em; }
/* tables: crisp header, aligned numbers */
table.data th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
table.data td.num, .kpi .v, .rec-cell, .node .r b { font-variant-numeric: tabular-nums; }
/* KPI tiles: a thin status rule instead of a dot */
.kpi { border-radius: var(--r-md); }
/* step bar: flat, the current step carries the accent */
.step.now { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.stepbar { box-shadow: var(--shadow-sm); }
/* the pipeline-at-a-glance panel sits on ink, its boxes stay readable */
.glance { border: 1px solid rgba(255,255,255,.06); }
/* verdict: a calm banner with a coloured edge */
.verdict { border-width: 1px; }
.verdict.bad { border-left: 4px solid var(--fail); }
.verdict.warn { border-left: 4px solid var(--warn); }
.verdict.good { border-left: 4px solid var(--pass); }
/* badges: compact and legible */
.badge { font-weight: 600; letter-spacing: .01em; }
/* code: the same mono everywhere */
pre.code, code, .mono, textarea { font-family: var(--mono); }
[data-theme="dark"] .avatar, [data-theme="dark"] .brand .logo, [data-theme="dark"] .ty-target, [data-theme="dark"] .drawer-head.t-target .dh-ic { background: var(--accent); }
[data-theme="dark"] .ty-target { --tc-bg: var(--accent); }
.row.gap-6 { gap: 6px; } .row.center { align-items: center; }

/* ---------------------------------------------------------------- sidebar: one-line names, explanation on hover */
.sidebar { background: var(--surface); padding: 16px 12px 14px; gap: 1px; }
.brand { padding: 2px 8px 14px; margin-bottom: 2px; }
.nav-sec { display: flex; flex-direction: column; gap: 1px; }
.nav-group { padding: 16px 10px 6px; font-size: var(--fs-2xs); color: var(--faint); }
.nav-item { align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); box-shadow: none; }
.nav-item svg { width: 17px; height: 17px; margin: 0; opacity: .75; }
.nav-txt { display: block; font-size: var(--fs-base); font-weight: 500; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover .nav-txt { color: var(--text); }
.nav-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-item.active .nav-txt { color: var(--accent-text); font-weight: 600; }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav-tip { position: fixed; z-index: 90; transform: translateY(-50%); max-width: 240px; padding: 8px 11px; border-radius: var(--r-md);
  background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: var(--fs-xs); line-height: 1.45; pointer-events: none;
  display: flex; flex-direction: column; gap: 1px; animation: navtip .12s ease-out; }
.nav-tip b { font-size: var(--fs-sm); font-weight: 600; }
.nav-tip span { color: rgba(255,255,255,.75); }
.nav-tip::before { content: ""; position: absolute; left: -5px; top: 50%; width: 10px; height: 10px; background: var(--ink); transform: translateY(-50%) rotate(45deg); border-radius: 2px; }
@keyframes navtip { from { opacity: 0; transform: translate(-4px, -50%); } }
[data-theme="dark"] .nav-tip, [data-theme="dark"] .nav-tip::before { background: #2a3342; }
.shell.collapsed .nav-item { justify-content: center; }
.shell.collapsed .nav-group { display: block; height: 12px; padding: 0; font-size: 0; }
.shell.collapsed .brand { justify-content: center; }

/* ---------------------------------------------------------------- section headers: a soft blue → white wash so each section stands out */
:root { --head-wash: linear-gradient(90deg, color-mix(in srgb, var(--accent) 13%, var(--surface)) 0%, color-mix(in srgb, var(--accent) 5%, var(--surface)) 45%, var(--surface) 100%); }
.card-head { background: var(--head-wash); border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  border-bottom-color: color-mix(in srgb, var(--accent) 14%, var(--border)); }
.card-head h3 { color: var(--text); }
.card-head h3::before { content: ""; display: inline-block; width: 3px; height: .95em; margin-right: 9px; vertical-align: -1px; border-radius: 2px; background: var(--accent); }
.card-head > svg + h3::before { display: none; }
.keys-head { margin: -12px -14px 12px; padding: 10px 14px; background: var(--head-wash); border-radius: calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0 0;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border)); }
.keys-head b, .keys-head strong { color: var(--text); }
details.fold > summary { background: var(--head-wash); border-radius: calc(var(--radius-sm) - 1px); font-weight: 600; color: var(--text); }
details.fold[open] > summary { border-radius: calc(var(--radius-sm) - 1px) calc(var(--radius-sm) - 1px) 0 0; margin-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border)); }
details.fold > summary::before { color: var(--accent); font-weight: 700; }
details.fold > summary:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, var(--surface)) 0%, var(--surface) 100%); }
.modal-head { background: var(--head-wash); }
.keys-head:last-child, .keys-head:has(+ .scope-detail:empty) { margin-bottom: -12px; border-bottom: 0; border-radius: calc(var(--r-md) - 1px); }
.scope-detail:empty { display: none; }

/* ---------------------------------------------------------------- firmer borders: thicker, darker outlines on every surface */
:root { --border: #d2d8e1; --border-strong: #b6bfcc; }
[data-theme="dark"] { --border: #333d4c; --border-strong: #475266; }
/* containers: 2px */
.card, .kpi, .keys-box, details.fold, .canvas-wrap, .table-wrap, .box, .stepbar, .run-opt, .modal, .fwin, .menu-pop, .cw-panel,
.jr-sec, .resume, .ct-row, .ct-result, .xl-scope, .xl-model, .saved-row, .filters, .pk-list, .sb-cols, .tc, .bd, .tr-step, .side-foot { border-width: 2px; }
/* small parts inside them: 1.5px */
.node, .chip, .pill, .seg, .keys-row, .edge-lab, .ok-key, .bd-st, .fwin-tab, .btn, input, select, textarea, .node .acts button { border-width: 1.5px; }
.sidebar { border-right-width: 2px; }
.topbar, header.top { border-bottom-width: 2px; }
.card-head, .keys-head, details.fold[open] > summary, .modal-head { border-bottom-width: 2px; }

/* ---------------------------------------------------------------- table Health tab: score, record flow, quantity reconcile, columns filled, trend */
.hc { display: flex; flex-direction: column; gap: 14px; --ok: var(--pass); --wa: var(--warn); --ba: var(--fail); }
.hc-top { display: grid; grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); gap: 14px; }
.hc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .hc-top, .hc-grid { grid-template-columns: minmax(0, 1fr); } }
.hc-box { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 14px 16px; min-width: 0; }
.hc-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.hc-head b { font-size: var(--fs-base); color: var(--heading, var(--text)); }
.hc-head span { font-size: var(--fs-xs); color: var(--muted); }
.hc-score { display: flex; align-items: center; gap: 14px; }
.hc-big { font-size: var(--fs-lg); color: var(--heading, var(--text)); display: block; margin-bottom: 2px; }
.hc-ring { position: relative; width: 76px; height: 76px; flex: none; }
.hc-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--text); }
.hc-ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.hc-ring-fg { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.t-ok .hc-ring-fg { stroke: var(--ok); } .t-warn .hc-ring-fg { stroke: var(--wa); } .t-bad .hc-ring-fg { stroke: var(--ba); } .t-na .hc-ring-fg { stroke: var(--faint); }
.hc-dims { display: flex; flex-direction: column; gap: 4px; }
.hc-dim { display: grid; grid-template-columns: 128px minmax(60px, 1fr) 34px; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left;
  padding: 5px 8px; border: 0; border-radius: var(--r-sm); background: transparent; font: inherit; cursor: pointer; color: var(--text); }
.hc-dim:hover { background: var(--surface-3); }
.hc-dname { font-size: var(--fs-sm); font-weight: 600; }
.hc-track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.hc-fill { display: block; height: 100%; border-radius: 4px; transition: width .6s ease; }
.hc-dim.t-ok .hc-fill { background: var(--ok); } .hc-dim.t-warn .hc-fill { background: var(--wa); } .hc-dim.t-bad .hc-fill { background: var(--ba); }
.hc-dval { font-size: var(--fs-sm); text-align: right; } .hc-dim.t-na .hc-dval { color: var(--faint); font-weight: 500; }
.hc-dnote { grid-column: 2 / span 2; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* record flow */
.hc-flow { display: flex; gap: 8px; align-items: stretch; overflow-x: auto; padding-bottom: 2px; }
.hc-col { flex: 1 1 0; min-width: 62px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hc-num { font-size: var(--fs-sm); font-weight: 700; }
.hc-bar-area { position: relative; width: 100%; height: 110px; border-bottom: 1px solid var(--border-strong); }
.hc-bar { position: absolute; left: 14%; right: 14%; border-radius: 4px 4px 2px 2px; }
.k-in .hc-bar { background: color-mix(in srgb, var(--accent) 70%, var(--surface)); } .k-out .hc-bar { background: var(--accent); }
.k-loss .hc-bar { background: color-mix(in srgb, var(--fail) 75%, var(--surface)); } .k-loss .hc-num { color: var(--fail); }
.k-gain .hc-bar { background: color-mix(in srgb, var(--warn) 80%, var(--surface)); } .k-gain .hc-num { color: var(--warn); }
.k-grp .hc-bar { background: repeating-linear-gradient(45deg, var(--faint) 0 4px, color-mix(in srgb, var(--faint) 45%, var(--surface)) 4px 8px); } .k-grp .hc-num { color: var(--muted); }
.hc-lab { font-size: var(--fs-xs); font-weight: 600; text-align: center; }
.hc-sub { font-size: var(--fs-2xs); color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* quantity reconcile */
.hc-recon { display: flex; flex-direction: column; gap: 8px; }
.hc-rrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 12px; border-radius: var(--r-md); border-left: 4px solid var(--border-strong); background: var(--surface-2); }
.hc-rrow.ok { border-left-color: var(--ok); } .hc-rrow.warn { border-left-color: var(--wa); } .hc-rrow.bad { border-left-color: var(--ba); background: var(--fail-bg); }
.hc-rname { font-size: var(--fs-sm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-rnum { font-size: var(--fs-sm); font-weight: 600; text-align: right; white-space: nowrap; }
.hc-arrow { color: var(--faint); margin: 0 6px; }
.hc-rwhy { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--muted); }
.hc-rrow.ok .hc-rwhy { color: var(--pass); } .hc-rrow.bad .hc-rwhy { color: var(--fail); } .hc-rrow.warn .hc-rwhy { color: var(--warn); }
/* columns filled */
.hc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(22px, 1fr)); gap: 4px; }
.hc-tile { height: 22px; border-radius: 4px; cursor: default; }
.hc-tile.full { background: color-mix(in srgb, var(--pass) 55%, var(--surface)); } .hc-tile.most { background: color-mix(in srgb, var(--pass) 25%, var(--surface)); }
.hc-tile.half { background: color-mix(in srgb, var(--warn) 55%, var(--surface)); } .hc-tile.low { background: color-mix(in srgb, var(--fail) 60%, var(--surface)); }
.hc-tile.na { background: var(--surface-3); } .hc-tile:hover { outline: 2px solid var(--text-2); outline-offset: 1px; }
/* trend */
.hc-spark { width: 100%; height: 64px; display: block; }
.hc-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.hc-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; } .hc-dot.bad { stroke: var(--fail); fill: var(--fail); }
.hc-spark-foot { display: flex; justify-content: space-between; font-size: var(--fs-2xs); color: var(--muted); margin-top: 4px; }
.hc-score { flex-direction: column; justify-content: center; text-align: center; gap: 10px; }
.hc-score .hc-ring { width: 96px; height: 96px; } .hc-score .hc-ring svg { width: 96px; height: 96px; } .hc-score .hc-ring b { font-size: 28px; }

/* ---------------------------------------------------------------- pipeline at a glance, refreshed: night-blue glow, lanes, stats, test bar */
.glance { padding: 20px 22px; gap: 22px; border: 0;
  background: radial-gradient(700px 380px at 12% -20%, rgba(91,141,239,.45) 0%, transparent 60%), radial-gradient(640px 420px at 100% 120%, rgba(45,212,191,.22) 0%, transparent 60%),
  linear-gradient(135deg, #0e1a3a 0%, #13234d 55%, #0f2a44 100%) !important; box-shadow: 0 18px 40px -22px rgba(14,26,58,.7) !important; }
.glance::before { opacity: .12; background-image: radial-gradient(rgba(255,255,255,.55) 1px, transparent 1px); background-size: 18px 18px; }
.glance-side { width: 250px; gap: 10px; justify-content: flex-start; }
.glance-kicker { color: #9fc0ff; }
.glance-target { font-size: 22px; }
.gl-pills { display: flex; gap: 6px; flex-wrap: wrap; } .gl-pills .glance-pill { margin-top: 0; }
.gl-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gl-stat { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-md); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.gl-stat b { font-size: 20px; line-height: 1.1; color: #fff; } .gl-stat span { font-size: var(--fs-2xs); color: rgba(255,255,255,.65); text-transform: uppercase; letter-spacing: .06em; }
.gl-records { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; padding: 8px 10px; border-radius: var(--r-md); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.gl-records span { font-size: var(--fs-xs); color: rgba(255,255,255,.65); } .gl-records span:last-child { flex-basis: 100%; font-size: var(--fs-2xs); }
.gl-records b { font-size: 18px; color: #fff; } .gl-records i { font-style: normal; color: #7fd8ff; font-weight: 700; }
.gl-testbar { display: flex; flex-direction: column; gap: 6px; }
.gl-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: rgba(255,255,255,.1); }
.gl-bar span { min-width: 4px; } .gl-bar .ok, .gl-bar-legend i.ok { background: #34d399; } .gl-bar .warn, .gl-bar-legend i.warn { background: #fbbf24; }
.gl-bar .bad, .gl-bar-legend i.bad { background: #f87171; } .gl-bar .err, .gl-bar-legend i.err { background: #c084fc; }
.gl-bar-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-2xs); color: rgba(255,255,255,.75); }
.gl-bar-legend span { display: inline-flex; align-items: center; gap: 5px; } .gl-bar-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.glance-map-wrap { background: rgba(6,12,30,.35); border: 1px solid rgba(255,255,255,.08); }
.gl-lane { fill: rgba(255,255,255,.035); } .gl-lane.alt { fill: rgba(255,255,255,.06); }
.gl-lane-t { font: 700 9.5px var(--font); letter-spacing: .12em; fill: rgba(190,210,255,.7); }
.ha-node rect { fill: rgba(255,255,255,.1); stroke: rgba(255,255,255,.28); }
.gl-node:hover rect, .gl-node:focus rect { fill: rgba(255,255,255,.2); stroke: #9fc0ff; }
.ha-node.target rect { fill: #fff; filter: drop-shadow(0 0 10px rgba(127,180,255,.75)); }
.gl-dot { fill: rgba(255,255,255,.45); } .gl-dot.ok { fill: #34d399; } .gl-dot.warn { fill: #fbbf24; } .gl-dot.fail { fill: #f87171; }
.ha-link { stroke: rgba(159,192,255,.35); } .ha-flow { stroke: #7fd8ff; }
.glance-legend { color: rgba(255,255,255,.7); }
.glance-map { height: auto; max-height: none; }
