.chat-explorer-page { --explorer-height: var(--panel-height); display: grid; grid-template-columns: minmax(0, 1fr) var(--dock-width); gap: var(--layout-gap); padding-block: 20px; }
.chat-explorer-section, .certichat-page .certichat-panel { height: var(--explorer-height); min-width: 0; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: var(--radius); box-shadow: var(--panel-shadow); overflow: hidden; }
.chat-explorer-section { display: flex; flex-direction: column; }
.chat-explorer-section > .certichat-heading { flex-shrink: 0; margin-bottom: 0; }
.chat-graph-heading h1 { margin: 0; font-size: inherit; font-weight: 650; letter-spacing: inherit; line-height: 1.05; }
.certichat-page .certichat { position: static; font-size: 14px; }
.certichat-page .certichat-panel { position: static; width: 100%; padding-bottom: 0; }
[data-explorer-chat-slot] { min-width: 0; }
[data-graph-workspace] { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-graph-toolbar { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-graph-toolbar .button { width: 36px; height: 36px; min-height: 36px; padding: 0; background: var(--paper); box-shadow: 0 2px 8px var(--shadow); }
.chat-graph-toolbar svg { width: 18px; height: 18px; }
.chat-graph-toolbar .button:disabled { opacity: .5; cursor: default; }
.chat-graph-zoom { align-self: center; padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--hover); color: var(--ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-graph-network { position: relative; flex: 1; min-height: 100px; overflow: hidden; }
.chat-graph-network canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.chat-graph-network canvas:focus-visible { outline: 3px solid var(--red); outline-offset: -4px; }
.chat-graph-card { position: absolute; z-index: 1; width: max-content; max-width: min(280px, calc(100% - 16px)); max-height: calc(100% - 16px); overflow: auto; padding: 10px 12px; border: 1px solid var(--red); border-radius: 6px; background: var(--paper); color: var(--ink); box-shadow: 0 3px 16px var(--shadow); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.chat-graph-card-connector { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; stroke: var(--red); stroke-width: 1px; }
.chat-graph-card[data-source="tube"] { border-color: var(--video-accent); }
.chat-graph-card-connector[data-source="tube"] { stroke: var(--video-accent); }
.chat-graph-card-connector[hidden] { display: none; }
.chat-graph-card strong { display: block; margin-bottom: 5px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.chat-graph-card p { margin: 4px 0 0; color: var(--muted); }
.chat-graph-card a { display: block; margin-top: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; padding-bottom: 2px; }
.chat-graph-card a:hover { color: var(--red); }
.chat-graph-card a::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; background: currentColor; mask: url("../../icons/certitips-course.svg") center / contain no-repeat; }
.chat-graph-card a[data-source="tube"]::before { mask-image: url("../../icons/certitube.svg"); }
.chat-graph-card[hidden] { display: none; }
.chat-graph-evidence { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.chat-graph-evidence:has(.chat-graph-active:not(:empty)) { border-top: 1px solid var(--line); }
.chat-graph-scroll { flex-shrink: 0; width: 32px; height: 32px; min-height: 32px; padding: 0; }
.chat-graph-scroll svg { width: 14px; height: 14px; }
.chat-graph-scroll:disabled { visibility: hidden; }
.chat-graph-evidence:not(:has(.chat-graph-scroll:enabled)) .chat-graph-scroll { display: none; }
.chat-graph-toolbar .button:enabled:hover, .chat-graph-scroll:enabled:hover { border-color: var(--red); color: var(--red); }
.chat-graph-stamp { justify-self: start; }
.chat-graph-updating { flex-shrink: 0; width: 12px; height: 12px; margin-left: 6px; border-width: 2px; }
.chat-graph-updating[hidden] { display: none; }
.chat-graph-active { display: flex; flex: 1; min-width: 0; flex-wrap: nowrap; gap: 6px; list-style: none; padding: 2px; margin: 6px 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior: contain; scrollbar-width: none; }
.chat-graph-active::-webkit-scrollbar { display: none; }
.chat-graph-active li { flex-shrink: 0; }
.chat-graph-active:empty { display: none; }
.chat-graph-active button { display: inline-flex; align-items: stretch; font: inherit; font-size: 13px; line-height: 1.4; border: 1px solid var(--line); border-radius: 4px; background: var(--hover); color: var(--ink); padding: 0; white-space: nowrap; cursor: pointer; }
.chat-graph-number { min-width: 2ch; margin: 3px 0; padding: 0 6px; border-right: 1px solid var(--line); font-variant-numeric: tabular-nums; text-align: center; }
.chat-graph-label { padding: 3px 6px; }
.chat-graph-active button { --concept-color: var(--red); }
.chat-graph-active button[data-source="tube"] { --concept-color: var(--video-accent); }
.chat-graph-active button[data-source="search"] { --concept-color: var(--search-accent, #2e7d32); }
.chat-graph-active button:focus-visible { outline-color: var(--concept-color); outline-offset: -2px; }
.chat-graph-active button:hover { border-color: var(--concept-color); }
.chat-graph-active button:not([aria-pressed="true"]):hover .chat-graph-number { border-color: var(--concept-color); }
.chat-graph-active button[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: var(--on-red); }
.chat-graph-active button[data-source="tube"][aria-pressed="true"] { background: var(--video-accent); border-color: var(--video-accent); }
.chat-graph-active button[aria-pressed="true"] .chat-graph-number { border-color: currentColor; }
.chat-graph-status { margin: 8px 16px; padding: 18px; border-radius: 8px; background: var(--hover); }
.chat-graph-status.is-loading { flex: 1; display: grid; place-items: center; margin: 0; background: none; }
[data-graph-workspace][hidden], .chat-graph-status[hidden] { display: none; }
@media (max-width: 1023px) {
  .chat-explorer-page { grid-template-columns: minmax(0, 1fr); }
  .chat-explorer-section { display: none; }
}
@media (max-width: 1023px) {
  .chat-explorer-page { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block: 20px; }
  .certichat-page .certichat-heading { padding-top: 12px; }
}
@media (max-width: 800px) {
  .certichat-page { overflow: hidden; }
  .chat-explorer-page { --explorer-height: calc(100dvh - var(--header) - var(--footer-height)); padding: 0; gap: 0; }
  .certichat-page .certichat-panel { border: 0; border-radius: 0; box-shadow: none; }
}

.chat-graph-legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; }
.chat-graph-legend > span { display: inline-flex; align-items: center; gap: 4px; }
.chat-graph-legend svg { width: 12px; height: 12px; }
.chat-graph-legend [data-source="tips"] { background: var(--red); border-color: var(--red); color: var(--on-red); }
.chat-graph-legend [data-source="tube"] { background: var(--video-accent); border-color: var(--video-accent); color: var(--on-red); }

.chat-explorer-page:has([data-voice-mode="true"], .certichat-panel[hidden]) { position: relative; }
.chat-explorer-page:has([data-voice-mode="true"], .certichat-panel[hidden]) [data-explorer-chat-slot] { position: absolute; inset: auto 0 20px auto; width: min(240px, calc(100% - 24px)); }
