.graph-pilot-page { align-items: start; }
.graph-pilot-page:has(.certichat-panel[hidden], [data-voice-mode="true"]) > [data-graph-pilot] { width: 100%; max-width: var(--content-width); justify-self: center; }
[data-graph-pilot] { --pilot-inset: 8px; --pilot-launcher-height: 32px; --search-accent: #2e7d32; --quiz-accent: #b58a00; --pilot-color: var(--red); --pilot-spider: #007f9e; display: flex; flex-direction: column; height: var(--panel-height); min-width: 0; border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
[data-theme="dark"] [data-graph-pilot] { --pilot-spider: #00ffff; --quiz-accent: #f2c94c; }
[data-graph-pilot] > .certichat-heading { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 0; }
[data-graph-pilot] .certichat-heading > a { flex-shrink: 0; color: var(--muted); font-size: 12px; }
.graph-pilot-viewport { position: relative; flex: 1; min-height: 280px; background: radial-gradient(ellipse at 50% 45%, #fff, #f7f8fa 45%, #e9ecf1); overflow: hidden; }
[data-theme="dark"] .graph-pilot-viewport { background: radial-gradient(ellipse at 50% 45%, var(--hover), var(--paper) 75%); }
[data-pilot-canvas] { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
[data-pilot-canvas]:active { cursor: grabbing; }
[data-pilot-canvas]:focus-visible { outline: 2px solid var(--red); outline-offset: -3px; }
.graph-pilot-labels { display: none; }
.graph-pilot-walk { position: absolute; top: 14px; left: 14px; max-width: min(420px, calc(100% - 90px)); padding: 2px 36px 2px 8px; background: linear-gradient(90deg, color-mix(in srgb, var(--paper) 96%, transparent), color-mix(in srgb, var(--paper) 90%, transparent) calc(100% - 32px), transparent); border-left: 3px solid var(--walk-color, var(--muted)); pointer-events: none; color: var(--ink); font-family: Consolas, monospace; z-index: 1; }
.graph-pilot-walk strong { display: block; font-size: 13px; line-height: 1.4; }
.graph-pilot-walk span { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
[data-graph-pilot] [hidden] { display: none; }
[data-graph-pilot] .chat-graph-card, [data-graph-pilot] .chat-graph-card-connector { border-color: var(--pilot-color); stroke: var(--pilot-color); }
[data-graph-pilot] .chat-graph-card { max-width: min(280px, calc(100% - 100px)); transform: translateZ(0); }
[data-graph-pilot] .chat-graph-legend [data-source="quiz"] { color: #29230c; background: #f2c94c; border-color: #f2c94c; }
[data-graph-pilot] .chat-graph-active button[data-source="quiz"] { border-color: var(--quiz-accent); }
[data-graph-pilot] .chat-graph-active button[data-source="quiz"][aria-pressed="true"] { background: #f2c94c; color: #29230c; }
[data-graph-pilot] .chat-graph-card a[data-source="quiz"]::before { mask-image: url("../../icons/certiquiz-rocket.svg"); }
[data-graph-pilot] .chat-graph-legend [data-source="search"] { color: #fff; background: var(--search-accent); border-color: var(--search-accent); }
[data-graph-pilot] .chat-graph-legend [data-source="search"] svg { fill: none; stroke: currentColor; }
[data-graph-pilot] .chat-graph-legend button { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 11px; cursor: pointer; }
[data-graph-pilot] .chat-graph-legend .graph-pilot-structure { background: var(--muted); border-color: var(--muted); color: var(--paper); cursor: default; }
[data-graph-pilot] .chat-graph-legend button:enabled:hover:not([aria-pressed="true"]) { box-shadow: 0 2px 5px rgb(0 0 0 / .35); }
[data-graph-pilot] .chat-graph-legend button[aria-pressed="true"] { box-shadow: inset 0 3px 6px rgb(0 0 0 / .72), inset 0 -2px 2px rgb(255 255 255 / .4); outline: none; }
[data-graph-pilot] .chat-graph-legend button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
[data-graph-pilot] .chat-graph-legend button:disabled { cursor: wait; opacity: .55; }
[data-graph-pilot] .chat-graph-active button[data-source="search"] { border-color: var(--search-accent); }
[data-graph-pilot] .chat-graph-active button[data-source="search"][aria-pressed="true"] { background: var(--search-accent); color: #fff; }
[data-graph-pilot] .chat-graph-toolbar { z-index: 2; }
[data-graph-pilot] [data-pilot-zoom] { box-sizing: border-box; width: 36px; padding-inline: 0; background: #fff; color: #31333f; text-align: center; }
:root[data-theme="dark"] [data-graph-pilot] [data-pilot-zoom] { background: var(--paper); color: var(--ink); }
[data-graph-pilot] [data-pilot-replay][aria-pressed="true"],
[data-graph-pilot] [data-pilot-replay][aria-pressed="true"]:enabled:hover { background: var(--red); border-color: var(--red); color: #fff; }
[data-graph-pilot] .chat-graph-evidence, [data-graph-pilot] .chat-graph-footer { flex-shrink: 0; }
[data-graph-pilot] .chat-graph-footer { min-height: 32px; }
.graph-pilot-render-status { padding: 16px; font-size: 14px; }
.graph-pilot-load-error:not([hidden]) { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; background: var(--paper); }
.graph-pilot-load-error h2 { display: flex; align-items: center; justify-content: center; gap: 18px; font-size: clamp(28px, 4vw, 44px); line-height: 1.08; letter-spacing: -.045em; margin: 14px 0 20px; }
.graph-pilot-load-error h2 svg { width: 46px; height: 46px; flex: 0 0 auto; fill: currentColor; }
.graph-pilot-load-error p { margin: 0 0 24px; }
.graph-pilot-load-error .graph-pilot-retry-hint { font-size: 14px; margin: 8px 0 0; }
.graph-pilot-freshness:not([hidden]) { display: inline-block; width: 12px; height: 12px; margin-inline-start: 4px; vertical-align: -2px; background: currentColor; mask: url("../../icons/alert.svg") center / contain no-repeat; }
[data-graph-pilot][data-renderer="fallback"] { height: auto; }
[data-graph-pilot][data-renderer="fallback"] .graph-pilot-viewport { flex: none; min-height: 0; }
/* Without a canvas, the selected concept must size the viewport so its sources remain reachable. */
[data-graph-pilot][data-renderer="fallback"] .chat-graph-card { position: static; width: auto; max-width: none; max-height: none; margin: 12px; transform: none; }
[data-graph-pilot][data-renderer="fallback"] .chat-graph-card-connector { display: none; }
[data-graph-pilot][data-renderer="fallback"] .chat-graph-legend, [data-graph-pilot][data-renderer="fallback"] .chat-graph-toolbar { display: none; }
@media (max-width: 1023px) {
  .graph-pilot-page.chat-explorer-page { grid-template-columns: minmax(0, 1fr); }
  .graph-pilot-page .certichat-panel { height: min(720px, calc(100dvh - var(--header) - var(--footer-height))); min-height: 420px; }
  [data-graph-pilot] { height: min(800px, calc(100dvh - var(--header) - var(--footer-height))); }
}
@media (max-width: 800px) {
  .certichat-page:has(.graph-pilot-page) { overflow: auto; }
  .graph-pilot-page.chat-explorer-page { gap: 16px; }
  [data-graph-pilot] { border-inline: 0; border-radius: 0; }
  [data-graph-pilot] .certichat-heading { align-items: start; }
  [data-graph-pilot] .certichat-heading > a { max-width: 90px; text-align: right; }
}

[data-graph-pilot] .chat-graph-card > strong { display: flex; align-items: stretch; }
[data-graph-pilot] .chat-graph-card > strong .chat-graph-number { min-width: 2ch; margin: 0 6px 0 0; padding: 0 6px 0 0; }
[data-graph-pilot] .chat-graph-card a[data-source="search"]::before { mask-image: url("../../icons/lucide-search.svg"); }

/* The graph, controls and concept strip share the same content inset. */
[data-graph-pilot] .chat-graph-toolbar { right: var(--pilot-inset); bottom: var(--pilot-inset); }
[data-graph-pilot] .chat-graph-legend { left: var(--pilot-inset); bottom: var(--pilot-inset); }
[data-graph-pilot] .chat-graph-evidence { padding: var(--pilot-inset); gap: var(--pilot-inset); }
[data-graph-pilot] .chat-graph-evidence:has(.chat-graph-active:empty) { padding-block: 0; }
[data-graph-pilot] .chat-graph-active { margin: 0; padding: 0; }
/* Keep the launcher beside the final control, within the graph's shared inset. */
.certichat-page .chat-graph-toolbar > .certichat { position: absolute; inset: auto calc(100% + var(--pilot-inset)) 0 auto; }
.graph-pilot-page .certichat .certichat-launcher { width: var(--pilot-launcher-height, 32px); height: var(--pilot-launcher-height, 32px); min-height: var(--pilot-launcher-height, 32px); padding: 0; gap: 0; }
.graph-pilot-page .certichat-launcher > span { display: none; }
.graph-pilot-page .certichat .certichat-launcher > svg { width: 16px; height: 16px; }
.graph-pilot-page [data-explorer-chat-slot] .certichat-launcher { position: absolute; }
[data-graph-pilot][data-renderer="fallback"] .chat-graph-toolbar:has(> .certichat) { display: flex; min-width: 32px; min-height: var(--pilot-launcher-height); }
[data-graph-pilot][data-renderer="fallback"] .chat-graph-toolbar > :not(.certichat) { display: none; }
[data-graph-pilot][data-renderer="fallback"] .chat-graph-toolbar > .certichat { right: 0; }
[data-graph-pilot][data-renderer="fallback"] .graph-pilot-viewport:has(.certichat-panel[hidden]) { padding-bottom: calc(var(--pilot-launcher-height) + 2 * var(--pilot-inset)); }
[data-graph-pilot] .chat-graph-toolbar .button { width: 32px; height: 32px; min-height: 32px; }
[data-graph-pilot] [data-pilot-zoom] { width: 32px; }
[data-graph-pilot] .chat-graph-toolbar svg { width: 16px; height: 16px; }
[data-graph-pilot] .chat-graph-active { mask-image: linear-gradient(90deg, var(--concept-fade-start, #000), #000 20px, #000 calc(100% - 20px), var(--concept-fade-end, #000)); }
[data-graph-pilot] .chat-graph-evidence:has([data-pilot-scroll="-1"]:enabled) { --concept-fade-start: transparent; }
[data-graph-pilot] .chat-graph-evidence:has([data-pilot-scroll="1"]:enabled) { --concept-fade-end: transparent; }

[data-graph-pilot] .chat-graph-scroll:enabled:hover { background: transparent; }
[data-graph-pilot] .chat-graph-scroll:is(:active, .is-scrolling) { color: var(--red); border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }

/* Voice keeps the live composer beside Consulta, using the closed graph's width. */
.graph-pilot-page .chat-graph-toolbar > .certichat #certichat-panel[data-voice-mode="true"] { position: static; inset: auto; width: 240px; height: auto; min-height: 0; padding-bottom: 0; }
[data-graph-pilot][data-renderer="fallback"] .chat-graph-toolbar:has([data-voice-mode="true"]) > [data-pilot-active-fit] { display: inline-flex; }
[data-graph-pilot][data-renderer="fallback"] .chat-graph-toolbar > .certichat:has([data-voice-mode="true"]) { right: calc(100% + var(--pilot-inset)); }
[data-graph-pilot][data-renderer="fallback"] .graph-pilot-viewport:has([data-voice-mode="true"]) { padding-bottom: calc(54px + 2 * var(--pilot-inset)); }

/* A concept without validated references has only its title, without an empty divider. */
[data-graph-pilot] .chat-graph-card:has([data-pilot-card-sources][hidden], [data-pilot-contact-sources][hidden]) > strong { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }

[data-graph-pilot] [data-pilot-card] { z-index: 2; }

[data-graph-pilot] .chat-graph-legend [data-source="rss"] { color:#fff; background:#b65a00; border-color:#b65a00; }
[data-graph-pilot] .chat-graph-active button[data-source="rss"] { border-color:#b65a00; }
[data-graph-pilot] .chat-graph-active button[data-source="rss"][aria-pressed="true"] { background:#b65a00; color:#fff; }
[data-graph-pilot] .chat-graph-card a[data-source="rss"]::before { mask-image:url("../../certirss/rss.svg"); }
