:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #14213d;
  background: #e9edf3;
  --ink: #14213d;
  --ink-soft: #566278;
  --line: #b6c0cf;
  --paper: #fffdf7;
  --canvas: #dbe1e9;
  --signal: #f06449;
  --signal-strong: #a93625;
  --signal-soft: #ffe1d8;
  --violet: #6456d6;
  --violet-soft: #efecff;
  --mint: #2f9f86;
  --mint-soft: #e1f6f0;
  --highlight: #fff0a6;
}

* { box-sizing: border-box; }
.workspace-change-review { margin-bottom: 10px; overflow-wrap: anywhere; }
.workspace-change-review ol { padding-left: 22px; }
.workspace-change-review li { margin: 8px 0; font-size: 12px; line-height: 1.5; }
.workspace-change-review pre { white-space: pre-wrap; max-height: 180px; overflow: auto; }
html { scroll-behavior: smooth; }
body { min-width: 0; margin: 0; background: var(--canvas); }
button { font: inherit; }
button:focus-visible,
[type="text"]:focus-visible,
[type="search"]:focus-visible,
[type="number"]:focus-visible,
[type="file"]:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible { outline: 3px solid var(--signal-strong); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; transform: translateY(-150%); padding: 8px 12px; color: white; background: var(--ink); }
.skip-link:focus { transform: none; }
.skip-link:focus-visible { outline-color: white; }

