.app-frame[data-workspace] { grid-template-rows: auto auto auto auto; align-content: start; }
.app-frame[data-workspace] > .black-layer { grid-row: 1; }
.app-frame[data-workspace] > .workspace-nav { grid-row: 2; grid-column: 1 / -1; }
.app-frame[data-workspace] > .library-module { grid-row: 3; grid-column: 1 / -1; }
.app-frame[data-workspace="research"] > .blue-layer { grid-row: 3; min-height: 650px; height: calc(100vh - 100px); }
.app-frame[data-workspace="research"] > .yellow-layer { grid-row: 4; }
.app-frame[data-workspace="explore"], .app-frame[data-workspace="analytics"] { height: 100vh; height: 100dvh; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; }
.workspace-nav { display: flex; align-items: stretch; gap: 26px; padding: 0 20px; min-height: 43px; background: var(--ink); border-bottom: 1px solid var(--border); }
.workspace-nav a { display: inline-flex; align-items: center; padding: 10px 2px; font-size: 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.workspace-nav a[aria-current] { color: var(--text); border-color: var(--cyan); }
.workspace-nav a[data-workspace-mode="analytics"] { margin-left: auto; }
.workspace-nav [hidden], .library-module[hidden] { display: none !important; }
.app-frame[data-workspace="explore"] > .blue-layer,
.app-frame[data-workspace="explore"] > .yellow-layer,
.app-frame[data-workspace="explore"] > .red-layer,
.app-frame[data-workspace="analytics"] > .blue-layer,
.app-frame[data-workspace="analytics"] > .yellow-layer,
.app-frame[data-workspace="analytics"] > .red-layer { display: none !important; }
.library-module { min-height: 0; min-width: 0; color: var(--text); background: #101113; color-scheme: dark; }
.library-module *, .workspace-nav * { letter-spacing: 0; }
.library-module [hidden] { display: none !important; }
.library-module a { color: inherit; text-decoration: none; }
.library-module button, .library-module input, .library-module select { font: inherit; }
.library-module input, .library-module select { background: #111518; color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; min-width: 0; width: 100%; font-size: 12px; }
.library-module input::placeholder { color: #849199; }
.library-module :focus-visible, .workspace-nav :focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.explore-layout { display: grid; grid-template-columns: 302px minmax(0, 1fr); height: 100%; min-height: 0; }
.document-rail { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; min-height: 0; min-width: 0; border-right: 1px solid var(--border); background: #0b0f12; }
.rail-head { padding: 14px 16px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rail-head h1 { font-size: 14px; font-weight: 600; }
.reader-tools { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.reader-tool { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #a1acb3; }
.reader-tool svg { width: 17px; height: 17px; pointer-events: none; }
.reader-tool:hover { background: #1c252c; color: var(--text); }
.reader-tool[aria-pressed="true"], .reader-tool.has-filters { background: var(--cyan-soft); color: var(--cyan); }
.reader-tool:disabled { cursor: default; opacity: .28; }
.reader-tool[data-tooltip]:hover::after, .reader-tool[data-tooltip]:focus-visible::after { content: attr(data-tooltip); position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; width: max-content; max-width: 180px; padding: 7px 9px; background: #24282b; color: #f1f3f4; border: 1px solid #49525a; font-size: 11px; line-height: 1.5; border-radius: 4px; pointer-events: none; }
.rail-search { display: flex; align-items: center; gap: 8px; margin: 4px 16px 0; padding: 0 10px; background: #12181d; border: 1px solid var(--border); border-radius: 5px; }
.rail-search > svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 15px; }
.rail-search input { border: 0; background: none; padding: 10px 0; height: 38px; }
.rail-status { display: flex; justify-content: space-between; gap: 8px; padding: 13px 18px 9px; min-height: 40px; color: #87969f; font-size: 11px; }
.reader-text-button { border: 0; padding: 0; background: none; color: var(--cyan); font-size: 12px; }
.document-list { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #39454e transparent; padding: 0 8px; min-height: 0; }
.document-option { display: block; padding: 16px 12px; border-left: 2px solid transparent; border-bottom: 1px solid rgba(174,198,216,.08); }
.document-option:hover { background: #121a20; }
.document-option[aria-current] { background: rgba(46,233,255,.065); border-left-color: var(--cyan); }
.document-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: #bfc9d0; font-size: 12px; line-height: 1.65; font-weight: 500; overflow-wrap: anywhere; }
.document-option[aria-current] .document-title { color: #e6fbff; }
.document-byline { display: flex; justify-content: space-between; gap: 10px; margin-top: 9px; font-size: 11px; line-height: 1.5; color: #869ba9; }
.document-byline small { font-size: 10px; color: #b7a475; flex-shrink: 0; }
.rail-pagination { display: flex; align-items: center; justify-content: center; gap: 32px; padding: 8px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }
.document-workspace { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-width: 0; min-height: 0; }
.reader-heading { display: flex; gap: 18px; align-items: center; padding: 20px 26px; border-bottom: 1px solid var(--border); }
.document-cover { width: 50px; height: 70px; flex: 0 0 50px; display: grid; place-items: center; border: 1px solid #3e4145; padding: 0; background: #212429; color: var(--muted); overflow: hidden; border-radius: 2px; }
.document-cover img { display: block; width: 100%; height: 100%; object-fit: contain; background: white; }
.reader-title { min-width: 0; flex: 1; }
.reader-title p { font-size: 12px; color: #c5c7cd; margin: 0 0 8px; line-height: 1.6; }
.reader-title p span { color: #a3a0a6; }
.reader-title h1 { font-size: 17px; font-weight: 550; line-height: 1.55; overflow-wrap: anywhere; }
.heading-tools { align-self: start; }
.reader-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; padding: 0 22px; border-bottom: 1px solid var(--border); background: #0e1216; }
.reader-tabs { display: flex; align-self: stretch; gap: 24px; }
.reader-tabs a { display: flex; align-items: center; border-bottom: 2px solid transparent; font-size: 12px; color: var(--muted); padding: 0 4px; }
.reader-tabs a[aria-selected="true"] { color: #fff; border-color: var(--magenta); }
.reader-location { color: #a99d80; font-size: 11px; white-space: nowrap; }
.reader-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; position: relative; }
.reader-outline { overflow: auto; border-right: 1px solid var(--border); padding: 16px 12px; background: #0e1115; scrollbar-width: thin; scrollbar-color: #39454e transparent; }
.outline-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.outline-head h2 { color: #c3ccd3; font-size: 12px; font-weight: 550; margin: 0; padding-left: 6px; }
.outline-head .reader-tool { width: 24px; height: 24px; flex-basis: 24px; min-height: 24px; }
#tocFilter { background: transparent; font-size: 11px; margin-bottom: 12px; }
.reader-outline ul { margin: 0; padding: 0; list-style: none; }
.reader-outline ul ul { padding-left: 12px; }
.outline-overview { display: block; margin: 0 0 8px; padding: 9px 8px; font-size: 12px; border-radius: 3px; }
.outline-row { display: flex; align-items: start; }
.outline-row > .reader-tool, .outline-indent { width: 22px; min-width: 22px; height: 32px; flex-basis: 22px; }
.outline-row .reader-tool svg { width: 13px; height: 13px; }
.outline-row .reader-tool[aria-expanded="true"] svg { transform: rotate(90deg); }
.outline-row a { flex: 1; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 6px; min-width: 0; font-size: 11px; line-height: 1.7; color: #92a0ad; border-radius: 3px; overflow-wrap: anywhere; }
.outline-row small { flex-shrink: 0; font-size: 10px; color: #807f83; }
.outline-row a:hover { color: var(--text); background: #1a1d22; }
.reader-outline a[aria-current] { color: #f4d7e9; background: rgba(255,79,216,.08); }
.reading-pane { min-width: 0; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #3e4248 transparent; background: #131416; }
.synopsis-reading { max-width: 780px; padding: 32px 42px; margin: 0 auto; }
.synopsis-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; font-size: 11px; color: #bd9cb3; }
.synopsis-head small { font-size: 10px; color: #8b8890; }
.synopsis-reading h2 { font-size: 19px; line-height: 1.6; font-weight: 500; margin: 0 0 22px; overflow-wrap: anywhere; }
.reader-prose { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 2; color: #c7c6c9; }
.synopsis-points { border-top: 1px solid var(--border); margin-top: 28px; font-size: 13px; color: #c6bec6; }
.synopsis-points summary { padding: 16px 0; cursor: pointer; }
.synopsis-points small { margin-left: 6px; color: var(--muted); }
.synopsis-points ul { padding-left: 20px; line-height: 1.9; }
.synopsis-points li { margin-bottom: 12px; }
.reading-sequence { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); margin-top: 30px; padding-top: 22px; font-size: 12px; color: #ac9eae; }
.reading-sequence a, .source-link { display: inline-flex; align-items: center; gap: 8px; }
.source-link { font-size: 12px; color: var(--cyan) !important; margin-top: 20px; }
.reading-sequence svg { width: 14px; height: 14px; }
.reader-note { color: var(--muted); font-size: 12px; padding: 14px; line-height: 1.8; }
.page-controls { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); background: #15191d; }
.page-controls form { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.page-controls input { width: 60px; height: 30px; padding: 4px 6px; }
.page-surface { overflow: auto; padding: 22px; min-height: 100px; }
.pdf-page-image { display: block; width: 100%; height: auto; max-width: none; margin: 0 auto; box-shadow: 0 4px 20px #0005; }
.page-transcription { max-width: 740px; margin: auto; }
.page-transcription .reader-note { padding: 0; color: #bda87d; }
.reader-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px; min-height: 200px; color: var(--muted); text-align: center; font-size: 13px; }
.reader-empty p { margin: 0; line-height: 1.8; }
.document-workspace > .reader-empty { grid-row: 1 / -1; }
.reader-empty a { color: var(--cyan); }
.explore-layout.rail-hidden { grid-template-columns: minmax(0, 1fr); }
.rail-hidden .document-rail { display: none; }
.reader-layout.outline-hidden { grid-template-columns: minmax(0, 1fr); }
.reader-layout.outline-hidden .reader-outline { display: none; }
.outline-backdrop { display: none; }
.reader-dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 24px; color: var(--text); background: #13171b; border: 1px solid #414b52; border-radius: 6px; box-shadow: 0 20px 80px #0009; }
.reader-dialog::backdrop { background: #0009; }
.reader-dialog header, .reader-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.reader-dialog header { margin-bottom: 20px; }
.reader-dialog h2 { font-size: 16px; margin: 0; }
.reader-dialog footer { margin-top: 24px; }
.reader-filter-fields { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reader-filter-fields label { display: grid; gap: 8px; font-size: 12px; color: var(--muted); }
.reader-dialog dl { margin: 0; }
.reader-dialog dl > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); padding: 10px 0; gap: 12px; font-size: 12px; line-height: 1.7; }
.reader-dialog dt { color: var(--muted); }
.reader-dialog dd { margin: 0; overflow-wrap: anywhere; }
.citation-detail { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 20px; }
.citation-detail h3 { font-size: 13px; font-weight: 500; margin: 0 0 12px; }
.citation-detail p { font-size: 12px; color: #b3b1b8; line-height: 1.8; }
#citationStatus { font-size: 12px; margin-left: 8px; }
.analytics-reserved { padding: 60px 36px; color: var(--muted); }
.analytics-reserved > svg { width: 22px; height: 22px; margin-bottom: 20px; color: #a49d87; }
.analytics-reserved h1 { font-size: 18px; font-weight: 500; color: #d1d0d2; }
.analytics-reserved p { font-size: 12px; margin-top: 12px; }
.empty-corpus-graph #graphStage { display: none; }
.corpus-graph-notice { padding: 22px; color: var(--muted); font-size: 14px; }
@media (max-width: 1200px) {
  .explore-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .reader-layout { grid-template-columns: 215px minmax(0, 1fr); }
  .reader-heading { padding: 18px; gap: 14px; }
  .reader-title h1 { font-size: 15px; }
  .synopsis-reading { padding: 26px; }
}
@media (max-width: 1000px) {
  .reader-layout { grid-template-columns: minmax(0, 1fr); }
  .reader-outline, .reader-layout.outline-hidden .reader-outline { display: none; }
  .reader-layout.outline-open .reader-outline { display: block; position: absolute; z-index: 6; inset: 0 auto 0 0; width: min(310px, 85%); box-shadow: 15px 0 30px #0006; }
  .outline-open .outline-backdrop { display: block; position: absolute; z-index: 5; inset: 0; border: 0; background: #0007; }
  .reader-heading { align-items: start; }
  .heading-tools { flex-direction: column; }
}
@media (max-width: 700px) {
  .black-layer { flex-wrap: wrap; gap: 8px; }
  .black-actions { flex-wrap: wrap; }
  .brand-block { min-width: 0; }
  .brand-block h1 { font-size: 13px; }
  #authPill { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
  .workspace-nav { padding: 0 14px; gap: 20px; }
  .workspace-nav a { font-size: 11px; }
  .explore-layout { grid-template-columns: minmax(0, 1fr); }
  .document-rail { border-right: 0; }
  .document-workspace { display: none; }
  .has-document .document-rail { display: none; }
  .has-document .document-workspace { display: grid; }
  .rail-hidden:not(.has-document) .document-rail { display: grid; }
  .document-title { font-size: 13px; }
  .document-option { padding: 18px 12px; }
  .reader-heading { padding: 14px; gap: 12px; }
  .document-cover { width: 38px; height: 55px; flex-basis: 38px; }
  .reader-title h1 { font-size: 12px; line-height: 1.6; }
  .reader-title p { font-size: 11px; margin-bottom: 5px; }
  .reader-toolbar { padding: 0 10px; gap: 8px; }
  .reader-tabs { gap: 16px; }
  .reader-tabs a { font-size: 11px; }
  .reader-location { font-size: 10px; }
  .synopsis-reading { padding: 24px 22px; }
  .synopsis-reading h2 { font-size: 17px; }
  .reader-prose { font-size: 13px; line-height: 1.95; }
  .page-controls { padding: 8px; }
  .page-controls .reader-tools { gap: 0; }
  .page-controls .reader-tool { width: 29px; flex-basis: 29px; }
  .page-surface { padding: 10px; }
}
.app-frame[data-workspace="admin"] { height: 100dvh; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; }
.app-frame[data-workspace="admin"] > .blue-layer,
.app-frame[data-workspace="admin"] > .yellow-layer,
.app-frame[data-workspace="admin"] > .red-layer { display: none !important; }
#adminModule { min-height: 0; display: flex; flex-direction: column; background: #101619; }
.admin-tabs { flex: none; padding: 12px 20px; border-bottom: 1px solid #29343b; }
.admin-module-body { overflow: auto; min-height: 0; padding: 20px; }
#adminModule .workbench-panel { display: none; }
#adminModule .workbench-panel.active { display: block; }
#adminModule [hidden] { display: none !important; }
#adminModule .admin-output { grid-template-columns: minmax(0, 1fr); }
#adminModule .admin-output > *, #adminModule .admin-layout > *, #adminModule .admin-panel { min-width: 0; }
#adminModule .view-head { border: 0; background: none; padding: 0; margin-bottom: 20px; }
#adminModule .view-head p { font-size: 13px; line-height: 1.6; }
#adminModule .view-head h2 { font-size: 17px; }
#adminModule .admin-summary-grid { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
#adminModule .admin-panel-head { flex-wrap: wrap; }
#adminModule .table-wrap { min-width: 0; max-width: 100%; }
