:root {
  --ink: #172621;
  --muted: #65716b;
  --paper: #f6f3eb;
  --panel: #fffdf8;
  --line: #d9d5ca;
  --line-strong: #b9b6ac;
  --forest: #1d342f;
  --forest-2: #31554a;
  --coral: #d96643;
  --gold: #d9a944;
  --sage: #8dae98;
  --shadow: 0 14px 34px rgba(23, 38, 33, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: radial-gradient(circle at 68% 26%, rgba(217, 169, 68, 0.08), transparent 28%), var(--paper); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--forest-2); }

.topbar {
  height: 72px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 243, 235, 0.94);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font: 800 18px/1 Georgia, serif; letter-spacing: 0.12em; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.brand-mark { width: 36px; height: 36px; position: relative; display: block; }
.brand-mark i { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: var(--coral); }
.brand-mark i:nth-child(1) { left: 1px; top: 13px; }
.brand-mark i:nth-child(2) { right: 1px; top: 2px; background: var(--gold); }
.brand-mark i:nth-child(3) { right: 0; bottom: 1px; background: var(--sage); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; height: 1px; background: var(--forest); transform-origin: left center; left: 10px; width: 20px; }
.brand-mark::before { top: 17px; transform: rotate(-30deg); }
.brand-mark::after { top: 20px; transform: rotate(31deg); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.graph-picker { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.graph-picker select { max-width: 260px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); padding: 8px 30px 8px 10px; }
.button, .icon-button { border: 1px solid transparent; cursor: pointer; transition: 140ms ease; }
.button { border-radius: 8px; padding: 10px 14px; text-decoration: none; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.button.ghost { border-color: var(--line); background: var(--panel); color: var(--ink); }
.button.ghost:hover { border-color: var(--forest-2); }
.button.small { padding: 7px 10px; font-size: 11px; }
.button.primary { background: var(--coral); color: white; box-shadow: 0 7px 16px rgba(217, 102, 67, 0.22); }
.button.primary:hover:not(:disabled) { background: #c55434; transform: translateY(-1px); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.text-button:disabled { opacity: .45; cursor: not-allowed; }
.icon-button { width: 34px; height: 34px; border-radius: 50%; border-color: var(--line); background: transparent; color: var(--muted); font-weight: 800; }

.workbench {
  min-height: calc(100vh - 158px);
  display: grid;
  grid-template-columns: minmax(285px, 330px) minmax(520px, 1fr) minmax(280px, 330px);
}
.research-panel, .inspector-panel { background: rgba(255, 253, 248, 0.78); min-height: 0; }
.research-panel { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.inspector-panel { border-left: 1px solid var(--line); }
.panel-section, .inspector-header { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.eyebrow { color: #8a5e40; text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: 0.15em; margin-bottom: 8px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-heading .eyebrow { margin-bottom: 0; }

.collection-control { margin: 0 0 13px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(247,244,236,.82); }
.collection-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.collection-row label { font: 700 13px Georgia, serif; }
.collection-control > select { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); padding: 7px 9px; font-size: 11px; }
.collection-scope { margin-top: 8px; display: flex; align-items: center; gap: 6px; color: #4f5e58; font-size: 10px; cursor: pointer; }
.collection-scope input { accent-color: var(--coral); }
.collection-summary { margin-top: 8px; display: flex; justify-content: space-between; align-items: start; gap: 8px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.collection-summary span { min-width: 0; }
.collection-summary strong { color: var(--ink); }
.evidence-entry { width: 100%; margin-top: 10px; border-color: rgba(49,85,74,.28); background: var(--forest); color: white; }
.evidence-entry:hover:not(:disabled) { background: var(--forest-2); transform: translateY(-1px); }

.connector-list { display: grid; gap: 8px; }
.connector { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; font-size: 12px; }
.connector-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; background: #aeb3af; box-shadow: 0 0 0 3px rgba(174,179,175,.14); }
.connector.available .connector-dot { background: #4c8b62; box-shadow: 0 0 0 3px rgba(76,139,98,.14); }
.connector strong { display: block; font-size: 12px; }
.connector span { display: block; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.connector-action { margin-top: 5px; }
.skeleton { background: linear-gradient(90deg, #e7e3da 25%, #f3f0e8 50%, #e7e3da 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 5px; }
.skeleton.line { height: 34px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.search-form label { font: 700 17px/1.2 Georgia, serif; display: block; margin-bottom: 10px; }
.search-form > select { width: 100%; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 7px; background: #f9f7f1; color: var(--ink); padding: 7px 9px; font-size: 10px; }
.search-control { display: grid; grid-template-columns: 1fr 38px; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: white; box-shadow: inset 0 1px 2px rgba(0,0,0,.03); }
.search-control:focus-within { outline: 2px solid rgba(49,85,74,.2); border-color: var(--forest-2); }
.search-control input { border: 0; min-width: 0; padding: 10px 11px; outline: none; color: var(--ink); background: transparent; }
.search-control button { border: 0; border-left: 1px solid var(--line); background: var(--forest); color: white; cursor: pointer; }
.search-meta { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.4; }

.results-section { min-height: 0; display: flex; flex-direction: column; flex: 1; }
.result-heading { padding: 12px 20px 8px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .11em; }
.result-list { overflow-y: auto; min-height: 180px; max-height: calc(100vh - 410px); padding-bottom: 20px; }
.result-card { width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 14px 18px; display: grid; grid-template-columns: 22px 1fr; gap: 9px; text-align: left; color: var(--ink); }
.result-card:hover { background: rgba(141,174,152,.10); }
.result-card.is-selected { background: rgba(217,169,68,.11); }
.result-card input { margin-top: 3px; accent-color: var(--coral); align-self: start; }
.result-card h3 { margin: 0; font: 700 13px/1.35 Georgia, serif; }
.result-meta { color: var(--muted); font-size: 10px; margin: 4px 0 7px; }
.source-badge { display: inline-block; margin-right: 4px; padding: 2px 5px; border-radius: 4px; background: #e7ede7; color: var(--forest-2); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.source-badge.private { background: #f3e5cc; color: #81552d; }
.result-card p { margin: 0; color: #4e5b56; font-size: 11px; line-height: 1.42; }
.result-actions { margin-top: 9px; display: flex; gap: 10px; }
.text-button { border: 0; padding: 0; background: none; color: var(--forest-2); font-size: 10px; font-weight: 800; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.text-button.danger { color: #9b3d27; }
.inline-error { margin: 8px 18px; padding: 10px; border-radius: 7px; background: #fff0eb; color: #8b321b; font-size: 11px; }

.graph-workspace { min-width: 0; padding: 22px 24px 14px; display: flex; flex-direction: column; }
.graph-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.graph-toolbar h1 { margin: 0; font: 700 clamp(19px, 2vw, 28px)/1.15 Georgia, serif; }
.graph-tools { display: flex; align-items: center; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { width: 29px; height: 16px; border-radius: 10px; background: #c9cbc7; padding: 2px; transition: .15s; }
.toggle span::after { content: ""; display: block; width: 12px; height: 12px; background: white; border-radius: 50%; transition: .15s; }
.toggle input:checked + span { background: var(--forest-2); }
.toggle input:checked + span::after { transform: translateX(13px); }
.metric-strip { display: flex; gap: 1px; margin-top: 17px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.metric-strip div { flex: 1; background: rgba(255,253,248,.82); padding: 9px 12px; display: flex; align-items: baseline; gap: 6px; }
.metric-strip strong { font: 700 17px Georgia, serif; }
.metric-strip span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }

.graph-stage { min-height: 440px; flex: 1; margin-top: 13px; border: 1px solid var(--line); border-radius: 12px; background-color: rgba(255,255,252,.68); background-image: radial-gradient(#c8c5bb 0.65px, transparent 0.65px); background-size: 16px 16px; position: relative; overflow: hidden; }
#knowledge-graph { width: 100%; height: 100%; min-height: 440px; display: block; color: #6c7771; }
.graph-edge { stroke: #78837e; stroke-width: 1.5; marker-end: url(#arrow); cursor: pointer; }
.graph-edge:hover, .graph-edge.selected { stroke: var(--coral); stroke-width: 3; }
.edge-label { fill: #5f6b65; font-size: 9px; paint-order: stroke; stroke: #fffef9; stroke-width: 4px; stroke-linejoin: round; cursor: pointer; }
.graph-node { cursor: pointer; }
.graph-node circle { stroke: #fff; stroke-width: 3; filter: drop-shadow(0 4px 6px rgba(23,38,33,.15)); }
.graph-node:hover circle, .graph-node.selected circle { stroke: var(--coral); stroke-width: 5; }
.graph-node text { fill: var(--ink); font: 700 10px Georgia, serif; text-anchor: middle; paint-order: stroke; stroke: #fffef9; stroke-width: 4px; stroke-linejoin: round; }
.graph-node .node-type { fill: var(--muted); font: 700 7px Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.graph-message { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.legend { position: absolute; left: 12px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 7px 10px; max-width: 80%; background: rgba(255,253,248,.86); padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.legend span { display: flex; gap: 4px; align-items: center; }
.legend i { width: 7px; height: 7px; border-radius: 50%; }
.graph-footer { min-height: 27px; padding: 8px 2px 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }

.inspector-header h2 { margin: 0; font: 700 21px Georgia, serif; }
.inspector-content { overflow-y: auto; max-height: calc(100vh - 175px); padding: 18px; }
.empty-state { min-height: 210px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 22px; color: var(--muted); }
.empty-state.compact { min-height: 100px; font-size: 11px; }
.empty-state strong { color: var(--ink); font: 700 15px Georgia, serif; }
.empty-state p { max-width: 230px; font-size: 11px; line-height: 1.5; }
.empty-icon { font-size: 30px; color: var(--sage); margin-bottom: 10px; }
.inspector-kind { color: #8a5e40; text-transform: uppercase; letter-spacing: .11em; font-size: 9px; font-weight: 800; }
.inspector-content h3 { font: 700 21px/1.2 Georgia, serif; margin: 7px 0; }
.inspector-subtitle { color: var(--muted); font-size: 11px; margin-bottom: 18px; }
.expression { border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: #fff; display: grid; gap: 5px; font-size: 12px; }
.expression span { color: var(--coral); font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.evidence-block { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.detail-label { margin: 0 0 7px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
blockquote { margin: 0; padding: 12px 13px; background: #f0eee6; border-left: 3px solid var(--gold); color: #35433e; font: 12px/1.5 Georgia, serif; }
.evidence-meta { color: var(--muted); font-size: 9px; margin: 7px 0; }
.grounding { display: grid; gap: 6px; }
.grounding div { background: #f3f0e8; padding: 8px; border-radius: 6px; }
.grounding span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.grounding strong { display: block; margin-top: 3px; font-size: 11px; }
.attribute-list { margin: 0; display: grid; gap: 7px; }
.attribute-list div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; font-size: 10px; }
.attribute-list dt { color: var(--muted); }
.attribute-list dd { margin: 0; overflow-wrap: anywhere; }

.build-dock { min-height: 86px; position: sticky; bottom: 0; z-index: 18; background: rgba(29,52,47,.97); color: white; box-shadow: 0 -12px 28px rgba(23,38,33,.13); display: grid; grid-template-columns: minmax(280px, 1fr) auto minmax(270px, .8fr); align-items: center; gap: 22px; padding: 12px 22px; }
.selection-summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
.step-number { width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; display: grid; place-items: center; color: var(--gold); font: 700 12px Georgia, serif; }
.selection-summary strong { display: block; font: 700 15px Georgia, serif; }
.selection-summary span { display: block; color: rgba(255,255,255,.62); font-size: 9px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 410px; }
.build-settings { display: flex; gap: 11px; }
.build-settings label { color: rgba(255,255,255,.62); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.build-settings input { display: block; margin-top: 4px; width: 112px; border: 1px solid rgba(255,255,255,.20); border-radius: 6px; color: white; background: rgba(255,255,255,.08); padding: 6px 7px; outline: none; }
.build-settings .token-field input { width: 135px; }
.build-action { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.build-action span { max-width: 175px; color: rgba(255,255,255,.62); font-size: 9px; line-height: 1.35; }

dialog { border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); padding: 25px; max-width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(23,38,33,.48); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; right: 12px; top: 10px; border: 0; background: none; color: var(--muted); font-size: 24px; cursor: pointer; }
.document-dialog { width: 720px; }
.document-dialog h2, .help-dialog h2, .upload-dialog h2, .collection-dialog h2, .history-dialog h2, .inquiry-dialog h2 { font: 700 26px/1.2 Georgia, serif; margin: 8px 25px 8px 0; }
.document-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0; }
.document-meta span { padding: 5px 7px; border-radius: 5px; background: #eeeae1; color: var(--muted); font-size: 9px; }
.source-preview { padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: #f5f2ea; max-height: 340px; overflow: auto; white-space: pre-wrap; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.document-actions { display: flex; align-items: center; gap: 12px; margin: 13px 0; }
.help-dialog { width: 550px; }
.help-dialog p { color: #4f5e58; font-size: 13px; line-height: 1.55; }
.upload-dialog { width: 620px; }
.collection-dialog { width: 580px; }
.history-dialog { width: 680px; }
.inquiry-dialog { width: 1060px; max-width: min(1060px, calc(100vw - 32px)); padding: 27px; overflow: auto; }
.dialog-intro { color: #4f5e58; font-size: 13px; line-height: 1.55; }
.upload-form { display: grid; gap: 15px; margin-top: 18px; }
.file-drop { min-height: 145px; border: 1px dashed var(--line-strong); border-radius: 11px; background: #f7f4ec; display: grid; place-items: center; text-align: center; cursor: pointer; padding: 24px; }
.file-drop:hover { border-color: var(--forest-2); background: #f2f3eb; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop strong { display: block; font: 700 18px Georgia, serif; }
.file-drop small { display: block; margin-top: 7px; color: var(--muted); }
.field-label { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.field-label input, .field-label textarea { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; color: var(--ink); background: white; text-transform: none; letter-spacing: 0; font-weight: 400; }
.field-label textarea { resize: vertical; min-height: 76px; font: 14px/1.45 Georgia, serif; }
.field-label input:focus, .field-label textarea:focus { outline: 2px solid rgba(49,85,74,.18); border-color: var(--forest-2); }
.inquiry-form { margin-top: 18px; }
.inquiry-actions { display: flex; align-items: end; gap: 12px; margin-top: 11px; }
.inquiry-actions .compact { width: 118px; flex: 0 0 auto; }
.inquiry-actions .compact span { color: var(--ink); }
.inquiry-actions > span { flex: 1; align-self: center; color: var(--muted); font-size: 10px; line-height: 1.4; }
.inquiry-workspace { display: grid; grid-template-columns: minmax(0, 1.03fr) minmax(0, .97fr); gap: 14px; margin-top: 20px; }
.inquiry-evidence-panel, .inquiry-brief-panel { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: #f9f7f1; overflow: hidden; }
.inquiry-workspace .result-heading { padding: 11px 13px; border-bottom: 1px solid var(--line); }
.inquiry-evidence-list, .inquiry-brief { height: min(490px, calc(100vh - 365px)); min-height: 290px; overflow-y: auto; padding: 11px; }
.evidence-card { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.evidence-card + .evidence-card { margin-top: 9px; }
.evidence-card-heading { display: grid; grid-template-columns: 24px 1fr; align-items: start; gap: 8px; }
.evidence-card-heading strong { display: block; font: 700 12px/1.3 Georgia, serif; }
.evidence-card-heading span:not(.evidence-rank) { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.evidence-rank { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: var(--forest); color: white; font: 700 9px Georgia, serif; }
.evidence-card blockquote { margin-top: 9px; max-height: 175px; overflow-y: auto; font-size: 11px; }
.evidence-card-footer { display: flex; align-items: start; justify-content: space-between; gap: 9px; margin-top: 8px; }
.evidence-card-footer > span { color: var(--muted); font-size: 8px; line-height: 1.4; }
.evidence-card-footer .text-button { flex: 0 0 auto; }
.brief-progress { min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 7px; color: var(--muted); }
.brief-progress i { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: spin .9s linear infinite; }
.brief-progress strong { color: var(--ink); font: 700 16px Georgia, serif; }
.brief-progress span { max-width: 290px; font-size: 10px; }
.brief-progress small { max-width: 290px; font-size: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.brief-answer { padding: 13px; border: 1px solid var(--line); border-left: 4px solid var(--sage); border-radius: 9px; background: var(--panel); }
.brief-answer.partial { border-left-color: var(--gold); }
.brief-answer.insufficient { border-left-color: var(--coral); }
.brief-answer-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.brief-answer-heading > span { color: var(--forest-2); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.brief-answer-heading small { color: var(--muted); font-size: 8px; }
.brief-answer > p { margin: 10px 0; font: 14px/1.5 Georgia, serif; }
.citation-row { display: flex; flex-wrap: wrap; gap: 5px; }
.citation-chip { padding: 4px 6px; border-radius: 5px; background: #e8eee8; color: var(--forest-2); font-size: 8px; font-weight: 700; }
.brief-findings { display: grid; gap: 8px; margin-top: 11px; }
.brief-finding { padding: 10px 11px; border: 1px solid var(--line); border-left: 3px solid var(--sage); border-radius: 8px; background: var(--panel); }
.brief-finding.contradiction { border-left-color: var(--coral); }
.brief-finding.uncertainty { border-left-color: var(--gold); }
.brief-finding > span { color: var(--forest-2); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.brief-finding.contradiction > span { color: #a0452d; }
.brief-finding > p { margin: 5px 0 8px; font-size: 11px; line-height: 1.45; }
.unresolved { margin-top: 11px; padding: 11px; border-radius: 8px; background: #eeeae1; }
.unresolved strong { font: 700 12px Georgia, serif; }
.unresolved ul { margin: 7px 0 0; padding-left: 17px; color: #4f5e58; font-size: 10px; line-height: 1.45; }
.brief-handoff { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.brief-handoff > span, .recovery-note { color: var(--muted); font-size: 9px; line-height: 1.4; }
.history-heading { margin: 20px 0 -10px; color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.upload-actions { display: flex; align-items: center; gap: 12px; }
.upload-actions span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.batch-results { display: grid; gap: 7px; max-height: 220px; overflow-y: auto; }
.batch-result { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #f6f4ed; font-size: 10px; }
.batch-result.success { border-left: 3px solid #4c8b62; }
.batch-result.failure { border-left: 3px solid var(--coral); background: #fff4ef; }
.batch-result span { color: var(--muted); line-height: 1.35; }
.job-history { display: grid; gap: 9px; margin-top: 18px; max-height: 480px; overflow-y: auto; }
.job-card { border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 8px; padding: 12px 13px; background: #faf8f2; }
.job-card.completed { border-left-color: #4c8b62; }
.job-card.failed { border-left-color: var(--coral); }
.job-card.running, .job-card.queued { border-left-color: var(--gold); }
.job-card-heading { display: flex; justify-content: space-between; gap: 12px; }
.job-card-heading strong { font: 700 15px Georgia, serif; }
.job-card-heading time { color: var(--muted); font-size: 9px; }
.job-card p { margin: 7px 0 4px; font-size: 10px; }
.job-card > span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.toast { position: fixed; z-index: 50; right: 20px; bottom: 108px; max-width: 360px; background: var(--ink); color: white; border-radius: 8px; padding: 11px 14px; box-shadow: var(--shadow); font-size: 11px; }

@media (max-width: 1120px) {
  .workbench { grid-template-columns: 300px 1fr; }
  .inspector-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .inspector-content { max-height: none; min-height: 220px; }
  .build-dock { grid-template-columns: 1fr auto; }
  .build-settings { display: none; }
}

@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .graph-picker span, .topbar .ghost { display: none; }
  .graph-picker select { max-width: 145px; }
  .workbench { display: block; }
  .research-panel { border-right: 0; }
  .result-list { max-height: 440px; }
  .graph-workspace { padding: 18px 12px; }
  .graph-toolbar { align-items: start; }
  .graph-tools { flex-direction: column; align-items: end; }
  .metric-strip { display: grid; grid-template-columns: 1fr 1fr; }
  .graph-stage, #knowledge-graph { min-height: 390px; }
  .build-dock { position: static; display: block; padding: 14px; }
  .build-action { margin-top: 12px; justify-content: stretch; }
  .build-action .button { flex: 1; }
  .selection-summary span { max-width: calc(100vw - 90px); }
  .inquiry-dialog { padding: 20px 14px; }
  .inquiry-actions { align-items: stretch; flex-direction: column; }
  .inquiry-actions .compact { width: 100%; }
  .inquiry-workspace { grid-template-columns: 1fr; }
  .inquiry-evidence-list, .inquiry-brief { height: auto; max-height: 430px; }
  .brief-handoff { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* One-line orientation between the brand and the workbench. The page's
   identity and primary journey must be readable without opening the help
   dialog, so this cannot live behind the "?" button. */
.orientation {
  margin: 0;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--rule, #d8d2c4);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Measure the line, not the rule: max-width on the <p> itself cropped the
   border-bottom to the text column, which read as a half-drawn divider. */
.orientation > span {
  display: block;
  max-width: 68ch;
}

/* Collapsed setup. Sources and the build options are configuration and status,
   not the primary journey; every Sources control is disabled on a deployment
   without an operator token, so eight dead controls used to sit above the one
   live one. Both stay one click away rather than competing on first view. */
.source-section > summary,
.build-settings-wrap > summary {
  cursor: pointer;
  list-style: none;
}
.source-section > summary::-webkit-details-marker,
.build-settings-wrap > summary::-webkit-details-marker { display: none; }
.source-section > summary::after,
.build-settings-wrap > summary::after {
  content: "▸";
  margin-left: 0.4em;
  font-size: 0.85em;
  opacity: 0.55;
}
.source-section[open] > summary::after,
.build-settings-wrap[open] > summary::after { content: "▾"; }
.source-section > summary { display: flex; align-items: baseline; gap: 0.6rem; }
.summary-hint { font-size: 0.8rem; opacity: 0.7; }
.build-settings-wrap > summary {
  font-size: 0.85rem;
  opacity: 0.85;
  padding: 0.2rem 0;
}
.build-settings-wrap[open] .build-settings { margin-top: 0.5rem; }

/* Keep the dock one row. Wrapping the settings in <details> made the collapsed
   summary a grid item of its own, pushing the primary action onto a second
   line and doubling the dock's height. The panel floats above the row when
   opened instead of displacing it. */
.build-settings-wrap { position: relative; justify-self: end; }
.build-settings-wrap > summary {
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}
.build-settings-wrap[open] > .build-settings {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  background: rgba(29, 52, 47, 0.99);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 -10px 26px rgba(23, 38, 33, 0.28);
  z-index: 20;
}

/* Fit the workbench to the window. The grid's height was a hardcoded
   calc(100vh - 158px) that predated the orientation line, so the extra ~78px
   pushed the graph under the sticky build dock and cut the bottom nodes off
   with no indication they were there. Making the page a column that flexes
   keeps every panel on screen whatever the chrome above it costs, and lets the
   individual panels scroll rather than the document. */
@media (min-width: 1121px) {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }
  .workbench {
    flex: 1;
    min-height: 0;
    max-height: none;
  }
  .research-panel,
  .inspector-panel { overflow-y: auto; }
  .graph-workspace { min-height: 0; }
  .graph-stage { min-height: 0; }
}

/* The unlock route out of the collapsed Options panel. */
.build-action .text-button.unlock {
  color: #f0c987;
  text-decoration: underline;
  font-size: 11px;
  text-align: left;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
