
:root{color-scheme:dark;--phd-bg:#0b1016;--phd-panel:#111820;--phd-bar:#101010;--phd-text:#d5dee9;--phd-muted:#9ca6b2;--phd-accent:#a7c9e5;--phd-selected:#162331;--phd-border:#304154;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;font-size:14px;background:var(--phd-bg);color:var(--phd-text)}
*{box-sizing:border-box}body{margin:0}body.visitor-portal{max-width:1040px;margin:0 auto;min-height:100vh;border-inline:1px solid var(--phd-border)}body.visitor-portal .sidebar.research-navigation{grid-template-columns:minmax(0,1fr);gap:6px}button{font:inherit;cursor:pointer}a,button,summary{touch-action:manipulation}a{color:var(--phd-accent)}body.visitor-portal a,body.visitor-portal a:is(:hover,:focus-visible){text-decoration:none}a:focus-visible,button:focus-visible,summary:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--phd-accent);outline-offset:3px}.skip-link{position:absolute;top:8px;left:12px;z-index:50;min-height:44px;transform:translateY(-200%);padding:12px;background:var(--phd-panel)}.skip-link:focus{transform:none}
.supervisor-entry{position:fixed;inset:0;z-index:100;width:min(620px,calc(100% - 32px));height:max-content;max-height:calc(100svh - 32px);margin:auto;padding:0;overflow:auto;border:1px solid var(--phd-border);border-radius:0;background:#101720;color:var(--phd-text);font:12px/1.5 "SFMono-Regular",Consolas,Menlo,monospace;box-shadow:none}.supervisor-entry:not([open]){display:none}.terminal-bar{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:44px;padding:0 18px;border-bottom:1px solid var(--phd-border);color:var(--phd-accent)}
.supervisor-entry::backdrop{background:#0b1017}#entry-heading:focus,body.visitor-portal main:focus{outline:none}
.entry-panel{padding:14px 18px}.entry-line{display:flex;align-items:center;gap:12px;min-height:44px;text-align:left}.entry-prompt{flex:none;color:var(--phd-accent);font-size:15px;white-space:nowrap;user-select:none}.cli-input{position:relative;flex:1;min-width:0}.entry-line input{display:block;width:100%;min-width:0;height:30px;line-height:30px;padding:0;border:0;border-radius:0;background:transparent;color:var(--phd-text);font:inherit;font-size:16px;caret-color:var(--phd-accent);outline:none;box-shadow:none}.entry-line:has(input:focus-visible) .entry-prompt{color:#eff6ff}.cli-caret{display:none;position:absolute;left:0;top:5px;width:10px;height:20px;line-height:20px;background:var(--phd-accent);color:var(--phd-bg);text-align:center;pointer-events:none}.cli-caret[hidden]{display:none!important}html[data-cli-caret="ready"] .cli-input:has(input:focus) .cli-caret{display:block}html[data-cli-caret="ready"] #supervisor-email{caret-color:transparent}.entry-line button{flex:none;min-width:44px;min-height:44px;padding:0;border:0;background:transparent;color:var(--phd-accent);font:inherit;font-size:20px}.entry-line button:disabled{opacity:.5;cursor:wait}.entry-status{margin:8px 0 0;font-size:11px;color:var(--phd-muted);overflow-wrap:anywhere}.entry-status:empty{display:none}.view-thesis{display:inline-flex;align-items:center;min-height:44px;padding:0;border:0;background:transparent;color:var(--phd-muted);font:inherit;font-size:11px}.view-thesis{justify-content:center;min-width:44px}.view-thesis:hover{color:var(--phd-text)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
body.visitor-portal .workspace-link.restricted{cursor:pointer}body.visitor-portal .workspace-link.restricted:hover{border-color:var(--phd-border);color:var(--phd-muted)}
.no-access{flex:0 0 16px;margin-left:auto;fill:none;stroke:currentColor;stroke-width:1.5;opacity:.75}
main{margin:0 auto 28px;padding:16px 20px 0;max-width:1200px;min-width:0}.view-thesis{white-space:nowrap}h1{font:600 16px/1.5 "SFMono-Regular",Consolas,Menlo,monospace;margin:0 0 12px}.paper-reader{display:grid;gap:12px;min-width:0}.paper-reader img{display:block;width:100%;height:auto;background:white;border:1px solid var(--phd-border)}
@media(max-width:680px){main{padding:13px 14px 0}.terminal-bar{padding:0 14px;gap:8px}.entry-panel{padding:12px 14px}.entry-line{gap:8px}.entry-prompt{font-size:13px}.paper-reader{gap:8px}h1{font-size:14px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

/* Shared portal chrome; presentation only. */
body .sidebar.research-navigation,
body.terminal-ui .sidebar.research-navigation {
  position: static !important;
  inset: auto;
  display: grid !important;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 12px 20px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--phd-border, #304154);
  background: var(--phd-bar, #101010);
  color: var(--phd-text, #d5dee9);
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
}
.portal-name { display: flex; align-items: center; font: 400 14px/1.5 "SFMono-Regular", Consolas, Menlo, monospace; color: var(--phd-text, #d5dee9); }
body .research-navigation nav,
body.terminal-ui .research-navigation nav {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: visible;
}
.workspace-item { position: relative; min-width: 0; }
body .research-navigation .workspace-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 70px;
  height: 100%;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--phd-border, #30373f);
  border-radius: 0;
  background: transparent;
  color: var(--phd-muted, #a4acb7);
  font: 600 12px/1.45 "SFMono-Regular", Consolas, Menlo, monospace;
  text-align: left;
  text-decoration: none;
  white-space: normal;
  box-shadow: none;
}
body .research-navigation .workspace-number { flex: 0 0 19px; width: 19px; color: inherit; font: 600 11px/1.4 "SFMono-Regular", Consolas, Menlo, monospace; }
.workspace-copy { display: block; min-width: 0; overflow-wrap: anywhere; }
body .research-navigation .workspace-link small { display: block; margin-top: 3px; color: inherit; opacity: .78; font-size: 10px; font-weight: 400; line-height: 1.45; }
body .research-navigation .workspace-link.active { border-color: var(--phd-accent, #a7c9e5); background: var(--phd-selected, #162331); color: var(--phd-accent, #a7c9e5); }
body .research-navigation .workspace-link:hover { border-color: var(--phd-accent, #a7c9e5); color: var(--phd-accent, #a7c9e5); }
body .research-navigation .workspace-link:focus-visible { outline: 2px solid var(--phd-accent, #a7c9e5); outline-offset: 2px; }
body .main-shell { margin-left: 0; width: 100%; min-width: 0; }
body .topbar.portal-topbar,
body.terminal-ui .topbar.portal-topbar {
  position: static !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "location repository controls";
  align-items: center;
  gap: 14px;
  height: auto;
  min-height: 48px;
  padding: 4px 20px;
  margin: 0;
  border-bottom: 1px solid var(--phd-border, #304154);
  background: var(--phd-bar, #101010);
  color: var(--phd-text, #d5dee9);
  font: 12px/1.5 "SFMono-Regular", Consolas, Menlo, monospace;
}
body .portal-topbar .breadcrumb { grid-area: location; order: initial; min-width: 0; margin: 0; color: var(--phd-muted, #a4acb7); font: inherit; white-space: normal; overflow-wrap: anywhere; }
body .portal-topbar .breadcrumb strong { color: var(--phd-text, #d5dee9); font-weight: 600; }
body .portal-topbar .github-link,
body .portal-topbar .header-repository { grid-area: repository; justify-self: center; order: initial; margin: 0; font: inherit; }
body .portal-topbar .github-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--phd-accent, #a7c9e5); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; box-shadow: none; }
body .portal-topbar .portal-actions { grid-area: controls; display: flex; align-items: center; justify-self: end; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-width: 0; max-width: 100%; }
body .portal-actions .phd-theme-picker { display: inline-flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; width: auto !important; margin: 0 !important; padding: 0; gap: 4px; }
body .portal-actions .phd-theme-label { display: none; }
body .portal-actions .phd-theme-picker button { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 36px; padding: 5px 8px; border: 1px solid transparent; border-radius: 0; background: transparent; color: var(--phd-muted, #a4acb7); font: inherit; box-shadow: none; }
body .portal-actions .phd-theme-picker button[aria-pressed="true"] { border-color: var(--phd-border, #304154); background: var(--phd-selected, #162331); color: var(--phd-accent, #a7c9e5); }
body .portal-actions :is(.reader-signout, .account-link) { order: initial; margin: 0; font: inherit; }
body .portal-actions .local-view-link { display: inline-flex; align-items: center; min-height: 40px; padding: 4px 9px; border: 1px solid var(--phd-border, #304154); font: inherit; text-decoration: none; white-space: nowrap; }
body .presentation-switch { display: none !important; }
body a:not(.brand) { color: var(--phd-accent, #a7c9e5); }
body a:focus-visible, body .github-link:focus-visible { outline: 2px solid var(--phd-accent, #a7c9e5); outline-offset: 2px; }
.preview-item { position: relative; }
body .workspace-link.restricted, body .header-repository .github-link { cursor: help; }
.access-hint { position: absolute; top: calc(100% - 1px); left: 0; z-index: 40; width: 292px; max-width: calc(100vw - 28px); padding: 12px; border: 1px solid var(--phd-border, #304154); background: var(--phd-panel, #101820); color: var(--phd-text, #d5dee9); font: 12px/1.6 "SFMono-Regular", Consolas, Menlo, monospace; text-align: left; box-shadow: none; }
.access-hint[hidden] { display: none; }
.access-hint p { margin: 0 0 8px; font: inherit; }
.access-hint a { display: inline-flex; align-items: center; min-height: 32px; color: var(--phd-accent, #a7c9e5); font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.workspace-item:nth-last-child(-n+2) .access-hint { left: auto; right: 0; }
.header-repository .access-hint { left: 50%; transform: translateX(-50%); }
@media (max-width: 1100px) {
  body .sidebar.research-navigation, body.terminal-ui .sidebar.research-navigation { grid-template-columns: 1fr; gap: 6px; }
  .portal-name { min-height: 24px; font-size: 12px; }
  body .research-navigation .workspace-link small { display: block; }
}
@media (max-width: 680px) {
  body { --mono: "SFMono-Regular", Consolas, Menlo, "Liberation Mono", monospace; --radius: 0; }
  body.terminal-ui { font: 12px/1.55 var(--mono); }
  body .sidebar.research-navigation, body.terminal-ui .sidebar.research-navigation { padding: 8px 14px; }
  body .research-navigation nav, body.terminal-ui .research-navigation nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  body .research-navigation .workspace-link { grid-column: auto !important; flex: initial; gap: 7px; min-height: 60px; padding: 7px 8px; font-size: 11px; }
  body .research-navigation .workspace-link small { display: none; }
  body .topbar.portal-topbar, body.terminal-ui .topbar.portal-topbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "location location" "repository controls"; gap: 0 12px; padding: 4px 14px; font-size: 10px; }
  body .portal-topbar .github-link, body .portal-topbar .header-repository { justify-self: start; }
  body .portal-actions .phd-theme-picker button { min-width: 44px; min-height: 44px !important; padding: 5px 6px; }
  body .portal-topbar .github-link, body .portal-actions .account-link { min-height: 44px; }
  body .portal-actions .local-view-link { display: none; }
  .workspace-item:nth-last-child(-n+2) .access-hint, .workspace-item .access-hint { left: 0; right: auto; }
  .workspace-item:nth-child(even) .access-hint { left: auto; right: 0; }
  .header-repository .access-hint { left: 0; transform: none; }
  .access-hint a { min-height: 44px; }
  body main, body.terminal-ui main { max-width: none; min-width: 0; padding: 13px 14px 0; }
  body .workspace { min-width: 0; }
  body .workspace .page-heading, body.terminal-ui .workspace .page-heading { display: flex; flex-direction: column; align-items: stretch; margin-bottom: 12px; gap: 9px; }
  body.terminal-ui h1 { font: 600 18px/1.35 var(--mono); }
  body :is(.button, .code-button, .text-button, .tabs button, .jump-group button, .segmented button, .pipeline button, select) { min-height: 44px; }
  body .tabs { display: flex; flex-wrap: wrap; gap: 3px; }
  body .reference-tabs { display: flex; flex-wrap: wrap; max-width: 100%; }
  body .reference-tabs button { flex: 1 1 120px; min-width: 0; white-space: normal; }
  body :is(.workspace-grid, .lower-grid, .estimation-grid, .paper-grid, .data-source-grid) { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  body :is(.table-wrap, .source-details, .json-record, pre, code) { max-width: 100%; }
  body :is(.source-footnote, .fine-print, .research-caption) { overflow-wrap: anywhere; }
}
body.terminal-ui { --mono: "SFMono-Regular", Consolas, Menlo, "Liberation Mono", monospace; --radius: 0; font: 12px/1.6 var(--mono); }
body.terminal-ui :is(h1,h2,h3,button,input,select,textarea,output,pre,code) { font-family: var(--mono); }
body.terminal-ui :is(.panel,.controls,.metrics,.button,.code-button,.text-button,input,select,.tag,.paper-card,.data-source-card,.timeline,.segmented) { border-radius: 0; box-shadow: none; }
body.terminal-ui h1 { font-size: 20px; line-height: 1.4; letter-spacing: 0; }
body.terminal-ui h2 { font-size: 13px; line-height: 1.5; }
body.terminal-ui main { max-width: none; padding: 16px 20px 0; }
@media(max-width:680px) { body.terminal-ui main { padding: 13px 14px 0; } body.terminal-ui h1 { font-size: 18px; } }

/* The existing local terminal is the shared default, including the RFQ desk. */
body.terminal-ui { font-family: var(--mono,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace); }
body.terminal-ui .research-navigation nav,body.visitor-portal .research-navigation nav { grid-template-columns: repeat(6,minmax(0,1fr)); }
body .portal-name { flex-direction:column;align-items:flex-start;justify-content:center;gap:3px; }
.portal-wordmark { font: 600 14px/1.2 var(--mono,monospace);letter-spacing:0;color:var(--ink,#d5dee9); }
.portal-identity { font: 11px/1.4 var(--mono,monospace);color:var(--phd-accent,#a9c9ea); }
body .research-navigation .workspace-link { min-height:60px; }
body .research-navigation .workspace-number { display:none; }
body .portal-topbar .breadcrumb { font-family:var(--mono,monospace); }
body .topbar.portal-topbar,body.terminal-ui .topbar.portal-topbar { grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"location controls"; }
body .portal-topbar .portal-actions { grid-area:controls;justify-self:end; }
.thesis-toolbar { display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 auto 16px;max-width:960px; }
.thesis-toolbar h1 { font-size:17px;margin:0; }
.thesis-toolbar p { font-size:11px;color:var(--muted);margin:3px 0 0; }
.thesis-actions,.pdf-mode { display:flex;align-items:center;gap:6px; }
.pdf-mode button[aria-pressed=true] { border-color:var(--phd-accent,#a9c9ea);color:var(--phd-accent,#a9c9ea); }
.pdf-pages { max-width:960px;margin:0 auto;display:grid;gap:16px; }
.pdf-pages figure { margin:0; }
.pdf-pages img { display:block;width:100%;height:auto;background:white;border:1px solid #343b44; }
html[data-pdf-mode=dark] .pdf-pages img { filter:invert(.91) hue-rotate(180deg); }
.rfq-subnav { display:flex;gap:6px;flex-wrap:wrap;margin:12px 0 16px; }
.rfq-subnav button[aria-pressed=true] { color:var(--phd-accent,#a9c9ea);border-color:var(--phd-accent,#a9c9ea);background:var(--phd-selected,#182534); }
#workspace-rfq { --rfq-up:#9fc9b8;--rfq-warm:#d7b58a; }
#workspace-rfq :is(button,input,select,table,h1,h2,h3,p,span,b,strong) { font-family:var(--mono,ui-monospace,monospace); }
#workspace-rfq .research-caption { margin:0 0 14px;max-width:110ch; }
.rfq-desk-grid { display:grid;grid-template-columns:minmax(0,1.15fr) minmax(300px,1fr);gap:12px;align-items:start; }
.rfq-desk-panel { padding:14px; }
.rfq-desk-panel h2 { font-size:14px;margin:0 0 12px; }
.rfq-desk-panel h3 { font-size:12px;margin:18px 0 8px; }
.rfq-episodes,.rfq-action-row { display:flex;gap:6px;align-items:center;flex-wrap:wrap; }
.rfq-episodes button.selected { border-color:var(--phd-accent,#a9c9ea);color:var(--phd-accent,#a9c9ea); }
.rfq-chart { width:100%;min-width:0;height:auto;margin:10px 0; }
.rfq-chart svg { width:100%;height:auto;display:block;font:10px var(--mono,monospace); }
.rfq-chart text { fill:#b9c9d8; }
.rfq-chart .axis-label { font-size:10px; }
.rfq-signal-grid,.rfq-quote-stats { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:12px 0;border-top:1px solid var(--border); }
.rfq-signal-grid span,.rfq-quote-stats span { display:block;color:var(--muted);font-size:10px;margin-bottom:5px; }
.rfq-signal-grid strong,.rfq-quote-stats strong { color:var(--ink);font-size:15px; }
.rfq-posterior { display:flex;min-height:36px;gap:3px;margin:10px 0; }
.rfq-posterior>div { min-width:30px;display:flex;align-items:center;justify-content:center;padding:6px 3px;background:#203143;font-size:10px;overflow:hidden; }
.rfq-posterior>div:first-child { background:#423326; }
.rfq-posterior>div:last-child { background:#213d35; }
.rfq-control { display:flex;justify-content:space-between;gap:10px;align-items:center;margin:8px 0 18px; }
.rfq-control select { min-height:32px;background:#181818;color:var(--ink);border:1px solid var(--border); }
.rfq-quote-number { display:flex;align-items:center;gap:8px;margin:14px 0; }
.rfq-quote-number input { width:100px;border:1px solid var(--border);background:#111;color:var(--ink);padding:8px;font:26px var(--mono,monospace); }
.rfq-quote-number span { color:var(--muted);font-size:11px; }
.rfq-quote-slider { width:100%;accent-color:var(--phd-accent,#a9c9ea); }
.rfq-value { display:flex;justify-content:space-between;gap:12px;align-items:center;padding:14px 0;border-top:1px solid var(--border); }
.rfq-value strong { font-size:24px;font-weight:400;color:#c4e3f0; }
.rfq-recommendation { padding:12px 0;border-top:1px solid var(--border); }
.rfq-recommendation p,.rfq-note { font-size:11px;color:var(--muted);line-height:1.65; }
.rfq-recommendation strong { color:var(--rfq-up); }
.rfq-outcome { padding:12px;margin:12px 0 0;border:1px solid var(--border);background:#111;line-height:1.65; }
.rfq-frontier { margin-top:12px; }
.rfq-evidence-table { width:100%;border-collapse:collapse;font-size:11px; }
.rfq-evidence-table :is(th,td) { padding:9px;border-bottom:1px solid var(--border);text-align:left; }
.rfq-evidence-table th { color:var(--muted);font-weight:400; }
.rfq-source-links { display:flex;gap:14px;flex-wrap:wrap;margin:14px 0; }
.rfq-protocol { margin-top:12px; }
.rfq-protocol p { max-width:115ch; }
.rfq-model-equation { padding:12px;border:1px solid var(--border);font-size:12px;line-height:1.7;overflow-wrap:anywhere; }
body.visitor-portal { font:12px/1.6 "SFMono-Regular",Consolas,Menlo,monospace;background:#0d1117;color:#d5dee9; }
body.visitor-portal .main-shell main { max-width:none;padding:18px 20px; }
body.visitor-portal .thesis-toolbar { max-width:960px; }
body.visitor-portal .thesis-toolbar h1 { font:600 17px/1.4 "SFMono-Regular",Consolas,Menlo,monospace; }
body.visitor-portal .thesis-actions :is(a,button) { font:11px/1.5 "SFMono-Regular",Consolas,Menlo,monospace;padding:6px 9px;border:1px solid #455567;background:#151b24;color:#bed7ec;text-decoration:none;cursor:pointer; }
@media(max-width:1000px){body.terminal-ui .research-navigation nav,body.visitor-portal .research-navigation nav{grid-template-columns:repeat(3,minmax(0,1fr))}.rfq-desk-grid{grid-template-columns:minmax(0,1fr)} }
@media(max-width:680px){body.terminal-ui .research-navigation nav,body.visitor-portal .research-navigation nav{grid-template-columns:repeat(2,minmax(0,1fr))}body .topbar.portal-topbar,body.terminal-ui .topbar.portal-topbar{grid-template-columns:minmax(0,1fr);grid-template-areas:"location" "controls"}.thesis-toolbar{gap:10px}.thesis-actions{width:100%;justify-content:space-between}.pdf-pages{gap:8px}.rfq-desk-panel{padding:11px}.rfq-subnav button{flex:1;min-height:40px}.rfq-signal-grid strong,.rfq-quote-stats strong{font-size:13px}body.visitor-portal .main-shell main{padding:14px} }

/* Document-linked workspace. PDF coordinates and numerical chart data are unchanged. */
body.linked-research {
  --thesis-share: 33.333333%;
  --workspace-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0,var(--thesis-share)) 8px minmax(0,1fr);
  grid-template-rows: minmax(0,1fr);
  width: 100%;
  height: var(--workspace-height);
  max-height: var(--workspace-height);
  min-width: 0;
  margin: 0;
  overflow: hidden;
}
body.linked-research > .thesis-pane,
body.linked-research > .portal-pane {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
body.linked-research > .thesis-pane {
  position: relative;
  padding: 0;
  background: #101113;
  border: 0;
  scroll-behavior: auto;
}
body.linked-research .thesis-pane .pdf-pages {
  width: 100%;
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 3px;
}
body.linked-research .thesis-page {
  position: relative;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  isolation: isolate;
}
body.linked-research .thesis-page > img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: 1132 / 1601;
  object-fit: contain;
  margin: 0;
  border: 0;
}
.paper-highlights {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.paper-highlights rect {
  fill: #f2ca46;
  fill-opacity: .36;
  stroke: none;
}
.paper-highlights[hidden],.paper-highlights [hidden] { display: none !important; }
.paper-passage { position: absolute; left: 0; width: 1px; height: 1px; pointer-events: none; }
body.linked-research > .thesis-divider {
  position: relative;
  width: 8px;
  min-width: 8px;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #151b23;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  z-index: 30;
  outline-offset: -2px;
}
body.linked-research > .thesis-divider::after {
  content: "";
  position: absolute;
  left: 3px;
  top: calc(50% - 23px);
  width: 2px;
  height: 46px;
  background: #667a8e;
  opacity: .65;
}
body.linked-research > .thesis-divider:focus-visible {
  outline: 2px solid var(--phd-accent,#a9c9ea);
}
body.linked-research.is-resizing,
body.linked-research.is-resizing * { cursor: col-resize !important; user-select: none !important; }
body.linked-research.is-resizing > .thesis-divider::after { background: var(--phd-accent,#a9c9ea); opacity: 1; }
body.linked-research > .portal-pane {
  container-name: research-pane;
  container-type: inline-size;
  position: relative;
  background: var(--page,#0d1117);
  scroll-behavior: auto;
}
body.linked-research .portal-pane .sidebar.research-navigation {
  position: sticky !important;
  top: 0;
  z-index: 20;
  display: grid !important;
  grid-template-columns: 32px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 0;
  width: 100%;
}
body.linked-research .portal-pane .research-navigation nav {
  display: grid !important;
  grid-template-columns: repeat(5,minmax(0,1fr));
  width: 100%;
  min-width: 0;
  gap: 5px;
}
body.linked-research .portal-pane .research-navigation .workspace-link {
  min-height: 54px;
  padding: 7px 8px;
  gap: 0;
  font-size: 11px;
}
body.linked-research .portal-pane .research-navigation .workspace-link small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.45;
}
body.linked-research .reading-link,
body.linked-research .reading-link.active {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 0;
  height: 36px;
  min-height: 0;
  padding: 3px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--phd-accent,#a9c9ea);
  box-shadow: none;
  opacity: .78;
}
body.linked-research .reading-link:hover { opacity: 1; background: transparent; }
body.linked-research .reading-link:focus-visible { outline: 2px solid var(--phd-accent,#a9c9ea); outline-offset: 1px; }
body.linked-research .reading-link svg { display: block; width: 25px; height: 25px; transform-origin: 50% 50%; }
body.linked-research .reading-link :is(.link-page,.link-lines,.link-flow) { fill:none;stroke:currentColor;stroke-width:1.2; }
body.linked-research .reading-link .link-lines { opacity:.65; }
body.linked-research .reading-link .link-node { fill:currentColor; }
body.linked-research .reading-link.is-syncing svg { animation: reading-link-sync 520ms ease-out both; }
@keyframes reading-link-sync {
  0% { opacity: .45; transform: translateX(-1px); }
  45% { opacity: 1; transform: translateX(1px); }
  100% { opacity: .78; transform: translateX(0); }
}
body.linked-research .portal-pane .main-shell { margin: 0; width: 100%; min-width: 0; }
body.linked-research .portal-pane .topbar.portal-topbar {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px 10px;
  min-height: 38px;
  padding: 3px 10px;
}
body.linked-research .portal-pane .breadcrumb { display: none !important; }
body.linked-research .portal-pane .portal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px 8px;
  width: 100%;
  min-width: 0;
}
body.linked-research .linked-reader-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-right: auto; min-width: 0; }
body.linked-research .linked-reader-tools .pdf-mode { display: flex; flex-wrap: wrap; gap: 4px; }
body.linked-research .linked-reader-tools :is(a,button) { min-height: 30px; padding: 4px 7px; font-size: 10px; white-space: normal; }
body.linked-research .portal-pane .portal-actions .phd-theme-picker { flex-wrap: wrap; gap: 2px; }
body.linked-research .portal-pane .portal-actions .phd-theme-picker button { min-width: 38px; min-height: 30px !important; padding: 4px 5px; font-size: 10px; }
body.linked-research .portal-pane main { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 12px 12px 0; }
body.linked-research .portal-pane :is(.workspace,.study-view,.panel,.controls,.page-heading,.panel-heading,.rfq-desk-panel,.chart-tools,.source-card,.data-source-card,.metric,.delay-grid,.delay-pitch,.notebook-experiment) { min-width: 0; }
body.linked-research .portal-pane :is(.workspace-grid,.lower-grid,.estimation-grid,.paper-grid,.data-source-grid,.rfq-desk-grid,.delay-grid,.delay-evaluation-grid,.research-reading-grid,.delay-provenance-grid) > * { min-width: 0; }
body.linked-research .portal-pane :is(.controls,.live-controls,.rfq-controls,.run-form,.panel-actions,.research-download-actions,.kernel-toolbar,.feed-status,.live-experiment-controls,.reference-tabs,.gauge-settings,.chart-tools-top,.jump-group) { flex-wrap: wrap; }
body.linked-research .portal-pane :is(.table-wrap,pre,.json-record,.source-details) { min-width: 0; max-width: 100%; overflow-x: auto; }
body.linked-research .portal-pane :is(select,input,textarea) { max-width: 100%; }
body.linked-research .portal-pane :is(.research-caption,.source-footnote,.fine-print,.hash,.rfq-note,.console-status) { overflow-wrap: anywhere; }
body.linked-research .portal-pane .study-tabs { flex-wrap: wrap; overflow: visible; }
body.linked-research .portal-pane .study-tabs button { white-space: normal; }
body.linked-research .portal-pane .chart-export-buttons { flex-wrap: wrap; max-width: 100%; }
body.linked-research .portal-pane .chart-scale-label { max-width: 100%; white-space: normal; flex-wrap: wrap; }
body.linked-research .portal-pane .chart-scale-label select { min-width: 0; }
body.linked-research .portal-pane .chart-range-summary { overflow-wrap: anywhere; }
body.linked-research .portal-pane .interactive-chart-host { min-width: 0; max-width: 100%; }
body.linked-research .portal-pane .rfq-chart { height: clamp(190px,30cqi,310px); }
body.linked-research .portal-pane .rfq-chart .interactive-chart-svg { height: 100%; }
body.visitor-portal .portal-name { display: none !important; }
body.visitor-portal .sidebar.research-navigation { grid-template-columns: minmax(0,1fr); }

/* The pane width, rather than browser width, determines the working layout. */
@container research-pane (max-width: 1000px) {
  body.linked-research .portal-pane :is(.workspace-grid,.lower-grid,.estimation-grid,.paper-grid,.data-source-grid,.rfq-desk-grid,.delay-grid,.delay-evaluation-grid,.research-reading-grid,.delay-provenance-grid) { grid-template-columns: minmax(0,1fr); gap: 10px; }
  body.linked-research .portal-pane .delay-flow { grid-template-columns: repeat(3,minmax(0,1fr)); }
  body.linked-research .portal-pane .pipeline { flex-wrap: wrap; }
  body.linked-research .portal-pane .pipeline > i { display: none; }
}
@container research-pane (max-width: 760px) {
  body.linked-research .portal-pane .research-navigation nav { grid-template-columns: repeat(3,minmax(0,1fr)); }
  body.linked-research .portal-pane .controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  body.linked-research .portal-pane .control-field :is(input,select) { min-width: 0; width: 100%; }
  body.linked-research .portal-pane .play-controls { grid-column: 1 / -1; display: flex; flex-wrap: wrap; }
  body.linked-research .portal-pane .horizon-field { grid-column: 1 / -1; max-width: none; min-width: 0; width: 100%; margin-left: 0; }
  body.linked-research .portal-pane .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.linked-research .portal-pane .delay-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.linked-research .portal-pane .delay-metrics > div { padding: 10px; }
  body.linked-research .portal-pane .bridge-pipeline { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.linked-research .portal-pane .bridge-pipeline > i { display: none; }
  body.linked-research .portal-pane .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  body.linked-research .portal-pane .notebook-experiment { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@container research-pane (max-width: 600px) {
  body.linked-research .portal-pane .sidebar.research-navigation { grid-template-columns: 26px minmax(0,1fr); gap: 6px; padding: 7px 8px; }
  body.linked-research .portal-pane .research-navigation nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.linked-research .portal-pane .research-navigation .workspace-link { min-height: 48px; padding: 6px; font-size: 10px; }
  body.linked-research .portal-pane .research-navigation .workspace-link small { font-size: 9px; }
  body.linked-research .portal-pane .reading-link { width: 26px; padding: 1px; }
  body.linked-research .portal-pane main { padding: 10px 8px 0; }
  body.linked-research .portal-pane .topbar.portal-topbar { padding: 4px 8px; }
  body.linked-research .portal-pane .chart-tools { padding: 7px 8px; }
  body.linked-research .portal-pane .chart-tools select { max-width: 100%; }
  body.linked-research .portal-pane .chart-export-buttons { margin-left: 0; }
  body.linked-research .portal-pane .chart-axis-fields label { min-width: min(100%,110px); }
  body.linked-research .portal-pane .delay-flow { grid-template-columns: minmax(0,1fr); }
  body.linked-research .portal-pane .delay-flow > li { border-right: 0 !important; border-bottom: 1px solid var(--border,#354253) !important; }
  body.linked-research .portal-pane .delay-flow > li:last-child { border-bottom: 0 !important; }
  body.linked-research .portal-pane .live-experiment-controls .session-picker { min-width: 0; width: 100%; flex-basis: 100%; }
  body.linked-research .portal-pane .live-experiment-controls label { min-width: 0; flex-wrap: wrap; }
  body.linked-research .portal-pane .delay-scenario-controls label { min-width: 0; flex-basis: 100%; }
  body.linked-research .portal-pane .timeline-top { flex-wrap: wrap; gap: 8px; }
  body.linked-research .portal-pane .panel-heading { flex-wrap: wrap; }
  body.linked-research .portal-pane .rfq-desk-panel { padding: 10px; }
  body.linked-research .portal-pane .rfq-quote-number input { width: 85px; font-size: 22px; }
}
@container research-pane (max-width: 400px) {
  body.linked-research .portal-pane .controls { grid-template-columns: minmax(0,1fr); }
  body.linked-research .portal-pane .control-field { width: 100%; }
  body.linked-research .portal-pane .horizon-field,
  body.linked-research .portal-pane .play-controls { grid-column: auto; }
  body.linked-research .portal-pane .bridge-pipeline { grid-template-columns: minmax(0,1fr); }
  body.linked-research .portal-pane .linked-reader-tools { width: 100%; }
  body.linked-research .portal-pane .portal-actions { justify-content: flex-start; }
  body.linked-research .portal-pane .rfq-signal-grid,
  body.linked-research .portal-pane .rfq-quote-stats { grid-template-columns: minmax(0,1fr); gap: 8px; }
  body.linked-research .portal-pane .rfq-value { flex-wrap: wrap; }
  body.linked-research .portal-pane .chart-tools :is(button,select,input) { font-size: 10px; padding: 4px 5px; }
  body.linked-research .portal-pane .chart-tools .chart-scale-label { flex-basis: 100%; }
}
@container research-pane (max-width: 320px) {
  body.linked-research .portal-pane .research-navigation nav { grid-template-columns: minmax(0,1fr); }
  body.linked-research .portal-pane .research-navigation .workspace-link { min-height: 42px; }
  body.linked-research .portal-pane .research-navigation .workspace-link small { display: none; }
  body.linked-research .portal-pane .metrics,
  body.linked-research .portal-pane .delay-metrics { grid-template-columns: minmax(0,1fr); }
  body.linked-research .portal-pane .composition-row { grid-template-columns: minmax(0,1fr) minmax(45px,1fr) 35px; }
}
@media (prefers-reduced-motion: reduce) {
  body.linked-research .reading-link.is-syncing svg { animation: none; }
  body.linked-research .paper-highlights,
  body.linked-research .paper-highlights rect { transition: none; animation: none; }
}

/* One reading appearance for the paper and research pane. Data and geometry stay unchanged. */
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(p,li,dt,dd,label,figcaption,.reference,.paper-meta,.paper-reading) { color:var(--phd-muted); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .rfq-plot-options { margin:8px 0 0; }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .rfq-plot-options>summary { color:var(--phd-accent);font-size:10px;cursor:pointer;padding:5px 0; }
html:root[data-reading-appearance="dark"] {
  color-scheme: dark;
  --phd-bg: #15191e;
  --phd-bar: #191e24;
  --phd-surface: #1c2229;
  --phd-panel: #1c2229;
  --phd-raised: #252f3b;
  --phd-selected: #273547;
  --phd-text: #edf1f6;
  --phd-muted: #b8c2ce;
  --phd-border: #3a4653;
  --phd-accent: #b2cce9;
  --phd-on-accent: #172637;
  --phd-focus: #d1e2f5;
  --reading-hover: #27313d;
  --reading-input: #151c24;
  --reading-plot: #19212b;
  --reading-grid: #374658;
  --reading-zero: #6b8099;
  --reading-axis: #c2cfdf;
  --reading-positive: #9ed4b8;
  --reading-warning: #e3c18b;
  --reading-code: #161d25;
  --reading-paper-edge: #11151a;
}
html:root[data-reading-appearance="light"] {
  color-scheme: light;
  --phd-bg: #f3f5f7;
  --phd-bar: #f8f9fb;
  --phd-surface: #ffffff;
  --phd-panel: #ffffff;
  --phd-raised: #e8edf3;
  --phd-selected: #e4ecf6;
  --phd-text: #1d2938;
  --phd-muted: #4e6075;
  --phd-border: #c8d2de;
  --phd-accent: #315f94;
  --phd-on-accent: #ffffff;
  --phd-focus: #214f87;
  --reading-hover: #edf1f6;
  --reading-input: #ffffff;
  --reading-plot: #ffffff;
  --reading-grid: #d8e0e9;
  --reading-zero: #8091a7;
  --reading-axis: #465b73;
  --reading-positive: #27684b;
  --reading-warning: #81561e;
  --reading-code: #edf1f5;
  --reading-paper-edge: #dfe5ec;
}
html:root[data-reading-appearance] {
  background: var(--phd-bg);
  color: var(--phd-text);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) {
  --page: var(--phd-bg);
  --white: var(--phd-surface);
  --ink: var(--phd-text);
  --navy: var(--phd-text);
  --muted: var(--phd-muted);
  --border: var(--phd-border);
  --blue: var(--phd-accent);
  --green: var(--reading-positive);
  --terminal-cyan: var(--phd-accent);
  --terminal-up: var(--reading-positive);
  --terminal-amber: var(--reading-warning);
  background: var(--phd-bg);
  color: var(--phd-text);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .portal-pane,.research-navigation,.topbar,.terminal-bar,.panel,.paper-card,
  .data-source-card,.controls,.metrics,.evidence,.chart-tools,.chart-tooltip,
  .timeline,.plain-note,.json-record,.source-dialog,.access-hint,.supervisor-entry,
  .rfq-desk-panel,.rfq-outcome,.rfq-model-equation,.bridge-pipeline>div,
  .console-status,.notice,.diagnostic-note,.gauge,.feed-status,
  button,select,input,textarea,summary,a,th,td,h1,h2,h3,p,small,span,strong,pre,
  .paper-highlights rect
) {
  transition-property: background-color,border-color,color,box-shadow;
  transition-duration: 240ms;
  transition-timing-function: cubic-bezier(.2,.7,.25,1);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  h1,h2,h3,h4,legend,.clock,.quote-readings,.timeline,.metric-value
) { color: var(--phd-text); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .subtitle,.research-caption,.fine-print,.source-footnote,.chart-footer,
  .rfq-note,.rfq-recommendation p,.hash,.chart-range-summary,.chart-tools,
  .chart-tools-hint,.chart-gesture-hint,.meeting-label,.gauge-settings,
  .rfq-signal-grid span,.rfq-quote-stats span,.rfq-quote-number span
) { color: var(--phd-muted); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .portal-pane,.main-shell
) { background: var(--phd-bg); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .panel,.paper-card,.data-source-card,.controls,.metrics,.evidence,
  .rfq-desk-panel,.gauge,.historical-panel,.feed-status
) {
  background: var(--phd-surface);
  border-color: var(--phd-border);
  border-radius: 4px;
  color: var(--phd-text);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .research-navigation,.topbar,.terminal-bar,.timeline,.chart-tools
) {
  background: var(--phd-bar);
  border-color: var(--phd-border);
  color: var(--phd-muted);
}
html:root[data-reading-appearance] body.linked-research .portal-pane .sidebar.research-navigation {
  grid-template-columns: minmax(0,1fr);
  padding: 9px 12px;
  gap: 0;
}
html:root[data-reading-appearance] body.linked-research .portal-pane .research-navigation nav {
  grid-template-columns: repeat(6,minmax(0,1fr));
  gap: 6px;
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .research-navigation .workspace-link {
  width: 100%;
  height: 100%;
  min-height: 52px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--phd-muted);
  box-shadow: none;
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .research-navigation .workspace-link small {
  color: var(--phd-muted);
  opacity: 1;
  font-size: 10px;
  line-height: 1.45;
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .research-navigation .workspace-link:hover {
  color: var(--phd-text);
  border-color: transparent;
  background: var(--reading-hover);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .research-navigation .workspace-link.active {
  color: var(--phd-text);
  background: var(--phd-selected);
  border-color: var(--phd-border);
  box-shadow: inset 0 -2px 0 var(--phd-accent);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .research-navigation .workspace-link.active small { color: var(--phd-muted); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .phd-theme-picker,
html:root[data-reading-appearance] body.linked-research .reading-link { display: none !important; }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .secondary,.code-button,.jump-group button,.segmented button,.pipeline button,
  .chart-tools button,.chart-tools select,.chart-tools input,.chart-axis-details summary,
  .control-field select,.live-controls select,.kernel-toolbar select,.run-form select,
  .window-control select,.plot-display-options select,.gauge-settings select,
  .rfq-control select,.rfq-quote-number input,.pdf-mode button,.linked-reader-tools a,
  .linked-reader-tools button,.thesis-actions a,.thesis-actions button,.account-link
) {
  background: var(--reading-input);
  border-color: var(--phd-border);
  color: var(--phd-text);
  border-radius: 3px;
  box-shadow: none;
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .secondary,.code-button,.jump-group button,.segmented button,.chart-tools button,
  .chart-axis-details summary,.linked-reader-tools a,.linked-reader-tools button,
  .thesis-actions a,.thesis-actions button,.account-link
):hover { background: var(--reading-hover);border-color: var(--reading-zero);color: var(--phd-text); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .primary,.button.primary
) { background: var(--phd-accent);border-color: var(--phd-accent);color: var(--phd-on-accent);box-shadow: none;border-radius: 3px; }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .pdf-mode button,.linked-reader-tools button,.thesis-actions button,
  .rfq-subnav button,.rfq-episodes button,.segmented button
)[aria-pressed="true"],
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(.rfq-episodes button.selected,.segmented button.active) {
  background: var(--phd-selected);
  color: var(--phd-text);
  border-color: var(--reading-zero);
  box-shadow: none;
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(button,select,input,a,summary):focus-visible {
  outline: 2px solid var(--phd-focus);
  outline-offset: 2px;
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(
  .json-record,.source-dialog pre,.rfq-model-equation,.rfq-outcome,.plain-note,.console-status
) { background: var(--reading-code);border-color: var(--phd-border);color: var(--phd-text); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(.notice,.diagnostic-note,.tag.amber) {
  background: var(--phd-surface);color: var(--reading-warning);border-color: var(--phd-border);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) th {
  background: var(--phd-raised);color: var(--phd-text);border-color: var(--phd-border);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) td { border-color: var(--phd-border);color: var(--phd-text); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) tbody tr:first-child { background: var(--phd-surface); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .rfq-value strong { color: var(--phd-accent); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .rfq-recommendation strong { color: var(--reading-positive); }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .rfq-posterior > div { background: var(--phd-raised);color: var(--phd-text); }
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .rfq-posterior > div:first-child { background: #f0e5d7; }
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .rfq-posterior > div:last-child { background: #dcece3; }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .chart-tooltip { background: var(--phd-surface);color: var(--phd-text);border-color: var(--reading-zero);box-shadow: 0 4px 15px #00000018; }
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .chart-export-buttons button,
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .chart-view-preset { background: var(--phd-selected);color: var(--phd-text);border-color: var(--phd-border); }

/* Target only the chart canvas; transparent gesture and clip rectangles must stay transparent. */
html:root[data-reading-appearance] .interactive-chart-svg > rect:first-of-type { fill: var(--reading-plot);transition: fill 240ms ease; }
html:root[data-reading-appearance] .interactive-chart-svg > text { fill: var(--reading-axis);transition: fill 240ms ease; }
html:root[data-reading-appearance] .interactive-chart-svg > line[stroke="#283448" i] { stroke: var(--reading-grid);transition: stroke 240ms ease; }
html:root[data-reading-appearance] .interactive-chart-svg > line[stroke="#53647d" i] { stroke: var(--reading-zero); }
html:root[data-reading-appearance] .interactive-chart-svg .chart-crosshair > line { stroke: var(--reading-zero); }
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#7aa2f7" i] { stroke: #315f9e; }
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#a9c4e9" i] { stroke: #657c93; }
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#a9c9ea" i],
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#94b6d3" i] { stroke: #315f94; }
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#d9a472" i],
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#d7b58a" i] { stroke: #94612c; }
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#83bd9d" i] { stroke: #2c7758; }
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#c59ee7" i] { stroke: #8554a0; }
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#74889c" i] { stroke: #6a7a8c; }
html:root[data-reading-appearance="light"] .interactive-chart-svg [stroke="#cedfed" i] { stroke: #334d68; }
html:root[data-reading-appearance="light"] .interactive-chart-svg [fill="#dbeafe" i] { fill: #315f94; }

html:root[data-reading-appearance] body.linked-research > .thesis-pane { background: var(--reading-paper-edge); }
html:root[data-reading-appearance] .pdf-pages img { transition: filter 260ms cubic-bezier(.2,.7,.25,1); }
html:root[data-reading-appearance="light"] .pdf-pages img { filter: none; }
html:root[data-reading-appearance="dark"] .pdf-pages img { filter: invert(.92) hue-rotate(180deg); }
html:root[data-reading-appearance] body.linked-research > .thesis-divider { background: var(--phd-bg);border-left: 1px solid var(--phd-border);border-right: 1px solid var(--phd-border); }
html:root[data-reading-appearance] body.linked-research > .thesis-divider::after { background: var(--phd-muted);width: 2px;left: 2px;height: 34px;top: calc(50% - 17px);opacity: .7; }
html:root[data-reading-appearance] .paper-highlights rect { fill: #e3c356;fill-opacity: .34; }

@container research-pane (max-width: 1000px) {
  html:root[data-reading-appearance] body.linked-research .portal-pane .research-navigation nav { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@container research-pane (max-width: 600px) {
  html:root[data-reading-appearance] body.linked-research .portal-pane .research-navigation nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  html:root[data-reading-appearance] body.linked-research .portal-pane .sidebar.research-navigation { padding: 7px 8px; }
  html:root[data-reading-appearance] body.linked-research .portal-pane .research-navigation .workspace-link { min-height: 46px;padding: 6px 8px; }
}
@container research-pane (max-width: 340px) {
  html:root[data-reading-appearance] body.linked-research .portal-pane .research-navigation nav { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html:root[data-reading-appearance] *,html:root[data-reading-appearance] *::before,html:root[data-reading-appearance] *::after { transition-duration: .01ms !important;animation-duration: .01ms !important; }
}

/* Original PDF drawing instructions, rendered at the current physical resolution. */
.pdf-pages .thesis-page { position:relative; margin:0; width:100%; aspect-ratio:595.28 / 841.89; background:white; isolation:isolate; }
.pdf-pages .pdf-surface { position:absolute; inset:0; }
.pdf-pages .pdf-canvas { display:block; width:100%; height:100%; background:white; }
html:root[data-reading-appearance="dark"] .pdf-pages .thesis-page { background:#141414; }
html:root[data-reading-appearance="dark"] .pdf-canvas { filter:invert(.92) hue-rotate(180deg); }
html:root[data-reading-appearance="light"] .pdf-canvas { filter:none; }
.pdf-pages .pdf-text { position:absolute; inset:0; overflow:clip; line-height:1; letter-spacing:normal; word-spacing:normal; text-size-adjust:none; forced-color-adjust:none; transform-origin:0 0; --min-font-size:1; --text-scale-factor:calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv:calc(1 / var(--min-font-size)); }
.pdf-pages .pdf-text :is(span,br) { color:transparent !important; position:absolute; white-space:pre; cursor:text; transform-origin:0 0; user-select:text; }
.pdf-pages .pdf-text > :not(.markedContent),.pdf-pages .pdf-text .markedContent span:not(.markedContent) { --font-height:0; font-size:calc(var(--text-scale-factor) * var(--font-height)); --scale-x:1; --rotate:0deg; transform:rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv)); }
.pdf-pages .pdf-text .markedContent { display:contents; }
.pdf-pages .pdf-text ::selection { background:rgb(230 185 40 / .35); }
.pdf-pages .paper-highlights { z-index:2; }
.pdf-pages .pdf-failure { position:absolute; inset:0; display:grid; place-content:center; padding:20px; color:#27313d; background:white; }

/* Emphasis follows the exact PDF lines; it never blurs or recolours the text. */
html:root[data-reading-appearance] .paper-highlights rect { fill:#e5bd49;fill-opacity:.16;stroke:none; }
html:root[data-reading-appearance="light"] .paper-highlights rect { fill:#d8ad29;fill-opacity:.21; }
.reading-context { flex:1;min-width:0;max-width:34ch;margin-inline:8px auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;font-size:10px; }
.reading-context:disabled { pointer-events:none; }

.mobile-reader-bar,.mobile-context { display:none; }
.reading-contents { width:min(620px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:0;border:1px solid var(--phd-border);background:var(--phd-panel,#1c2229);color:var(--phd-text); }
.reading-contents::backdrop { background:rgb(0 0 0 / .45); }
.contents-header { display:flex;align-items:center;justify-content:space-between;padding:12px 18px;border-bottom:1px solid var(--phd-border); }
.contents-header h2 { margin:0;font:600 18px/1.3 ui-monospace,monospace;color:var(--phd-text); }
.contents-download { margin-left:auto;margin-right:16px;padding:12px 0;color:var(--phd-accent);font:500 12px/1.4 ui-monospace,monospace; }
.reading-contents button { font:inherit;color:var(--phd-text);background:transparent;border:0;cursor:pointer; }
.contents-header button { min-height:44px;min-width:60px; }
.contents-body { padding:0 18px 24px;overflow:auto;max-height:calc(100dvh - 120px); }
.contents-group { margin:24px 0 8px;font:500 12px/1.5 ui-monospace,monospace;color:var(--phd-muted); }
.contents-section,.contents-study { display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:12px 0;text-align:left;border-bottom:1px solid var(--phd-border) !important;line-height:1.5; }
.contents-page { margin-left:auto;flex-shrink:0;color:var(--phd-muted);font-size:11px; }
.contents-label { min-width:0;white-space:normal;overflow-wrap:break-word; }
.contents-study { flex-direction:column;align-items:flex-start;gap:3px; }
.contents-study small { color:var(--phd-muted);font-size:12px; }
.contents-study[aria-current=true] { color:var(--phd-accent); }
.reading-contents button:focus-visible,.mobile-reader-bar button:focus-visible,.mobile-context button:focus-visible { outline:2px solid var(--phd-accent);outline-offset:-2px; }
body.linked-research.is-mobile { display:block;--mobile-chrome:calc(54px + env(safe-area-inset-top,0px));padding-top:var(--mobile-chrome); }
body.is-mobile .mobile-reader-bar { position:fixed;inset:0 0 auto;z-index:60;display:grid;grid-template-columns:auto auto 1fr 44px;align-items:center;gap:4px;min-height:var(--mobile-chrome,54px);padding:env(safe-area-inset-top,0px) 8px 0;background:var(--phd-panel,#1c2229);border-bottom:1px solid var(--phd-border); }
body.is-mobile .mobile-reader-bar button { border:0;border-radius:0;min-height:52px;padding:4px 10px;color:var(--phd-muted);background:transparent;font:500 13px/1.4 ui-monospace,monospace;cursor:pointer; }
body.is-mobile .mobile-reader-bar button:nth-child(3) { justify-self:end; }
body.is-mobile .mobile-reader-bar button:last-child { font-size:21px;padding:4px; }
body.is-mobile .mobile-reader-bar button[aria-pressed=true] { color:var(--phd-text);box-shadow:inset 0 -2px var(--phd-accent); }
body.linked-research.is-mobile > :is(.thesis-pane,.portal-pane) { width:100%;height:calc(100dvh - var(--mobile-chrome));max-height:calc(100dvh - var(--mobile-chrome));padding-bottom:calc(58px + env(safe-area-inset-bottom,0px)); }
body.linked-research.is-mobile > .thesis-divider { display:none !important; }
body.linked-research.is-mobile > .thesis-pane { overflow-x:auto; }
body.linked-research.is-mobile .thesis-pane .pdf-pages { width:calc(100% * var(--mobile-pdf-zoom,1)); }
body.linked-research.is-mobile[data-mobile-surface=thesis] > .portal-pane,body.linked-research.is-mobile[data-mobile-surface=research] > .thesis-pane { display:none !important; }
body.linked-research.is-mobile .portal-pane .research-navigation { display:none !important; }
body.linked-research.is-mobile .reading-context { display:none; }
body.linked-research.is-mobile .portal-pane main { padding:16px 14px 0; }
body.linked-research.is-mobile .portal-pane .page-heading h1 { font-size:24px;line-height:1.3; }
body.linked-research.is-mobile .portal-pane :is(.button,.code-button,.study-tabs button,select,input,summary) { min-height:44px; }
body.linked-research.is-mobile .portal-pane .study-tabs { gap:4px; }
body.linked-research.is-mobile .portal-pane .study-tabs button { padding:8px 10px;font-size:12px; }
body.linked-research.is-mobile .portal-pane .topbar.portal-topbar { position:static;min-height:48px; }
body.linked-research.is-mobile .portal-pane .topbar.portal-topbar:not(:has(form)) { display:none !important; }
body.linked-research.is-mobile .portal-pane .linked-reader-tools { display:none !important; }
body.linked-research.is-mobile .portal-pane .linked-reader-tools { gap:5px; }
body.linked-research.is-mobile .portal-pane .linked-reader-tools :is(a,button) { font-size:11px;min-height:36px; }
body.linked-research.is-mobile .mobile-context { position:fixed;inset:auto 0 0;display:flex;align-items:center;z-index:55;min-height:58px;padding:4px 14px calc(4px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--phd-border);background:var(--phd-panel,#1c2229); }
body.linked-research.is-mobile .mobile-context button { width:100%;min-height:48px;text-align:left;border:0;background:transparent;color:var(--phd-accent);font:500 13px/1.4 ui-monospace,monospace;cursor:pointer; }
body.linked-research.is-mobile .mobile-context .mobile-pdf-zoom { width:44px;flex-shrink:0;text-align:center;font-size:22px; }
body.linked-research.is-mobile .mobile-context .mobile-pdf-zoom:disabled { opacity:.3;cursor:default; }
body.linked-research.is-mobile[data-mobile-surface=research] .mobile-pdf-zoom { display:none; }
body.is-mobile .reading-contents { width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;inset:0;margin:0;border:0; }
body.is-mobile .contents-header { min-height:70px;padding-top:calc(12px + env(safe-area-inset-top,0px)); }
body.is-mobile .contents-body { max-height:calc(100dvh - 70px - env(safe-area-inset-top,0px));padding-bottom:calc(28px + env(safe-area-inset-bottom,0px));font-size:14px; }
body.visitor-portal.is-mobile { padding-top:54px; }
body.visitor-portal.is-mobile .sidebar.research-navigation { display:none !important; }
body.visitor-portal.is-mobile main { padding:10px 0 !important; }
body.visitor-portal.is-mobile .thesis-toolbar { padding:0 12px 8px; }
body.visitor-portal.is-mobile .thesis-toolbar { display:none; }
body.visitor-portal.is-mobile .thesis-toolbar > div:first-child { display:none; }
body.visitor-portal.is-mobile .pdf-pages { width:100%;gap:3px; }
/* Document contents and experiment selection are separate destinations. */
body.is-mobile .mobile-reader-bar { grid-template-columns:auto auto minmax(58px,1fr) 36px;gap:2px;padding-inline:6px; }
body.is-mobile .mobile-reader-bar:has(.mobile-session-button:not([hidden])) { grid-template-columns:auto auto minmax(58px,1fr) 36px 36px; }
body.is-mobile .mobile-reader-bar button { padding-inline:8px;font-size:12px;white-space:nowrap; }
body.is-mobile .mobile-reader-bar button:nth-child(4),body.is-mobile .mobile-reader-bar .mobile-session-button { width:36px;min-width:36px;padding:2px;font-size:21px; }
body.is-mobile .mobile-reader-bar .mobile-session-button { font-size:25px; }
body.is-mobile .mobile-reader-bar [hidden],body.is-mobile .mobile-context [hidden] { display:none !important; }
.mobile-session-menu { position:fixed;inset:calc(58px + env(safe-area-inset-top,0px)) 8px auto auto;margin:0;width:230px;max-width:calc(100vw - 16px);padding:0;border:1px solid var(--phd-border);border-radius:6px;background:var(--phd-panel);color:var(--phd-text);box-shadow:0 12px 32px rgb(0 0 0 / .16); }
.mobile-session-menu::backdrop { background:rgb(0 0 0 / .2); }
.mobile-session-menu .contents-header { min-height:48px;padding:2px 12px; }
.mobile-session-menu .contents-header h2 { font-size:13px; }
.mobile-session-menu .contents-header button { border:0;background:transparent;color:var(--phd-muted);font:inherit; }
.mobile-session-menu form { margin:0;padding:8px; }
.mobile-session-menu form button { width:100%;min-height:44px;padding:8px 12px;text-align:left;font:500 13px/1.4 ui-monospace,monospace;border:0;background:transparent;color:var(--phd-text); }
.mobile-session-menu form button:hover { background:var(--reading-hover); }
body.linked-research.is-mobile .portal-pane .study-tabs { display:flex;flex-wrap:nowrap !important;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:thin; }
body.linked-research.is-mobile .portal-pane .study-tabs button { flex:0 0 auto;white-space:nowrap; }
body.visitor-portal.is-mobile { height:100dvh;max-height:100dvh;overflow:hidden;padding-top:calc(54px + env(safe-area-inset-top,0px)); }
body.visitor-portal.is-mobile main { height:calc(100dvh - 54px - env(safe-area-inset-top,0px));min-height:0;overflow:hidden;padding:0 !important; }
body.visitor-portal.is-mobile .thesis-reader { height:100%;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin; }
body.visitor-portal.is-mobile .thesis-reader .pdf-pages { width:calc(100% * var(--mobile-pdf-zoom,1));max-width:none; }
.contents-zoom { display:flex;align-items:center;gap:8px;margin-top:20px;padding:12px 0; }
.contents-zoom span { margin-right:auto;color:var(--phd-muted);font-size:12px; }
.contents-zoom button { min-width:44px;min-height:44px;font-size:22px;border:1px solid var(--phd-border); }

/* One-finger panning stays native; only the PDF owns a two-finger zoom. */
@media (max-width:900px), (max-width:1024px) and (max-height:600px) {
  .pdf-gesture-surface { touch-action:pan-x pan-y;overscroll-behavior:contain; }
}

/* Desktop navigation modes. Load after the linked workspace and reading palette.
   State contract:
   - data-desktop-surface="thesis": reading-first split and compact study list.
   - any other desktop surface: a single, horizontally scrollable tab strip.
   - .reading-suggestion: contextual suggestion only; .active remains selection.
   A divider-set inline --thesis-share continues to override the reading default.
   Native PDF rendering, colours and filters are intentionally untouched. */

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation nav {
  display: flex !important;
  flex-flow: row nowrap !important;
  align-items: stretch;
  gap: 5px;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 2px 0 5px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--phd-border) transparent;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-item {
  display: flex;
  flex: 1 0 200px;
  align-items: stretch;
  min-width: 200px;
  max-width: none;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-item:has([data-workspace="papers"]) {
  flex-basis: 94px;
  min-width: 94px;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-link {
  display: flex;
  align-items: center;
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  height: auto;
  margin: 0;
  padding: 7px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-copy,
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-copy small {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

/* Reserve the same geometry for selected, suggested, hovered and focused tabs. */
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-link.reading-suggestion:not(.active) {
  color: var(--phd-text);
  border-color: transparent;
  background: transparent;
  box-shadow: inset 2px 0 0 var(--phd-accent);
  animation: none;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-link.reading-suggestion:not(.active):hover {
  background: var(--reading-hover);
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-link:focus-visible {
  outline: 2px solid var(--phd-focus);
  outline-offset: -3px;
}

/* Study views remain a separate single row at every desktop pane width. */
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .study-tabs {
  display: flex;
  flex-flow: row nowrap !important;
  align-items: stretch;
  justify-content: flex-start;
  min-width: 0;
  max-width: 100%;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--phd-border) transparent;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .study-tabs > button {
  flex: 0 0 auto;
  min-width: max-content;
  min-height: 42px;
  white-space: nowrap;
  overflow-wrap: normal;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .study-tabs > button:focus-visible {
  outline: 2px solid var(--phd-focus);
  outline-offset: -3px;
}

/* Explicit reading mode gives the paper two thirds; opening a study exits it.
   The optional .desktop-reading-context belongs outside .portal-pane main. */
html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] {
  --thesis-share: 66.666667%;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .portal-pane .sidebar.research-navigation {
  position: static !important;
  padding: 12px;
  border-bottom: 0;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .portal-pane .research-navigation nav {
  flex-direction: column !important;
  gap: 4px;
  padding: 0;
  overflow: visible;
  scrollbar-width: none;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .portal-pane .research-navigation .workspace-item {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .portal-pane .research-navigation .workspace-item:has([data-workspace="papers"]) {
  flex-basis: auto;
  min-width: 0;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .portal-pane .research-navigation .workspace-link {
  min-height: 56px;
  padding: 8px 12px;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .portal-pane .research-navigation .workspace-copy {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .portal-pane .research-navigation .workspace-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .portal-pane main {
  display: none;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile):not([data-desktop-surface="thesis"]) .desktop-reading-context {
  display: none;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .desktop-reading-context {
  display: block;
  margin: 16px 20px;
  padding: 0;
  color: var(--phd-muted);
  font: 11px/1.7 var(--mono,"SFMono-Regular",Consolas,Menlo,monospace);
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .desktop-reading-context strong {
  display: block;
  margin-bottom: 6px;
  color: var(--phd-text);
  font-weight: 600;
}

html:root[data-reading-appearance] body.linked-research .desktop-reading-context[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html:root[data-reading-appearance] body.linked-research:not(.is-mobile) :is(.research-navigation nav,.study-tabs) {
    scroll-behavior: auto !important;
  }
  html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .workspace-link.reading-suggestion {
    transition: none !important;
    animation: none !important;
  }
}

/* Reader finishing layer. Load last; native PDF drawing and session forms stay intact. */
html:root[data-reading-appearance="light"] {
  --phd-text: #172638;
  --phd-muted: #394c61;
  --phd-accent: #285b91;
  --phd-bg: #f6f8fa;
  --phd-bar: #ffffff;
  --phd-surface: #ffffff;
  --phd-panel: #ffffff;
  --phd-raised: #edf2f7;
  --phd-selected: #e2ebf6;
  --phd-border: #b9c7d8;
  --reading-hover: #edf2f7;
  --reading-cue-ink: #624300;
  --reading-cue-edge: #a67815;
  --reading-cue-surface: #fff2ce;
  --reading-cue-badge: #ffe4a0;
  --reading-cue-stroke: #a67815;
  --reading-jump-fill: #e4b137;
  --reading-jump-opacity: .25;
  --reader-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23394c61' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html:root[data-reading-appearance="dark"] {
  --phd-muted: #c2ccd9;
  --reading-cue-ink: #f3d38a;
  --reading-cue-edge: #b58b35;
  --reading-cue-surface: #342b1a;
  --reading-cue-badge: #48381b;
  --reading-cue-stroke: #d9ae4c;
  --reading-jump-fill: #e4b137;
  --reading-jump-opacity: .23;
  --reader-select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23c2ccd9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Explicit component colours prevent old terminal literals leaking into Light. */
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(h1,h2,h3,h4,h5,h6,legend,.study-strip strong) {
  color: var(--phd-text);
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .portal-pane main :is(p,li,dt,dd,label,figcaption,.reference,.paper-meta,.paper-reading) {
  color: var(--phd-muted);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .portal-pane main :is(p,li,dd,figcaption,.paper-reading) {
  color: #293b50;
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(.study-strip,.source-bar,.window-control,.plot-display-options label,.session-bounds,.timeline-bottom,#replay-status) {
  color: var(--phd-muted);
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(#model-badge,.model-badge) {
  color: var(--phd-text);
  background: var(--phd-selected);
  border-color: var(--phd-border);
  font-weight: 600;
  opacity: 1;
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .study-tabs {
  color: var(--phd-text);
  border-color: var(--phd-border);
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .study-tabs > button {
  color: var(--phd-muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom-color: transparent;
  opacity: 1;
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .study-tabs > button:hover {
  color: var(--phd-text);
  background: var(--reading-hover);
  border-color: var(--phd-border);
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .study-tabs > button:is(.active,[aria-selected="true"],[aria-pressed="true"]) {
  color: var(--phd-text);
  background: var(--phd-selected);
  border-color: var(--phd-border);
  border-bottom-color: var(--phd-accent);
  box-shadow: inset 0 -1px var(--phd-accent);
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .timeline {
  color: var(--phd-text);
  background: var(--phd-bar);
  border-color: var(--phd-border);
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .timeline :is(.clock,.timeline-top,.timeline-bottom,.session-bounds,#replay-status) {
  color: var(--phd-text);
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .timeline :is(small,.session-bounds span,.timeline-bottom > span) {
  color: var(--phd-muted);
}

/* Keep the native select itself; reserve a separate, consistently inset arrow. */
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) select:not([multiple]) {
  -webkit-appearance: none;
  appearance: none;
  padding-inline: 11px 35px !important;
  color: var(--phd-text);
  background-color: var(--reading-input);
  background-image: var(--reader-select-arrow);
  background-position: right 12px center;
  background-size: 12px 8px;
  background-repeat: no-repeat;
  border-color: var(--phd-border);
  text-overflow: ellipsis;
}

html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) #history-window {
  min-width: 10em;
  max-width: 100%;
}

/* Cue geometry is fixed. The badge occupies the existing subtitle line. */
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-link.reading-suggestion[data-workspace] {
  color: var(--reading-cue-ink);
  background: var(--reading-cue-surface);
  border-color: var(--reading-cue-edge);
  box-shadow: inset 3px 0 0 var(--reading-cue-edge);
  animation: none;
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-link.reading-suggestion[data-workspace]:hover {
  color: var(--reading-cue-ink);
  background: var(--reading-cue-surface);
  border-color: var(--reading-cue-edge);
}

.reading-cue-label {
  display: none;
  position: absolute;
  inset-inline-start: 11px;
  bottom: 5px;
  max-width: calc(100% - 22px);
  min-height: 17px;
  align-items: center;
  padding: 1px 5px;
  border: 1px solid var(--reading-cue-edge);
  border-radius: 3px;
  color: var(--reading-cue-ink);
  background: var(--reading-cue-badge);
  font: 500 9px/1.35 var(--mono,"SFMono-Regular",Consolas,Menlo,monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.reading-suggestion .reading-cue-label { display: inline-flex; }
.reading-cue-label[hidden] { display: none !important; }
.reading-suggestion:has(.reading-cue-label) .workspace-copy small { visibility: hidden; }

html:root[data-reading-appearance] .paper-highlights :is(.reading-cue-mark rect,rect.reading-cue-mark) {
  fill: none !important;
  fill-opacity: 0 !important;
  stroke: var(--reading-cue-stroke) !important;
  stroke-width: 1.5px;
  stroke-opacity: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

html:root[data-reading-appearance] .paper-highlights :is(.reading-jump-mark rect,rect.reading-jump-mark) {
  fill: var(--reading-jump-fill);
  fill-opacity: var(--reading-jump-opacity);
  stroke: none;
  pointer-events: none;
}

/* Label and arrow have separate flex boxes; neither can reach the button edge. */
html:root[data-reading-appearance] body.linked-research .reading-context {
  box-sizing: border-box;
  min-width: 0;
  min-height: 44px;
  width: calc(100% - 40px);
  max-width: calc(100% - 40px);
  margin: 14px 20px;
  padding: 10px 14px !important;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  white-space: normal;
  text-align: left;
  border: 1px solid var(--phd-border);
  color: var(--phd-text);
  background: var(--reading-input);
}

html:root[data-reading-appearance] body.linked-research:not(.is-mobile)[data-desktop-surface="thesis"] .reading-context {
  display: flex;
}

.reading-context-label {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-context-arrow {
  display: block;
  flex: 0 0 auto;
  min-width: 1em;
  text-align: center;
  line-height: 1;
}

/* Media-first shell: the PDF remains readable while the large study data parse.
   Visible height reserves the fixed header/footer exactly once, even in Safari. */
@media (max-width: 900px), (max-width: 1024px) and (max-height: 600px) {
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) {
    --mobile-reader-header: calc(54px + env(safe-area-inset-top,0px));
    --mobile-reader-footer: calc(58px + env(safe-area-inset-bottom,0px));
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  html:root[data-reading-appearance] body.linked-research > :is(.thesis-pane,.portal-pane) {
    position: fixed;
    inset: var(--mobile-reader-header) 0 var(--mobile-reader-footer);
    box-sizing: border-box;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding-bottom: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  html:root[data-reading-appearance] body.linked-research > .thesis-pane { overflow-x: auto; }
  html:root[data-reading-appearance] body.linked-research:not([data-mobile-surface="research"]) > .portal-pane,
  html:root[data-reading-appearance] body.linked-research[data-mobile-surface="research"] > .thesis-pane,
  html:root[data-reading-appearance] body.linked-research > .thesis-divider,
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .sidebar.research-navigation,
  html:root[data-reading-appearance] body.linked-research .portal-pane .topbar.portal-topbar,
  html:root[data-reading-appearance] body.linked-research .reading-context {
    display: none !important;
  }

  html:root[data-reading-appearance] body.linked-research .thesis-pane .pdf-pages,
  html:root[data-reading-appearance] body.visitor-portal .thesis-reader .pdf-pages {
    width: calc(100% * var(--mobile-pdf-zoom,1));
    max-width: none;
  }

  html:root[data-reading-appearance] body.linked-research .portal-pane main {
    display: block;
    margin: 0;
    padding: 16px 14px 0;
  }

  html:root[data-reading-appearance] body.visitor-portal main {
    position: fixed;
    inset: var(--mobile-reader-header) 0 var(--mobile-reader-footer);
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0 !important;
    overflow: hidden;
  }

  html:root[data-reading-appearance] body.visitor-portal .thesis-reader {
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  html:root[data-reading-appearance] body.visitor-portal .thesis-toolbar { display: none; }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-reader-bar {
    display: grid;
    position: fixed;
    inset: 0 0 auto;
    z-index: 60;
    grid-template-columns: auto auto minmax(0,1fr) 44px;
    align-items: center;
    gap: 2px;
    height: var(--mobile-reader-header);
    min-height: var(--mobile-reader-header);
    margin: 0;
    padding: env(safe-area-inset-top,0px) 8px 0;
    border-bottom: 1px solid var(--phd-border);
    color: var(--phd-text);
    background: var(--phd-panel);
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-reader-bar > button {
    min-width: 44px;
    min-height: 44px;
    width: auto;
    height: 44px;
    padding: 4px 6px;
    border: 0;
    border-radius: 0;
    color: var(--phd-muted);
    background: transparent;
    font: 500 12px/1.3 var(--mono,"SFMono-Regular",Consolas,Menlo,monospace);
    white-space: nowrap;
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-reader-bar > button[aria-pressed="true"] {
    color: var(--phd-text);
    box-shadow: inset 0 -2px var(--phd-accent);
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-reader-bar > button:nth-child(4) {
    width: 44px;
    min-width: 44px;
    padding: 4px;
    font-size: 21px;
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context {
    display: flex;
    position: fixed;
    inset: auto 0 0;
    z-index: 55;
    box-sizing: border-box;
    align-items: center;
    gap: 4px;
    height: var(--mobile-reader-footer);
    min-height: var(--mobile-reader-footer);
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom,0px));
    border-top: 1px solid var(--phd-border);
    color: var(--phd-text);
    background: var(--phd-panel);
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context > :is(button,a) {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: auto;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    margin: 0;
    padding: 8px 10px;
    border: 0;
    border-radius: 3px;
    color: var(--phd-text);
    background: transparent;
    font: 500 12px/1.4 var(--mono,"SFMono-Regular",Consolas,Menlo,monospace);
    text-align: left;
    text-decoration: none;
    overflow: hidden;
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context > .mobile-pdf-zoom {
    flex: 0 0 44px;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    padding: 6px;
    font-size: 22px;
    text-align: center;
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context > .mobile-pdf-download {
    flex: 1 1 auto;
    justify-content: flex-start;
    min-width: 60px;
    margin-inline-start: 0;
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context > .mobile-pdf-zoom:disabled {
    color: var(--phd-muted);
    opacity: .45;
    cursor: default;
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context > :is(button,a):focus-visible,
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-reader-bar :is(button,a):focus-visible {
    outline: 2px solid var(--phd-focus);
    outline-offset: -3px;
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(.mobile-context,.mobile-reader-bar) [hidden] {
    display: none !important;
  }

  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) select { min-height: 44px; }
}

@media (max-width: 360px) {
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-reader-bar {
    gap: 0;
    padding-inline: 4px;
  }
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-reader-bar > button {
    padding-inline: 5px;
    font-size: 11px;
  }
}

@media (forced-colors: active) {
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) select:not([multiple]) {
    -webkit-appearance: auto;
    appearance: auto;
    background-image: none;
    padding-inline-end: 11px !important;
  }
  .reading-suggestion .reading-cue-label { border-color: Highlight; }
}

@media (prefers-reduced-motion: reduce) {
  .reading-cue-label,.reading-cue-mark,.reading-jump-mark {
    animation: none !important;
    transition: none !important;
  }
}

/* Light study surfaces use dark ink throughout; chart paths and image assets
   retain their own scientific palettes. Nested paper panels need their own
   backgrounds because their original terminal rules used literal dark fills. */
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .page-heading .eyebrow,.page-heading .eyebrow span,.source-bar > span,
  .quote-readings span,.scale-labels,.scale-labels span,.mark-description,
  .plot-display-options > span,.plot-display-options label,.mark-meaning,
  .research-caption,.source-footnote,.fine-print,.chart-footer,.source-details,
  .research-reading-list,.research-paper-context,.papers-provenance,.papers-status,
  .papers-sync-note,.papers-search label,.papers-pagination label,.papers-source-controls label
) { color: var(--phd-muted); }

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .quote-readings strong,.source-details strong,.research-reading-list strong,
  .research-paper-content strong,.research-notes strong,.papers-accessible-text summary
) { color: var(--phd-text); }

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .mark-number {
  color: var(--phd-accent);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .group-counts {
  color: var(--phd-muted);
}
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .group-counts span:first-child {
  color: var(--phd-accent);
}
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .group-counts span:nth-child(2) {
  color: #8a4b18;
}
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .group-counts span:last-child {
  color: var(--phd-muted);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .bridge-pipeline > div,.research-reading-grid .research-paper-card,
  .research-paper-content,.delay-metrics,.delay-source-record,.chart-axis-fields
) {
  color: var(--phd-text);
  background: var(--phd-surface);
  border-color: var(--phd-border);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .bridge-pipeline span,.bridge-pipeline p,.research-paper-content p,
  .research-paper-content li,.research-reading-list li,.delay-flow p,
  .delay-pitch-note,.delay-availability-note,.delay-chart-note,.delay-result-reading,
  .delay-scenario-description,.delay-record-note,.delay-status,.delay-original-idea,
  .delay-audit p,.delay-audit li,.delay-scenario-controls label,.delay-history-controls,
  .delay-metrics span,.delay-metrics small,.delay-series-key,.delay-series-key span,
  .delay-calibration-table .delay-empty-bin td
) { color: var(--phd-muted); }

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .bridge-pipeline h2,.bridge-pipeline h3,.research-paper-content h3,
  .delay-flow strong,.delay-metrics strong,.delay-source-record strong,
  .delay-original-idea strong
) { color: var(--phd-text); }

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .delay-flow li > span {
  color: var(--phd-accent);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .delay-flow .delay-future,
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .delay-flow .delay-future .research-paper-content {
  color: var(--phd-text);
  background: #fff5df;
  border-color: #c9ad78;
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .delay-flow .delay-future > span,.delay-flow .research-paper-content > span,
  .delay-flow .research-paper-context,.delay-status[data-error="true"],
  .delay-comparison-table td.score-higher
) { color: #805414; }

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .delay-comparison-table td.score-lower {
  color: #276448;
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .delay-original-idea blockquote {
  color: var(--phd-text);
  background: var(--phd-raised);
  border-color: var(--phd-accent);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) main details > summary,
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .delay-comparison-plot > summary {
  color: var(--phd-accent);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .portal-pane main a,
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .papers-reader a {
  color: var(--phd-accent);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .portal-pane main a:is(.primary,.button.primary),
html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .papers-reader a:is(.primary,.button.primary) {
  color: var(--phd-on-accent);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .portal-pane main pre,.source-dialog pre,.papers-source-container pre,
  .papers-accessible-text pre,.delay-audit pre,.json-record
) {
  color: #24364c;
  background: var(--reading-code);
  border-color: var(--phd-border);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .portal-pane main code,.source-dialog code,.papers-reader code
) { color: #25486d; }

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) :is(
  .portal-pane main pre code,.source-dialog pre code,.papers-reader pre code
) { color: inherit; }

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .research-paper-overlay {
  background: rgb(246 248 250 / .78);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .research-paper-overlay > .research-paper-link {
  color: var(--phd-accent);
  background: var(--phd-selected);
  border-color: var(--phd-accent);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .research-paper-overlay > .research-paper-link:hover {
  color: var(--phd-accent);
  background: var(--phd-surface);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .research-paper-preview {
  color: var(--phd-text);
  background: var(--phd-panel);
  border-color: var(--phd-border);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .research-paper-preview :is(h3,.research-paper-authors) {
  color: var(--phd-text);
}

html:root[data-reading-appearance="light"] body:is(.linked-research,.visitor-portal) .research-paper-preview :is(.research-paper-publication,.research-paper-summary) {
  color: var(--phd-muted);
  border-color: var(--phd-border);
}

/* Navigation uses quiet rules, without enclosing frames or filled pills. */
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(.segmented,.reference-tabs) {
  display:flex;flex-wrap:nowrap;gap:14px;padding:0;background:transparent;border:0;border-bottom:1px solid var(--phd-border);border-radius:0;box-shadow:none;overflow-x:auto;scrollbar-width:thin;
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(.segmented,.reference-tabs) > button,
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(.study-tabs,.rfq-subnav) > button {
  flex:0 0 auto;min-height:44px;padding:8px 10px;background:transparent !important;border:0 !important;border-bottom:2px solid transparent !important;border-radius:0 !important;box-shadow:none !important;color:var(--phd-muted);white-space:nowrap;
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) :is(.segmented,.reference-tabs,.study-tabs,.rfq-subnav) > button:is(.active,[aria-selected="true"],[aria-pressed="true"]) {
  color:var(--phd-text);border-bottom-color:var(--phd-accent) !important;background:transparent !important;font-weight:600;
}
html:root[data-reading-appearance] body.linked-research .portal-pane .research-navigation .workspace-link.active {
  background:transparent;border-color:transparent;box-shadow:inset 0 -2px var(--phd-accent);
}
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-link.reading-suggestion[data-workspace] {
  color:var(--reading-cue-ink);background:transparent;border-color:transparent;box-shadow:none;
}
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .research-navigation .workspace-link.reading-suggestion[data-workspace]:hover {
  background:var(--reading-hover);border-color:transparent;
}
html:root[data-reading-appearance] body.linked-research .reading-suggestion .workspace-copy { color:var(--reading-cue-ink); }
html:root[data-reading-appearance] body.linked-research .reading-cue-label {
  padding:0;border:0;background:transparent;color:var(--reading-cue-ink);font-size:10px;font-weight:500;bottom:6px;
}
html:root[data-reading-appearance] .paper-highlights .reading-cue-mark line {
  fill:none;stroke:var(--reading-cue-stroke);stroke-width:1.5px;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none;
}
html:root[data-reading-appearance] body.linked-research .reading-context {
  background:transparent;border:0;box-shadow:none;color:var(--reading-cue-ink);
}
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .reference-tabs > button { flex:1 1 0;min-width:0;white-space:normal;line-height:1.4; }
@media (max-width:900px), (max-width:1024px) and (max-height:600px) {
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .reference-tabs > button { font-size:12px; }
}

/* Compact, centred header controls. */
html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-reader-bar > .mobile-appearance {
  display:inline-flex;align-items:center;justify-content:center;padding:0;line-height:1;
}
.mobile-appearance svg { display:block;width:18px;height:18px;flex:none; }
html:root[data-reading-appearance] body.linked-research .portal-actions form button {
  min-height:44px;padding:8px 6px;border:0;background:transparent;box-shadow:none;
  color:var(--phd-muted);font:500 12px/1.4 var(--mono,"SFMono-Regular",Consolas,Menlo,monospace);
}
html:root[data-reading-appearance] body.linked-research .portal-actions form button:hover { color:var(--phd-text);text-decoration:underline;text-underline-offset:4px; }
html:root[data-reading-appearance] body.linked-research[data-desktop-surface="thesis"] .reading-context { background:transparent;border:0;box-shadow:none; }

/* Navigation stays with its label; PDF zoom is a separate control group. */
@media (max-width:900px), (max-width:1024px) and (max-height:600px) {
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context > .mobile-related {
    justify-content:flex-start;gap:8px;flex:1 1 auto;
  }
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-related > .reading-context-label { flex:0 1 auto; }
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-related > .reading-context-arrow { flex:0 0 auto; }
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-zoom-controls {
    display:flex;align-items:center;justify-content:flex-end;flex:0 0 auto;gap:4px;margin-inline-start:16px;
  }
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context .mobile-zoom-controls > .mobile-pdf-zoom {
    display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;
    box-sizing:border-box;width:44px;min-width:44px;max-width:44px;height:44px;min-height:44px;
    margin:0;padding:6px;border:0;border-radius:0;background:transparent;color:var(--phd-text);
    font:500 22px/1 var(--mono,"SFMono-Regular",Consolas,Menlo,monospace);text-align:center;
  }
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context .mobile-zoom-controls > .mobile-pdf-zoom:disabled { color:var(--phd-muted);opacity:.45; }
  html:root[data-reading-appearance] body:is(.linked-research,.visitor-portal) .mobile-context .mobile-zoom-controls > .mobile-pdf-zoom:focus-visible { outline:2px solid var(--phd-focus);outline-offset:-3px; }
  html:root[data-reading-appearance] body.linked-research .mobile-reader-bar:has(.mobile-session-action) { grid-template-columns:auto auto minmax(0,1fr) 36px auto; }
  html:root[data-reading-appearance] body.linked-research .mobile-reader-bar > .mobile-appearance { width:36px;min-width:36px; }
  html:root[data-reading-appearance] body.linked-research .mobile-session-action,
  html:root[data-reading-appearance] body.linked-research .mobile-session-action form { display:flex;align-items:center;justify-content:center;margin:0;padding:0; }
  html:root[data-reading-appearance] body.linked-research .mobile-session-action form button {
    display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;
    min-width:54px;min-height:44px;height:44px;margin:0;padding:4px 5px;
    border:0;border-radius:0;box-shadow:none;background:transparent;color:var(--phd-muted);
    font-size:0 !important;line-height:1;
  }
  html:root[data-reading-appearance] body.linked-research .mobile-session-action form button::after { content:"Sign out";font:500 11px/1 var(--mono,"SFMono-Regular",Consolas,Menlo,monospace);white-space:nowrap; }
  html:root[data-reading-appearance] body.linked-research .mobile-session-action form button:hover { color:var(--phd-text); }
}

/* The access prompt uses one appearance, including typed and autofilled text. */
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry,
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry :is(.terminal-bar,.entry-panel) {
  background:var(--phd-panel);color:var(--phd-text);border-color:var(--phd-border);
}
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry::backdrop { background:var(--phd-bg); }
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry :is(.entry-prompt,.entry-status) { color:var(--phd-muted); }
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry .entry-line:has(input:focus-visible) .entry-prompt { color:var(--phd-text); }
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry :is(a,.view-thesis,.entry-line button) { color:var(--phd-accent); }
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry #supervisor-email {
  background:var(--reading-input);color:var(--phd-text);-webkit-text-fill-color:var(--phd-text);opacity:1;
}
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry #supervisor-email::placeholder { color:var(--phd-muted);-webkit-text-fill-color:var(--phd-muted);opacity:1; }
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry #supervisor-email:autofill { color:var(--phd-text);-webkit-text-fill-color:var(--phd-text);box-shadow:0 0 0 1000px var(--reading-input) inset; }
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry #supervisor-email:-webkit-autofill { color:var(--phd-text);-webkit-text-fill-color:var(--phd-text);-webkit-box-shadow:0 0 0 1000px var(--reading-input) inset; }
html:root[data-reading-appearance] body.visitor-portal .supervisor-entry .cli-caret { background:var(--phd-accent);color:var(--reading-input); }

/* Six study destinations share the available research pane. */
html:root[data-reading-appearance] body.visitor-portal:not(.is-mobile) .sidebar.research-navigation nav,
html:root[data-reading-appearance] body.linked-research:not(.is-mobile):not([data-desktop-surface="thesis"]) .portal-pane .sidebar.research-navigation nav {
  display:grid !important;
  grid-template-columns:repeat(6,minmax(0,1fr));
  align-items:stretch;
  gap:4px;
}
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .sidebar.research-navigation nav > .workspace-item {
  min-width:0;
}
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .sidebar.research-navigation nav .workspace-link {
  width:100%; min-width:0; padding-inline:7px;
}
html:root[data-reading-appearance] body.linked-research:not(.is-mobile) .portal-pane .sidebar.research-navigation nav .workspace-link :is(.workspace-copy,small) {
  white-space:normal; overflow-wrap:anywhere; min-width:0;
}