.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: end; padding: 24px clamp(18px, 4vw, 58px); color: white; background: var(--ink); }
.topbar h1 { max-width: 870px; margin: 5px 0 0; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: clamp(34px, 4.4vw, 58px); font-weight: 700; line-height: .94; letter-spacing: -.045em; }
.eyebrow,
.source-kicker { margin: 0; color: #8bd7c5; font: 800 10px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .09em; text-transform: uppercase; }
.boundary { max-width: 390px; margin: 0; color: #d3dae4; text-align: right; }

.paper-source-gate { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; align-items: center; width: min(1180px, calc(100% - 32px)); margin: 18px auto 0; padding: 18px 20px; border: 1px solid var(--ink); border-radius: 14px; background: linear-gradient(125deg, #fff 0 68%, var(--mint-soft) 100%); box-shadow: 5px 5px 0 rgba(20, 33, 61, .14); }
.paper-source-gate[hidden] { display: none; }
.paper-source-gate h2 { margin-bottom: 5px; }
.paper-source-gate p:not(.eyebrow) { max-width: 760px; margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.paper-start-actions { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(250px, .9fr); gap: 10px; min-width: min(670px, 52vw); }
.attention-demo-button { display: grid; gap: 3px; min-height: 78px; padding: 11px 13px; border-color: var(--violet); color: white; background: var(--violet); text-align: left; }
.attention-demo-button:hover:not(:disabled) { border-color: var(--ink); background: var(--ink); }
.attention-demo-button span,
.attention-demo-button small { font: 800 9px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .055em; text-transform: uppercase; }
.attention-demo-button strong { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 17px; line-height: 1.05; }
.attention-demo-button small { color: #e6e2ff; font-size: 8px; text-transform: none; }
.paper-file-picker { display: grid; gap: 7px; min-width: min(310px, 100%); padding: 12px; border: 1px dashed var(--violet); border-radius: 10px; color: var(--ink); background: var(--violet-soft); font-weight: 800; }
.paper-file-picker span { font: 800 10px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.paper-file-picker input { width: 100%; color: var(--ink-soft); font: 650 12px/1.4 Inter, ui-sans-serif, system-ui, sans-serif; }
#paper-source-gate-status { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid rgba(20, 33, 61, .14); font: 800 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.is-waiting-for-paper .workspace { opacity: .58; filter: saturate(.72); }

main { width: min(1840px, calc(100% - 16px)); margin: 14px auto 60px; }
.status-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--ink); border-radius: 12px; overflow: hidden; background: white; }
.status-grid div { display: grid; gap: 3px; padding: 11px 14px; border-right: 1px solid var(--line); }
.status-grid div:last-child { border-right: 0; }
.status-grid span { color: #59677b; font: 800 10px ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.status-grid strong { font-size: 13px; }

.workspace { display: grid; grid-template-columns: minmax(235px, .57fr) minmax(590px, 1.85fr) minmax(335px, .83fr); grid-template-areas: "mentor paper rail"; gap: 12px; align-items: start; margin-top: 12px; }
.paper-panel { grid-area: paper; }
.activity-panel { grid-area: mentor; }
.graph-panel { grid-area: rail; }
.paper-panel,
.graph-panel,
.activity-panel { min-width: 0; padding: 20px; border: 1px solid var(--ink); border-radius: 14px; background: white; }
.paper-panel { box-shadow: 6px 6px 0 rgba(20, 33, 61, .14); }
.activity-panel,
.graph-panel { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.panel-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 16px; }
.panel-heading > p { max-width: 300px; margin: 0; color: var(--ink-soft); font-size: 12px; text-align: right; }
h2 { margin: 5px 0 8px; font-size: 24px; letter-spacing: -.025em; }
h3 { margin: 5px 0 10px; }
h4 { margin: 3px 0 0; font-size: 16px; }
.paper-panel .eyebrow,
.graph-panel .eyebrow,
.activity-panel .eyebrow,
.paper-source-gate .eyebrow,
.paper-panel .source-kicker,
.graph-panel .source-kicker,
.activity-panel .source-kicker { color: #1b6958; }

.paper-stage { position: relative; padding: 12px; border: 1px solid #95a1b3; border-radius: 12px; background: #cfd6e0; overflow: hidden; }
.pdf-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 18px; align-items: center; margin: 0 auto 12px; padding: 8px 10px; border: 1px solid #9ca8b9; border-radius: 9px; color: #4c596f; background: rgba(255, 255, 255, .82); font: 800 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.pdf-identity { display: grid; gap: 3px; text-transform: uppercase; }
.pdf-identity #pdf-integrity-status { color: #256c5d; font-size: 9px; }
.pdf-controls { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.pdf-controls button { min-width: 34px; min-height: 32px; padding: 4px 8px; }
.pdf-controls input { width: 54px; height: 32px; padding: 4px 6px; border: 1px solid var(--ink); border-radius: 6px; color: var(--ink); background: white; font: inherit; }
.pdf-controls output { min-width: 44px; text-align: center; }
.pdf-active-page { padding: 5px 8px; border-radius: 999px; color: #315f54; background: var(--mint-soft); white-space: nowrap; }
.pdf-control-divider { align-self: stretch; width: 1px; background: #aab4c3; }
.pdf-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border: 2px solid var(--ink); border-radius: 50%; background: var(--mint); vertical-align: -1px; }
.pdf-scrollport { position: relative; display: flex; flex-direction: column; gap: 28px; align-items: center; min-height: 600px; max-height: min(78vh, 940px); padding: 22px; overflow: auto; overscroll-behavior: contain; scroll-padding-block: 36px; border: 1px solid #8d98a8; border-radius: 8px; background: #aeb8c6; }
.pdf-page-surface { position: relative; width: 612px; height: 792px; margin: 0 auto; overflow: hidden; scroll-margin-block: 34px; border: 1px solid #778296; background: white; box-shadow: 0 18px 42px rgba(20, 33, 61, .28); transform-origin: top left; }
.pdf-page-surface[data-page-number]::after { content: "Page " attr(data-page-number); position: absolute; right: 10px; bottom: 8px; z-index: 6; padding: 4px 7px; border: 1px solid rgba(20, 33, 61, .32); border-radius: 999px; color: var(--ink); background: rgba(255, 255, 255, .9); font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; pointer-events: none; }
.pdf-page-surface.is-active-page { outline: 3px solid rgba(47, 159, 134, .82); outline-offset: 5px; }
.pdf-page-surface canvas { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; background: white; }
.pdf-page-surface .textLayer { z-index: 3; }
.pdf-page-surface .textLayer ::selection { color: transparent; background: rgba(100, 86, 214, .34); }
.pdf-annotation-overlay { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pdf-page-surface.is-region-selecting { cursor: crosshair; }
.pdf-selection-anchor { border: 0 !important; box-shadow: none !important; }
.pdf-selection-anchor:focus,
.pdf-selection-anchor.active { outline: 3px solid var(--signal-strong); outline-offset: 3px; }
.pdf-selection-anchor.is-exact-text:focus,
.pdf-selection-anchor.is-exact-text.active { outline: 0; }
.pdf-selection-anchor.is-exact-text:focus::after,
.pdf-selection-anchor.is-exact-text.active::after { content: "Source"; position: absolute; top: -12px; left: -12px; display: grid; min-width: 44px; min-height: 26px; place-items: center; padding: 3px 6px; border: 3px solid var(--signal-strong); border-radius: 999px; color: white; background: var(--ink); font: 800 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.pdf-selection-anchor.is-page-region,
.pdf-selection-anchor.pdf-region-selection-draft { border: 2px solid var(--violet) !important; background: repeating-linear-gradient(135deg, rgba(100, 86, 214, .08) 0 8px, rgba(100, 86, 214, .16) 8px 16px); }
.pdf-selection-anchor.pdf-region-selection-draft { border-style: dashed !important; cursor: move; }
.pdf-region-visible-label { position: absolute; left: -2px; bottom: calc(100% + 4px); width: max-content; max-width: 180px; padding: 5px 7px; overflow: hidden; border: 1px solid var(--ink); border-radius: 6px 6px 6px 2px; color: white; background: var(--ink); font: 800 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.pdf-source-highlight { fill: rgba(255, 221, 67, .42); stroke: rgba(184, 119, 0, .94); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.pdf-captured-anchor-highlights.is-exact-text rect { fill: rgba(255, 221, 67, .34); stroke: rgba(151, 96, 0, .94); }
.pdf-captured-anchor-highlights.is-page-region rect,
.pdf-captured-anchor-highlights.pdf-region-selection-draft rect { fill: rgba(100, 86, 214, .1); stroke: var(--violet); stroke-dasharray: .9 .55; }
.pdf-captured-anchor-highlights.is-agent rect { stroke: var(--signal-strong); stroke-dasharray: .4 .35; }
.pdf-source-highlight.is-agent-editing { fill: rgba(240, 100, 73, .35); stroke: var(--signal); }
.pdf-source-anchor { position: absolute; border: 2px solid transparent; pointer-events: none; }
.pdf-source-anchor.active { border-color: rgba(240, 100, 73, .78); box-shadow: 0 0 0 4px rgba(240, 100, 73, .13); }
.pdf-source-anchor.is-agent-editing { border-color: var(--mint); box-shadow: 0 0 0 5px rgba(47, 159, 134, .22); }
.pdf-loading { position: absolute; inset: 22px; z-index: 8; display: grid; place-items: center; padding: 28px; color: var(--ink); background: rgba(233, 237, 243, .94); font-weight: 800; text-align: center; }
.pdf-loading[hidden] { display: none; }
.paper-evidence-strip { display: grid; grid-template-columns: minmax(190px, 1fr) auto; gap: 10px 16px; align-items: center; margin-top: 12px; padding: 12px; border: 1px solid #9aa5b5; border-radius: 9px; background: #fff; }
.paper-evidence-strip p { margin: 2px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.4; }
.paper-evidence-strip .source-kicker { color: var(--violet); }
.source-annotation-overlay { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; min-height: 30px; }
#text-source > .source-annotation-overlay { display: none; }
.annotation-chip { display: inline-flex; gap: 7px; align-items: center; padding: 6px 9px; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); background: white; font: 800 10px/1.25 ui-monospace, SFMono-Regular, Consolas, monospace; }
.annotation-chip::before { content: ""; width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; background: var(--highlight); }
.annotation-chip.is-agent { color: #8d2818; background: var(--signal-soft); }
.annotation-chip.is-agent::before { background: var(--signal); }
.annotation-chip.is-reader { color: #1b6958; background: var(--mint-soft); }
.annotation-chip.is-reader::before { background: var(--mint); }
.annotation-chip.is-fixture { color: #5045a7; background: var(--violet-soft); }
.annotation-chip.is-tombstoned { text-decoration: line-through; border-style: dashed; }
.pdf-selection-anchor > .annotation-chip { position: absolute; left: 0; bottom: calc(100% + 3px); width: max-content; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-shadow: 2px 2px 0 rgba(20, 33, 61, .12); }
.pdf-selection-anchor.is-page-region > .annotation-chip { top: 7px; right: 7px; bottom: auto; left: auto; max-width: calc(100% - 14px); }
.pdf-selection-anchor.pdf-automatic-map-anchor > .annotation-chip { padding: 4px 7px; color: #463aa4; background: rgba(239, 236, 255, .94); }
.reader-annotation-composer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .65fr) auto; gap: 8px 10px; align-items: end; margin: 0 0 12px; padding: 10px; border: 1px solid var(--ink); border-radius: 10px; background: #f3fbf8; }
.reader-annotation-composer > * { min-width: 0; }
.annotation-composer-intro { grid-column: 1 / -1; align-self: center; }
.annotation-composer-intro h3 { margin: 3px 0 4px; }
.annotation-composer-intro p:not(.source-kicker),
.annotation-composer-boundary { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.reader-annotation-composer label { display: grid; gap: 5px; color: var(--ink-soft); font: 800 10px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.reader-annotation-composer input,
.reader-annotation-composer select,
.reader-annotation-composer textarea,
.graph-search input { min-width: 0; height: 38px; padding: 7px 9px; border: 1px solid var(--ink); border-radius: 7px; color: var(--ink); background: white; font: 650 13px/1.2 Inter, ui-sans-serif, system-ui, sans-serif; text-transform: none; }
.reader-annotation-composer textarea { height: auto; min-height: 78px; resize: vertical; }
.annotation-source-mode { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 7px; align-items: center; padding: 9px; border: 1px solid rgba(20, 33, 61, .22); border-radius: 8px; background: rgba(255, 255, 255, .7); }
.annotation-source-mode button[aria-pressed="true"] { color: white; background: var(--signal-strong); }
.annotation-source-mode span { flex: 1 1 280px; color: var(--ink-soft); font-size: 10px; line-height: 1.4; }
.reader-annotation-error { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--signal-strong); color: var(--signal-strong); background: white; font-size: 12px; line-height: 1.5; }
.reader-annotation-error:empty { margin: 0; padding: 0; border: 0; }
.reader-annotation-composer [aria-invalid="true"] { outline: 2px solid var(--signal-strong); outline-offset: 2px; }
.region-description-field { grid-column: 1 / -1; }
.region-description-field[hidden],
.annotation-source-mode [hidden] { display: none; }
.annotation-composer-boundary { grid-column: 1 / -1; padding-top: 9px; border-top: 1px solid rgba(20, 33, 61, .16); }
.visual-region.active { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(240, 100, 73, .18); }
.visual-region > .runtime-annotation-pin { position: absolute; top: 12px; left: 12px; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button { min-height: 36px; padding: 7px 11px; border: 1px solid var(--ink); border-radius: 8px; color: var(--ink); background: white; cursor: pointer; font-weight: 760; }
button:hover:not(:disabled) { color: white; background: var(--ink); }
button:disabled { cursor: not-allowed; opacity: .45; }

.visual-diagnostic { margin-top: 12px; background: #f5f7fa; }
.visual-diagnostic > summary { color: #4b5870; font: 800 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; }
.visual-diagnostic-body { padding: 8px 14px 16px; border-top: 1px solid var(--line); }
.visual-diagnostic-body > header { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.visual-regions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.visual-region { position: relative; margin: 0; padding: 9px; border: 2px solid transparent; border-radius: 8px; background: #edf1f7; }
.visual-region canvas { display: block; width: 100%; height: auto; border: 1px solid var(--ink); background: white; }
.visual-region figcaption { margin: 6px 0; font: 800 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.sealed { padding: 10px; border: 1px dashed var(--violet); border-radius: 8px; color: #5146b0; background: #f2efff; }
.commitment { display: grid; gap: 5px; margin-bottom: 8px; color: #59677b; font: 800 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.commitment code { overflow-wrap: anywhere; color: var(--ink); font-size: 9px; }
.visual-proof-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.visual-proof-controls span { font: 800 10px ui-monospace, SFMono-Regular, Consolas, monospace; }

.agent-presence-layer { display: contents; pointer-events: none; }
.agent-thread { display: none; }
.agent-cursor { position: absolute; z-index: 15; top: 14px; right: 14px; width: 30px; height: 30px; pointer-events: none; transition: top .48s cubic-bezier(.2, .75, .25, 1), right .48s cubic-bezier(.2, .75, .25, 1), transform .2s ease; }
.cursor-pencil { position: absolute; inset: 4px 9px 4px 10px; display: block; border: 2px solid white; border-radius: 3px 3px 1px 1px; background: var(--signal); box-shadow: 0 0 0 2px var(--ink), 4px 4px 0 rgba(20, 33, 61, .18); transform: rotate(-28deg); }
.cursor-pencil::after { content: ""; position: absolute; left: 1px; bottom: -9px; border-top: 9px solid var(--ink); border-right: 4px solid transparent; border-left: 4px solid transparent; }
.agent-cursor-label { position: absolute; left: 25px; top: -17px; width: max-content; max-width: 190px; padding: 6px 8px; border: 1px solid var(--ink); border-radius: 7px 7px 7px 2px; color: white; background: var(--ink); box-shadow: 3px 3px 0 rgba(20, 33, 61, .16); font: 800 10px/1.25 ui-monospace, SFMono-Regular, Consolas, monospace; }
.agent-cursor.is-working { animation: mentor-pencil 1s ease-in-out infinite; }
.agent-cursor.is-editing .cursor-pencil { background: var(--mint); }
.agent-cursor.is-complete .cursor-pencil { background: var(--violet); }
.agent-cursor.is-error .cursor-pencil { background: white; }
.agent-cursor.at-text { top: -18px; right: -14px; }
.agent-cursor.at-text .agent-cursor-label { right: 25px; left: auto; }
.agent-cursor.at-visual-a,
.agent-cursor.at-visual-b { top: 24%; right: 10%; }
.agent-cursor.at-page { top: 10%; right: 7%; }

@keyframes mentor-pencil {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(2px, -7px, 0); }
}

.agent-action-card { margin: 14px 0; padding: 14px; border: 1px solid var(--ink); border-radius: 10px; background: var(--mint-soft); }
.agent-action-title { display: flex; gap: 10px; align-items: center; }
.agent-action-title h3 { margin: 0; }
.agent-action-title p { margin: 3px 0 0; color: #1b6958; font-size: 12px; }
.agent-badge { display: grid; flex: 0 0 38px; height: 38px; place-items: center; border: 1px solid var(--ink); border-radius: 50%; color: white; background: var(--ink); font: 800 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.agent-truth-note,
.annotation-boundary { color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.agent-action-card button { width: 100%; }

.mentor-explanation { margin: 14px 0 10px; padding: 14px; border: 1px solid var(--ink); border-radius: 11px; background: #fff; overflow-wrap: anywhere; }
.mentor-explanation-heading { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.mentor-explanation-heading h3 { margin: 3px 0 0; }
.review-state { flex: 0 0 auto; padding: 4px 7px; border: 1px solid var(--ink); border-radius: 999px; color: white; background: var(--signal-strong); font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.review-state.is-empty { color: var(--ink-soft); background: white; }
.review-state.is-saved { background: #1b6958; }
.mentor-explanation-body { margin-top: 11px; }
.mentor-explanation-body > p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.mentor-section { margin-top: 8px; border-color: var(--line); background: white; }
.mentor-section summary { padding: 10px 9px; font-size: 12px; }
.mentor-section summary h4 { display: inline; margin: 0; font: inherit; }
.mentor-claim { margin: 3px 9px 12px; padding: 2px 0 1px 10px; border-left: 2px solid var(--line); }
.mentor-claim.is-document-evidence { border-left-color: #1b6958; }
.mentor-claim.is-rendered-document-view { border-left-color: var(--signal-strong); }
.mentor-claim.is-uncertain, .mentor-claim.is-legacy-unclassified { border-left-style: dashed; }
.mentor-authority { display: inline-block; max-width: 100%; margin: 0 0 6px; color: var(--ink-soft); font: 700 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.mentor-claim.is-document-evidence .mentor-authority { color: #1b6958; }
.mentor-claim.is-rendered-document-view .mentor-authority,
.mentor-claim.is-external-source .mentor-authority { color: var(--signal-strong); }
.mentor-claim p.mentor-claim-text { margin: 0; color: var(--ink); font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 17px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.mentor-claim p.mentor-claim-note, .mentor-visual-description .mentor-claim-note { margin: 7px 0 0; color: var(--ink-soft); font: 400 11px/1.5 Inter, ui-sans-serif, system-ui, sans-serif; }
.mentor-evidence-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; min-width: 0; }
.mentor-evidence-chips button, .mentor-coverage-row button { max-width: 100%; min-height: 32px; padding: 5px 7px; border-color: var(--line); color: var(--ink); background: white; text-align: left; white-space: normal; overflow-wrap: anywhere; font: 650 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.mentor-evidence-chips button:disabled, .mentor-coverage-row button:disabled { opacity: 1; color: var(--ink-soft); background: #f0f2f5; border-style: dashed; }
.mentor-external-citation { display: block; max-width: 100%; color: var(--signal-strong); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
a.mentor-external-citation:focus-visible { outline: 3px solid var(--signal-strong); outline-offset: 3px; }
.mentor-explanation-body p.mentor-review-notice { margin: 0 0 10px; padding: 8px 9px; border-left: 2px solid var(--signal-strong); background: var(--signal-soft); color: var(--ink); font-size: 11px; line-height: 1.5; }
.mentor-visual-description { margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; }
.mentor-visual-description h4 { margin: 0 0 8px; font-size: 12px; }
.mentor-visual-description p { margin: 0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.mentor-coverage-row { margin: 0 9px 12px; }
.mentor-coverage-row p { margin: 0 0 5px; font-size: 11px; line-height: 1.5; }
.mentor-coverage > .mentor-evidence-chips { margin: 0 9px 10px; }
.mentor-explanation-actions,
.browser-save-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.mentor-explanation-actions[hidden] { display: none; }
.mentor-takeaway { display: grid; flex: 1 0 100%; gap: 5px; color: var(--ink-soft); font: 800 9px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.mentor-takeaway span { font-weight: 650; text-transform: none; }
.mentor-takeaway textarea { width: 100%; min-height: 68px; resize: vertical; padding: 8px 9px; border: 1px solid var(--ink); border-radius: 7px; color: var(--ink); background: white; font: 650 12px/1.45 Inter, ui-sans-serif, system-ui, sans-serif; text-transform: none; }
.mentor-explanation-status,
#browser-save-status { margin: 8px 0 0; color: var(--ink-soft); font: 800 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.reader-takeaway { margin: 10px 0 0; padding: 9px; border: 1px dashed #1b6958; border-radius: 8px; color: #1b6958; background: var(--mint-soft); font-size: 11px; line-height: 1.5; }

.browser-save-card { margin: 10px 0 14px; padding: 12px; border: 1px solid #9a90d2; border-radius: 10px; background: var(--violet-soft); }
.browser-save-card h3 { margin: 3px 0 4px; }
.browser-save-card p:not(.source-kicker, #browser-save-status) { margin: 0; color: #4e4779; font-size: 10px; line-height: 1.5; }
.browser-save-card .browser-clear-warning { margin-top: 9px; padding: 8px; border-left: 3px solid var(--signal-strong); color: var(--signal-strong); font-size: 11px; }
.browser-save-actions button { flex: 1 1 120px; min-height: 32px; padding: 5px 8px; font-size: 10px; }
.browser-save-card.is-saved { border-color: #1b6958; background: var(--mint-soft); }
.browser-save-card.is-dirty { border-color: var(--signal-strong); }
.browser-save-card.is-error { border-color: var(--signal-strong); background: #fff1ec; }
.activity-trail > summary { font-size: 11px; }

.paper-map { position: relative; margin: 12px 0 14px; padding: 14px; overflow: hidden; border: 1px solid var(--ink); border-radius: 11px; background: repeating-linear-gradient(0deg, rgba(20, 33, 61, .026) 0 1px, transparent 1px 24px), #fbfffe; box-shadow: 4px 4px 0 rgba(20, 33, 61, .1); }
.paper-map::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--mint); }
.paper-map-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-left: 5px; }
.paper-map-heading h3 { margin: 3px 0 0; }
.map-state-chip { display: inline-grid; min-height: 25px; padding: 4px 8px; place-items: center; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); background: white; font: 800 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; }
.map-state-chip[data-state="ready"] { color: #154f43; border-color: #1b6958; background: var(--mint-soft); }
.map-state-chip[data-state="partial"] { color: #634c15; border-color: #8a6b20; background: #fff4cc; }
.map-state-chip[data-state="failed"] { color: var(--signal-strong); border-color: var(--signal-strong); background: #fff1ec; }
.paper-map-status { margin: 10px 0 8px; color: var(--ink); font-size: 12px; font-weight: 780; line-height: 1.45; }
.paper-map-progress-label,
.critical-map-progress-label { display: block; margin-top: 10px; color: var(--ink-soft); font: 800 9px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }
.paper-map progress { display: block; width: 100%; height: 9px; margin: 5px 0 8px; overflow: hidden; border: 1px solid var(--ink); border-radius: 999px; background: white; accent-color: var(--mint); }
.paper-map progress::-webkit-progress-bar { background: white; }
.paper-map progress::-webkit-progress-value { background: var(--mint); }
.paper-page-ledger { display: grid; grid-template-columns: repeat(var(--page-count, 1), minmax(1px, 1fr)); gap: 1px; min-height: 30px; margin: 10px 0; padding: 5px; border: 1px solid #799087; border-radius: 6px; background: white; }
.paper-page-ledger span { position: relative; min-width: 0; border: 1px solid #1b6958; border-radius: 2px; background: var(--mint); }
.paper-page-ledger span::before { content: ""; position: absolute; inset: 4px 35%; border-radius: 999px; background: rgba(255, 255, 255, .72); }
.paper-page-ledger span.is-limited { background: repeating-linear-gradient(135deg, #f8fafc 0 3px, #537188 3px 6px); }
.paper-page-ledger span.is-limited::before { content: "~"; inset: 50% auto auto 50%; color: var(--ink); background: white; transform: translate(-50%, -50%); font: 900 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.paper-page-ledger span.is-failed { border-color: var(--signal-strong); background: #fff1ec; }
.paper-page-ledger span.is-failed::before { content: "!"; inset: 50% auto auto 50%; color: var(--signal-strong); background: transparent; transform: translate(-50%, -50%); font: 900 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.paper-page-ledger span.has-semantic::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 5px; height: 5px; border: 1px solid white; border-radius: 50%; background: var(--violet); }
.paper-map-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.paper-map-facts div { min-width: 0; padding: 7px; border-top: 2px solid var(--mint); background: rgba(255, 255, 255, .8); }
.paper-map-facts dt { color: var(--ink-soft); font: 800 8px/1.25 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; }
.paper-map-facts dd { margin: 2px 0 0; color: var(--ink); font: 850 14px/1.1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.paper-map-boundary { margin: 8px 0 0; padding: 8px 9px; border-left: 3px solid var(--mint); color: #315f54; background: var(--mint-soft); font-size: 10px; line-height: 1.45; }
.paper-structure-details { background: rgba(255, 255, 255, .82); }
#paper-structure-list { display: grid; gap: 7px; margin: 0; padding: 0 10px 10px; list-style: none; }
#paper-structure-list > li { padding: 8px; border: 1px solid #b8ccc7; border-left: 4px solid var(--mint); border-radius: 7px; background: white; }
#paper-structure-list > li.is-limited { border-left-color: #537188; }
#paper-structure-list > li.is-failed { border-left-color: var(--signal-strong); background: #fff7f4; }
.paper-structure-label { display: block; overflow-wrap: anywhere; font-size: 12px; line-height: 1.3; }
.paper-structure-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 0; color: var(--ink-soft); font: 800 9px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.paper-structure-summary { margin: 5px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.paper-structure-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.paper-structure-actions button { min-height: 28px; padding: 3px 7px; font-size: 9px; }

.critical-map { position: relative; margin: 12px 0; padding: 14px; overflow: hidden; border: 1px solid var(--ink); border-radius: 11px; background: linear-gradient(150deg, #fff 0 64%, #f0edff 100%); box-shadow: 4px 4px 0 rgba(20, 33, 61, .1); }
.critical-map::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: linear-gradient(var(--signal), var(--violet), var(--mint)); }
.critical-map-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-left: 5px; }
.critical-map-heading h3 { margin: 3px 0 0; }
.critical-map progress { display: block; width: 100%; height: 9px; margin: 12px 0 8px; overflow: hidden; border: 1px solid var(--ink); border-radius: 999px; background: white; accent-color: var(--violet); }
.critical-map progress::-webkit-progress-bar { background: white; }
.critical-map progress::-webkit-progress-value { background: linear-gradient(90deg, var(--violet), var(--mint)); }
#paper-analysis-summary { margin: 0; color: var(--ink); font-size: 12px; font-weight: 780; line-height: 1.45; }
.critical-map-boundary { margin: 7px 0 12px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
#critical-idea-list { display: grid; gap: 7px; margin: 0; padding: 0; counter-reset: critical-idea; list-style: none; }
#critical-idea-list > li { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: start; padding: 9px; border: 1px solid #cbc5eb; border-radius: 8px; background: rgba(255, 255, 255, .9); counter-increment: critical-idea; }
#critical-idea-list > li::before { content: counter(critical-idea, decimal-leading-zero); display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--ink); border-radius: 50%; color: white; background: var(--violet); font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
#critical-idea-list > li:first-child { border-color: rgba(240, 100, 73, .72); box-shadow: inset 3px 0 0 var(--signal); }
#critical-idea-list > li:first-child::before { background: var(--signal-strong); }
#critical-idea-list > li.is-tombstoned { border-style: dashed; }
#critical-idea-list > li.is-tombstoned strong { text-decoration: line-through; }
.critical-idea-copy { min-width: 0; }
.critical-idea-copy strong { display: block; overflow-wrap: anywhere; font-size: 12px; line-height: 1.3; }
.critical-idea-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 0; color: var(--ink-soft); font: 800 9px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.critical-idea-page { padding: 2px 5px; border-radius: 999px; color: #315f54; background: var(--mint-soft); }
.critical-idea-excerpt { margin: 5px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.critical-idea-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.critical-idea-actions button { min-height: 28px; padding: 3px 7px; font-size: 9px; }

.graph-arranger { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: end; margin-top: 12px; padding: 12px; border: 1px solid var(--ink); border-radius: 10px; background: var(--mint-soft); box-shadow: 3px 3px 0 rgba(20, 33, 61, .1); }
.graph-arranger-copy h3 { margin: 3px 0 4px; }
.graph-arranger-copy > p:last-child { margin: 0; color: #315f54; font-size: 11px; line-height: 1.45; }
.graph-arranger-actions { display: grid; gap: 8px; }
#graph-layout-status { min-height: 31px; margin: 0; color: var(--ink); font-size: 11px; line-height: 1.4; }
.graph-nudge-row { display: grid; grid-template-columns: repeat(4, 36px) minmax(86px, 1fr); gap: 5px; }
.graph-nudge-row button { min-width: 0; min-height: 34px; padding: 4px; font-size: 13px; }
.graph-nudge-row #graph-layout-reset { padding-inline: 8px; font-size: 10px; }
.graph-canvas-shell { position: relative; margin: 14px 0; border-radius: 11px; transition: box-shadow .16s ease, transform .16s ease; }
.sigma-container { height: 310px; margin: 0; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.graph-canvas-shell.is-node-hovered .sigma-container { cursor: grab; }
.graph-canvas-shell.is-node-dragging .sigma-container { cursor: grabbing; }
.graph-canvas-shell.is-drop-target { box-shadow: 0 0 0 4px rgba(47, 159, 134, .28), 5px 5px 0 rgba(20, 33, 61, .12); transform: translateY(-2px); }
.graph-canvas-shell.is-drop-target .sigma-container { border-color: var(--mint); border-style: dashed; background: #f1fcf9; }
.graph-drop-hint { position: absolute; inset: 50% auto auto 50%; z-index: 4; width: max-content; max-width: calc(100% - 30px); padding: 9px 12px; border: 1px solid var(--ink); border-radius: 999px; color: white; background: var(--ink); box-shadow: 3px 3px 0 rgba(20, 33, 61, .16); opacity: 0; pointer-events: none; transform: translate(-50%, -42%); transition: opacity .16s ease, transform .16s ease; font: 800 10px/1.25 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
.graph-canvas-shell.is-drop-target .graph-drop-hint { opacity: 1; transform: translate(-50%, -50%); }
.graph-search { display: grid; gap: 9px; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f5f8fc; }
.graph-search h3 { margin: 0; }
.graph-search p { margin: 3px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.graph-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 7px; }
#graph-search-results { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
#graph-search-results li { padding: 8px; border-left: 3px solid var(--mint); background: white; font-size: 11px; line-height: 1.4; }
#graph-search-results button { display: block; min-height: 30px; margin-top: 7px; padding-block: 4px; font-size: 11px; }
#graph-outline,
#activity-list,
#tool-list { display: grid; gap: 8px; padding-left: 22px; }
#annotation-list { display: grid; gap: 8px; margin-block: 10px 0; padding: 0; list-style: none; }
#graph-outline li,
#annotation-list li { font-size: 12px; line-height: 1.45; }
.annotation-item { position: relative; padding: 9px; border: 1px solid #d0caee; border-left: 4px solid var(--violet); border-radius: 8px; background: #f7f5ff; transition: opacity .14s ease, box-shadow .14s ease, transform .14s ease; }
.annotation-item.is-agent { border-left-color: var(--signal); background: #fff1ec; }
.annotation-item.is-reader { border-left-color: var(--mint); background: #eefaf7; }
.annotation-item.is-automatic { border-left-color: var(--violet); background: linear-gradient(135deg, #f7f5ff, #fff); }
.annotation-item.is-selected,
#graph-outline li.is-selected { box-shadow: 0 0 0 3px rgba(240, 100, 73, .2); }
.annotation-item.is-dragging { opacity: .48; transform: scale(.985); }
.annotation-item.is-drop-before { box-shadow: inset 0 4px 0 var(--mint); }
.annotation-item.is-drop-after { box-shadow: inset 0 -4px 0 var(--mint); }
.annotation-card-head { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 7px; align-items: start; }
.annotation-drag-handle { display: grid; width: 24px; height: 28px; place-items: center; border: 1px solid rgba(20, 33, 61, .35); border-radius: 6px; color: var(--ink-soft); background: rgba(255, 255, 255, .72); cursor: grab; font-size: 16px; line-height: 1; }
.annotation-drag-handle:active { cursor: grabbing; }
.annotation-card-summary { min-width: 0; overflow-wrap: anywhere; }
.annotation-source-summary { display: block; margin-top: 6px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.annotation-item button { display: block; min-height: 30px; margin-top: 7px; padding-block: 4px; font-size: 11px; }
.annotation-actions,
.graph-outline-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.annotation-actions button,
.graph-outline-actions button { display: inline-flex; flex: 1 1 auto; justify-content: center; min-height: 30px; margin: 0; padding: 4px 7px; font-size: 10px; }
.annotation-actions button.is-selected,
.graph-outline-actions button.is-selected { color: white; background: var(--signal-strong); }
.annotation-layout-status { margin: 8px 0 0; padding: 8px 9px; border-left: 3px solid var(--mint); color: #315f54; background: var(--mint-soft); font-size: 10px; line-height: 1.45; }
.section-heading-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.section-heading-row h3 { margin-bottom: 0; }
.count-chip { display: inline-grid; min-width: 26px; height: 26px; place-items: center; border: 1px solid var(--ink); border-radius: 999px; color: white; background: var(--ink); font: 800 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { padding: 11px; border-left: 3px solid var(--mint); background: #ebfbf7; font-size: 12px; line-height: 1.5; }
#activity-list { max-height: 360px; overflow: auto; }
#activity-list li { padding: 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; }
details { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; }
summary { padding: 10px; cursor: pointer; font-weight: 750; }
.contract-manifest { display: grid; gap: 10px; margin: 10px; }
.contract-manifest div { display: grid; gap: 3px; }
.contract-manifest dt { color: #59677b; font: 800 10px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }
.contract-manifest dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; }
pre { max-height: 380px; margin: 0; padding: 10px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 10px; }

/* The map is a working surface. Long provenance and route lists disclose below it. */
body:not(.is-waiting-for-paper) .topbar { align-items: center; padding: 12px 22px; }
body:not(.is-waiting-for-paper) .topbar h1 { margin-top: 3px; font-size: 27px; line-height: 1.05; }
body:not(.is-waiting-for-paper) .topbar .boundary { font-size: 11px; line-height: 1.4; }
body:not(.is-waiting-for-paper) main { margin-top: 10px; }
body:not(.is-waiting-for-paper) .status-grid div { padding: 8px 11px; }
body:not(.is-waiting-for-paper) .status-grid strong { font-size: 11px; }
.graph-panel { display: flex; flex-direction: column; padding: 14px; height: calc(100dvh - 146px); max-height: calc(100dvh - 24px); min-height: 630px; overflow: hidden; background: var(--paper); }
.graph-rail-heading { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; }
.graph-rail-heading h2 { margin: 4px 0 10px; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 24px; }
.graph-history-controls { display: flex; gap: 4px; }
.graph-history-controls button { min-height: 30px; padding: 4px 7px; font-size: 11px; }
.graph-rail-tabs { display: grid; flex: 0 0 auto; grid-template-columns: 1fr 1.45fr 1fr; border-bottom: 1px solid var(--line); }
.graph-rail-tabs button { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 38px; padding: 7px 4px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; font-size: 12px; background: transparent; box-shadow: none; }
.graph-rail-tabs button[aria-selected="true"] { border-bottom-color: var(--ink); color: var(--ink); background: #eae5f7; }
.graph-rail-tabs .count-chip { min-width: 20px; height: 20px; padding: 0 4px; font-size: 9px; }
.graph-visual-workspace { flex: 0 0 auto; }
.graph-view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin: 10px 0 0; }
.graph-view-toolbar > div { display: flex; gap: 4px; }
.graph-view-toolbar button { min-height: 28px; padding: 3px 8px; font-size: 10px; }
.graph-view-toolbar button[aria-pressed="true"] { color: white; background: var(--ink); }
.graph-view-summary { margin: 6px 0 0; color: var(--ink-soft); font: 650 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.graph-canvas-shell { margin: 8px 0 6px; }
.sigma-container { height: clamp(210px, 26vh, 290px); border-color: #d2cbdc; background: radial-gradient(circle, #d8d2de .6px, transparent .8px) 0 0 / 16px 16px, #fbf9fe; }
.graph-visual-fallback { display: grid; position: absolute; inset: 0; place-content: center; margin: 0; padding: 24px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-soft); background: var(--paper); font-size: 12px; line-height: 1.6; text-align: center; }
.graph-legend { display: flex; flex-wrap: wrap; gap: 9px; color: var(--ink-soft); font-size: 9px; line-height: 1.4; }
.graph-legend span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 4px; border: 1px solid var(--ink); border-radius: 50%; background: var(--violet); }
.graph-legend .legend-structure::before { border-radius: 1px; background: #718598; }
.graph-legend .legend-reader::before { background: var(--mint); }
.graph-legend .legend-agent::before { background: var(--signal); }
.graph-arranger { gap: 4px; margin: 7px 0 0; padding: 7px 0 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.graph-nudge-row { grid-template-columns: repeat(4, 32px) minmax(74px, 1fr); }
.graph-nudge-row button { min-height: 30px; }
#graph-layout-status { min-height: 27px; margin: 3px 0 0; font-size: 10px; line-height: 1.35; }
.graph-rail-body { min-height: 140px; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 0 4px 8px 0; }
.graph-rail-body [role="tabpanel"] { outline-offset: -3px; }
.graph-panel [hidden] { display: none !important; }
.graph-selection { margin: 10px 0; padding: 11px; border: 1px solid #cec5df; border-left: 3px solid var(--violet); border-radius: 3px 8px 8px 3px; background: white; }
.graph-selection h3 { margin: 4px 0 5px; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 19px; line-height: 1.15; overflow-wrap: anywhere; }
#graph-selection-meta { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
#graph-selection-detail p { margin: 7px 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.graph-selection-position { display: block; margin-top: 7px; color: var(--ink-soft); font: 500 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.graph-selection details { margin-top: 8px; background: var(--paper); }
.graph-selection summary { padding: 6px 8px; font-size: 11px; }
.graph-source-actions { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0; }
.graph-source-actions button { min-height: 29px; padding: 4px 7px; font-size: 10px; text-align: left; }
.graph-relations { display: grid; gap: 7px; padding: 0 9px 9px 20px; font-size: 11px; line-height: 1.45; }
.graph-relations button { min-height: 28px; padding: 4px 7px; font-size: 10px; text-align: left; }
.graph-search { gap: 7px; margin: 10px 0; padding: 0 0 10px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.graph-search h3 { font-size: 13px; }
.graph-search-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px; }
.graph-search-row input { height: 32px; padding: 5px 7px; font-size: 11px; }
.graph-search-row button { min-width: 0; min-height: 32px; padding: 4px 6px; font-size: 10px; }
.graph-search-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.graph-search-filters label { display: grid; gap: 4px; color: var(--ink-soft); font-size: 10px; }
.graph-search-filters select { min-width: 0; width: 100%; min-height: 30px; padding: 4px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: white; font-size: 10px; }
#graph-search-status { font-size: 10px; }
.graph-outline-details > summary, .paper-route-details > summary, .idea-candidates-details > summary { font-size: 12px; }
#graph-outline-count { color: var(--ink-soft); font-weight: 500; font-size: 10px; }
.outline-help { margin: 0; padding: 0 10px 8px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
#graph-outline { display: grid; gap: 8px; margin: 0; padding: 0 7px 7px; list-style: none; }
#graph-outline > li { padding: 9px; border: 1px solid #d8d2df; border-radius: 7px; background: white; }
#graph-outline > li[data-outline-kind="edge"] { border-left: 3px solid #9aa6b6; background: #f4f7fa; }
.graph-node-title { max-width: 100%; min-height: 30px; padding: 0; border: 0; color: var(--ink); background: transparent; font-size: 12px; line-height: 1.4; font-weight: 750; text-align: left; overflow-wrap: anywhere; box-shadow: none; }
.graph-node-title:hover:not(:disabled) { color: var(--signal-strong); background: transparent; text-decoration: underline; }
.graph-fact-meta, .graph-fact-summary { margin: 5px 0; color: var(--ink-soft); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.graph-fact-summary { font-size: 11px; color: var(--ink); }
.graph-entity-details { margin-top: 7px; }
.graph-entity-details summary { padding: 6px 7px; font-size: 10px; }
.graph-entity-details > div { padding: 0 7px 7px; }
.graph-entity-key { overflow-wrap: anywhere; font: 500 9px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ink-soft); }
.graph-fact-tombstoned { border-style: dashed !important; }
.graph-fact-tombstoned .graph-node-title { text-decoration: line-through; }
.paper-map, .critical-map { margin: 0; padding: 10px; border: 0; border-radius: 0; box-shadow: none; }
.paper-map-facts { gap: 4px; }
.annotation-card-summary strong { display: block; font-size: 12px; line-height: 1.4; }
.annotation-card-summary small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 10px; line-height: 1.4; }
.annotation-source-details { margin-top: 7px; background: rgba(255,255,255,.8); }
.annotation-source-details summary { padding: 6px 7px; font-size: 10px; }
.annotation-source-details .annotation-source-summary { padding: 0 8px 8px; overflow-wrap: anywhere; }
.annotation-drag-handle { width: 26px; min-height: 34px; }
.annotation-boundary { font-size: 11px; }
.annotation-layout-status { font-size: 10px; }
#graph-evidence-panel > #activity-list { max-height: none; padding-left: 18px; }

@media (max-width: 1240px) {
  .workspace { grid-template-columns: minmax(250px, .7fr) minmax(540px, 1.45fr); grid-template-areas: "mentor paper" "rail paper"; }
  .activity-panel,
  .graph-panel { position: static; max-height: none; }
  .graph-panel { height: 820px; min-height: 0; }
}

@media (max-width: 1180px) {
  .paper-source-gate { grid-template-columns: 1fr; }
  .paper-start-actions { min-width: 0; width: 100%; }
  #paper-source-gate-status { grid-column: 1; }
}

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; grid-template-areas: "paper" "mentor" "rail"; }
  .activity-panel,
  .graph-panel { position: static; max-height: none; }
  .panel-heading { align-items: start; }
  .graph-panel { height: 900px; }
}

@media (max-width: 700px) {
  .topbar,
  .panel-heading { display: grid; }
  .boundary,
  .panel-heading > p { text-align: left; }
  .status-grid,
  .visual-regions { grid-template-columns: 1fr; }
  .status-grid div { border-right: 0; border-bottom: 1px solid var(--line); }
  .status-grid div:last-child { border-bottom: 0; }
  .paper-source-gate { grid-template-columns: 1fr; width: min(100% - 20px, 1180px); }
  .paper-start-actions { grid-template-columns: 1fr; }
  #paper-source-gate-status { grid-column: 1; }
  .paper-panel { padding: 10px; }
  .paper-stage { padding-inline: 6px; }
  .pdf-toolbar,
  .paper-evidence-strip,
  .visual-diagnostic-body > header { display: grid; }
  .paper-evidence-strip { grid-template-columns: minmax(0, 1fr); }
  .paper-evidence-strip > button { width: 100%; }
  .pdf-controls { justify-content: start; }
  .pdf-scrollport { min-height: 480px; padding: 10px; }
  .pdf-scrollport { gap: 18px; }
  .reader-annotation-composer,
  .graph-search-row,
  .graph-arranger { grid-template-columns: 1fr; }
  .paper-map-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reader-annotation-composer > *,
  .annotation-composer-intro,
  .annotation-composer-boundary { grid-column: 1; }
  .annotation-source-mode { min-width: 0; }
  .annotation-source-mode span { min-width: 0; flex-basis: 100%; overflow-wrap: anywhere; }
  .annotation-source-mode button { max-width: 100%; white-space: normal; }
  .agent-cursor-label { right: 23px; left: auto; }
  .graph-panel { padding: 11px; height: 900px; }
  .graph-rail-heading { gap: 5px; }
  .graph-rail-heading h2 { font-size: 21px; }
  .graph-rail-tabs button { font-size: 11px; }
  .graph-nudge-row { grid-template-columns: repeat(4, 30px) minmax(70px, 1fr); gap: 4px; }
  .graph-search-row { grid-template-columns: minmax(0, 1fr) auto; }
  #clear-graph-search { grid-column: 2; }
  .graph-search-filters { grid-template-columns: minmax(0, 1fr); }
}

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

@media (forced-colors: active) {
  .paper-panel,
  .graph-panel,
  .activity-panel,
  .mentor-explanation,
  .browser-save-card,
  .paper-map,
  .graph-arranger,
  .annotation-item,
  .pdf-page-surface { border: 2px solid CanvasText; box-shadow: none; forced-color-adjust: auto; }
  .pdf-source-highlight,
  .pdf-captured-anchor-highlights rect { fill: Highlight; fill-opacity: .28; stroke: Highlight; }
  .agent-cursor,
  .paper-page-ledger span { forced-color-adjust: none; }
  .annotation-chip, .review-state, .count-chip, .mentor-authority { color: CanvasText; background: Canvas; forced-color-adjust: auto; }
  .reader-annotation-error { color: CanvasText; background: Canvas; border-color: CanvasText; }
  .annotation-item.is-reader { border-left-style: solid; }
  .annotation-item.is-agent { border-left-style: dashed; }
  button:focus-visible, a:focus-visible, [tabindex]:focus-visible, summary:focus-visible,
  .reader-annotation-composer [aria-invalid="true"] { outline: 3px solid Highlight; }
}
