@font-face {
  font-family: Inter;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/space-grotesk-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --header-height: 76px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071014;
  color: #f5f5f2;
  --ink: #071014;
  --ink-deep: #050b0e;
  --text: #f5f5f2;
  --surface: #0d1b20;
  --surface-raised: #14292e;
  --surface-overlay: #10222a;
  --border: #223a40;
  --border-strong: #2c454b;
  --muted: #9fb5b7;
  --muted-strong: #b2c3c5;
  --accent: #00c9a7;
  --accent-soft: #00c9a719;
  --accent-edge: #257868;
  --orange: #ff7a0a;
  --warning: #ffb46e;
  --danger: #ffb8a5;
  --ok: #7fe3cd;
  --heading-font: 'Space Grotesk', Inter, ui-sans-serif, system-ui, sans-serif;
  --code-font: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --radius: 12px;
  --radius-small: 8px;
  --shadow: 0 18px 44px #00000052;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 420px at 88% -4%, #00c9a714, transparent 70%),
    radial-gradient(900px 480px at -8% 14%, #0e3b4252, transparent 68%),
    var(--ink);
}
h1, h2, h3, h4 { font-family: var(--heading-font); font-weight: 560; letter-spacing: -.015em; }
a { color: var(--accent); }
.skip-link { background: var(--accent); border-radius: 0 0 10px 0; color: var(--ink); font-weight: 700; left: 0; padding: 14px 20px; position: fixed; top: -100px; z-index: 60; }
.skip-link:focus { top: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }
::selection { background: #00c9a74d; }

* { scrollbar-width: thin; scrollbar-color: #2c454b transparent; }
::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-thumb { background: #2c454b; border: 2px solid transparent; border-radius: 99px; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Buttons & inputs ---------- */
.quiet-button, .primary-button {
  align-items: center;
  border-radius: 9px;
  display: inline-flex;
  font-weight: 620;
  gap: 8px;
  justify-content: center;
  min-height: 40px;
  padding: 8px 15px;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}
.quiet-button { background: #ffffff08; border: 1px solid var(--border-strong); color: var(--text); }
.quiet-button:hover { background: var(--surface-raised); border-color: #4e6c73; }
.primary-button { background: var(--accent); border: 1px solid var(--accent); color: var(--ink); }
.primary-button:hover { background: #36ddbb; border-color: #36ddbb; }
.eyebrow { color: var(--accent); font-size: .71rem; font-weight: 720; letter-spacing: .16em; margin: 0 0 10px; text-transform: uppercase; }

input, select, textarea {
  background: var(--ink-deep);
  border: 1px solid #3c585f;
  border-radius: 9px;
  color: var(--text);
  min-height: 44px;
  min-width: 0;
  padding: 9px 13px;
  transition: border-color .14s ease;
}
input:hover, select:hover, textarea:hover { border-color: #567078; }
input::placeholder, textarea::placeholder { color: #7e9598; opacity: 1; }
input[type="checkbox"] { accent-color: var(--accent); }
textarea { resize: vertical; width: 100%; }
select { appearance: auto; }
code, pre, textarea[spellcheck="false"] { font-family: var(--code-font); }
textarea[spellcheck="false"] { font-size: .85rem; line-height: 1.6; }

/* ---------- Top bar ---------- */
.site-header {
  align-items: center;
  backdrop-filter: blur(10px);
  background: #071014e0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 18px 28px;
  justify-content: space-between;
  min-height: 76px;
  padding: 8px 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}
body[data-practice="true"] .site-header { border-bottom-color: #8a572b; }
.identity { align-items: center; display: flex; gap: 12px; flex: 0 0 auto; }
.sidebar-toggle { flex: 0 0 auto; }
.sidebar-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
body:has(#workspace[hidden]) .sidebar-toggle { display: none; }
.identity-logo { display: block; height: auto; width: 178px; }
.header-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: flex-end; }
.practice-badge { background: #6e4412; border: 1px solid #d69b4e; border-radius: 999px; color: #fff3dd; font-size: .68rem; font-weight: 800; letter-spacing: .08em; padding: 7px 10px; white-space: nowrap; }
.connection-state { border-left: 2px solid var(--accent); color: var(--muted-strong); font-size: .8rem; line-height: 1.45; max-width: 260px; padding-left: 12px; }
.project-switch { align-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px; display: flex; gap: 10px; padding: 5px 6px 5px 14px; }
body:has(#workspace[hidden]) .project-switch { display: none; }
.project-switch-label { color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.project-switch select { background: var(--ink-deep); border-color: transparent; font-size: .86rem; max-width: 230px; min-height: 38px; }
.project-switch select:hover { border-color: #567078; }

/* ---------- Gate (sign-in) ---------- */
.gate {
  align-items: center;
  display: grid;
  column-gap: clamp(32px, 5vw, 72px);
  row-gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .85fr);
  grid-template-areas: "intro auth" "context auth";
  margin: clamp(40px, 9vh, 96px) auto;
  max-width: 1040px;
  padding: 0 28px;
}
.gate-copy { align-self: end; grid-area: intro; }
.gate:has(.auth-card[hidden]) { grid-template-columns: minmax(0, 620px); grid-template-areas: "intro" "context"; justify-content: center; }
.gate h1 { font-size: clamp(2.3rem, 4.4vw, 3.6rem); font-weight: 500; letter-spacing: -.04em; line-height: 1.08; margin: 0 0 18px; }
.gate-copy > p:not(.eyebrow) { color: var(--muted-strong); font-size: 1.02rem; line-height: 1.65; margin-bottom: 0; max-width: 480px; }
.gate > .context-note { align-self: start; border-left: 2px solid var(--border-strong); color: var(--muted); font-size: .82rem; grid-area: context; line-height: 1.6; margin: 0; padding-left: 16px; }
.auth-card {
  background: linear-gradient(170deg, #11252b, var(--surface) 55%);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  grid-area: auth;
  min-width: 0;
  padding: clamp(24px, 4vw, 38px);
  position: relative;
}
.auth-card::before { background: linear-gradient(90deg, var(--accent), var(--orange)); border-radius: 16px 16px 0 0; content: ""; height: 3px; left: 0; position: absolute; right: 0; top: 0; }
.auth-card h2 { font-size: 1.55rem; margin: 0 0 8px; }
.auth-card p { color: var(--muted-strong); font-size: .9rem; line-height: 1.55; }
.auth-card label { display: block; font-size: .9rem; font-weight: 650; margin: 24px 0 9px; }
.auth-card input { width: 100%; }
.auth-card .primary-button { margin-top: 20px; width: 100%; }
.auth-card .form-error { color: var(--danger); margin-bottom: 0; }

/* ---------- Workspace shell ---------- */
.workspace {
  --rail-width: 224px;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: calc(100dvh - var(--header-height));
  transition: grid-template-columns .24s ease;
}
.rail {
  background: linear-gradient(180deg, #0a161b, #081116);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 16px 12px;
  position: sticky;
  top: var(--header-height);
  align-self: start;
  height: calc(100dvh - var(--header-height));
  overflow-x: hidden;
  overflow-y: auto;
  transition: opacity .18s ease, transform .24s ease, padding .24s ease, border-color .24s ease, visibility 0s linear 0s;
}
/* An interior object (a source open in the reader) is in focus: the sidebar steps aside. */
body[data-sidebar="hidden"] .workspace { --rail-width: 0px; }
body[data-sidebar="hidden"] .rail {
  border-right-color: transparent;
  opacity: 0;
  padding-inline: 0;
  pointer-events: none;
  transform: translateX(-100%);
  transition: opacity .18s ease, transform .24s ease, padding .24s ease, border-color .24s ease, visibility 0s linear .24s;
  visibility: hidden;
}
.rail-button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted-strong);
  display: flex;
  font-size: .88rem;
  font-weight: 560;
  gap: 12px;
  min-height: 44px;
  padding: 10px 13px;
  text-align: left;
  white-space: nowrap;
  width: 100%;
}
.rail-button svg { fill: none; flex: 0 0 auto; height: 19px; opacity: .85; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; width: 19px; }
.rail-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 12px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.rail-heading button { min-height: 36px; width: 36px; padding: 4px; }
.sidebar-backdrop { position: fixed; inset: var(--header-height) 0 0; z-index: 39; border: 0; background: #0009; }
body.navigation-open { overflow: hidden; }
.rail-button:hover { background: var(--surface-raised); color: #fff; }
.rail-button[aria-current="page"] {
  background: var(--accent-soft);
  border-color: var(--accent-edge);
  box-shadow: inset 3px 0 var(--accent);
  color: var(--text);
  font-weight: 680;
}
.rail-button[aria-current="page"] svg { color: var(--accent); opacity: 1; }
.rail-foot { border-top: 1px solid var(--border); color: var(--muted); font-size: .73rem; margin-top: auto; padding: 16px 13px 4px; }
.rail-pref { align-items: center; color: var(--muted-strong); cursor: pointer; display: flex; font-size: .76rem; gap: 9px; line-height: 1.35; margin: 0 0 12px; }
.rail-pref input { flex: 0 0 auto; height: 16px; min-height: 16px; padding: 0; width: 16px; }

.views { min-width: 0; width: 100%; max-width: 1440px; margin-inline: auto; padding: 32px clamp(20px, 3vw, 48px) 64px; }
.view { display: none; }
.view.is-active { animation: view-in .22s ease; display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.view-heading { align-items: end; display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; margin: 0 0 22px; }
.view-heading h1 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -.03em; margin: 0; }
.view-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); }

.practice-banner { align-items: baseline; background: #302311; border: 1px solid #b27c32; border-radius: 10px; color: #fff0d4; display: flex; flex-wrap: wrap; gap: 6px 14px; line-height: 1.5; margin: 0 0 22px; padding: 13px 16px; }
.practice-banner strong { font-size: .88rem; white-space: nowrap; }
.practice-banner span { font-size: .83rem; }

/* ---------- Panels ---------- */
.panel, .readiness-panel, .coverage-panel, .collections-panel, .knowledge-panel, .products-panel, .research-panel, .additions-panel {
  background: linear-gradient(176deg, #0f2026, var(--surface) 62%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 20px;
  min-width: 0;
  padding: clamp(16px, 2.2vw, 26px);
}
.panel-heading { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-bottom: 4px; }
.panel-heading h2 { font-size: 1.14rem; font-weight: 640; margin: 0; }
.panel-heading h3 { font-size: .98rem; margin: 18px 0 0; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.panel h2 { font-size: 1.14rem; margin: 0 0 10px; }
.panel p, .readiness-panel p, .additions-panel > p, .hosted-client-connection p, .citation-help,
.collections-panel p, .knowledge-panel p, .products-panel p, .products-panel small, .research-panel p, .governance-panel p {
  color: var(--muted-strong); font-size: .83rem; line-height: 1.6; overflow-wrap: anywhere;
}
.panel-state { min-height: 1.3em; }
[data-state="attention"], .research-panel .research-error { color: var(--warning); }
.readiness-detail[data-state="attention"], .readiness-panel [data-state="attention"],
.collections-panel [data-state="attention"], .knowledge-panel [data-state="attention"],
.products-panel [data-state="attention"], .research-panel [data-state="attention"],
.governance-panel [data-state="attention"] { color: var(--warning); }

/* Disclosure cards (details/summary) */
.disclosure { background: #0a171c; border: 1px solid var(--border); border-radius: 10px; margin-top: 14px; padding: 0 16px; }
.disclosure > summary {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: .9rem;
  font-weight: 640;
  gap: 10px;
  list-style: none;
  margin: 0 -16px;
  min-height: 48px;
  padding: 12px 16px;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { color: var(--accent); content: "▸"; display: inline-block; font-size: .8rem; transition: transform .15s ease; }
.disclosure[open] > summary::before { transform: rotate(90deg); }
.disclosure[open] { padding-bottom: 16px; }
.disclosure[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.disclosure .disclosure { background: #081216; }

/* ---------- Library view ---------- */
.view-library.is-active { display: block; }
.category-nav { display: grid; gap: 3px; }
.library-filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.category-filter { position: relative; min-width: 0; }
.category-filter > summary { cursor: pointer; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 8px; padding: 11px 14px; font-size: .84rem; }
.category-filter > summary span { color: var(--text); font-weight: 600; margin-left: 8px; }
.category-filter .category-nav { position: absolute; top: calc(100% + 8px); left: 0; width: 300px; max-width: calc(100vw - 40px); max-height: 55dvh; overflow-y: auto; padding: 8px; background: #102128; border: 1px solid var(--border-strong); border-radius: 12px; z-index: 20; box-shadow: var(--shadow); }
.result-layout { display: flex; flex: 0 0 auto; border: 1px solid var(--border-strong); border-radius: 8px; padding: 3px; }
.result-layout button { background: transparent; color: var(--muted-strong); border: 0; border-radius: 5px; padding: 8px 14px; min-height: 36px; font-size: .82rem; }
.result-layout button[aria-pressed="true"] { background: var(--surface-raised); color: var(--text); box-shadow: 0 1px 3px #0005; }
.category-button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted-strong);
  font-size: .86rem;
  line-height: 1.35;
  min-height: 40px;
  padding: 9px 13px;
  text-align: left;
  width: 100%;
}
.category-button:hover { background: var(--surface-raised); color: #fff; }
.category-button[aria-pressed="true"] { background: #00c9a719; border-color: #257868; box-shadow: inset 3px 0 var(--accent); color: var(--text); font-weight: 650; }
.collection { min-width: 0; }
.collection-heading { align-items: center; display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: space-between; }
.collection-heading h1 { font-size: clamp(1.7rem, 2.4vw, 2.1rem); font-weight: 560; letter-spacing: -.035em; margin: 0; }
.count-badge { border: 1px solid var(--border-strong); border-radius: 100px; color: var(--muted-strong); font-size: .75rem; padding: 8px 13px; white-space: nowrap; }
.index-state { color: var(--muted); font-size: .82rem; line-height: 1.6; margin: 12px 0 18px; }
.search-panel { min-width: 0; }
.search-form {
  background: transparent;
  border: 0;
  padding: 0;
  position: relative;
}
.search-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; min-height: 52px; background: var(--surface); border-color: var(--border-strong); }
.search-row .primary-button { padding-inline: 26px; }
.result-status { color: var(--muted); font-size: .82rem; margin: 18px 0 12px; min-height: 1.5em; }

/* Source tree */
.results { display: flex; flex-direction: column; gap: 0; }
.results[data-layout="list"] { border: 1px solid var(--border); border-radius: 12px; background: #0c191f; overflow: hidden; }
.results[data-layout="list"]:empty { border: 0; }
.results[data-layout="list"] .result-card + .result-card { border-top: 1px solid var(--border); }
.results[data-layout="list"] .result-card > button { padding: 18px 20px; border-radius: 0; }
.result-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-type { grid-column: 1; grid-row: 2; font: 600 .6rem var(--code-font); color: var(--muted); }
.extraction-state { grid-column: 2; font-size: .75rem; color: var(--warning); }
.result-folder { background: #0a171c; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.result-folder > summary {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: .86rem;
  font-weight: 640;
  gap: 10px;
  list-style: none;
  min-height: 44px;
  padding: 9px 14px;
}
.result-folder > summary::-webkit-details-marker { display: none; }
.result-folder > summary:hover { background: var(--surface-raised); }
.result-folder > summary::before { color: var(--accent); content: "▸"; font-size: .76rem; transition: transform .15s ease; }
.result-folder[open] > summary::before { transform: rotate(90deg); }
.folder-icon { fill: none; height: 16px; opacity: .9; stroke: var(--orange); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; width: 16px; }
.folder-count { background: #ffffff10; border-radius: 99px; color: var(--muted-strong); font-size: .7rem; font-weight: 650; margin-left: auto; padding: 3px 9px; }
.result-folder .folder-body { border-top: 1px solid var(--border); display: flex; flex-direction: column; padding: 5px 6px 6px; }
.result-folder .result-folder { border-inline: 0; border-radius: 0; margin-left: 14px; }
.result-card { border-radius: 8px; min-width: 0; }
.result-card > button {
  align-items: start;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  display: grid;
  gap: 2px 12px;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}
.result-card > button:hover { background: var(--accent-soft); border-color: var(--accent-edge); }
.file-icon { fill: none; grid-column: 1; grid-row: 1; height: 17px; margin-top: 2px; opacity: .9; stroke: var(--muted-strong); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; width: 17px; }
.result-card[data-kind="markdown"] .file-icon { stroke: var(--accent); }
.result-card .result-title { font-family: var(--heading-font); font-size: 1rem; font-weight: 600; grid-column: 2; grid-row: 1; line-height: 1.45; overflow-wrap: anywhere; }
.result-card .tag { color: var(--accent); font-size: .67rem; font-weight: 700; grid-column: 3; letter-spacing: .07em; padding-top: 3px; text-transform: uppercase; white-space: nowrap; }
.result-card .result-summary { color: var(--muted-strong); font-size: .8rem; grid-column: 2 / -1; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.result-card small { color: var(--muted); font-size: .71rem; grid-column: 2 / -1; overflow-wrap: anywhere; }
.results > .result-card { background: transparent; border: 0; border-radius: 0; }
.empty-state { border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--muted-strong); line-height: 1.65; padding: 28px; }
.load-more { display: flex; margin: 22px auto 0; }

/* ---------- Status view ---------- */
.dashboard-freshness { color: var(--muted-strong); font-size: .8rem; line-height: 1.5; margin: 8px 0 0; }
.dashboard-summary { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-summary-card { margin-bottom: 0; }
.dashboard-state { background: #19332f; border: 1px solid #327468; border-radius: 99px; color: var(--ok); font-size: .72rem; font-weight: 700; padding: 5px 10px; white-space: nowrap; }
.dashboard-state[data-state="attention"], .dashboard-state[data-state="unavailable"] { background: #352616; border-color: #906139; color: #ffd3a2; }
.dashboard-state[data-state="failed"] { background: #3b2020; border-color: #9e5147; color: var(--danger); }
.dashboard-card-scope { margin: 3px 0 14px; }
.dashboard-metrics { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 0; }
.dashboard-metrics div { background: #0a171c; border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; }
.dashboard-metrics dt { color: var(--muted); font-size: .72rem; line-height: 1.35; }
.dashboard-metrics dd { font-family: var(--heading-font); font-size: 1.45rem; font-weight: 620; margin: 7px 0 0; }
.dashboard-metrics dd[data-state="running"] { color: var(--ok); }
.dashboard-metrics dd[data-state="attention"] { color: #ffd3a2; }
.dashboard-metrics dd[data-state="unavailable"] { color: var(--muted-strong); }
.dashboard-detail { color: var(--muted-strong); font-size: .8rem; line-height: 1.5; margin: 14px 0 0; }
.dashboard-worker-detail + .dashboard-detail { margin-top: 8px; }
.dashboard-live { margin-bottom: 20px; }
.dashboard-live-metrics { margin-top: 14px; }
.dashboard-live-subtitle { font-size: .82rem; margin: 18px 0 0; }
.dashboard-live-chart-wrap .dashboard-detail { margin-top: 4px; }
.dashboard-live-chart { align-items: flex-end; background: #0a171c; border: 1px solid var(--border); border-radius: 9px; display: flex; gap: 3px; height: 74px; margin-top: 8px; padding: 8px; }
.dashboard-live-bar { background: #167760; border-radius: 2px 2px 0 0; flex: 1 1 0; height: calc(max(var(--bar, 0) * 100%, 2px)); min-width: 3px; }
.dashboard-live-bar[data-empty] { background: #1d3136; }
.dashboard-live-controls { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.dashboard-live-controls label { color: var(--muted); font-size: .74rem; }
.dashboard-live-controls select { background: #0a171c; border: 1px solid var(--border); border-radius: 7px; color: inherit; font-size: .8rem; max-width: 300px; padding: 6px 8px; }
.dashboard-live-ticker { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 12px 0 0; max-height: 330px; overflow-y: auto; padding: 0; }
.dashboard-live-ticker li { align-items: baseline; border-bottom: 1px solid var(--border); display: grid; font-size: .8rem; gap: 3px 12px; grid-template-columns: auto auto 1fr; padding: 7px 4px; }
.dashboard-live-ticker li.is-new { animation: dashboard-live-arrive 1.6s ease-out; }
@keyframes dashboard-live-arrive { from { background: #19332f; } to { background: transparent; } }
.dashboard-live-ticker time { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.dashboard-live-ticker strong { font-weight: 620; overflow-wrap: anywhere; }
.dashboard-live-ticker li > span:last-child { color: var(--muted-strong); font-size: .74rem; grid-column: 3; overflow-wrap: anywhere; }
.dashboard-live-ticker .dashboard-live-empty { color: var(--muted-strong); display: block; }
.dashboard-live-tag { border: 1px solid; border-radius: 99px; font-size: .64rem; font-weight: 700; padding: 2px 8px; white-space: nowrap; }
.dashboard-live-tag[data-kind="new"] { border-color: #327468; color: var(--ok); }
.dashboard-live-tag[data-kind="updated"] { border-color: #647d7f; color: var(--muted-strong); }
.dashboard-live-tag[data-kind="pending"] { border-color: #906139; color: #ffd3a2; }
.dashboard-live-tag[data-kind="attention"] { border-color: #9e5147; color: var(--danger); }
@media (max-width: 720px) { .dashboard-live-ticker li { grid-template-columns: auto 1fr; } .dashboard-live-ticker li > span:last-child { grid-column: 1 / -1; } }
.dashboard-ingestion { align-items: baseline; margin-top: 20px; }
.dashboard-ingestion .dashboard-detail { margin-bottom: 0; }
.dashboard-geography { margin-top: 20px; }
.dashboard-meaning { max-width: 920px; }
.dashboard-map-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.5fr) minmax(250px, .9fr); margin-top: 18px; }
.dashboard-map-figure { background: #081418; border: 1px solid var(--border); border-radius: 11px; margin: 0; min-width: 0; padding: 12px; }
#dashboard-map { display: block; height: auto; max-height: 480px; width: 100%; }
#dashboard-map .dashboard-state-path { cursor: pointer; fill: #1d3136; fill-rule: evenodd; stroke: #647d7f; stroke-width: 1.1; vector-effect: non-scaling-stroke; }
#dashboard-map .dashboard-state-path:hover, #dashboard-map .dashboard-state-path:focus-visible { filter: brightness(1.35); stroke: #fff; stroke-width: 2; outline: none; }
#dashboard-map .dashboard-state-path[data-status="collected"] { fill: #167760; }
#dashboard-map .dashboard-state-path[data-status="attention"] { fill: #b47a2a; }
#dashboard-map .dashboard-state-path[data-status="failed"] { fill: #a24c46; }
#dashboard-map .dashboard-state-path[data-status="disabled"] { fill: #58636d; }
#dashboard-map .dashboard-state-path[aria-pressed="true"] { stroke: #fff; stroke-width: 3; }
#dashboard-map .dashboard-state-label { fill: #f5f5f2; font: 700 13px Inter, sans-serif; paint-order: stroke; pointer-events: none; stroke: #071014; stroke-width: 3px; text-anchor: middle; }
.dashboard-map-figure figcaption { color: var(--muted-strong); font-size: .74rem; line-height: 1.45; margin: 4px 3px 0; }
.dashboard-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 3px 3px; }
.dashboard-legend span { align-items: center; color: var(--muted-strong); display: inline-flex; font-size: .72rem; gap: 6px; }
.dashboard-legend span::before { background: #1d3136; border: 1px solid #647d7f; border-radius: 3px; content: ''; height: 11px; width: 11px; }
.dashboard-legend span[data-status="collected"]::before { background: #167760; }
.dashboard-legend span[data-status="attention"]::before { background: #b47a2a; }
.dashboard-legend span[data-status="failed"]::before { background: #a24c46; }
.dashboard-legend span[data-status="disabled"]::before { background: #58636d; }
.dashboard-map-detail { background: #0a171c; border: 1px solid var(--border); border-radius: 11px; min-width: 0; padding: 16px; }
.dashboard-map-detail h3 { font-size: 1.05rem; margin: 0 0 9px; }
.dashboard-map-detail p { margin: 0 0 10px; }
.dashboard-selection-items { display: grid; gap: 9px; list-style: none; margin: 12px 0 0; max-height: 400px; overflow: auto; padding: 0; }
.dashboard-selection-items li { border-top: 1px solid var(--border); display: grid; font-size: .77rem; gap: 4px; line-height: 1.45; padding-top: 9px; }
.dashboard-selection-items strong { color: var(--text); overflow-wrap: anywhere; }
.dashboard-selection-items span { color: var(--muted-strong); overflow-wrap: anywhere; }
.dashboard-table-wrap { margin-bottom: 0; max-height: 440px; }
.dashboard-geography-table th, .dashboard-geography-table td { white-space: nowrap; }
.dashboard-geography-table td:last-child { white-space: normal; }
.dashboard-geography-table button { background: none; border: 0; color: var(--accent); font-size: inherit; font-weight: 650; padding: 0; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.dashboard-geography-table tr[data-selected="true"] td { background: #00c9a711; }
.dashboard-geography-table tr[data-state="failed"] td:nth-child(4), .dashboard-geography-table tr[data-state="attention"] td:nth-child(4) { color: var(--warning); }
.readiness-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.readiness-panel .readiness-scope { background: #302311; border-left: 3px solid #d69b4e; border-radius: 0 8px 8px 0; color: #fff0d4; font-weight: 650; margin: 16px 0 4px; padding: 10px 12px; }
.readiness-stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); margin: 16px 0 0; }
.readiness-stats div { background: #0a171c; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.readiness-stats dt { color: var(--muted); font-size: .71rem; line-height: 1.35; }
.readiness-stats dd { font-family: var(--heading-font); font-size: 1.3rem; font-weight: 620; margin: 8px 0 0; }
.readiness-panel #readiness-count-note { margin: 12px 0 16px; }
.coverage-state, .coverage-note { color: var(--muted-strong); font-size: .8rem; line-height: 1.55; margin: 14px 0 0; }
.coverage-state[data-state="unavailable"] { color: var(--warning); }
.coverage-sources { border-top: 1px solid var(--border); display: grid; gap: 9px; list-style: none; margin: 18px 0 0; padding: 16px 0 0; }
.coverage-sources li { align-items: baseline; display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; }
.coverage-sources strong { font-size: .8rem; }
.coverage-sources small { color: var(--muted); font-size: .74rem; }
.coverage-sources li[data-attention="true"] small { color: var(--warning); }
.coverage-sources details { min-width: 0; overflow-wrap: anywhere; width: 100%; }
.coverage-sources details details { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.coverage-sources details summary { cursor: pointer; }
.coverage-sources details p, .coverage-sources details li { font-size: .8rem; line-height: 1.5; }

/* ---------- Collections view ---------- */
.collections-table-wrap { border: 1px solid var(--border); border-radius: 10px; margin: 16px 0; max-height: 420px; overflow: auto; }
.collections-table { border-collapse: collapse; font-size: .8rem; text-align: left; width: 100%; }
.collections-table caption { font-weight: 650; padding: 12px 14px; text-align: left; }
.collections-table th, .collections-table td { border-top: 1px solid var(--border); padding: 10px 14px; vertical-align: top; }
.collections-table th { background: #0a171c; color: var(--muted-strong); position: sticky; top: 0; }
.collections-table tbody tr:hover td { background: #ffffff06; }
.collections-actions { align-items: baseline; display: flex; flex-wrap: wrap; gap: 10px; }
.collections-panel .check-row input { height: 20px; min-height: 20px; width: 20px; }
.collections-panel pre { font-size: .8rem; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
#collection-search-results { margin-top: 16px; }

/* ---------- Forms (shared) ---------- */
.addition-form { display: grid; gap: 9px; grid-template-columns: 1fr; margin-top: 16px; max-width: 760px; }
.addition-form label { font-size: .82rem; font-weight: 650; margin-top: 7px; }
.addition-form .primary-button { justify-self: start; margin-top: 10px; }
.addition-form p { margin: 0; }
.check-row { align-items: center; display: flex; gap: 10px; }
.check-row input { flex: 0 0 auto; height: 18px; min-height: 18px; width: 18px; }
.additions-panel h3, .research-panel h3 { font-size: 1rem; margin: 26px 0 10px; }
.knowledge-panel .addition-form, .products-panel .addition-form, .research-panel .addition-form, .governance-panel .addition-form { max-width: 100%; }

.operations-list { display: grid; gap: 10px; }
.operation-item { background: #0a171c; border: 1px solid var(--border); border-radius: 10px; display: grid; gap: 6px; padding: 14px; }
.operation-item strong, .operation-item small { overflow-wrap: anywhere; }
.operation-item small { color: var(--muted); }
.operation-item[data-state="attention"] small { color: var(--warning); }
.operation-item button { justify-self: start; }
.operation-detail { border-top: 1px solid var(--border); display: grid; gap: 8px; margin-top: 8px; padding-top: 12px; }
.operation-detail h4 { font-size: .86rem; margin: 12px 0 0; }
.operation-detail p { color: var(--muted-strong); font-size: .8rem; line-height: 1.55; margin: 0; }
.operation-detail pre { background: var(--ink-deep); border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: .82rem; line-height: 1.55; margin: 0; overflow-wrap: anywhere; padding: 12px; white-space: pre-wrap; }

/* ---------- Knowledge / products / research ---------- */
.knowledge-panel fieldset, .products-panel fieldset, .governance-panel fieldset { background: #081216; border: 1px solid var(--border); border-radius: 10px; min-width: 0; padding: 14px; }
.knowledge-panel legend, .products-panel legend, .governance-panel legend { color: var(--muted-strong); font-size: .8rem; padding: 0 6px; }
.knowledge-panel select, .products-panel input:not([type="checkbox"]), .products-panel select, .products-panel textarea, .governance-panel input:not([type="checkbox"]), .governance-panel select { width: 100%; }
.knowledge-options { display: grid; gap: 11px; max-height: 340px; overflow: auto; }
.knowledge-options label { align-items: baseline; display: flex; gap: 10px; font-size: .83rem; line-height: 1.6; overflow-wrap: anywhere; }
.knowledge-options input[type="checkbox"] { flex: 0 0 auto; height: 18px; min-height: 18px; width: 18px; }
.knowledge-options small { color: var(--muted); display: block; }
#knowledge-preview-load, #knowledge-select-sources { justify-self: start; margin-top: 12px; }
.products-panel fieldset { display: grid; gap: 12px; }
.products-panel pre { font: inherit; font-size: .83rem; line-height: 1.6; max-height: 360px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
.products-panel .products-check, .publication-panel .publication-check { align-items: center; display: flex; gap: 10px; }
.products-panel input[type="checkbox"], .governance-panel input[type="checkbox"] { flex: 0 0 auto; height: 18px; min-height: 18px; width: 18px; }
.products-statement { background: #081216; border: 1px solid var(--border); border-radius: 9px; display: grid; gap: 12px; margin-bottom: 12px; padding: 14px; }
.products-statement ul { font-size: .8rem; line-height: 1.6; overflow-wrap: anywhere; padding-left: 22px; }
.products-actions { margin: 14px 0; }
#products-detail { margin-top: 16px; }
#products-preview section { border-bottom: 1px solid var(--border); padding: 12px 0; }
.research-settings { margin: 16px 0; }
#research-credit-note { border-left: 3px solid var(--accent); padding-left: 12px; }
.research-job h4 { font-size: 1rem; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.research-job p { margin: 4px 0; }
.research-results { display: grid; gap: 14px; list-style: none; margin: 8px 0; padding: 0; }
.research-result { border-top: 1px solid var(--border); display: grid; gap: 8px; min-width: 0; padding-top: 14px; }
.research-actions { align-items: center; display: flex; flex-wrap: wrap; font-size: .83rem; gap: 10px; }
.research-panel a { overflow-wrap: anywhere; }

/* ---------- Access view ---------- */
.project-panel h2 { margin-bottom: 8px; }
.project-panel label { display: block; font-size: .78rem; font-weight: 650; margin: 12px 0 6px; }
.project-panel input, .project-panel select { width: 100%; }
.project-form { margin-top: 14px; }
.project-form button { margin-top: 12px; }
.first-run-guide { background: #122a2e; border: 1px solid #2b7466; border-radius: 9px; margin: 14px 0; padding: 12px; }
.first-run-guide strong { color: #abf3df; font-size: .83rem; }
.first-run-guide p { margin: 7px 0 0; }
.access-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.sidebar-note strong { color: #e7f4f0; }

/* ---------- Reader drawer ---------- */
.reader {
  --reader-pad: clamp(20px, 3.5vw, 44px);
  --reader-measure: 100%;
  background: linear-gradient(190deg, #0f2026, var(--surface) 42%);
  border: 0;
  border-left: 1px solid var(--border-strong);
  color: #edf5f3;
  height: 100vh;
  margin: 0 0 0 auto;
  max-height: 100vh;
  max-width: min(860px, 100%);
  overflow: auto;
  padding: 0;
  width: 100%;
}
.reader::backdrop { backdrop-filter: blur(2px); background: #000b; }
/* With the sidebar hidden the source takes the whole window; its text stays in a readable centered column. */
body[data-sidebar="hidden"] .reader { --reader-measure: 920px; border-left: 0; max-width: 100%; }
body[data-sidebar="hidden"] .reader[open] { animation: reader-in .2s ease; }
@keyframes reader-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reader-head, .reader-pane { padding-inline: max(var(--reader-pad), calc((100% - var(--reader-measure)) / 2)); }
.reader-head { background: #0d1b20f0; backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding-block: 20px 0; position: sticky; top: 0; z-index: 5; }
.reader-toolbar { align-items: center; display: flex; gap: 12px; justify-content: space-between; }
.reader-toolbar .eyebrow { margin: 0; }
.reader h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.25; margin: 12px 0 14px; overflow-wrap: anywhere; }
.reader-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 -4px; }
.reader-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  color: var(--muted-strong);
  font-size: .84rem;
  font-weight: 620;
  min-height: 42px;
  padding: 8px 14px;
}
.reader-tab:hover { background: #ffffff0a; color: #fff; }
.reader-tab.is-active { border-bottom-color: var(--accent); color: var(--text); }
.reader-pane { display: none; padding-block: 22px 44px; }
.reader-pane.is-active { display: block; }
.reader h3 { border-top: 1px solid var(--border); font-size: 1.02rem; margin-top: 26px; padding-top: 22px; }
.reader-pane > h3:first-child, .reader-selection h3 { border-top: 0; margin-top: 0; padding-top: 0; }
.reader-summary, .reader-notice { color: var(--muted-strong); line-height: 1.65; }
.reader-notice { font-size: .83rem; }
.reader-details { border-top: 1px solid var(--border); display: grid; font-size: .83rem; grid-template-columns: 140px minmax(0, 1fr); line-height: 1.6; }
.reader-details dt, .reader-details dd { border-bottom: 1px solid var(--border); margin: 0; overflow-wrap: anywhere; padding: 10px 0; }
.reader-details dt { color: var(--muted); padding-right: 15px; }
.reader-details a { color: var(--accent); overflow-wrap: anywhere; }
.reader-content { line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.original-link { align-items: center; display: inline-flex; margin-top: 12px; text-decoration: none; }
.reader-format-toggle { display: flex; gap: 6px; margin-bottom: 16px; }
.toggle-chip { border-radius: 99px; font-size: .78rem; min-height: 34px; padding: 5px 14px; }
.toggle-chip.is-active { background: var(--accent-soft); border-color: var(--accent-edge); color: var(--text); }

/* Markdown viewer */
.reader-markdown { line-height: 1.7; overflow-wrap: anywhere; }
.reader-markdown > :first-child { margin-top: 0; }
.reader-markdown h1, .reader-markdown h2, .reader-markdown h3, .reader-markdown h4, .reader-markdown h5, .reader-markdown h6 {
  border: 0; font-family: var(--heading-font); line-height: 1.3; margin: 1.5em 0 .55em; padding: 0;
}
.reader-markdown h1 { font-size: 1.65rem; letter-spacing: -.02em; }
.reader-markdown h2 { border-bottom: 1px solid var(--border); font-size: 1.32rem; padding-bottom: .3em; }
.reader-markdown h3 { font-size: 1.12rem; }
.reader-markdown h4, .reader-markdown h5, .reader-markdown h6 { font-size: 1rem; }
.reader-markdown p { margin: .75em 0; }
.reader-markdown ul, .reader-markdown ol { margin: .7em 0; padding-left: 26px; }
.reader-markdown li { margin: .3em 0; }
.reader-markdown blockquote { border-left: 3px solid var(--accent); color: var(--muted-strong); margin: 1em 0; padding: 2px 0 2px 16px; }
.reader-markdown pre { background: var(--ink-deep); border: 1px solid var(--border); border-radius: 9px; font-size: .84rem; line-height: 1.6; margin: 1em 0; overflow: auto; padding: 14px; }
.reader-markdown code { background: #ffffff0f; border-radius: 5px; font-size: .86em; padding: 2px 6px; }
.reader-markdown pre code { background: transparent; border-radius: 0; padding: 0; }
.reader-markdown hr { border: 0; border-top: 1px solid var(--border-strong); margin: 1.6em 0; }
.reader-markdown table { border-collapse: collapse; display: block; font-size: .86rem; margin: 1em 0; max-width: 100%; overflow-x: auto; }
.reader-markdown th, .reader-markdown td { border: 1px solid var(--border-strong); padding: 7px 12px; text-align: left; }
.reader-markdown th { background: #0a171c; }
.reader-markdown a { color: var(--accent); }

#located-text-state { color: var(--muted-strong); font-size: .83rem; line-height: 1.55; }
.located-text-list { display: grid; gap: 12px; }
.located-unit { background: #0a171c; border: 1px solid var(--border); border-radius: 9px; padding: 14px; }
.located-unit strong { color: var(--accent); display: block; font-size: .8rem; margin-bottom: 8px; overflow-wrap: anywhere; }
.located-unit pre { font: inherit; line-height: 1.6; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
#load-more-units { margin-top: 16px; }
.citation-form label { display: block; font-size: .83rem; font-weight: 650; margin-bottom: 9px; }
.citation-row { display: flex; flex-wrap: wrap; gap: 10px; }
.citation-row input { flex: 1 1 180px; }
#citation-state { color: var(--muted-strong); font-size: .83rem; line-height: 1.55; overflow-wrap: anywhere; }
.reader-selection p { color: var(--muted-strong); font-size: .85rem; line-height: 1.55; }

/* Governance / publication inside reader */
.governance-panel { min-width: 0; }
.governance-details { margin-top: 14px; }
.governance-actions { align-items: baseline; display: flex; flex-wrap: wrap; gap: 10px; }
.governance-history { display: grid; gap: 12px; padding-left: 24px; }
.governance-history li { font-size: .83rem; line-height: 1.6; overflow-wrap: anywhere; }
.governance-history p { margin: 6px 0; white-space: pre-wrap; }
.metadata-topics { display: grid; gap: 10px; max-height: 230px; overflow: auto; }
.metadata-topics label { align-items: baseline; display: flex; gap: 9px; margin: 0; overflow-wrap: anywhere; }
.metadata-topics small { color: var(--muted); display: block; font-weight: 400; margin-top: 3px; }
.publication-panel h4 { font-size: .9rem; margin: 22px 0 12px; }
.publication-panel .publication-check { font-size: .83rem; line-height: 1.6; margin: 10px 0; }
.publication-workflows { display: grid; gap: 10px; }
.publication-workflows button { display: grid; gap: 5px; overflow-wrap: anywhere; text-align: left; width: 100%; }
.publication-workflows small { color: var(--muted); font-size: .75rem; }
.publication-actions { margin-top: 14px; }
#publication-reason { width: 100%; }
#publication-preview { margin: 14px 0; }

/* ---------- Grant & sync dialogs ---------- */
.grant-dialog { background: linear-gradient(176deg, #10222a, var(--surface) 55%); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); color: #edf5f3; max-height: 90vh; max-width: min(580px, 94vw); overflow: auto; padding: 24px 28px 28px; width: 100%; }
.grant-dialog::backdrop { backdrop-filter: blur(2px); background: #000b; }
.grant-dialog h2 { margin: 16px 0 8px; }
.grant-dialog p { color: var(--muted-strong); font-size: .82rem; line-height: 1.55; }
.grant-form { border-bottom: 1px solid var(--border); padding-bottom: 22px; }
.grant-form > label:not(.check-row) { display: block; font-size: .78rem; font-weight: 650; margin: 12px 0 6px; }
.grant-form input:not([type="checkbox"]), .grant-form select { width: 100%; }
.grant-form .check-row { margin: 13px 0; }
.grant-form button { margin-top: 8px; width: 100%; }
.sync-projects-fieldset { border: 1px solid var(--border); border-radius: 9px; margin: 18px 0; min-width: 0; padding: 12px; }
.sync-projects-fieldset legend { font-size: .83rem; font-weight: 650; padding: 0 5px; }
.sync-projects { display: grid; gap: 10px; max-height: 220px; overflow: auto; }
.sync-projects label { align-items: center; display: flex; gap: 10px; overflow-wrap: anywhere; }
.sync-projects input { height: 18px; min-height: 18px; width: 18px; }
.grant-token { background: #132b29; border: 1px solid #2b7466; border-radius: 9px; margin-top: 18px; padding: 16px; }
.grant-token code { display: block; font-size: .75rem; overflow-wrap: anywhere; padding: 12px 0; }
.hosted-client-connection { background: #132b29; border: 1px solid #2b7466; border-radius: 9px; padding: 14px; }
.hosted-client-connection code { display: block; overflow-wrap: anywhere; padding: 8px 0 12px; }
.grant-list { display: grid; gap: 10px; }
.grant-item { background: #0a171c; border: 1px solid var(--border); border-radius: 9px; display: grid; gap: 8px; padding: 14px; }
.grant-item strong, .grant-item small { overflow-wrap: anywhere; }
.grant-item small { color: var(--muted); }
.grant-item button { justify-self: start; }

/* ---------- Responsive ---------- */
@media (max-width: 1150px) {
  .header-actions { gap: 8px; }
  .connection-state { max-width: 150px; font-size: .73rem; }
  .project-switch-label { display: none; }
}
@media (max-width: 900px) {
  .dashboard-map-layout { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: minmax(0, 1fr); position: relative; }
  .rail { position: fixed; top: var(--header-height); bottom: 0; left: 0; width: 280px; max-width: 85vw; height: calc(100dvh - var(--header-height)); z-index: 40; box-shadow: var(--shadow); }
  .site-header { gap: 8px; flex-wrap: wrap; padding: 8px 16px; }
  .header-actions { flex: 1; }
  .connection-state { order: 3; flex-basis: 100%; max-width: none; font-size: .7rem; line-height: 1.2; border: 0; padding: 0; }
  .gate { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "auth" "context"; max-width: 560px; }
}
@media (max-width: 560px) {
  .dashboard-summary { grid-template-columns: 1fr; }
  .site-header { min-height: 0; position: sticky; }
  .identity { width: 100%; justify-content: space-between; }
  .identity-logo { width: 146px; max-width: 45%; }
  .header-actions { justify-content: space-between; width: 100%; min-width: 0; }
  .project-switch { flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; }
  .project-switch select { max-width: 100%; width: 100%; min-width: 0; border-color: var(--border); }
  .views { padding: 24px 16px 40px; }
  .collection-heading { gap: 8px; }
  .collection-heading .count-badge { border: 0; padding: 0; }
  .collection-heading .eyebrow { display: none; }
  .library-filters { flex-wrap: wrap; gap: 8px; }
  .category-filter { flex: 1; }
  .category-filter > summary { padding: 10px; }
  .category-filter > summary span { display: block; margin: 4px 0 0; }
  .result-layout button { padding-inline: 10px; }
  .results[data-layout="list"] .result-card > button { padding: 14px 12px; }
  .reader-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .reader-tab { flex: 0 0 auto; padding-inline: 12px; }
  .gate { margin-top: 28px; padding-inline: 20px; }
  .search-row { gap: 8px; }
  .search-row .primary-button { padding-inline: 14px; }
  .collection-heading { align-items: flex-start; flex-direction: column; }
  .reader-details { grid-template-columns: 100px minmax(0, 1fr); }
  .coverage-heading { align-items: flex-start; }
  .result-card > button { grid-template-columns: 20px minmax(0, 1fr); }
  .result-card .tag { grid-column: 2; grid-row: auto; justify-self: start; }
}
@media (max-width: 360px) {
  .site-header { padding-inline: 12px; }
  .views { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .view.is-active, body[data-sidebar="hidden"] .reader[open] { animation: none; }
  * { transition: none !important; }
}
