/* Gemini Data Team knowledge map — light theme (v0) */
:root {
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efeb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #8a8985;
  --line: #d9d8d2;
  --line-2: #c4c3bc;
  --accent: #2a78d6;
  --accent-soft: #e3eefb;
  --lane-gemini: #f6f1e7;      /* warm: shared */
  --lane-gemini-line: #e0d3b6;
  --lane-client: #e9f0f6;      /* cool: per-client */
  --lane-client-line: #bfd0e2;
  --t-notebook: #2a78d6;
  --t-run_job: #eb6834;
  --t-condition: #eda100;
  --t-for_each: #4a3aa7;
  --t-other: #1baf7a;
  --deck: #cfd9e4;
  --hi: #eb6834;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); overflow: hidden; }
button { font: inherit; }

/* ---------- top bar ---------- */
#topbar {
  height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 5;
}
#topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 650; cursor: pointer; white-space: nowrap; }
#topbar .logo { color: var(--accent); font-size: 18px; }
#topbar .spacer { flex: 1; }
#crumbs { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; margin-left: 10px; min-width: 0; overflow: hidden; }
#crumbs a { color: var(--ink-2); text-decoration: none; padding: 3px 6px; border-radius: 6px; white-space: nowrap; }
#crumbs a:hover { background: var(--surface-2); color: var(--ink); }
#crumbs .sep { color: var(--ink-3); }
#crumbs .cur { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-filter { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.client-filter select, #search, #topbar button {
  height: 32px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 0 10px; font-size: 13px;
}
#search { width: 260px; }
#topbar button { cursor: pointer; }
#topbar button:hover { background: var(--surface-2); }

/* ---------- stage ---------- */
#stage { position: relative; height: calc(100% - 52px); }
#canvas { width: 100%; height: 100%; display: block; cursor: grab; background: var(--bg); }
#canvas:active { cursor: grabbing; }
#canvas text { font-family: var(--font); }
#arrow path { fill: var(--line-2); }
#arrow-hi path { fill: var(--hi); }

/* lanes */
.lane rect.lane-bg { rx: 28; stroke-width: 2; }
.lane.gemini rect.lane-bg { fill: var(--lane-gemini); stroke: var(--lane-gemini-line); }
.lane.per_client rect.lane-bg { fill: var(--lane-client); stroke: var(--lane-client-line); }
.lane-title { font-size: 44px; font-weight: 700; fill: var(--ink); }
.lane-sub { font-size: 22px; fill: var(--ink-2); }

