:root {
  color: #e7efec;
  background: #10171c;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  line-height: 1.45;
  --canvas: #10171c; --sidebar: #0c1216; --panel: #151f25; --panel-raised: #1b272e;
  --line: #2c3b43; --line-strong: #42545b; --ink: #e7efec; --soft: #b3c0be;
  --muted: #829492; --faint: #596b6c; --accent: #72d7c5; --accent-strong: #a2eddf;
  --success: #80c99a; --warning: #e0b06a; --document: #edf1ef; --document-ink: #26353a;
  --document-muted: #66787a;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; transition: border-color .16s ease, background-color .16s ease, color .16s ease; }
button:focus-visible, input:focus-visible, select:focus-visible, .result:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 216px minmax(0, 1fr); background: var(--canvas); }
.sidebar { min-height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--accent); border-radius: 4px; color: var(--accent); font-family: Consolas, monospace; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.brand strong { display: block; color: var(--ink); font-size: 14px; letter-spacing: 0; }
.brand small, .session-card small { display: block; margin-top: 2px; color: var(--faint); font-family: Consolas, monospace; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: grid; gap: 3px; padding: 16px 10px 10px; }
.nav-label, .source-status-head { color: var(--faint); font-family: Consolas, monospace; font-size: 9px; letter-spacing: .1em; }
.nav-label { padding: 3px 8px 7px; }
.nav-item { width: 100%; border: 1px solid transparent; border-radius: 3px; padding: 8px 9px; color: var(--muted); background: transparent; text-align: left; font-size: 12px; }
.nav-item:hover, .nav-item.active { border-color: var(--line); color: var(--ink); background: var(--panel); }
.nav-item.active { border-left-color: var(--accent); color: var(--accent); }
.source-status { min-height: 0; flex: 1; overflow: auto; margin: 8px 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.source-status-head { display: flex; justify-content: space-between; padding: 0 6px 8px; }
.source-list { display: grid; gap: 2px; }
.source-entry { display: grid; grid-template-columns: minmax(0, 1fr) 26px; gap: 2px; align-items: stretch; }
.source-row { display: grid; grid-template-columns: 7px minmax(0, 1fr); gap: 7px; align-items: center; width: 100%; min-height: 30px; border: 1px solid transparent; border-radius: 2px; padding: 4px 6px; color: var(--soft); background: transparent; text-align: left; font-size: 11px; }
.source-row:hover, .source-row.is-filtered { border-color: #383838; background: var(--panel); }
.source-row.is-filtered { box-shadow: inset 2px 0 0 var(--accent); }
.source-query { display: inline-grid; place-items: center; min-width: 26px; border: 1px solid transparent; border-radius: 2px; padding: 0; color: var(--faint); background: transparent; }
.source-query:hover { border-color: var(--line); color: var(--accent); background: var(--panel); }
.source-query .icon { width: 13px; height: 13px; }
.source-copy { display: grid; min-width: 0; gap: 2px; }
.source-row b, .source-result-count { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-row b { color: var(--soft); font-weight: 500; }
.source-result-count { color: var(--faint); font: 9px Consolas, monospace; }
.source-dot, .presence { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.source-dot.ready, .presence.ready { background: var(--success); }
.source-dot.failed { background: var(--warning); }
.source-dot.pending { background: var(--accent); animation: source-pulse 1.1s ease-in-out infinite; }
.sidebar-empty { margin: 6px; color: var(--faint); font-size: 10px; line-height: 1.4; }
.session-card { display: grid; grid-template-columns: 7px minmax(0, 1fr); gap: 8px; align-items: start; margin: 10px; border: 1px solid var(--line); border-radius: 3px; padding: 10px; background: var(--panel); }
.session-card b { display: block; overflow: hidden; color: var(--soft); font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.presence { margin-top: 4px; }

.main-area { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 9px 22px; background: #11191e; }
.topbar-context { display: grid; gap: 1px; }
.topbar-context span, .connection, .eyebrow, .query-input > span, .filters label > span, .summary-label, .reader-kicker { color: var(--faint); font-family: Consolas, monospace; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.topbar-context b { color: var(--soft); font-size: 11px; font-weight: 500; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.connection { color: var(--muted); letter-spacing: 0; text-transform: none; }
.button { min-height: 34px; border: 1px solid var(--line-strong); border-radius: 3px; padding: 6px 10px; color: var(--soft); background: var(--panel); font-size: 11px; font-weight: 600; }
.button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--panel-raised); }
.button.primary { border-color: var(--accent); color: #09221f; background: var(--accent); }
.button.primary:hover:not(:disabled) { color: #08201d; background: var(--accent-strong); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.auth-trigger { display: inline-flex; min-width: 118px; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 0 0 1px rgba(55, 148, 255, .16); }
.auth-trigger span { font-size: 12px; line-height: 1; }
.auth-trigger[hidden] { display: none; }
.icon-button { min-height: 34px; border: 1px solid var(--line); border-radius: 3px; color: var(--soft); background: var(--panel); font-size: 10px; }
.mobile-only { display: none; }

.workbench { min-width: 0; padding: 28px clamp(18px, 3vw, 42px) 34px; }
.page-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); }
h1 { max-width: 670px; margin: 0; color: var(--ink); font-size: 25px; line-height: 1.2; letter-spacing: 0; }
.page-heading p:not(.eyebrow) { max-width: 650px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.heading-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 230px; }
.heading-meta span { border: 1px solid var(--line); border-radius: 3px; padding: 4px 6px; color: var(--muted); font-family: Consolas, monospace; font-size: 9px; text-transform: uppercase; }
.query-panel { position: relative; display: grid; gap: 9px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 4px; padding: 11px; background: var(--panel); }
.query-panel[aria-busy="true"]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--accent); content: ""; animation: query-progress 1.4s ease-in-out infinite; transform-origin: left; }
.query-input { display: grid; gap: 6px; }
.query-input input { width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 11px; outline: 0; color: var(--ink); background: #10181d; font-size: 13px; }
.query-input input::placeholder { color: var(--faint); }
.query-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(114, 215, 197, .18); }
.filters { display: flex; gap: 8px; align-items: end; }
.filters label { display: grid; flex: 1 1 170px; gap: 6px; }
.filters label, .filters select { min-width: 0; }
.filters select { width: 100%; height: 33px; border: 1px solid var(--line); border-radius: 3px; padding: 0 7px; outline: 0; color: var(--soft); background: #10181d; font-size: 11px; }
.filters select:focus { border-color: var(--accent); }
.filters .button { flex: 0 0 auto; height: 33px; min-width: 92px; white-space: nowrap; }
.async-search-option { display: flex !important; min-width: 145px; flex: 0 1 170px !important; min-height: 33px; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 3px; padding: 5px 8px; color: var(--soft); background: #10181d; cursor: pointer; }
.async-search-option input { flex: 0 0 auto; accent-color: var(--accent); }
.async-search-option span { display: grid; gap: 2px; min-width: 0; }
.async-search-option b { color: var(--ink); font: 10px Consolas, monospace; font-weight: 500; }
.async-search-option small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.async-search-option:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(114, 215, 197, .18); }
.async-search-option[hidden] { display: none !important; }
.notice { margin: 0 0 16px; border-left: 2px solid var(--warning); padding: 8px 10px; color: #edcf93; background: rgba(224, 176, 106, .08); font-size: 11px; }
.notice[data-tone="error"] { border-left-color: #df8585; color: #f0b5b5; background: rgba(223, 133, 133, .08); }
.notice[data-tone="info"] { border-left-color: var(--accent); color: var(--soft); background: rgba(114, 215, 197, .07); }
.results-summary { display: flex; justify-content: space-between; gap: 16px; align-items: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 9px 0; color: var(--muted); font-size: 11px; }
.results-summary > div { display: flex; gap: 8px; align-items: center; }
.results-summary strong { color: var(--soft); font-family: Consolas, monospace; font-size: 10px; font-weight: 500; }
#query-state { overflow: hidden; color: var(--faint); font-family: Consolas, monospace; font-size: 9px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.summary-status { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 12px; }
.stream-status { color: var(--accent); font: 9px Consolas, monospace; white-space: nowrap; }
.stream-status[data-active="true"]::before { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: var(--accent); content: ""; vertical-align: 1px; animation: stream-pulse 1.1s ease-in-out infinite; }
.stream-status[data-state="cancelled"] { color: var(--warning); }
.cancel-search { display: inline-flex; min-height: 28px; align-items: center; gap: 5px; padding: 4px 8px; color: var(--soft); font-size: 10px; }
.cancel-search .icon { width: 13px; height: 13px; }
.cancel-search:hover:not(:disabled) { border-color: var(--warning); color: var(--warning); }
.content-grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 38%); min-height: 500px; border-bottom: 1px solid var(--line); }
.results-pane { min-width: 0; max-height: calc(100vh - 315px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; border-right: 1px solid var(--line); }
.result-list { display: grid; }
.result { position: relative; display: grid; gap: 7px; width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 15px 16px; color: inherit; background: transparent; text-align: left; }
.result.result-arriving { animation: result-arrive .18s ease-out both; }
.result:hover, .result.selected { background: #142027; }
.result.selected::before { position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--accent); content: ""; }
.result-meta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--muted); font-family: Consolas, monospace; font-size: 9px; }
.result-source { color: var(--accent); font-weight: 700; }
.result h2 { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.35; }
.result p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--soft);
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.result-footer { display: flex; justify-content: space-between; gap: 10px; color: var(--faint); font-size: 10px; }
.result-footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { display: grid; min-height: 260px; place-items: center; align-content: center; gap: 6px; padding: 24px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--soft); font-size: 12px; }
.empty-state span { max-width: 31ch; font-size: 11px; }
.reader { min-width: 0; max-height: calc(100vh - 315px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; background: var(--document); color: var(--document-ink); }
.mobile-reader { display: none; }
.reader-empty { display: grid; min-height: 100%; align-content: center; gap: 8px; padding: 26px; color: var(--document-muted); }
.reader-kicker { color: #758c88; }
.reader-empty strong { color: var(--document-ink); font-size: 14px; }
.reader-empty p { max-width: 33ch; margin: 0; font-family: Georgia, serif; font-size: 13px; line-height: 1.55; }
.reader-document { display: grid; gap: 18px; padding: 0 clamp(22px, 3vw, 38px) 42px; }
.reader-meta { display: flex; gap: 7px; flex-wrap: wrap; color: var(--document-muted); font-family: Consolas, monospace; font-size: 9px; }
.reader-document > .reader-meta { margin-top: 28px; }
.reader-source { color: #2e756a; font-weight: 700; }
.reader-document h2 { margin: 0; color: var(--document-ink); font-family: "Times New Roman", Times, serif; font-size: 30px; font-weight: 700; line-height: 1.22; }
.reader-tabs { display: flex; gap: 12px; border-bottom: 1px solid #cbd6d2; }
.reader-tabs span { border-bottom: 2px solid #3e9588; padding: 0 0 8px; color: #2e756a; font-family: Consolas, monospace; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.reader-body { max-width: 72ch; color: #28383b; font-family: "Times New Roman", Times, serif; font-size: 17px; line-height: 1.72; }
.reader-body p { margin: 0; white-space: pre-line; }
.reader-body .reader-lead { text-align: left; }
.reader-details { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 2fr); gap: 7px 12px; border-top: 1px solid #cbd6d2; padding-top: 14px; color: var(--document-muted); font-family: Consolas, monospace; font-size: 9px; }
.reader-details b { overflow-wrap: anywhere; color: var(--document-ink); font-weight: 500; }
.reader-source-link { width: fit-content; color: #1f665d; font-family: Consolas, monospace; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.backdrop { display: none; }
.auth-dialog { width: min(420px, calc(100vw - 28px)); margin: auto; border: 1px solid var(--line-strong); border-radius: 5px; padding: 0; color: var(--ink); background: var(--panel); box-shadow: 0 24px 70px rgba(0, 0, 0, .52); }
.auth-dialog::backdrop { background: rgba(5, 9, 11, .72); }
.auth-modal { display: grid; gap: 22px; padding: 22px; }
.auth-modal-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.auth-modal h2 { margin: 0; color: var(--ink); font-size: 19px; line-height: 1.3; }
.api-key-modal { width: min(620px, calc(100vw - 32px)); }
.api-key-form { display: grid; grid-template-columns: 1fr 150px auto; gap: 10px; align-items: end; }
.api-key-form label { display: grid; gap: 6px; }
.api-key-form label > span { color: var(--muted); font: 10px/1.2 var(--mono); letter-spacing: .08em; }
.api-key-secret { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--accent); background: rgba(38, 166, 154, .08); }
.api-key-secret code { overflow-wrap: anywhere; color: var(--ink); font: 12px/1.5 var(--mono); user-select: all; }
.api-key-list { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.api-key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.api-key-row div { display: grid; gap: 4px; min-width: 0; }
.api-key-row small { color: var(--muted); font: 11px/1.4 var(--mono); overflow-wrap: anywhere; }
.dialog-close { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border: 1px solid var(--line); border-radius: 3px; padding: 0; color: var(--soft); background: transparent; font-size: 20px; line-height: 1; }
.dialog-close:hover { border-color: var(--accent); color: var(--accent); background: var(--panel-raised); }
.provider-list { display: grid; gap: 9px; }
.provider-button { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; width: 100%; align-items: center; border: 1px solid var(--line-strong); border-radius: 4px; padding: 11px; color: var(--soft); background: #11191e; text-align: left; text-decoration: none; }
.provider-button:hover:not(:disabled) { border-color: var(--accent); background: var(--panel-raised); }
.provider-button[aria-disabled="true"] { cursor: not-allowed; opacity: .52; pointer-events: none; }
.provider-button:disabled { cursor: not-allowed; opacity: .52; }
.provider-button b, .provider-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-button b { color: var(--ink); font-size: 12px; font-weight: 600; }
.provider-button small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.provider-mark { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line-strong); border-radius: 3px; font-family: Consolas, monospace; font-size: 13px; font-weight: 700; }
.oracle-mark { color: #f4b183; }
.microsoft-mark { color: #79b8f3; }

@media (max-width: 980px) { .workspace { grid-template-columns: 188px minmax(0, 1fr); } .content-grid { grid-template-columns: minmax(0, 1fr); } .results-pane { border-right: 0; } .reader { min-height: 380px; border-top: 1px solid var(--line); } }
@media (max-width: 700px) { .workspace { display: block; } .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: min(250px, 82vw); transform: translateX(-102%); transition: transform .18s ease; box-shadow: 20px 0 40px rgba(0, 0, 0, .35); } .sidebar.open { transform: translateX(0); } .backdrop.visible { position: fixed; inset: 0; z-index: 9; display: block; background: rgba(5, 9, 11, .55); } .mobile-only { display: inline-grid; place-items: center; } .topbar { padding: 9px 14px; } .topbar-context { flex: 1; } .connection { display: none; } .workbench { padding: 22px 14px 30px; } .page-heading { display: block; margin-bottom: 18px; } .heading-meta { justify-content: flex-start; margin-top: 13px; } h1 { font-size: 22px; } .filters { display: grid; grid-template-columns: 1fr 1fr; } .filters .button { grid-column: 1 / -1; } .results-summary { align-items: flex-start; flex-direction: column; } .summary-status { width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 5px 10px; } #query-state { max-width: 100%; text-align: left; } .reader { min-height: 330px; } }
@media (prefers-reduced-motion: reduce) { .sidebar, button { transition: none; } }

/* Workbench tokens and layout follow the density and focus model of VS Code Web. */
:root {
  color: #cccccc;
  background: #181818;
  font-family: "Segoe UI", system-ui, sans-serif;
  --canvas: #1e1e1e; --sidebar: #181818; --panel: #252526; --panel-raised: #2d2d30;
  --line: #333333; --line-strong: #454545; --ink: #f1f1f1; --soft: #c8c8c8;
  --muted: #9d9d9d; --faint: #858585; --accent: #3794ff; --accent-strong: #75beff;
  --success: #89d185; --warning: #cca700; --document: #f3f3f3; --document-ink: #242424;
  --document-muted: #616161;
}

body { background: var(--canvas); }
.workspace { grid-template-columns: 44px 236px minmax(0, 1fr); background: var(--canvas); }
.activity-bar { display: flex; min-height: 100vh; flex-direction: column; align-items: center; border-right: 1px solid #292929; background: #181818; }
.activity-brand { display: grid; width: 44px; height: 56px; place-items: center; border-bottom: 1px solid #292929; color: var(--accent); font: 700 11px Consolas, monospace; letter-spacing: .08em; }
.activity-nav { display: grid; width: 100%; gap: 2px; padding-top: 8px; }
.activity-item { position: relative; display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-left: 2px solid transparent; color: #858585; background: transparent; font: 12px Consolas, monospace; }
.activity-item:hover, .activity-item.active { color: #e7e7e7; background: #252526; }
.activity-item.active { border-left-color: var(--accent); }
.activity-bottom { margin-top: auto; margin-bottom: 8px; }
.brand { padding: 17px 14px; }
.brand-mark { border-color: var(--accent); color: var(--accent); }
.nav { padding: 14px 8px 10px; }
.nav-item { border-radius: 2px; padding: 8px 10px; color: #b8b8b8; }
.nav-item small { float: right; color: #6d6d6d; font-size: 9px; }
.nav-item:hover:not(:disabled), .nav-item.active { border-color: #383838; color: #f1f1f1; background: #252526; }
.nav-item.active { border-left-color: var(--accent); color: #75beff; }
.nav-item:disabled { cursor: default; opacity: .5; }
.source-status { margin-inline: 8px; }
.session-card { margin: 8px; border-radius: 2px; background: #252526; }
.topbar { min-height: 56px; padding-inline: 18px; background: #181818; }
.topbar-context b { color: #cccccc; }
.topbar-context span { color: #858585; }
.command-button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #3c3c3c; border-radius: 2px; padding: 5px 9px; color: #9d9d9d; background: #252526; font-size: 11px; }
.command-button:hover { border-color: #6b6b6b; color: #f1f1f1; }
kbd { border: 1px solid #4b4b4b; border-radius: 2px; padding: 1px 4px; color: #bdbdbd; background: #1e1e1e; font: 10px Consolas, monospace; }
.button { border-radius: 2px; color: #cccccc; background: #252526; }
.button:hover:not(:disabled) { border-color: var(--accent); color: #ffffff; background: #2a2d2e; }
.button.primary { border-color: #3794ff; color: #ffffff; background: #0e639c; }
.button.primary:hover:not(:disabled) { background: #1177bb; }
.workbench { padding-top: 24px; }
.eyebrow { color: #75beff; }
h1 { font-size: 24px; font-weight: 600; }
.page-heading p:not(.eyebrow) { color: #a0a0a0; }
.heading-meta span { border-radius: 2px; color: #9d9d9d; }
.query-panel { border-radius: 2px; background: #252526; }
.query-input input, .filters select { border-radius: 2px; background: #1e1e1e; }
.query-input input:focus, .filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(55, 148, 255, .35); }
.results-summary { border-color: #333333; }
.results-summary strong { color: #cccccc; }
.result:hover, .result.selected { background: #252526; }
.result.selected::before { background: var(--accent); }
.result-source { color: #75beff; }
.reader { background: #f3f3f3; }
.pagination { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 12px; border-bottom: 1px solid var(--line); }
.pagination[hidden] { display: none; }
.pagination .button { min-height: 30px; padding: 5px 10px; font-size: 11px; }
.page-status { color: var(--muted); font: 11px Consolas, monospace; }
.page-status strong { color: var(--ink); }
.search-form[aria-busy="true"] #search { cursor: wait; }

@media (max-width: 980px) { .workspace { grid-template-columns: 44px 188px minmax(0, 1fr); } }
@media (max-width: 980px) { .results-pane, .reader { max-height: none; overflow: visible; scrollbar-gutter: auto; } }
@media (max-width: 700px) { .workspace { display: block; } .activity-bar { display: none; } .auth-trigger { min-width: 0; } }
@media (max-width: 700px) { .api-key-form { grid-template-columns: 1fr; } }

/* Responsive shell: keep the application viewport stable and localize scrolling. */
html { min-width: 320px; min-height: 100%; background: var(--canvas); }
body { min-width: 320px; min-height: 100%; overflow: hidden; }
.workspace { height: 100dvh; min-height: 0; overflow: hidden; }
.activity-bar, .sidebar, .main-area { min-height: 0; height: 100%; }
.sidebar { overflow: hidden; }
.main-area { overflow: hidden; }
.workbench { min-height: 0; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.content-grid { height: clamp(440px, calc(100dvh - 315px), 720px); min-height: 0; }
.results-pane, .reader { height: 100%; max-height: none; min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; }
.source-status { min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; }
.results-summary > div, #query-state, .topbar-context, .topbar-actions { min-width: 0; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }

/* Thin rails preserve the VS Code-like density without creating a second visual gutter. */
.workbench, .source-status, .results-pane, .reader {
  scrollbar-width: thin;
  scrollbar-color: #5a5a5a transparent;
}
.workbench::-webkit-scrollbar, .source-status::-webkit-scrollbar, .results-pane::-webkit-scrollbar, .reader::-webkit-scrollbar { width: 9px; height: 9px; }
.workbench::-webkit-scrollbar-track, .source-status::-webkit-scrollbar-track, .results-pane::-webkit-scrollbar-track, .reader::-webkit-scrollbar-track { background: transparent; }
.workbench::-webkit-scrollbar-thumb, .source-status::-webkit-scrollbar-thumb, .results-pane::-webkit-scrollbar-thumb, .reader::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background-clip: padding-box; background-color: #5a5a5a; }
.workbench::-webkit-scrollbar-thumb:hover, .source-status::-webkit-scrollbar-thumb:hover, .results-pane::-webkit-scrollbar-thumb:hover, .reader::-webkit-scrollbar-thumb:hover { background-color: #787878; }

@media (max-width: 980px) {
  .content-grid { height: auto; min-height: 0; }
  .results-pane, .reader { height: auto; max-height: none; overflow: visible; scrollbar-gutter: auto; }
  .reader { min-height: 380px; }
}

@media (max-width: 700px) {
  body { overflow: hidden; }
  .workspace { display: block; height: 100dvh; }
  .activity-bar { display: none; }
  .sidebar { height: 100dvh; }
  .topbar { min-height: 56px; padding: 8px 12px; }
  .topbar-actions { gap: 6px; }
  .command-button { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .workbench { padding: 20px 12px 28px; }
  .page-heading { gap: 12px; }
  .heading-meta { max-width: none; }
  .query-panel { padding: 10px; }
  .results-summary { gap: 8px; }
  .pagination { min-height: 48px; flex-wrap: wrap; padding: 8px 0; }
  .reader { min-height: 330px; }
  .reader-document { padding: 0 18px 34px; }
  .reader-document > .reader-meta { margin-top: 24px; }
  .reader-document h2 { font-size: 26px; }
  .reader-body { font-size: 16px; }
  .content-grid > .reader { display: none; }
  .mobile-reader { display: block; grid-column: 1 / -1; margin-top: 8px; border: 1px solid #cbd6d2; background: #f3f3f3; color: var(--document-ink); }
  .mobile-reader[hidden] { display: none; }
  .mobile-reader .reader-document { padding: 0 18px 30px; }
  .mobile-reader .reader-tools { position: sticky; top: 0; margin-inline: -18px; padding-inline: 18px; }
}

@media (max-width: 480px) {
  .main-area, .workbench, .page-heading, .query-panel, .content-grid { width: 100%; max-width: 100%; }
  .topbar { gap: 6px; }
  .topbar-context { flex: 1 1 auto; max-width: none; overflow: hidden; }
  .topbar-context span, .topbar-context b { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { flex: 0 0 auto; }
  #command-palette { width: 34px; min-width: 34px; max-width: 34px; padding-inline: 5px; overflow: hidden; font-size: 0; }
  #command-palette::before { color: var(--soft); content: "/"; font: 12px Consolas, monospace; }
  #command-palette kbd { display: none; }
  .auth-trigger { min-width: 34px; padding-inline: 8px; font-size: 0; }
  .auth-trigger span { font-size: 12px; }
  h1 { width: 100%; max-width: none; font-size: 22px; overflow-wrap: anywhere; white-space: normal; }
  .reader-document h2 { font-size: 24px; }
  .page-heading p:not(.eyebrow) { max-width: none; }
  .filters { grid-template-columns: 1fr; }
  .filters .button { grid-column: auto; width: 100%; }
  .query-input input, .filters select { min-width: 0; }
  .results-summary > div { flex-wrap: wrap; }
  .page-status { text-align: center; }
  .reader-details { grid-template-columns: 1fr; gap: 3px; }
  .reader-details b { margin-bottom: 5px; }
}

/* Vector controls and institutional identity refinements. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: inline-block; width: 16px; height: 16px; flex: 0 0 16px; vertical-align: middle; }
.activity-item .icon { width: 18px; height: 18px; }
.activity-brand { font-family: "Segoe UI", system-ui, sans-serif; font-size: 10px; letter-spacing: .12em; }
.icon-button { display: inline-grid; place-items: center; width: 34px; padding: 0; }
.institution-context { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.institution-context img { width: 78px; height: 32px; flex: 0 0 78px; object-fit: contain; object-position: center; }
.institution-context span { display: grid; gap: 1px; min-width: 0; }
.institution-context small { color: #858585; font: 9px Consolas, monospace; letter-spacing: .06em; }
.topbar-context { gap: 2px; }
.topbar-context > b { margin-left: 30px; }
.command-button, .auth-trigger, #logout, .search-action, .pagination-action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.command-button .icon, .auth-trigger .icon, #logout .icon, .search-action .icon, .pagination-action .icon { width: 14px; height: 14px; }
.auth-trigger { min-width: 132px; min-height: 36px; border-color: #4aa3ff; box-shadow: 0 0 0 1px rgba(55, 148, 255, .12), 0 5px 14px rgba(0, 0, 0, .16); font-weight: 650; }
.auth-trigger:hover:not(:disabled) { border-color: #9dceff; box-shadow: 0 0 0 1px rgba(117, 190, 255, .25), 0 7px 18px rgba(0, 0, 0, .22); }
.search-action { min-width: 104px; font-weight: 650; }
.pagination-action { min-width: 92px; }
.pagination-action:disabled { opacity: .35; }
.auth-modal { gap: 18px; padding: 24px; }
.auth-identity { display: flex; align-items: center; gap: 11px; border-bottom: 1px solid #333; padding-bottom: 16px; }
.auth-identity img { width: 100px; height: 50px; flex: 0 0 100px; object-fit: contain; object-position: center; }
.auth-identity div { display: grid; gap: 2px; }
.auth-identity small { color: #858585; font: 9px Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }
.auth-subtitle { max-width: 34ch; margin: 7px 0 0; color: #9d9d9d; font-size: 11px; line-height: 1.5; }
.provider-button { min-height: 58px; transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.provider-button:hover:not(:disabled) { border-color: #75beff; box-shadow: 0 5px 18px rgba(0, 0, 0, .18); transform: translateY(-1px); }
.provider-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 3px; }
.oracle-mark { color: #f3c35c; border-color: #7f6a38; font-family: Georgia, serif; font-size: 16px; }
.microsoft-mark { position: relative; grid-template-columns: repeat(2, 7px); grid-template-rows: repeat(2, 7px); gap: 2px; border-color: #4b5662; }
.microsoft-mark::before, .microsoft-mark::after { width: 7px; height: 7px; background: #f35325; box-shadow: 9px 0 #81bc06, 0 9px #05a6f0, 9px 9px #ffba08; content: ""; }
.microsoft-mark::after { display: none; }
.auth-security-note { display: flex; gap: 7px; align-items: flex-start; margin: 0; border-top: 1px solid #333; padding-top: 13px; color: #858585; font-size: 10px; line-height: 1.45; }
.auth-security-note .icon { width: 14px; height: 14px; flex: 0 0 14px; color: #75beff; }
.reader-document { --reader-zoom: 1; }
.reader-tools { position: sticky; top: 0; z-index: 5; display: flex; min-height: 36px; align-items: center; gap: 5px; margin: 0 calc(clamp(22px, 3vw, 38px) * -1) 2px; border-bottom: 1px solid #d1d9d6; padding: 7px clamp(22px, 3vw, 38px); background: #f3f3f3; box-shadow: 0 1px 0 rgba(39, 55, 58, .08); }
.reader-tools-label { margin-right: auto; color: #758c88; font: 9px Consolas, monospace; letter-spacing: .1em; }
.reader-tool, .reader-zoom-reset { display: inline-grid; min-width: 28px; height: 27px; place-items: center; border: 1px solid #c5cfcc; border-radius: 2px; padding: 0 7px; color: #40565a; background: transparent; font: 10px Consolas, monospace; }
.reader-tool .icon { width: 15px; height: 15px; }
.reader-tool:hover:not(:disabled), .reader-zoom-reset:hover { border-color: #3e9588; color: #1d665d; background: #e8efec; }
.reader-tool:disabled { cursor: not-allowed; opacity: .4; }
.reader-zoom-label { min-width: 38px; color: #40565a; font: 10px Consolas, monospace; text-align: center; }
.reader-document h2 { font-size: calc(30px * var(--reader-zoom)); }
.reader-body { font-size: calc(17px * var(--reader-zoom)); }
.reader-details { font-size: calc(9px * var(--reader-zoom)); }
.reader-source-link { display: inline-flex; align-items: center; gap: 5px; }
.reader-source-link .icon { width: 13px; height: 13px; }

@keyframes source-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes query-progress { 0% { opacity: .35; transform: scaleX(.08); } 55% { opacity: 1; transform: scaleX(.68); } 100% { opacity: .35; transform: scaleX(.96); } }
@keyframes stream-pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes result-arrive { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 700px) {
  .topbar-context > b { display: none; }
  .institution-context img { width: 68px; height: 28px; flex-basis: 68px; }
  .auth-modal { padding: 20px; }
  .reader-tools { margin-inline: -18px; padding-inline: 18px; }
}

@media (max-width: 480px) {
  .institution-context small { display: none; }
  .institution-context small { font-size: 8px; }
  .command-button { gap: 0; }
  .command-button span { display: none; }
  .command-button .icon { width: 16px; height: 16px; }
  .auth-trigger { min-width: 36px; padding-inline: 8px; }
  .auth-trigger span, #logout span { display: none; }
  .search-action { width: 100%; }
}

@media (max-width: 1200px) and (min-width: 701px) {
  .assistant-open .content-grid { grid-template-columns: minmax(0, 1fr); }
  .assistant-open .results-pane { border-right: 0; }
  .assistant-open .reader { min-height: 380px; border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  .source-dot.pending, .query-panel[aria-busy="true"]::after, .stream-status[data-active="true"]::before, .result.result-arriving { animation: none; }
}

/* AI activity panel: a docked secondary sidebar in the VS Code Web idiom. */
.assistant-panel { position: fixed; inset: 56px 0 0 auto; z-index: 7; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; width: min(380px, 42vw); min-width: 320px; border-left: 1px solid #3b3b3b; color: var(--soft); background: #181818; box-shadow: -14px 0 30px rgba(0, 0, 0, .22); }
.assistant-open .main-area { margin-right: min(380px, 42vw); }
.mobile-assistant-nav { display: none; }
.assistant-panel[hidden] { display: none; }
.assistant-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 15px 16px 13px; background: #1e1e1e; }
.assistant-panel-title { display: flex; min-width: 0; gap: 9px; align-items: center; }
.assistant-panel-title h2 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.assistant-panel-title .eyebrow { margin: 0 0 3px; font-size: 8px; }
.assistant-panel-icon { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #466f9e; color: #75beff; background: #202a35; }
.assistant-panel-icon .icon { width: 16px; height: 16px; }
.assistant-context { display: grid; gap: 4px; border-bottom: 1px solid var(--line); padding: 12px 16px; background: #252526; }
.assistant-context-label { color: var(--faint); font: 8px Consolas, monospace; letter-spacing: .1em; }
.assistant-context strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.assistant-context small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.assistant-messages { min-height: 0; overflow: auto; padding: 14px 16px; scrollbar-width: thin; scrollbar-color: #5a5a5a transparent; }
.assistant-empty { display: grid; min-height: 190px; place-items: center; align-content: center; gap: 9px; color: var(--muted); text-align: center; }
.assistant-empty .icon { width: 27px; height: 27px; color: #75beff; }
.assistant-empty strong { max-width: 28ch; color: var(--soft); font-size: 12px; }
.assistant-empty span { max-width: 34ch; font-size: 10px; line-height: 1.5; }
.assistant-message { display: grid; gap: 9px; margin-bottom: 14px; border-left: 2px solid #466f9e; padding: 11px 12px; background: #252526; }
.assistant-message[data-role="user"] { border-left-color: #5c5c5c; background: #202020; }
.assistant-message-label { color: var(--faint); font: 8px Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.assistant-message-body { color: var(--soft); font-size: 11px; line-height: 1.62; white-space: pre-wrap; }
.assistant-section { display: grid; gap: 5px; border-top: 1px solid #363636; padding-top: 8px; }
.assistant-section-title { margin: 0; color: #b8cbe0; font: 9px Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.assistant-key-points { display: grid; gap: 4px; margin: 0; padding-left: 16px; color: var(--soft); font-size: 10px; line-height: 1.5; }
.assistant-terms { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; margin: 0; font-size: 10px; line-height: 1.45; }
.assistant-terms dt { color: #d2dbe5; font-weight: 600; }
.assistant-terms dd { margin: 0; color: var(--muted); }
.assistant-next-list { display: grid; gap: 4px; }
.assistant-next-question { border: 1px solid #3b4c5d; padding: 5px 7px; color: #9cc9ef; background: #202a35; font-size: 10px; line-height: 1.35; text-align: left; cursor: pointer; }
.assistant-next-question:hover { border-color: #75beff; background: #263746; }
.assistant-limitations { margin: 0; padding-left: 17px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.assistant-citations { display: grid; gap: 5px; }
.assistant-citation { display: flex; min-width: 0; align-items: center; gap: 5px; border: 1px solid transparent; padding: 4px 5px; color: #75beff; background: transparent; font: 9px Consolas, monospace; text-align: left; }
.assistant-citation:hover { border-color: #466f9e; background: #202a35; }
.assistant-citation span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-citations-more { display: grid; gap: 4px; }
.assistant-citations-more summary { padding: 3px 5px; color: #8ab7da; font: 9px Consolas, monospace; cursor: pointer; }
.assistant-citations-more summary:hover { color: #b8dcfa; }
.assistant-composer { border-top: 1px solid var(--line); padding: 10px 12px 12px; background: #1e1e1e; }
.assistant-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.assistant-actions .button { min-height: 28px; padding: 4px 8px; font-size: 10px; }
.assistant-form { display: grid; gap: 8px; }
.assistant-form label { display: grid; gap: 5px; }
.assistant-form label > span { color: var(--faint); font: 8px Consolas, monospace; letter-spacing: .1em; }
.assistant-form textarea { width: 100%; resize: vertical; min-height: 52px; border: 1px solid var(--line-strong); border-radius: 2px; padding: 7px 8px; outline: 0; color: var(--soft); background: #111111; font-size: 11px; line-height: 1.4; }
.assistant-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(55, 148, 255, .25); }
.assistant-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.assistant-form-foot small { color: var(--faint); font-size: 9px; }
.assistant-form-foot .button { min-height: 30px; }
.activity-item[data-active="true"] { border-left-color: #3794ff; color: #75beff; background: #252526; }
.reader-assistant-tools { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid #cbd6d2; padding-bottom: 12px; }
.reader-assistant-tools .button { min-height: 29px; padding: 5px 8px; color: #2f5d77; background: #edf3f1; font-size: 10px; }
.reader-assistant-tools .button:hover:not(:disabled) { border-color: #3e9588; color: #1d665d; background: #e1ece8; }
.reader-assistant-tools .button[data-selected="true"] { border-color: #3e9588; color: #1d665d; background: #d5e9e3; }

@media (max-width: 700px) {
  .assistant-panel { inset: 56px 0 0 auto; width: min(100vw, 380px); min-width: 0; }
  .assistant-open .main-area { margin-right: 0; }
  .mobile-assistant-nav { display: inline-grid; place-items: center; color: #75beff; }
  .assistant-panel-head { padding-inline: 13px; }
  .assistant-messages { padding-inline: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-panel { transition: none; }
}

/* Minimal monochrome institutional mark and aligned workbench context. */
.topbar-context { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; gap: 14px; overflow: hidden; }
.topbar-context > b { min-width: 0; margin-left: 0; overflow: hidden; color: #cccccc; font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.institution-context { flex: 0 0 auto; gap: 8px; border-right: 1px solid #3a3a3a; padding-right: 14px; }
.institution-mark { display: block; width: 28px; height: 34px; flex: 0 0 28px; color: #f1f1f1; }
.institution-mark-frame { overflow: hidden; position: relative; }
.institution-mark-frame img { display: block; width: 100%; height: auto; }
.auth-mark { width: 54px; height: 66px; flex-basis: 54px; color: #f1f1f1; }
.auth-mark img { width: 100%; height: auto; }
.auth-identity { align-items: center; }
.auth-identity small { color: #858585; }

/* The query row fills the panel while reserving a stable action column. */
.query-panel { width: 100%; }
.filters { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, .9fr) auto; gap: 8px; align-items: end; }
.filters label { width: 100%; min-width: 0; }
.filters .button { width: auto; min-width: 112px; }

@media (max-width: 700px) {
  .topbar-context > b { display: block; max-width: 22ch; }
  .institution-context { padding-right: 10px; }
  .institution-mark { width: 26px; height: 32px; flex-basis: 26px; }
  .auth-mark { width: 52px; height: 64px; flex-basis: 52px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 480px) {
  .topbar-context > b { max-width: 13ch; font-size: 10px; }
  .institution-mark { width: 24px; height: 29px; flex-basis: 24px; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .filters .button { grid-column: auto; }
}

/* API workspace: documentation and credentials share the workbench shell. */
.api-workspace { position: fixed; inset: 56px 0 0 280px; z-index: 8; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 28px clamp(18px, 3vw, 42px) 48px; background: var(--canvas); scrollbar-width: thin; scrollbar-color: #5a5a5a transparent; }
.api-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; max-width: 1120px; margin: 0 auto 22px; }
.api-heading h1 { max-width: 720px; }
.api-heading p:not(.eyebrow) { max-width: 680px; margin: 8px 0 0; color: #a0a0a0; font-size: 12px; }
.api-heading-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.api-heading-actions .button { white-space: nowrap; }
.api-notice { max-width: 1120px; margin: 0 auto 16px; border-left: 2px solid var(--warning); padding: 9px 11px; color: #edcf93; background: rgba(204, 167, 0, .1); font-size: 11px; }
.api-notice[data-tone="info"] { border-left-color: var(--accent); color: #b9d9f6; background: rgba(55, 148, 255, .1); }
.api-notice[data-tone="error"] { border-left-color: #df8585; color: #f0b5b5; background: rgba(223, 133, 133, .1); }
.api-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; max-width: 1120px; margin: 0 auto; align-items: start; }
.api-nav { position: sticky; top: 0; display: grid; gap: 2px; border-right: 1px solid var(--line); padding: 4px 16px 12px 0; }
.api-nav-label { padding: 4px 8px 8px; color: var(--faint); font: 9px Consolas, monospace; letter-spacing: .1em; }
.api-nav-spacer { margin-top: 16px; }
.api-nav-link { border-left: 2px solid transparent; padding: 8px; color: var(--muted); font-size: 11px; text-decoration: none; }
.api-nav-link:hover, .api-nav-link:focus-visible, .api-nav-link.is-active { border-left-color: var(--accent); color: var(--ink); background: #252526; outline: none; }
.api-content { min-width: 0; }
.api-section { scroll-margin-top: 20px; border-bottom: 1px solid var(--line); padding: 8px 0 28px; margin-bottom: 28px; }
.api-section:last-child { margin-bottom: 0; }
.api-section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.api-kicker { display: block; margin-bottom: 7px; color: #75beff; font: 9px Consolas, monospace; letter-spacing: .1em; }
.api-section h2 { margin: 0; color: var(--ink); font-size: 18px; line-height: 1.3; font-weight: 600; }
.api-section-note { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.api-status { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); padding: 5px 7px; color: var(--muted); font: 9px Consolas, monospace; white-space: nowrap; text-transform: uppercase; }
.api-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.api-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 20px; border: 1px solid var(--line); background: var(--line); }
.api-step { min-width: 0; min-height: 130px; padding: 14px; background: var(--panel); }
.api-step > span { display: block; margin-bottom: 14px; color: var(--accent); font: 10px Consolas, monospace; }
.api-step strong { color: var(--ink); font-size: 12px; }
.api-step p, .api-copy { max-width: 70ch; margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.api-code-block { margin-top: 14px; border: 1px solid var(--line-strong); background: #181818; overflow: hidden; }
.api-code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 6px 9px; color: var(--faint); font: 9px Consolas, monospace; }
.api-code-block code { display: block; overflow-x: auto; padding: 13px; color: #d7e6f4; font: 11px/1.65 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.api-copy-button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; padding: 3px 5px; color: var(--muted); background: transparent; font: 10px Consolas, monospace; }
.api-copy-button:hover { border-color: var(--line-strong); color: var(--ink); background: var(--panel-raised); }
.api-copy-button .icon { width: 13px; height: 13px; }
.api-key-form { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 10px; align-items: end; margin-top: 18px; }
.api-key-form label { display: grid; min-width: 0; gap: 6px; }
.api-key-form label > span { color: var(--muted); font: 10px/1.2 Consolas, monospace; letter-spacing: .08em; }
.api-key-form input, .api-key-form select { width: 100%; height: 36px; min-width: 0; border: 1px solid var(--line-strong); border-radius: 2px; padding: 0 9px; color: var(--ink); background: #1e1e1e; font-size: 12px; }
.api-key-form input:focus, .api-key-form select:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 1px rgba(55, 148, 255, .3); }
.api-scopes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; border: 1px solid var(--line); padding: 10px; }
.api-scopes legend { padding: 0 5px; color: var(--faint); font: 9px Consolas, monospace; letter-spacing: .08em; }
.api-scopes label { display: flex; min-width: 0; gap: 8px; align-items: flex-start; border: 1px solid transparent; padding: 7px; color: var(--soft); background: #1e1e1e; font-size: 11px; }
.api-scopes label:has(input:checked) { border-color: rgba(55, 148, 255, .45); background: rgba(55, 148, 255, .08); }
.api-scopes input { flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--accent); }
.api-scopes span { display: grid; min-width: 0; gap: 3px; }
.api-scopes small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.api-key-secret { display: grid; gap: 10px; margin-top: 16px; border-left: 2px solid var(--accent); padding: 12px; color: var(--soft); background: rgba(55, 148, 255, .08); }
.api-key-secret strong { font-size: 11px; }
.api-key-secret code { overflow-wrap: anywhere; color: var(--ink); font: 11px/1.5 Consolas, monospace; user-select: all; }
.api-key-secret .button { width: fit-content; }
.api-key-list { display: grid; gap: 0; margin-top: 18px; }
.api-key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; border-top: 1px solid var(--line); padding: 13px 0; }
.api-key-row div { display: grid; min-width: 0; gap: 5px; }
.api-key-row b { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.api-key-row small { overflow-wrap: anywhere; color: var(--muted); font: 10px/1.5 Consolas, monospace; }
.api-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 18px 0 0; border: 1px solid var(--line); background: var(--line); }
.api-facts div { min-width: 0; padding: 12px; background: var(--panel); }
.api-facts dt { color: var(--faint); font: 9px Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.api-facts dd { margin: 7px 0 0; color: var(--soft); font-size: 11px; line-height: 1.35; }

@media (max-width: 800px) {
  .api-heading { display: block; }
  .api-heading-actions { justify-content: flex-start; margin-top: 16px; }
  .api-layout { grid-template-columns: 1fr; gap: 16px; }
  .api-nav { position: static; display: flex; gap: 3px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; white-space: nowrap; }
  .api-nav-label { display: none; }
  .api-nav-link { border-left: 0; border-bottom: 2px solid transparent; padding: 7px 8px; }
  .api-nav-link:hover, .api-nav-link:focus-visible, .api-nav-link.is-active { border-left: 0; border-bottom-color: var(--accent); }
  .api-steps, .api-facts { grid-template-columns: 1fr 1fr; }
  .api-step:last-child, .api-facts div:last-child { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .api-workspace { padding: 20px 12px 32px; }
  .api-heading h1 { font-size: 22px; }
  .api-section-heading { display: block; }
  .api-status { margin-top: 12px; }
  .api-key-form { grid-template-columns: 1fr; }
  .api-scopes { grid-template-columns: 1fr; }
  .api-key-row { grid-template-columns: 1fr; gap: 9px; }
  .api-key-row .button { width: fit-content; }
  .api-steps, .api-facts { grid-template-columns: 1fr; }
  .api-step:last-child, .api-facts div:last-child { grid-column: auto; }
}

/* First-party PUC-SP registration. Kept separate from the workbench so the
   account journey is focused, keyboard-friendly, and never mimics an OCI
   administration page. */
.registration-page { min-height: 100dvh; background: #10171c; }
.registration-shell { display: grid; min-height: 100dvh; grid-template-rows: auto minmax(0, 1fr) auto; gap: 22px; padding: 24px; }
.registration-brand { display: inline-flex; width: fit-content; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.registration-brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--accent); border-radius: 3px; color: var(--accent); font: 700 10px Consolas, monospace; letter-spacing: .08em; }
.registration-brand b { display: block; font-size: 14px; }
.registration-brand small { display: block; margin-top: 2px; color: var(--faint); font: 9px Consolas, monospace; letter-spacing: .09em; }
.registration-card { align-self: center; width: min(680px, 100%); margin: 0 auto; border: 1px solid var(--line); border-radius: 4px; padding: clamp(22px, 4vw, 34px); background: var(--panel); box-shadow: 0 18px 50px rgba(0, 0, 0, .22); }
.registration-heading { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 15px; align-items: start; margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.registration-crest { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line-strong); border-radius: 3px; }
.registration-crest img { max-width: 29px; max-height: 35px; }
.registration-heading .eyebrow { margin-bottom: 5px; }
.registration-heading h1 { font-size: 23px; }
.registration-heading p:not(.eyebrow) { max-width: 50ch; margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.registration-guidance { margin: 0 0 16px; color: var(--soft); font-size: 11px; line-height: 1.55; }
.registration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-group { display: grid; gap: 5px; margin-bottom: 14px; }
.field-group label { color: var(--soft); font-size: 11px; font-weight: 600; }
.field-group input { width: 100%; min-width: 0; height: 38px; border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 10px; outline: 0; color: var(--ink); background: #10181d; font-size: 13px; }
.field-group input::placeholder { color: var(--faint); }
.field-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(114, 215, 197, .18); }
.field-group input[aria-invalid="true"] { border-color: #de8181; box-shadow: 0 0 0 1px rgba(222, 129, 129, .15); }
.field-hint, .field-error { min-height: 15px; margin: 0; font-size: 10px; line-height: 1.35; }
.field-hint { color: var(--faint); }
.field-error { color: #f0abab; }
.field-error:empty { display: none; }
.password-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.password-control input { border-radius: 3px 0 0 3px; }
.password-toggle { min-width: 64px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 3px 3px 0; color: var(--soft); background: #182227; font-size: 10px; }
.password-toggle:hover { color: var(--accent); background: var(--panel-raised); }
.registration-status-message { margin: 2px 0 0; border-left: 2px solid var(--accent); padding: 8px 10px; color: var(--soft); background: rgba(114, 215, 197, .07); font-size: 11px; line-height: 1.4; }
.registration-status-message[data-tone="error"] { border-left-color: #de8181; color: #f0abab; background: rgba(222, 129, 129, .08); }
.registration-status-message[data-tone="success"] { border-left-color: var(--success); color: #aee1bc; background: rgba(128, 201, 154, .08); }
.registration-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
.registration-actions .button { display: inline-flex; min-width: 130px; align-items: center; justify-content: center; gap: 7px; }
.registration-back { color: var(--soft); font-size: 11px; text-decoration: none; }
.registration-back:hover { color: var(--accent); text-decoration: underline; }
.button-progress { width: 12px; height: 12px; border: 2px solid rgba(8, 32, 29, .35); border-top-color: #08201d; border-radius: 50%; animation: registration-spin .7s linear infinite; }
.registration-footnote { width: min(680px, 100%); margin: 0 auto; color: var(--faint); font-size: 10px; line-height: 1.4; text-align: center; }
@keyframes registration-spin { to { transform: rotate(360deg); } }
@media (max-width: 620px) {
  .registration-shell { min-height: 100svh; gap: 16px; padding: 16px; }
  .registration-card { align-self: start; padding: 20px; }
  .registration-grid { grid-template-columns: 1fr; gap: 0; }
  .registration-heading { grid-template-columns: 36px minmax(0, 1fr); gap: 11px; margin-bottom: 17px; padding-bottom: 14px; }
  .registration-crest { width: 36px; height: 36px; }
  .registration-crest img { max-width: 23px; max-height: 28px; }
  .registration-heading h1 { font-size: 20px; }
}
@media (max-width: 700px) {
  .api-workspace { inset: 56px 0 0; }
}

/* Login-first gate: the workspace remains mounted for a fast post-login
   transition, but it is intentionally not interactive without a session. */
body.auth-gated .workbench,
body.auth-gated .sidebar,
body.auth-gated .activity-bar {
  filter: saturate(.55);
  opacity: .62;
  pointer-events: none;
  user-select: none;
}

.auth-dialog {
  width: min(480px, calc(100vw - 28px));
}

.auth-modal {
  gap: 18px;
  padding: clamp(20px, 4vw, 28px);
}

.auth-modal-head { gap: 18px; }
.auth-modal h2 { font-size: 21px; letter-spacing: -.01em; }
.auth-subtitle { max-width: 44ch; line-height: 1.6; }
.provider-list { gap: 8px; }
.provider-button { min-height: 60px; }
.provider-button:focus-visible,
.registration-button:focus-visible,
.dialog-close:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.dialog-close[hidden] { display: none; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font: 10px Consolas, monospace;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.auth-registration {
  display: grid;
  gap: 13px;
  border: 1px solid var(--line);
  padding: 14px;
  background: #1f1f1f;
}

.auth-registration strong { color: var(--ink); font-size: 12px; }
.auth-registration p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.auth-registration b { color: var(--soft); font-family: Consolas, monospace; font-weight: 500; }
.registration-status[hidden] { display: none; }
.registration-button { width: fit-content; min-height: 34px; gap: 7px; text-decoration: none; }
.registration-status { display: block; margin-top: 7px; color: #d9ad6a; font-size: 10px; line-height: 1.45; }
.registration-button .icon { width: 14px; height: 14px; }
.registration-button.is-disabled { cursor: not-allowed; opacity: .58; pointer-events: none; }
.auth-status {
  margin: 0;
  border-left: 2px solid var(--accent);
  padding: 8px 10px;
  color: var(--soft);
  background: rgba(55, 148, 255, .09);
  font-size: 11px;
  line-height: 1.45;
}
.auth-status[data-tone="warning"] { border-left-color: var(--warning); color: #edcf93; background: rgba(204, 167, 0, .09); }
.auth-status[hidden] { display: none; }
.auth-security-note { line-height: 1.55; }


@media (max-width: 520px) {
  .auth-dialog { width: min(100vw - 20px, 480px); }
  .auth-modal { padding: 19px; }
  .auth-identity { padding-bottom: 12px; }
  .auth-mark { width: 44px; height: 54px; flex-basis: 44px; }
  .auth-registration { padding: 12px; }
  .registration-button { width: 100%; justify-content: space-between; }
}

/* The sign-in surface is intentionally compact: it must fit a browser or
   provider popup without introducing a second scrolling context. */
.auth-dialog {
  width: min(520px, calc(100vw - 24px));
  max-block-size: calc(100dvh - 24px);
  overflow: clip;
  border-color: #4a4a4a;
  border-radius: 4px;
  background: #1e1e1e;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .58);
}

.auth-modal {
  gap: 12px;
  padding: 16px 18px;
}

.auth-identity {
  display: flex;
  min-height: 66px;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid #3a3a3a;
  padding-bottom: 12px;
}

.auth-identity-copy { display: grid; gap: 4px; min-width: 0; }
.auth-identity-copy span { color: #9d9d9d; font: 10px/1.2 Consolas, monospace; letter-spacing: .1em; }
.auth-identity-copy strong { color: #f1f1f1; font-size: 13px; font-weight: 600; }
.auth-modal-head { gap: 12px; }
.auth-modal h2 { font-size: 21px; line-height: 1.2; }
.auth-modal .eyebrow { margin: 0 0 5px; color: #75beff; font-size: 10px; }
.auth-subtitle { margin: 6px 0 0; max-width: 52ch; color: #bdbdbd; font-size: 12px; line-height: 1.45; }

.provider-list { gap: 7px; }
.provider-button {
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 49px;
  gap: 10px;
  border-color: #454545;
  border-radius: 3px;
  padding: 8px 10px;
  background: #252526;
}

.provider-button:hover:not(:disabled) { border-color: #75beff; background: #2a2d2e; }
.provider-button b { color: #f1f1f1; font-size: 12px; }
.provider-button small { margin-top: 2px; font-size: 10px; }
.provider-mark { width: 34px; height: 34px; border-color: #4b4b4b; border-radius: 2px; }
.provider-mark img { display: block; max-width: 23px; max-height: 23px; object-fit: contain; }
.pucsp-email-mark { overflow: hidden; }
.pucsp-email-mark img { max-width: 20px; max-height: 26px; }
.microsoft-mark { display: grid; grid-template-columns: none; grid-template-rows: none; place-items: center; gap: 0; }
.microsoft-mark img { width: 21px; height: 21px; }
.microsoft-mark::before,
.microsoft-mark::after { display: none; }
.oracle-mark { display: grid; place-items: center; }
.oracle-mark img { width: 25px; max-width: 25px; height: auto; }

.auth-divider { gap: 9px; font-size: 9px; }
.auth-registration {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-color: #3f3f46;
  padding: 10px 12px;
  background: #252526;
}
.auth-registration-copy { min-width: 0; }
.auth-registration strong { display: block; font-size: 11px; }
.auth-registration p { margin-top: 3px; font-size: 10px; line-height: 1.35; }
.registration-button { min-height: 32px; white-space: nowrap; }
.auth-security-note { display: flex; align-items: flex-start; gap: 7px; margin: 0; color: #9d9d9d; font-size: 10px; line-height: 1.4; }
.auth-security-note .icon { width: 13px; height: 13px; flex: 0 0 13px; color: #75beff; }
.auth-status { padding: 7px 9px; font-size: 10px; line-height: 1.35; }

@media (max-height: 620px) {
  .auth-dialog { max-block-size: calc(100dvh - 12px); }
  .auth-modal { gap: 8px; padding: 12px 16px; }
  .auth-identity { min-height: 48px; gap: 10px; padding-bottom: 8px; }
  .auth-identity-copy { gap: 2px; }
  .auth-identity-copy strong { font-size: 12px; }
  .auth-modal h2 { font-size: 19px; }
  .auth-subtitle { margin-top: 4px; font-size: 11px; line-height: 1.35; }
  .provider-list { gap: 5px; }
  .provider-button { min-height: 42px; padding-block: 5px; }
  .provider-mark { width: 30px; height: 30px; }
  .provider-button { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; }
  .auth-registration { padding: 8px 10px; }
  .auth-registration p { display: none; }
  .auth-security-note { font-size: 9px; }
}

@media (max-width: 520px) {
  .auth-dialog { width: calc(100vw - 16px); }
  .auth-modal { padding-inline: 14px; }
  .auth-registration { grid-template-columns: minmax(0, 1fr) auto; }
  .registration-button { width: auto; }
}
