@charset "UTF-8";

/* Codex account board: system colors, system fonts, inset grouped cards. */
:root {
  color-scheme: light dark;
  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --fill: rgba(118, 118, 128, .12);
  --fill-strong: rgba(118, 118, 128, .2);
  --label: #000000;
  --label-2: rgba(60, 60, 67, .6);
  --label-3: rgba(60, 60, 67, .3);
  --separator: rgba(60, 60, 67, .29);
  --blue: #007AFF;
  --green: #34C759;
  --red: #FF3B30;
  --orange: #FF9500;
  --green-bg: rgba(52, 199, 89, .14);
  --red-bg: rgba(255, 59, 48, .13);
  --orange-bg: rgba(255, 149, 0, .15);
  --blue-bg: rgba(0, 122, 255, .12);
  --surface-muted: #F9F9FB;
  --graph-selected: #EAF3FF;
  --graph-path: #F5F9FF;
  --button-label: #FFFFFF;
  --backdrop: rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .04);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1C1C1E;
    --fill: rgba(118, 118, 128, .24);
    --fill-strong: rgba(118, 118, 128, .36);
    --label: #FFFFFF;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .3);
    --separator: rgba(84, 84, 88, .65);
    --blue: #0A84FF;
    --green: #30D158;
    --red: #FF453A;
    --orange: #FF9F0A;
    --green-bg: rgba(48, 209, 88, .18);
    --red-bg: rgba(255, 69, 58, .18);
    --orange-bg: rgba(255, 159, 10, .2);
    --blue-bg: rgba(10, 132, 255, .2);
    --surface-muted: #121214;
    --graph-selected: #102B47;
    --graph-path: #181F2B;
    --backdrop: rgba(0, 0, 0, .6);
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro SC",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
a { color: var(--blue); text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Shared navigation remains available in the login and explorer views. */
.topbar { min-height: 82px; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; gap: 16px; }
.site-navigation { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand { color: var(--label); font-size: 19px; font-weight: 700; letter-spacing: -.022em; white-space: nowrap; }
.codex-section-nav { display: flex; gap: 4px; padding: 4px; background: var(--fill); border-radius: 12px; width: fit-content; margin: 18px 0 6px; }
.codex-section-nav a { font-size: 14px; font-weight: 600; padding: 7px 16px; border-radius: 9px; color: var(--label-2); white-space: nowrap; }
.codex-section-nav a[aria-current="page"] { background: var(--surface); color: var(--label); box-shadow: var(--shadow); }
.codex-section-nav a:hover { color: var(--label); }
.codex-section-nav a:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 2px; }
.codex-section-nav a:active { opacity: .6; }
.topbar .codex-section-nav { margin: 0; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.readonly-badge { font-size: 13px; display: flex; align-items: center; gap: 7px; color: var(--label-2); white-space: nowrap; }
.readonly-badge span, .status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.button { border: 0; border-radius: 999px; background: var(--fill); padding: 8px 15px; font-size: 14px; font-weight: 590; color: var(--blue); transition: opacity .12s ease, transform .12s ease; }
.button:hover { background: var(--fill-strong); }
.button:active { transform: scale(.96); opacity: .8; }
.button.primary { background: var(--blue); color: var(--button-label); display: flex; justify-content: space-between; align-items: center; }
.button.primary:hover { opacity: .88; }
.button.subtle { background: var(--fill); }
.button.full { width: 100%; padding: 13px 16px; border-radius: 10px; font-size: 15px; }
.text-button { background: none; border: 0; padding: 0; color: var(--blue); font-size: 14px; }
.text-button:hover { text-decoration: underline; }
.eyebrow { font-size: 13px; font-weight: 400; color: var(--label-2); margin: 0 0 8px; }

/* Large title and grouped cards, matching the account board. */
.welcome { max-width: 1040px; margin: auto; padding: 58px 28px 72px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: start; }
.welcome-copy h1 { font-size: 34px; line-height: 1.12; letter-spacing: -.022em; font-weight: 700; margin: 0 0 15px; }
.welcome-description { font-size: 17px; color: var(--label-2); line-height: 1.7; max-width: 420px; margin: 0; }
.welcome-steps { display: flex; flex-direction: column; gap: 0; margin-top: 30px; background: var(--surface); border-radius: var(--radius); padding: 0 16px; box-shadow: var(--shadow); }
.welcome-steps > div { position: relative; padding: 14px 0 14px 32px; }
.welcome-steps > div + div { border-top: .5px solid var(--separator); }
.welcome-steps span { position: absolute; left: 0; top: 15px; font-size: 13px; color: var(--blue); font-variant-numeric: tabular-nums; }
.welcome-steps strong { font-size: 16px; font-weight: 500; }
.welcome-steps p { font-size: 14px; line-height: 1.6; color: var(--label-2); margin: 3px 0 0; }
.login-card { background: var(--surface); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.login-symbol { width: 42px; height: 42px; display: grid; place-items: center; background: var(--blue-bg); color: var(--blue); border-radius: 11px; font-size: 24px; }
.login-card h2 { font-size: 22px; margin: 20px 0 9px; font-weight: 600; letter-spacing: -.015em; }
.login-card > p { font-size: 15px; line-height: 1.6; color: var(--label-2); margin: 0 0 24px; }
.login-card label { font-size: 14px; display: block; margin: 0 0 9px; font-weight: 500; }
.login-card input { width: 100%; border: .5px solid var(--separator); border-radius: 9px; background: var(--bg); color: var(--label); padding: 13px; font-size: 16px; margin-bottom: 16px; }
.login-card input:focus { border-color: var(--blue); }
.login-card .remember-device { display: flex; align-items: center; gap: 9px; margin: 0 0 17px; color: var(--label-2); font-weight: 400; cursor: pointer; }
.login-card .remember-device input { width: 17px; height: 17px; margin: 0; padding: 0; flex-shrink: 0; accent-color: var(--blue); }
.login-card .privacy-note { font-size: 13px; margin: 15px 0 23px; line-height: 1.65; }
input::placeholder { color: var(--label-2); opacity: 1; }

/* The map uses the full height below the common navigation. */
main { min-width: 0; }
body:has(#workspace:not([hidden])) { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
body:has(#workspace:not([hidden])) > main { min-height: 0; overflow: hidden; }
.workspace { height: 100%; min-height: 0; padding: 0 18px calc(18px + env(safe-area-inset-bottom)); }
.demo-banner { display: grid; grid-template-columns: 7px minmax(0, 1fr); align-items: center; gap: 6px 8px; background: var(--orange-bg); padding: 12px; margin: 0 0 18px; border-radius: 9px; font-size: 12px; color: var(--label-2); line-height: 1.7; }
.demo-banner strong { font-weight: 600; color: var(--label); }
.demo-banner > span:not(.demo-dot) { grid-column: 1 / -1; }
.demo-banner > .text-button { grid-column: 1 / -1; justify-self: start; font-size: 12px; margin-top: 3px; }
.demo-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex-shrink: 0; }
.workspace-heading { margin: 0 5px 20px; }
.workspace-heading .eyebrow { margin: 0 0 5px; }
.workspace-heading h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.022em; margin: 0 0 9px; font-weight: 700; }
.workspace-heading p:not(.eyebrow) { font-size: 13px; color: var(--label-2); margin: 0; overflow-wrap: anywhere; line-height: 1.65; }
.project-select { margin: 0 5px 17px; }
.project-select label { display: block; margin-bottom: 8px; font-size: 12px; color: var(--label-2); }
.project-select-controls { display: flex; align-items: center; gap: 7px; min-width: 0; }
.project-select select { flex: 1; width: 100%; min-width: 0; padding: 10px 25px 10px 10px; border: .5px solid var(--separator); border-radius: 9px; background: var(--fill); color: var(--label); font-size: 12px; }
.project-select .button { flex-shrink: 0; font-size: 12px; padding: 9px 11px; }
.auto-refresh-status { margin: 8px 0 0; font-size: 11px; line-height: 1.65; color: var(--label-2); }
.auto-refresh-status.retrying { color: var(--orange); }
.overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px 9px; margin: 0 5px 20px; padding: 15px 12px; background: var(--fill); border-radius: 9px; }
.overview > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.overview > div > span { font-size: 11px; color: var(--label-2); }
.overview strong { font-size: 24px; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; }
.overview > .overview-updated { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; padding-top: 11px; border-top: .5px solid var(--separator); gap: 8px; }
.overview-updated strong { font-size: 12px; overflow-wrap: anywhere; }
.overview > p { grid-column: 1 / -1; margin: -3px 0 0; color: var(--label-2); font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.overview > p.partial { color: var(--orange); }
.explorer { height: 100%; min-height: 0; display: grid; grid-template-columns: clamp(250px, 18vw, 360px) minmax(0, 1fr) clamp(280px, 18vw, 380px); gap: 16px; align-items: stretch; }
.panel { background: var(--surface); border-radius: var(--radius); min-width: 0; box-shadow: var(--shadow); overflow: hidden; }
.sidebar, .detail-panel { height: 100%; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sidebar { padding: 23px 12px 12px; }
.sidebar-search { padding-top: 18px; border-top: .5px solid var(--separator); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 7px; }
.panel-heading h2 { margin: 0; font-size: 15px; font-weight: 600; }
.count-label { font-size: 12px; line-height: 22px; border-radius: 999px; background: var(--fill); color: var(--label-2); padding: 0 8px; }
.search-box { display: flex; background: var(--fill); border: 1px solid transparent; border-radius: 9px; margin: 16px 5px 12px; overflow: hidden; }
.search-box:focus-within { border-color: var(--blue); }
.search-box input { width: 100%; min-width: 0; background: none; border: 0; padding: 11px 3px 11px 11px; outline: none; font-size: 13px; color: var(--label); }
.search-box button { width: 35px; flex-shrink: 0; background: none; border: 0; color: var(--label-2); display: grid; place-items: center; }
.search-box svg { width: 17px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.sidebar-caption { display: flex; justify-content: space-between; font-size: 12px; color: var(--label-2); padding: 0 7px 12px; gap: 6px; }
.sidebar-caption .text-button { font-size: 12px; }
.node-list { display: flex; flex-direction: column; gap: 5px; }
.node-row { padding: 13px 12px; border: 1px solid transparent; border-radius: 9px; text-align: left; background: none; width: 100%; color: var(--label); transition: background .15s; }
.node-row:hover { background: var(--fill); }
.node-row.selected { background: var(--blue-bg); border-color: var(--blue); }
.node-row.path-member:not(.selected) { border-left-color: var(--blue); background: var(--graph-path); }
.node-row-top { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-bottom: 8px; color: var(--label-2); }
.node-index { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--blue); }
.node-type { margin-left: auto; background: var(--fill); color: var(--label-2); border-radius: 999px; padding: 2px 6px; font-size: 10px; }
.node-row strong { display: block; font-size: 14px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.node-row-summary { color: var(--label-2); font-size: 12px; line-height: 1.75; margin: 7px 0 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.node-row-bottom { display: flex; justify-content: space-between; gap: 8px; color: var(--label-2); font-size: 11px; }
.list-empty { font-size: 14px; color: var(--label-2); padding: 30px 12px; line-height: 1.8; text-align: center; }

/* SVG fixed dimensions are unchanged; all colors follow the system scheme. */
.map-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.map-toolbar { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: .5px solid var(--separator); flex-shrink: 0; gap: 10px; }
.view-tabs { display: flex; padding: 3px; background: var(--fill); border-radius: 8px; gap: 3px; }
.view-tab { padding: 7px 12px; border: 0; background: none; color: var(--label-2); border-radius: 6px; font-size: 13px; white-space: nowrap; }
.view-tab.active { background: var(--surface); box-shadow: var(--shadow); color: var(--label); font-weight: 600; }
.graph-controls { display: flex; align-items: center; gap: 3px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.graph-controls button { width: 28px; height: 30px; border: 0; background: none; border-radius: 6px; color: var(--blue); font-size: 18px; }
.graph-controls button:hover { background: var(--fill); }
.graph-controls > span { font-size: 11px; text-align: center; min-width: 40px; }
.graph-controls .fit-button { width: auto; padding: 0 9px; font-size: 12px; margin-left: 5px; border-left: .5px solid var(--separator); border-radius: 0; }
.graph-viewport { flex: 1; position: relative; overflow: hidden; min-height: 0; background-color: var(--surface-muted); background-image: radial-gradient(var(--separator) .65px, transparent .65px); background-size: 18px 18px; touch-action: none; overscroll-behavior: contain; }
.graph-viewport.dragging { cursor: grabbing; }
.graph-viewport > svg { width: 100%; height: 100%; display: block; cursor: grab; }
.graph-scene { overflow: visible; }
.graph-link { fill: none; stroke: var(--separator); stroke-width: 1.7; vector-effect: non-scaling-stroke; }
.graph-link.path-link { stroke: var(--blue); stroke-width: 2.3; }
.graph-node { cursor: pointer; }
.graph-node rect { fill: var(--surface); stroke: var(--separator); stroke-width: 1.1; }
.graph-node:hover rect { stroke: var(--blue); }
.graph-node.selected rect { fill: var(--graph-selected); stroke: var(--blue); stroke-width: 2; }
.graph-node.path-member:not(.selected) rect { fill: var(--graph-path); stroke: var(--blue); }
.graph-node text { font-family: inherit; fill: var(--label); pointer-events: none; }
.graph-node .graph-meta { font-size: 10px; fill: var(--label-2); }
.graph-node .graph-title { font-size: 12px; font-weight: 500; }
.graph-node .graph-device { font-size: 10px; fill: var(--label-2); }
.graph-node .graph-type { font-size: 10px; fill: var(--blue); }
.graph-node .graph-indicator { fill: var(--label-3); stroke: none; }
.graph-node.selected .graph-indicator { fill: var(--blue); }
.graph-hint { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--label-2); white-space: nowrap; pointer-events: none; padding: 6px 10px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.graph-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: var(--surface-muted); }
.empty-symbol { color: var(--blue); font-size: 32px; width: 64px; height: 64px; display: grid; place-items: center; background: var(--blue-bg); border-radius: 16px; margin-bottom: 21px; }
.graph-empty h2 { font-size: 19px; font-weight: 600; margin: 0 0 13px; }
.graph-empty p { font-size: 14px; color: var(--label-2); line-height: 1.8; margin: 0 0 22px; }
.map-legend { min-height: 43px; border-top: .5px solid var(--separator); display: flex; align-items: center; gap: 14px; padding: 10px 16px; font-size: 11px; color: var(--label-2); flex-shrink: 0; }
.map-legend > span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.map-legend i { display: block; width: 7px; height: 7px; border-radius: 2px; background: var(--label-3); }
.map-legend .legend-path { background: var(--blue); }
.map-legend .legend-leaf { background: var(--green); }
.map-legend .integrity-note { margin-left: auto; color: var(--orange); font-size: 11px; white-space: normal; }
.wide-list { flex: 1; min-height: 0; overflow: auto; padding: 13px; overscroll-behavior: contain; }
.wide-list .node-row { padding: 17px; margin-bottom: 7px; border-color: var(--separator); }
.wide-list .node-row-summary { font-size: 14px; }
.wide-list .node-row strong { font-size: 16px; }
.wide-list .node-row-top, .wide-list .node-row-bottom { font-size: 12px; }

.detail-empty { padding: 60px 20px; text-align: center; color: var(--label-2); }
.detail-empty > span { font-size: 32px; color: var(--label-3); }
.detail-empty h2 { font-size: 17px; font-weight: 500; color: var(--label); margin: 22px 0 12px; }
.detail-empty p { font-size: 14px; line-height: 1.8; }
.detail-header { padding: 23px 23px 18px; border-bottom: .5px solid var(--separator); }
.detail-kicker { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--blue); margin: 0 0 14px; }
.detail-title { font-size: 22px; line-height: 1.55; font-weight: 600; margin: 0 0 14px; overflow-wrap: anywhere; letter-spacing: -.015em; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 12px; line-height: 23px; padding: 0 9px; background: var(--fill); color: var(--label-2); border-radius: 999px; overflow-wrap: anywhere; max-width: 100%; }
.detail-actions { display: flex; gap: 7px; margin-top: 19px; flex-wrap: wrap; }
.detail-actions .button { font-size: 12px; padding: 8px 11px; }
.detail-actions .button.primary { display: inline-flex; gap: 10px; }
.detail-section { padding: 18px 23px; border-bottom: .5px solid var(--separator); }
.detail-section h3 { font-size: 14px; font-weight: 600; margin: 0 0 11px; display: flex; align-items: center; gap: 8px; }
.detail-section h3 span { font-size: 12px; color: var(--label-2); font-weight: 400; }
.detail-section p, .detail-section li { font-size: 14px; line-height: 1.8; color: var(--label-2); margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-section ul { padding: 0 0 0 17px; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.section-empty { font-size: 13px !important; color: var(--label-2) !important; }
.path-list { display: flex; flex-direction: column; gap: 0; }
.path-item { position: relative; border-left: 1px solid var(--separator); padding: 0 0 16px 13px; margin-left: 4px; }
.path-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.path-item:before { content: ""; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--label-3); box-shadow: 0 0 0 3px var(--surface); }
.path-item.current:before { background: var(--blue); }
.path-item summary { list-style: none; font-size: 13px; cursor: pointer; color: var(--label); line-height: 1.7; overflow-wrap: anywhere; }
.path-item summary::-webkit-details-marker { display: none; }
.path-item.current summary { font-weight: 600; color: var(--blue); }
.path-item .path-summary { font-size: 13px; margin: 6px 0 7px; color: var(--label-2); line-height: 1.75; }
.path-read { font-size: 12px; color: var(--blue); border: 0; padding: 0; background: none; text-decoration: underline; }
.relations { display: flex; flex-direction: column; gap: 7px; }
.relation-button { display: flex; gap: 8px; align-items: flex-start; justify-content: flex-start; background: var(--fill); border: 0; border-radius: 8px; padding: 10px 11px; font-size: 13px; color: var(--blue); text-align: left; line-height: 1.65; overflow-wrap: anywhere; }
.relation-button:hover { background: var(--fill-strong); }
.relation-button > span { color: var(--label-2); flex-shrink: 0; }
.identity-table { display: grid; grid-template-columns: 66px 1fr; gap: 9px 10px; font-size: 12px; line-height: 1.7; }
.identity-table dt { color: var(--label-2); }
.identity-table dd { margin: 0; color: var(--label-2); overflow-wrap: anywhere; font-family: "SFMono-Regular", Consolas, monospace; }
.deep-link { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.deep-link a { font-size: 12px; color: var(--blue); text-decoration: underline; overflow-wrap: anywhere; line-height: 1.7; }
.deep-link .button { font-size: 11px; white-space: nowrap; padding: 6px 8px; }
.workspace-footer { display: flex; flex-direction: column; align-items: flex-start; color: var(--label-2); font-size: 11px; line-height: 1.7; padding: 15px 7px 5px; margin-top: 14px; border-top: .5px solid var(--separator); gap: 8px; overflow-wrap: anywhere; }
.workspace-footer > span:first-child { display: flex; gap: 7px; align-items: center; }
.notice { position: fixed; left: 50%; bottom: 27px; transform: translateX(-50%); max-width: min(600px, calc(100% - 30px)); background: var(--surface); color: var(--label); border: .5px solid var(--separator); padding: 12px 19px; font-size: 14px; line-height: 1.7; border-radius: var(--radius); box-shadow: var(--shadow); z-index: 30; }
.notice.error { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.copy-dialog { width: min(560px, calc(100vw - 34px)); border: .5px solid var(--separator); border-radius: var(--radius); padding: 24px; color: var(--label); background: var(--surface); box-shadow: var(--shadow); }
.copy-dialog::backdrop { background: var(--backdrop); }
.copy-dialog h2 { font-size: 20px; margin: 0 0 16px; }
.copy-dialog textarea { display: block; width: 100%; min-height: 140px; resize: vertical; border: .5px solid var(--separator); border-radius: 8px; background: var(--bg); font-size: 14px; line-height: 1.8; padding: 12px; margin-bottom: 15px; color: var(--label); }

@media (min-width: 1550px) {
  .detail-section, .detail-header { padding-left: 27px; padding-right: 27px; }
}
/* Keep desktop controls in view; only the results need their own scroll area. */
@media (min-width: 1001px) {
  .explorer > .sidebar { display: flex; flex-direction: column; overflow: hidden; padding: 16px 12px 12px; }
  .sidebar > :not(.sidebar-search) { flex-shrink: 0; }
  .sidebar .workspace-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 4px 9px; margin: 0 5px 10px; }
  .sidebar .workspace-heading .eyebrow { margin: 0; }
  .sidebar .workspace-heading h1 { margin: 0; font-size: 23px; }
  .sidebar .workspace-heading p:not(.eyebrow) { grid-column: 1 / -1; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .sidebar .project-select { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 5px 8px; margin: 0 5px 10px; }
  .sidebar .project-select label { grid-column: 1; grid-row: 1; margin: 0; }
  .sidebar .auto-refresh-status { grid-column: 2; grid-row: 1; margin: 0; max-width: 126px; text-align: right; }
  .sidebar .project-select-controls { grid-column: 1 / -1; grid-row: 2; }
  .sidebar .project-select select { padding-block: 8px; }
  .sidebar .project-select .button { padding-block: 8px; }
  .sidebar .overview { margin: 0 5px 10px; padding: 10px; gap: 8px 6px; }
  .sidebar .overview > div { gap: 2px; }
  .sidebar .overview strong { font-size: 22px; }
  .sidebar .overview > .overview-updated { padding-top: 7px; gap: 8px; }
  .sidebar .overview-updated strong { font-size: 12px; }
  .sidebar .overview > p { margin: 0; }
  .sidebar-search { display: flex; flex-direction: column; flex: 1; min-height: 0; padding-top: 10px; }
  .sidebar-search > :not(.node-list) { flex-shrink: 0; }
  .sidebar .search-box { margin: 8px 5px 6px; }
  .sidebar .search-box input { padding-block: 9px; }
  .sidebar .sidebar-caption { padding-bottom: 8px; }
  .sidebar .node-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; padding: 3px; }
  .sidebar .node-row { flex-shrink: 0; padding: 10px; }
  .sidebar .node-row-top { margin-bottom: 5px; gap: 6px; }
  .sidebar .node-row strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.5; }
  .sidebar .node-row-summary { line-height: 1.6; margin: 5px 0 7px; }
  .sidebar .workspace-footer { margin-top: 8px; padding: 7px 7px 0; gap: 3px; line-height: 1.5; }
  .sidebar .demo-banner { padding: 8px 10px; margin-bottom: 12px; gap: 3px 7px; line-height: 1.5; }
}
/* A shorter desktop window trades spacing for a usable results viewport. */
@media (min-width: 1001px) and (min-height: 541px) and (max-height: 680px) {
  .explorer > .sidebar { padding: 12px 12px 8px; }
  .sidebar .workspace-heading { gap: 3px 9px; margin-bottom: 6px; }
  .sidebar .project-select { row-gap: 4px; margin-bottom: 7px; }
  .sidebar .overview { padding-block: 8px; gap: 6px; margin-bottom: 7px; }
  .sidebar-search { padding-top: 8px; }
  .sidebar .search-box { margin-top: 6px; margin-bottom: 5px; }
  .sidebar .sidebar-caption { padding-bottom: 6px; }
  .sidebar .workspace-footer { margin-top: 6px; padding-top: 6px; gap: 2px; }
}
/* Short or heavily zoomed windows keep every control reachable. */
@media (min-width: 1001px) and (max-height: 580px) {
  .explorer > .sidebar { overflow-y: auto; }
  .sidebar-search { flex: 0 0 auto; min-height: 0; }
  .sidebar .node-list { flex: 0 0 auto; max-height: 220px; }
}
@media (min-width: 1001px) and (min-height: 581px) and (max-height: 760px) {
  .explorer > .sidebar:has(#demo-banner:not([hidden])) { overflow-y: auto; }
  .sidebar:has(#demo-banner:not([hidden])) .sidebar-search { flex: 0 0 auto; min-height: 0; }
  .sidebar:has(#demo-banner:not([hidden])) .node-list { flex: 0 0 auto; max-height: 220px; }
}
@media (max-width: 1200px) {
  .explorer { grid-template-columns: 230px minmax(0, 1fr) 280px; gap: 12px; }
  .workspace { padding-inline: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .map-toolbar { padding: 0 10px; }
  .map-legend { gap: 9px; padding: 10px; }
  .detail-section, .detail-header { padding-left: 18px; padding-right: 18px; }
  .graph-controls .fit-button { margin-left: 1px; }
  .topbar { padding-inline: 20px; }
}
@media (max-width: 1000px) {
  body:has(#workspace:not([hidden])) { display: block; height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  body:has(#workspace:not([hidden])) > main { overflow: visible; }
  .workspace { height: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .explorer { height: auto; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .85fr); }
  .welcome { gap: 35px; }
  .explorer > .sidebar { grid-column: 1 / -1; height: auto; overflow: visible; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "heading project" "demo overview" "search search" "footer footer"; gap: 14px 20px; padding: 20px 18px 14px; }
  .workspace-heading { grid-area: heading; margin: 0; }
  .demo-banner { grid-area: demo; margin: 0; align-self: start; }
  .project-select { grid-area: project; margin: 0; align-self: start; }
  .overview { grid-area: overview; margin: 0; }
  .sidebar-search { grid-area: search; padding-top: 14px; }
  .workspace-footer { grid-area: footer; margin: 0; padding: 12px 7px 0; }
  .sidebar .node-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 155px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .sidebar .node-row-summary, .sidebar .node-row-bottom { display: none; }
  .sidebar .node-row { padding: 9px 12px; }
  .map-panel, .detail-panel { height: 620px; }
  .graph-viewport { min-height: 0; }
}
@media (max-width: 700px) {
  .topbar { padding: 16px 14px; gap: 12px; flex-wrap: wrap; }
  .site-navigation { width: 100%; justify-content: space-between; gap: 10px; }
  .codex-section-nav a { padding: 7px 12px; font-size: 13px; }
  .header-actions { width: 100%; justify-content: flex-end; gap: 10px; }
  .readonly-badge { font-size: 12px; margin-right: auto; }
  .header-actions .button { font-size: 13px; padding: 7px 11px; }
  .welcome { padding: 28px 16px 40px; grid-template-columns: 1fr; gap: 25px; }
  .welcome-description { font-size: 15px; }
  .welcome-steps { margin-top: 24px; }
  .login-card { padding: 22px; }
  .workspace { padding: 0 12px calc(14px + env(safe-area-inset-bottom)); }
  .explorer { grid-template-columns: 1fr; gap: 14px; }
  .explorer > .sidebar { grid-column: auto; display: block; padding: 20px 13px 12px; }
  .workspace-heading { margin: 0 5px 17px; }
  .workspace-heading h1 { font-size: 26px; }
  .demo-banner { margin-bottom: 17px; }
  .project-select { margin: 0 5px 16px; }
  .overview { margin: 0 5px 17px; }
  .sidebar .node-list { display: flex; max-height: 160px; }
  .sidebar .node-row { padding: 10px 11px; display: none; }
  .sidebar .node-row.selected, .sidebar.searching .node-row { display: block; }
  .sidebar .list-empty { padding: 14px 7px; }
  .search-box { margin-top: 12px; }
  .map-panel { height: 560px; height: min(640px, 78dvh); min-height: 460px; }
  .map-toolbar { height: 54px; }
  .detail-panel { height: auto; min-height: 180px; overflow: visible; }
  .detail-empty { padding: 27px 18px; }
  .detail-empty > span { font-size: 25px; }
  .detail-empty h2 { margin: 13px 0 8px; }
  .detail-header { padding: 21px; }
  .detail-section { padding: 18px 21px; }
  .detail-actions .button { font-size: 13px; padding: 10px 12px; }
  .workspace-footer { margin-top: 15px; padding-top: 13px; }
  .graph-hint { font-size: 10px; padding-inline: 8px; }
  .map-legend { font-size: 10px; gap: 12px; }
  .map-legend .integrity-note { font-size: 10px; }
  .graph-empty p { font-size: 13px; }
}
@media (max-width: 360px) {
  .map-toolbar { height: auto; min-height: 54px; flex-wrap: wrap; gap: 7px; padding-block: 10px; }
  .graph-controls { margin-left: auto; }
  .map-legend { gap: 10px; flex-wrap: wrap; }
  .site-navigation { gap: 8px; }
  .codex-section-nav a { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