/* client chips (svg) */
.chip { cursor: pointer; }
.chip rect { fill: var(--surface); stroke: var(--line-2); rx: 16; }
.chip text { font-size: 22px; fill: var(--ink-2); pointer-events: none; }
.chip:hover rect { stroke: var(--accent); }
.chip.on rect { fill: var(--accent); stroke: var(--accent); }
.chip.on text { fill: #fff; font-weight: 600; }
.chip.pseudo rect { stroke-dasharray: 4 3; }

/* repos */
.repo rect.repo-bg { fill: var(--surface); stroke: var(--line); stroke-width: 2; rx: 20; }
.repo-head { cursor: pointer; }
.repo-title { font-size: 34px; font-weight: 700; fill: var(--ink); }
.repo-title tspan.gh { font-size: 18px; font-weight: 500; fill: var(--accent); }
.repo-desc { font-size: 16px; fill: var(--ink-2); }
.repo-stats { font-size: 15px; fill: var(--ink-3); }
.repo-head:hover .repo-title { fill: var(--accent); }

/* domain groups */
.group rect.group-bg { fill: var(--surface-2); stroke: none; rx: 14; }
.group-title { font-size: 15px; font-weight: 650; fill: var(--ink-2); letter-spacing: .04em; text-transform: uppercase; }
.group.legacy rect.group-bg { fill: transparent; stroke: var(--line-2); stroke-dasharray: 6 4; }

/* job cards */
.job { cursor: pointer; }
.job .deck { fill: var(--deck); stroke: var(--surface); stroke-width: 1.5; rx: 12; }
.job rect.card { fill: var(--surface); stroke: var(--line-2); stroke-width: 1.5; rx: 12; }
.job.orphan rect.card { stroke-dasharray: 7 5; }
.job.legacy rect.card { fill: #f7f7f4; }
.job:hover rect.card { stroke: var(--accent); }
.job.selected rect.card { stroke: var(--accent); stroke-width: 3; }
.job.dim { opacity: .18; }
.job.dim.gemini-shared { opacity: .55; }
.job foreignObject { pointer-events: none; }
.card-html { font-family: var(--font); color: var(--ink); height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.card-title { font-size: 17px; font-weight: 650; line-height: 1.2; margin: 0; word-break: break-word; }
.card-title .ph { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 0 5px; font-weight: 600; font-size: .9em; }
.card-title .cli { background: var(--accent); color: #fff; border-radius: 6px; padding: 0 5px; font-weight: 600; font-size: .9em; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pill { font-size: 11.5px; line-height: 18px; padding: 0 7px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.sched { background: #eef6ee; color: #1f5f24; }
.pill.sched.paused { background: #f5f0e6; color: #7a5a12; text-decoration: line-through; }
.pill.manual { color: var(--ink-3); }
.pill.n { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pill.legacy { background: #f3e9e9; color: #8b3a3a; }
.card-summary { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.35; overflow: hidden; }
.card-summary .row { margin-top: 3px; }
.card-summary code { font-family: var(--mono); font-size: 11.5px; }
.card-summary .k { color: var(--ink-3); }

/* DAG inside card */
.dag rect.node { rx: 6; stroke-width: 1; fill: var(--surface); }
.dag .node-t-notebook rect.node { stroke: var(--t-notebook); }
.dag .node-t-run_job rect.node { stroke: var(--t-run_job); fill: #fff3ee; }
.dag .node-t-condition rect.node { stroke: var(--t-condition); fill: #fff8e6; }
.dag .node-t-for_each rect.node { stroke: var(--t-for_each); fill: #f0eefa; }
.dag .node-t-python_wheel rect.node, .dag .node-t-spark_python rect.node, .dag .node-t-sql rect.node,
.dag .node-t-pipeline rect.node, .dag .node-t-dbt rect.node, .dag .node-t-other rect.node { stroke: var(--t-other); }
.dag rect.node-bar { rx: 2; }
.dag .node-t-notebook rect.node-bar { fill: var(--t-notebook); }
.dag .node-t-run_job rect.node-bar { fill: var(--t-run_job); }
.dag .node-t-condition rect.node-bar { fill: var(--t-condition); }
.dag .node-t-for_each rect.node-bar { fill: var(--t-for_each); }
.dag .node-t-python_wheel rect.node-bar, .dag .node-t-spark_python rect.node-bar, .dag .node-t-sql rect.node-bar,
.dag .node-t-pipeline rect.node-bar, .dag .node-t-dbt rect.node-bar, .dag .node-t-other rect.node-bar { fill: var(--t-other); }
.dag text.node-label { font-size: 12px; fill: var(--ink); }
.dag text.node-sub { font-size: 9.5px; fill: var(--ink-3); font-family: var(--mono); }
.dag path.dep { fill: none; stroke: var(--line-2); stroke-width: 1.2; marker-end: url(#arrow); }
.dag text.dep-label { font-size: 9px; fill: var(--ink-3); }
.dag .tnode { cursor: pointer; }
.dag .tnode:hover rect.node { stroke-width: 2.5; }
.dag .tnode.selected rect.node { stroke-width: 3; stroke: var(--accent); }
.dag .tnode.jump text.node-jump { font-size: 10px; fill: var(--t-run_job); font-weight: 600; }

/* job→job edges */
.jedge { fill: none; stroke: var(--line-2); stroke-width: 2; opacity: .55; marker-end: url(#arrow); pointer-events: none; }
.jedge.hi { stroke: var(--hi); opacity: 1; stroke-width: 3; marker-end: url(#arrow-hi); }
.jedge.dim { opacity: .08; }

/* level-of-detail: k0 (far), k1 (mid), k2 (near) */
.card-summary { display: none; }            /* summary lives in the side panel; the card shows the DAG */
.k0 .pills { display: none; }
.k0 .card-title { font-size: 26px; }
.k0 .group-title { font-size: 20px; }
.k0 .dag { opacity: .75; }
.k0 .jedge { stroke-width: 4; }

/* ---------- panel ---------- */
#panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 400px; max-width: calc(100% - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.08);
  overflow: auto; padding: 18px 18px 24px; font-size: 13.5px; line-height: 1.45; z-index: 4;
}
#panel.hidden, #help.hidden { display: none; }
#panel-close { position: absolute; top: 8px; right: 10px; border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--ink-3); }
#panel h2 { margin: 0 24px 4px 0; font-size: 18px; line-height: 1.25; word-break: break-word; }
#panel h3 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
#panel .sub { color: var(--ink-2); }
#panel .kv { display: grid; grid-template-columns: 110px 1fr; gap: 3px 10px; }
#panel .kv .k { color: var(--ink-3); }
#panel code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
#panel a { color: var(--accent); }
#panel table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
#panel td, #panel th { text-align: left; padding: 3px 6px 3px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
#panel th { color: var(--ink-3); font-weight: 500; }
#panel .chips { display: flex; flex-wrap: wrap; gap: 5px; }
#panel .chips button, #panel button.jump {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 12px; padding: 1px 9px; cursor: pointer; font-size: 12px; color: var(--ink-2);
}
#panel .chips button:hover, #panel button.jump:hover { border-color: var(--accent); color: var(--accent); }
#panel .chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#panel .links a { display: inline-block; margin: 2px 8px 2px 0; }
#panel .task-list li { margin: 2px 0; }
#panel .task-list .dot { margin-right: 6px; }
#panel .muted { color: var(--ink-3); }
#panel .warn { color: #7a5a12; background: #fbf5e6; padding: 6px 8px; border-radius: 8px; }
#panel .btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
#panel .btn-row a { display: inline-block; border: 1px solid var(--accent); border-radius: 8px; padding: 3px 9px; text-decoration: none; font-size: 12.5px; }

/* legend + help */
#legend {
  position: absolute; left: 12px; bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 12px; color: var(--ink-2); z-index: 3; box-shadow: 0 4px 16px rgba(0,0,0,.05);
}
.legend-title { font-weight: 650; color: var(--ink); margin-bottom: 4px; }
.legend-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.legend-hint { margin-top: 6px; color: var(--ink-3); }
.sw { display: inline-block; width: 22px; height: 14px; border: 1.5px solid var(--line-2); border-radius: 3px; background: var(--surface); }
.sw.deck { box-shadow: 3px 3px 0 var(--deck), 6px 6px 0 var(--deck); }
.sw.dashed { border-style: dashed; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 3px 0 6px; vertical-align: -1px; }
.dot.t-notebook { background: var(--t-notebook); } .dot.t-run_job { background: var(--t-run_job); }
.dot.t-condition { background: var(--t-condition); } .dot.t-for_each { background: var(--t-for_each); }
.dot.t-python_wheel, .dot.t-spark_python, .dot.t-sql, .dot.t-pipeline, .dot.t-dbt, .dot.t-other { background: var(--t-other); }
#help {
  position: absolute; left: 50%; top: 40px; transform: translateX(-50%); width: 560px; max-width: calc(100% - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; z-index: 6; box-shadow: 0 12px 40px rgba(0,0,0,.12); font-size: 14px;
}
#help h3 { margin: 0 0 8px; }
#help kbd { border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; font-family: var(--mono); font-size: 12px; background: var(--surface-2); }
#help button { margin-top: 6px; border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 12px; background: var(--surface); cursor: pointer; }

/* ---------- view tabs (map ↔ deployment) ---------- */
#view-tabs { display: flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; margin-left: 4px; flex: none; }
#view-tabs button { height: 30px; border: none; background: var(--surface); color: var(--ink-2); padding: 0 12px; font-size: 13px; cursor: pointer; }
#view-tabs button + button { border-left: 1px solid var(--line-2); }
#view-tabs button:hover { background: var(--surface-2); }
#view-tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- deployment screen ---------- */
body.view-deploy #canvas, body.view-deploy #legend,
body.view-deploy .client-filter, body.view-deploy #search { display: none; }
#deploy-screen { position: absolute; inset: 0; overflow-y: auto; background: var(--bg); }
.dep-wrap { max-width: 1160px; margin: 0 auto; padding: 26px 32px 60px; font-size: 13.5px; line-height: 1.45; }
.dep-h { margin: 0; font-size: 24px; }
.dep-sub { margin: 6px 0 20px; color: var(--ink-2); max-width: 720px; }
.dep-sec { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }

/* infra strip: workspaces + aurora */
.dep-infra { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 22px; }
.ws-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ws-box { border-radius: 12px; padding: 12px 14px; border: 1.5px solid; }
.ws-box.ws-sandbox { background: var(--lane-client); border-color: var(--lane-client-line); }
.ws-box.ws-prod { background: #fdeee6; border-color: #f0c4ac; }
.ws-label { font-weight: 650; }
.ws-host { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); word-break: break-all; }
.env-tokens { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.env-token { font-family: var(--mono); font-size: 11px; line-height: 18px; padding: 0 7px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2); }
.ws-note { margin-top: 7px; font-size: 12px; color: var(--ink-2); }
.aurora-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 12px; }
.aurora-box { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; }
.au-cyl { flex: none; width: 22px; height: 26px; border: 2px solid var(--ink-3); border-radius: 11px / 6px; position: relative; }
.au-cyl::before { content: ""; position: absolute; left: -2px; right: -2px; top: -2px; height: 10px; border: 2px solid var(--ink-3); border-radius: 50%; box-sizing: border-box; background: var(--surface); }
.au-prod .au-cyl, .au-prod .au-cyl::before { border-color: var(--hi); }
.au-label { font-weight: 600; font-size: 13px; }
.infra-note { margin: 12px 0 0; color: var(--ink-2); font-size: 12.5px; max-width: 860px; }

/* repo lanes */
.dep-repo { background: var(--surface); border: 1px solid var(--line); border-left-width: 5px; border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.dep-repo.lane-g { border-left-color: var(--lane-gemini-line); }
.dep-repo.lane-c { border-left-color: var(--lane-client-line); }
.dr-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dr-head h3 { margin: 0; font-size: 17px; }
.fanout-badge { font-size: 11.5px; line-height: 20px; padding: 0 9px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); cursor: default; }
.fanout-badge.fanout-ci_matrix { background: #f0eefa; color: var(--t-for_each); }
.fanout-badge.fanout-job_params { background: var(--accent-soft); color: var(--accent); }
.wf-link { margin-left: auto; font-size: 12px; color: var(--accent); text-decoration: none; font-family: var(--mono); }
.wf-link:hover { text-decoration: underline; }
.dep-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 10px; }
.branch-chip { font-family: var(--mono); font-size: 12.5px; line-height: 24px; padding: 0 11px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.branch-chip.ghost { border-style: dashed; color: var(--ink-3); background: transparent; }
.branch-chip.prod { background: #fdeee6; border-color: #f0c4ac; color: #a4430f; font-weight: 600; }
.flow-arrow { color: var(--ink-3); }
.ci-cell { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; }
.gate-badge { font-weight: 600; font-size: 12px; padding: 1px 8px; border-radius: 9px; }
.gate-badge.on { background: #eef6ee; color: #1f5f24; }
.gate-badge.off { background: #f3e9e9; color: #8b3a3a; }
.check-pill { font-size: 11.5px; line-height: 18px; padding: 0 7px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.pr-note { flex-basis: 100%; color: var(--ink-2); }
.pr-note .k { color: var(--ink-3); }
.dep-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.target-card { border: 1.5px solid var(--lane-client-line); background: var(--lane-client); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; }
.target-card.ws-prod { background: #fdeee6; border-color: #f0c4ac; }
.tc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tc-name { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.mode-badge { font-size: 10.5px; line-height: 16px; padding: 0 6px; border-radius: 8px; }
.mode-badge.mode-production { background: var(--hi); color: #fff; }
.mode-badge.mode-development { background: #eef6ee; color: #1f5f24; }
.mode-badge.mode-none { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-3); }
.default-tag { font-size: 10.5px; line-height: 16px; padding: 0 6px; border-radius: 8px; background: var(--accent); color: #fff; cursor: default; }
.tc-ws { margin-top: 5px; color: var(--ink-2); font-size: 11.5px; }
.ws-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--accent); vertical-align: 0; }
.target-card.ws-prod .ws-dot { background: var(--hi); }
.tc-cat { display: inline-block; font-family: var(--mono); font-size: 11.5px; background: var(--surface); border-radius: 5px; padding: 1px 5px; margin-top: 5px; word-break: break-all; }
.tc-sched { margin-top: 5px; }
.sched-live { color: #1f5f24; }
.sched-paused { color: #7a5a12; }
.tc-sched .muted, .dep-wrap .muted { color: var(--ink-3); }
.tc-branch { margin-top: 6px; font-size: 11.5px; color: var(--ink-2); border-top: 1px solid rgba(0,0,0,.06); padding-top: 5px; }
.dep-gotchas { margin-top: 12px; }
.gotcha { background: #fbf5e6; color: #7a5a12; border-left: 3px solid var(--t-condition); border-radius: 0 8px 8px 0; padding: 6px 10px; font-size: 12.5px; margin-top: 6px; }

/* shared vs differences */
.dep-shared { display: grid; grid-template-columns: 5fr 7fr; gap: 18px; margin-top: 22px; }
.shared-col, .diff-col { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.shared-col ul { margin: 0; padding-left: 18px; }
.shared-col li { margin: 5px 0; }
.diff-col { overflow-x: auto; }
.diff-col table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.diff-col td, .diff-col th { text-align: left; padding: 5px 8px 5px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.diff-col th { color: var(--ink-3); font-weight: 600; font-size: 12px; }
.diff-col td.k { color: var(--ink-3); white-space: nowrap; }
.diff-col code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
@media (max-width: 900px) { .ws-row, .aurora-row, .dep-shared { grid-template-columns: 1fr; } }

/* ---------- Domains view: the handover handbook ---------- */
/* Domain hues = the eight validated categorical slots (light / dark stepped separately);
   clients and people are drawn in ink. Dark mode applies to this view only. */
:root {
  --dom-1: #2a78d6; --dom-2: #eb6834; --dom-3: #1baf7a; --dom-4: #eda100;
  --dom-5: #e87ba4; --dom-6: #008300; --dom-7: #4a3aa7; --dom-8: #e34948;
  --dom-ink: #52514e; --dom-ink-soft: #8a8985; --dom-5b: #a8457a;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  body.view-domains {
    --bg: #121211; --surface: #1a1a19; --surface-2: #242422;
    --ink: #f4f4f1; --ink-2: #c3c2b7; --ink-3: #8f8e88;
    --line: #2c2c2a; --line-2: #3d3d3a;
    --accent: #6aa5ec; --accent-soft: #1d2b3c;
    --dom-1: #3987e5; --dom-2: #d95926; --dom-3: #199e70; --dom-4: #c98500;
    --dom-5: #d55181; --dom-6: #008300; --dom-7: #9085e9; --dom-8: #e66767;
    --dom-ink: #c3c2b7; --dom-ink-soft: #8f8e88; --dom-5b: #f0a0c2;
    color-scheme: dark;
  }
}
body.view-domains { background: var(--bg); }
body.view-domains #canvas, body.view-domains #legend, body.view-domains .client-filter,
body.view-domains #search, body.view-domains #btn-reset { display: none; }
#domains-screen { position: absolute; inset: 0; overflow-y: auto; background: var(--bg); color: var(--ink); }
.hb-wrap { max-width: 1120px; margin: 0 auto; padding: 34px 32px 72px; }
.hb-error { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--dom-8); border-radius: 8px; padding: 10px 14px; }
.hb-wrap a { color: inherit; }
.hb-wrap :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* index */
.hb-intro h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 12px; font-weight: 720; }
.hb-intro p { font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink-2); max-width: 64ch; margin: 0; }
.hb-map { margin: 26px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px 10px 14px; }
.hb-map-canvas { position: relative; }
.hb-map figcaption { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 4px 14px 0; font-size: 12.5px; color: var(--ink-2); }
.hb-map figcaption span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { fill: var(--ink-3); }
.lg-ring { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.lg-ring.dashed { stroke-dasharray: 3 2.5; }

.dmap { display: block; width: 100%; height: auto; font-family: var(--font); }
.dm-ring { fill: none; stroke: var(--line-2); stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.dm-ring-label { font-size: 12.5px; fill: var(--ink-3); }
.dm-band { fill: color-mix(in srgb, var(--hue) 9%, var(--surface)); stroke: color-mix(in srgb, var(--hue) 35%, var(--surface)); stroke-width: 1; }
.dm-band-label { font-size: 13px; fill: var(--ink-2); }
.dm-spine { stroke: var(--ink-3); stroke-width: 2; }
.dm-branch { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 5 4; }
.dm-flow-label { font-size: 12px; fill: var(--ink-3); font-style: italic; }
.dm-tie { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 1 4; stroke-linecap: round; }
.dm-chev { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dm-node { cursor: pointer; outline: none; }
.dm-hit { fill: transparent; }
.dm-dot { fill: var(--hue); stroke: var(--surface); stroke-width: 2; transform-box: fill-box; transform-origin: center; transition: transform .15s ease; }
.dm-owner-ring { fill: none; stroke: var(--hue); stroke-width: 1.5; }
.dm-node.no-owner .dm-owner-ring { stroke-dasharray: 4 3; }
.dm-node:hover .dm-dot, .dm-node:focus-visible .dm-dot { transform: scale(1.06); }
.dm-node:focus-visible .dm-owner-ring { stroke-width: 3; stroke: var(--accent); }
.dm-title { font-size: 15px; font-weight: 650; fill: var(--ink); }
.dm-tip { position: absolute; z-index: 2; width: 220px; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.dm-tip dl { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; margin: 6px 0; }
.dm-tip dt { color: var(--ink-2); }
.dm-tip dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.dm-tip p { margin: 0; color: var(--ink-3); }

.hb-grid-h { font-size: 19px; margin: 40px 0 14px; font-weight: 650; }
.hb-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.hb-card a { display: flex; flex-direction: column; height: 100%; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-top: 5px solid var(--hue); border-radius: 6px 6px 12px 12px; padding: 14px 16px 13px; }
.hb-card a:hover { border-color: var(--line-2); border-top-color: var(--hue); background: color-mix(in srgb, var(--hue) 4%, var(--surface)); }
.hb-card h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.25; }
.hb-gist { margin: 0 0 12px; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; flex: 1; }
.hb-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 9px; }
.hb-people .chip { font-size: 12px; line-height: 22px; padding: 0 9px; border-radius: 11px; background: var(--surface-2); color: var(--ink-2); }
.hb-people .chip.tbd { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-3); }
.hb-counts { margin: 0; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* page */
.hb-back { display: inline-block; font-size: 13px; color: var(--ink-2) !important; text-decoration: none; padding: 4px 0; }
.hb-back::before { content: "‹ "; }
.hb-back:hover { color: var(--ink) !important; }
.hb-head { border-left: 6px solid var(--hue); padding: 4px 0 4px 18px; margin: 14px 0 30px; }
.hb-head h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.04; letter-spacing: -0.022em; margin: 0 0 10px; font-weight: 720; }
.hb-lede { font-family: var(--serif); font-size: 19px; line-height: 1.5; color: var(--ink-2); margin: 0; max-width: 60ch; }
.hb-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 44px; align-items: start; }
.hb-body > * { min-width: 0; }
.hb-rail { position: sticky; top: 18px; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 18px; }
.hb-rail h2 { font-size: 12.5px; font-weight: 650; color: var(--ink); margin: 0 0 6px; }
.hb-rail ul { list-style: none; margin: 0; padding: 0; }
.rail-people { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.rail-people dt { color: var(--ink-3); }
.rail-people dd { margin: 0; color: var(--ink); font-weight: 600; }
.rail-people dd.tbd { font-weight: 400; color: var(--ink-2); font-style: italic; }
.rail-toc ol { margin: 0; padding: 0 0 0 22px; }
.rail-toc li { margin: 2px 0; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rail-toc a { text-decoration: none; color: var(--ink-2); }
.rail-toc a:hover { color: var(--ink); text-decoration: underline; }
.rail-jobs li, .rail-repos li { margin: 3px 0; }
.rail-jobs a, .rail-repos a { font-family: var(--mono); font-size: 12px; text-decoration: none; word-break: break-all; }
.rail-runbooks li { margin: 5px 0; line-height: 1.35; }
.rail-runbooks a { text-decoration: none; font-family: var(--mono); font-size: 11.5px; word-break: break-all; color: var(--ink-2); }
.rail-runbooks a:hover { color: var(--ink); text-decoration: underline; }
.rb-repo { display: block; font-family: var(--font); font-size: 11.5px; color: var(--ink-3); }
.rail-linear { margin: 0; line-height: 1.9; }
.rail-linear code { font-family: var(--mono); font-size: 11px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.hb-wrap a.to-map { color: var(--accent); text-decoration: none; border-bottom: 1px dotted currentColor; }
.hb-wrap a.to-map:hover { border-bottom-style: solid; }
.rail-jobs a.to-map::before, .rail-repos a.to-map::before { content: "◎ "; font-family: var(--font); }

.hb-prose { font-family: var(--serif); font-size: 17px; line-height: 1.62; max-width: 70ch; }
.hb-prose h2 { font-family: var(--font); font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; font-weight: 680;
  margin: 2.1em 0 .6em; position: relative; scroll-margin-top: 16px; }
.hb-prose h2:first-child { margin-top: 0; }
.hb-prose h2::before { content: attr(data-n); position: absolute; left: -2.1em; width: 1.5em; text-align: right;
  color: var(--hue); font-variant-numeric: tabular-nums; font-weight: 700; }
.hb-prose h3 { font-family: var(--font); font-size: 16.5px; font-weight: 650; margin: 1.6em 0 .4em; }
.hb-prose p, .hb-prose ul, .hb-prose ol { margin: 0 0 .9em; }
.hb-prose ul, .hb-prose ol { padding-left: 1.3em; }
.hb-prose li { margin: .28em 0; }
.hb-prose li::marker { color: var(--ink-3); }
.hb-prose a { text-decoration-color: var(--line-2); text-underline-offset: 2px; }
.hb-prose a:hover { text-decoration-color: var(--ink); }
.hb-prose code { font-family: var(--mono); font-size: .8em; background: var(--surface-2); padding: .08em .35em; border-radius: 4px; overflow-wrap: anywhere; }
.hb-prose pre { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.hb-prose pre code { background: none; padding: 0; }
.hb-prose strong { font-weight: 700; }
.hb-prose table { font-family: var(--font); font-size: 13.5px; line-height: 1.4; border-collapse: collapse; margin: 0 0 1.1em; display: block; overflow-x: auto; }
.hb-prose th { text-align: left; font-weight: 650; border-bottom: 1.5px solid var(--ink-3); padding: 6px 12px 6px 0; vertical-align: bottom; }
.hb-prose td { border-bottom: 1px solid var(--line); padding: 7px 12px 7px 0; vertical-align: top; }
.hb-prose blockquote { margin: 0 0 1em; padding: 2px 0 2px 16px; border-left: 3px solid var(--line-2); color: var(--ink-2); }

.hb-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 56px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.hb-pager a { text-decoration: none; font-weight: 650; font-size: 15px; padding: 10px 0; }
.hb-pager a[rel=next] { text-align: right; }
.hb-pager small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-bottom: 2px; }
.hb-pager a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .hb-body { grid-template-columns: 1fr; gap: 24px; }
  .hb-rail { position: static; }
  .hb-prose h2::before { position: static; display: inline-block; width: auto; margin-right: .5em; }
}
/* phone: the grid is the index; the map would be unreadable at this width */
@media (max-width: 700px) {
  .hb-map { display: none; }
  .hb-wrap { padding: 22px 16px 56px; }
  .hb-grid { grid-template-columns: 1fr; }
  .hb-grid-h { margin-top: 26px; }
  body.view-domains #topbar { gap: 8px; padding: 0 10px; }
  body.view-domains #topbar .brand span:last-child, body.view-domains #crumbs, body.view-domains #btn-help { display: none; }
  .hb-prose { font-size: 16.5px; }
}
@media (prefers-reduced-motion: reduce) { .dm-dot { transition: none; } }
@media print {
  body.view-domains { overflow: visible; height: auto; }
  body.view-domains #topbar, body.view-domains #panel, body.view-domains #help, .hb-back, .hb-pager, .rail-toc { display: none !important; }
  body.view-domains #stage { height: auto; }
  #domains-screen { position: static; overflow: visible; }
  .hb-body { grid-template-columns: 1fr; }
  .hb-rail { position: static; }
  .hb-prose { max-width: none; font-size: 11pt; }
  .hb-prose h2 { break-after: avoid; }
  .hb-prose h2::before { position: static; margin-right: .5em; }
  .hb-prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; word-break: break-all; }
  .hb-card a { break-inside: avoid; }
}
