@charset "UTF-8";
/* BaseLine work interface. Shared components precede the work-surface layout contract. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --paper: #ffffff;
  --sidebar-bg: #f7f7f8;
  --surface: #f5f5f6;
  --surface-hover: #ebebed;
  --selected: #e9e9ec;
  --ink: #242427;
  --muted: #66666e;
  --line: #dedee3;
  --line-soft: #ededf0;
  --blue: #2868b2;
  --blue-soft: #edf4fc;
  --blue-line: #c7d8ed;
  --green: #287248;
  --green-soft: #edf7f0;
  --green-line: #c2ddca;
  --purple: #7650a5;
  --purple-soft: #f5f0fa;
  --purple-line: #d9cbe9;
  --amber: #8b641d;
  --amber-soft: #fcf6e9;
  --amber-line: #e7d6af;
  --red: #b83c3c;
  --red-soft: #fbeeee;
  --red-line: #ebc7c7;
  --orange: var(--amber);
  --orange-dark: var(--amber);
  --orange-soft: var(--amber-soft);
  --action-bg: #28282b;
  --action-hover: #414146;
  --action-fg: #ffffff;
  --solid-fg: #ffffff;
  --scrim: #17171966;
  --shadow: none;
  --radius: 8px;
  --sidebar-width: 244px;
  --reader-width: min(52vw, 760px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #212121;
  --paper: #212121;
  --sidebar-bg: #181818;
  --surface: #292929;
  --surface-hover: #343434;
  --selected: #303030;
  --ink: #ededed;
  --muted: #ababaf;
  --line: #414144;
  --line-soft: #343437;
  --blue: #91b9ed;
  --blue-soft: #263548;
  --blue-line: #405b7b;
  --green: #9bc8a9;
  --green-soft: #263c2d;
  --green-line: #47664f;
  --purple: #c4a9e4;
  --purple-soft: #3a3047;
  --purple-line: #624e7b;
  --amber: #dcc28e;
  --amber-soft: #403724;
  --amber-line: #6a5a36;
  --red: #e8a0a0;
  --red-soft: #442a2a;
  --red-line: #784a4a;
  --action-bg: #e5e5e5;
  --action-hover: #ffffff;
  --action-fg: #202020;
  --scrim: #00000080;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body { margin: 0; font: 14px/1.6 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { border: 0; background: none; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
input, textarea, select { width: 100%; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); outline: none; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--muted); outline: 2px solid var(--line); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; min-height: 144px; line-height: 1.7; }
label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 600; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--blue); flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 23px; font-weight: 600; line-height: 1.35; letter-spacing: -.35px; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.5; }
h3 { font-size: 14px; font-weight: 600; line-height: 1.5; }
strong { font-weight: 600; }
small { font-size: 12px; }
[hidden] { display: none !important; }
svg.icon { display: block; width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.75; }
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--muted); outline-offset: 3px; }
::selection { background: var(--blue-soft); }
.skip-link { position: fixed; z-index: 100; top: -60px; left: 16px; padding: 8px 16px; border-radius: var(--radius); background: var(--ink); color: var(--action-fg); }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 600; line-height: 1.5; letter-spacing: .3px; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 12px; border: 1px solid transparent; border-radius: var(--radius); font-size: 13px; font-weight: 500; line-height: 1.5; white-space: nowrap; text-decoration: none; }
.button:hover { text-decoration: none; }
.button-primary, .button-ink { background: var(--action-bg); border-color: var(--action-bg); color: var(--action-fg); }
.button-primary:hover:not(:disabled), .button-ink:hover:not(:disabled) { background: var(--action-hover); border-color: var(--action-hover); }
.button-secondary { background: transparent; border-color: var(--line); color: var(--ink); }
.button-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--line); }
.button-soft { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button-soft:hover:not(:disabled) { background: var(--surface-hover); }
.button-text { min-height: 30px; padding: 4px 6px; color: var(--muted); }
.button-text:hover:not(:disabled) { background: var(--surface); }
.button-success { color: var(--green); background: var(--green-soft); border-color: var(--green-line); }
.button-success:hover:not(:disabled) { background: var(--green-soft); border-color: var(--green); }
.button-danger { background: var(--paper); border-color: var(--line); color: var(--red); }
.button-danger:hover:not(:disabled) { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.button-small { min-height: 28px; padding: 3px 9px; font-size: 12px; }
.wide { width: 100%; }
.icon-button { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius); color: var(--muted); flex-shrink: 0; }
.icon-button:hover { color: var(--ink); background: var(--surface-hover); }

/* Project navigation and main toolbar. */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 20px 12px 12px; border-right: 1px solid var(--line-soft); background: var(--sidebar-bg); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.4; }
.brand:hover { text-decoration: none; }
.brand-icon { display: block; width: 32px; height: 32px; flex-shrink: 0; object-fit: contain; }
.login-story .brand-icon { width: 44px; height: 44px; }
.boot-screen .brand-icon { width: 64px; height: 64px; }
.project-symbol.brand-icon { width: 20px; height: 20px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: .2px; }
.brand-mark { color: var(--ink); font-size: 30px; font-weight: 600; line-height: 1; }
.sidebar .brand { margin: 0 10px 24px; min-height: 28px; }
.sidebar-section-label { padding: 0 10px; margin-bottom: 7px; font-size: 11px; color: var(--muted); font-weight: 500; }
.project-list { display: flex; flex-direction: column; gap: 2px; max-height: 42vh; overflow-y: auto; flex-shrink: 0; }
.project-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid transparent; border-radius: var(--radius); text-align: left; color: var(--ink); }
.project-item:hover { background: var(--surface-hover); }
.project-item.active { background: var(--selected); border-color: transparent; }
.project-symbol { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; }
.project-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.project-item .icon { width: 13px; height: 13px; color: var(--muted); }
.sidebar-rule { height: 1px; flex-shrink: 0; margin: 18px 10px; background: var(--line-soft); }
.main-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 10px; border-radius: var(--radius); color: var(--ink); font-size: 13px; text-align: left; }
.nav-item .icon { width: 16px; height: 16px; color: var(--muted); }
.nav-item:hover { background: var(--surface-hover); }
.nav-item.active { background: var(--selected); font-weight: 500; }
.nav-item.active::before { display: none; }
.nav-count, .nav-new { margin-left: auto; padding: 0 5px; color: var(--muted); font-size: 11px; font-weight: 400; }
.nav-new { border: 1px solid var(--line); background: transparent; }
.sidebar-bottom { margin-top: auto; padding-top: 24px; }
.local-status { display: flex; align-items: center; gap: 6px; margin: 0 10px 10px; font-size: 10px; color: var(--muted); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.account-button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; text-align: left; }
.account-button:hover { background: var(--surface-hover); }
.avatar { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; }
.account-info { flex: 1; min-width: 0; line-height: 1.4; }
.account-info strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.account-info small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.account-button > .icon { width: 14px; height: 14px; color: var(--muted); }
.workspace { width: calc(100% - var(--sidebar-width)); min-width: 0; min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 9px 28px; border-bottom: 1px solid var(--line-soft); background: var(--paper); }
.global-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 120px; width: 240px; max-width: 280px; height: 32px; padding: 0 9px; border: 1px solid transparent; border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.global-search:focus-within { border-color: var(--line); outline: 2px solid var(--line); outline-offset: 1px; }
.global-search input { min-width: 0; padding: 5px 0; border: 0; background: transparent; outline: none; font-size: 13px; }
.global-search input:focus { outline: none; }
.global-search kbd { padding: 0 5px; border: 1px solid var(--line); border-radius: 3px; font: 11px/1.6 var(--font); color: var(--muted); white-space: nowrap; }
#main { max-width: 1280px; margin: 0 auto; padding: 26px 32px 20px; outline: none; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading .eyebrow { display: none; }
.page-description { max-width: 680px; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex-shrink: 0; }
.workspace-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 12px; color: var(--muted); font-size: 10px; }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 10px; }
.section-top h2 { font-size: 16px; }
.section-top .meta { color: var(--muted); font-size: 12px; }

/* Neutral sections and source lists. */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 0 20px; border-bottom: 1px solid var(--line-soft); background: transparent; }
.hero-copy { width: 100%; min-width: 0; }
.hero h2 { margin-top: 5px; font-size: 20px; }
.hero p { max-width: 750px; margin: 7px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.hero-art, .hero-art::before, .hero-art::after, .hero-art .orbit, .hero-art .orbit::after { display: none; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; border-block: 1px solid var(--line-soft); overflow: hidden; }
.stat-card { min-width: 0; padding: 14px 16px; background: transparent; }
.stat-card + .stat-card { border-left: 1px solid var(--line-soft); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.stat-top .icon { width: 16px; height: 16px; color: var(--muted); }
.stat-value { margin-top: 4px; font-size: 21px; font-weight: 500; line-height: 1.4; font-variant-numeric: tabular-nums; }
.stat-unit { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 400; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { min-width: 0; padding: 16px 0; border-top: 1px solid var(--line-soft); background: transparent; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; }
.foundation-text { max-height: 260px; overflow: auto; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.foundation-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; max-height: 164px; overflow: hidden; }
.foundation-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }
.mini-list { display: flex; flex-direction: column; }
.mini-source { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line-soft); text-align: left; }
.mini-source:first-child { padding-top: 0; }
.mini-source:last-child { padding-bottom: 0; border-bottom: 0; }
.mini-source:hover .mini-title { color: var(--blue); }
.mini-copy { flex: 1; min-width: 0; }
.mini-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.6; }
.mini-meta { margin-top: 3px; color: var(--muted); font-size: 11px; }
.mini-source .icon { width: 14px; height: 14px; margin-left: auto; color: var(--muted); }
.source-icon, .source-icon.chatgpt, .source-icon.codex, .source-icon.code, .source-icon.report, .source-icon.foundation { display: flex; align-items: center; justify-content: center; width: 32px; height: 36px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .2px; }
.source-cards { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.source-card { display: flex; flex-direction: column; gap: 8px; width: 100%; min-width: 0; padding: 16px 20px; background: var(--paper); text-align: left; cursor: pointer; }
.source-card + .source-card { border-top: 1px solid var(--line); }
.source-card:hover { background: var(--surface); }
.source-card-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; }
.source-card-top .source-icon { width: 24px; height: 27px; font-size: 8px; }
.source-card h3 { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.source-card:hover h3 { color: var(--blue); }
.source-excerpt { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; max-height: 7.2em; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.source-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; color: var(--muted); font-size: 11px; }
.source-card-bottom > span { min-width: 0; overflow-wrap: anywhere; }
.source-card-bottom .icon { width: 14px; height: 14px; }
mark { padding: 0 1px; background: var(--amber-soft); color: inherit; border-radius: 2px; }
.search-summary { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 12px; }
.search-summary .icon { width: 16px; height: 16px; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.library-filter { position: relative; display: flex; align-items: center; width: 100%; max-width: 380px; min-width: 0; }
.library-filter .icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); }
.library-filter input { padding-left: 34px; font-size: 13px; }
.library-count { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.document-table { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.table-head, .document-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 140px 90px; align-items: center; gap: 16px; }
.table-head { padding: 10px 16px; background: var(--surface); color: var(--muted); font-size: 12px; }
.document-row { width: 100%; min-height: 65px; padding: 12px 16px; border-top: 1px solid var(--line-soft); text-align: left; cursor: pointer; }
.document-row:hover { background: var(--surface); }
.document-row-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.document-name { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.document-subtitle { margin-top: 2px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.table-cell { min-width: 0; color: var(--muted); font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; color: var(--muted); font-size: 12px; }
.pagination-buttons { display: flex; gap: 6px; }

/* Status is semantic; document types remain neutral. */
.badge, .status-badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; max-width: 100%; padding: 1px 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.7; white-space: nowrap; }
.status-badge { border-color: var(--status-border, var(--line)); background: var(--status-bg, var(--surface)); color: var(--status-fg, var(--muted)); }
.status-success, .status-accepted, .status-complete, .status-connected, .status-healthy, .status-verified, [data-status="success"], [data-status="accepted"], [data-status="complete"], [data-status="connected"], [data-status="healthy"], [data-status="verified"], [data-status="succeeded"] { --status-fg: var(--green); --status-bg: var(--green-soft); --status-border: var(--green-line); }
.status-review, [data-status="review"], [data-status="needs-review"] { --status-fg: var(--purple); --status-bg: var(--purple-soft); --status-border: var(--purple-line); }
.status-proposed, .status-proposal, [data-status="proposed"], [data-status="proposal"] { --status-fg: var(--muted); --status-bg: var(--surface); --status-border: var(--line); }
.status-processing, .status-running, [data-status="processing"], [data-status="running"] { --status-fg: var(--blue); --status-bg: var(--blue-soft); --status-border: var(--blue-line); }
.status-warning, .status-attention, .status-partial, [data-status="warning"], [data-status="attention"], [data-status="partial"] { --status-fg: var(--amber); --status-bg: var(--amber-soft); --status-border: var(--amber-line); }
.status-danger, .status-error, .status-failed, [data-status="danger"], [data-status="error"], [data-status="failed"] { --status-fg: var(--red); --status-bg: var(--red-soft); --status-border: var(--red-line); }
.status-neutral, .status-gray, .status-queued, .status-history, .status-retired, .status-idle, [data-status="neutral"], [data-status="gray"], [data-status="queued"], [data-status="history"], [data-status="retired"], [data-status="idle"], [data-status="closed"] { --status-fg: var(--muted); --status-bg: var(--surface); --status-border: var(--line); }
.badge[class*="status-"], .badge[data-status] { border-color: var(--status-border, var(--line)); background: var(--status-bg, var(--surface)); color: var(--status-fg, var(--muted)); }
.badge.green { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }
.badge.purple { border-color: var(--purple-line); background: var(--purple-soft); color: var(--purple); }
.badge.blue { border-color: var(--blue-line); background: var(--blue-soft); color: var(--blue); }
.badge.orange, .badge.amber { border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber); }
.badge.red { border-color: var(--red-line); background: var(--red-soft); color: var(--red); }
.badge.muted, .badge.gray { border-color: var(--line); background: var(--surface); color: var(--muted); }
.status-dot[data-status], .status-dot[class*="status-"] { background: var(--status-fg, var(--muted)); }
.status-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 12px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.status-legend > span, .status-legend > li { display: inline-flex; align-items: center; gap: 5px; }
.status-legend .status-dot { width: 6px; height: 6px; }
details.status-legend { position: relative; display: block; margin: 0; }
details.status-legend > summary { margin: 0; padding: 6px 8px; min-height: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 12px; white-space: nowrap; }
details.status-legend > summary:hover { background: var(--surface-hover); }
.status-legend-items { position: absolute; top: calc(100% + 6px); right: 0; z-index: 12; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 244px; max-width: calc(100vw - 32px); padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.status-legend-items > div, .status-legend-items > span { display: flex; align-items: center; gap: 8px; width: 100%; }

/* Progress, connections and account settings. */
.updates-list { display: flex; flex-direction: column; gap: 0; }
.update-card { padding: 20px 0; border-bottom: 1px solid var(--line-soft); background: transparent; }
.update-header { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.update-header .update-time { margin-left: auto; color: var(--muted); font-size: 11px; }
.update-card h3 { margin-bottom: 8px; }
.update-text { max-height: 260px; overflow: auto; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.update-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.update-footer .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; width: fit-content; max-width: 100%; margin-bottom: 18px; padding: 3px; border-radius: 9px; background: var(--surface); overflow-x: auto; }
.tab { min-height: 32px; padding: 6px 12px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tab:hover { color: var(--ink); background: var(--surface); }
.tab.active { background: var(--paper); border-color: var(--line-soft); color: var(--ink); font-weight: 500; }
.connection-grid { display: flex; flex-direction: column; border-block: 1px solid var(--line-soft); overflow: hidden; }
.connection-card { min-width: 0; padding: 18px 0; background: transparent; }
.connection-card + .connection-card { border-top: 1px solid var(--line-soft); }
.connection-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.connection-head > .icon { width: 18px; height: 18px; color: var(--muted); }
.connection-head .badge, .connection-head .status-badge { margin-left: auto; }
.connection-card h3 { font-size: 14px; }
.connection-card p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.connection-detail { margin-top: 7px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.endpoint { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.endpoint code { flex: 1; min-width: 0; color: var(--ink); font: 12px/1.7 var(--mono); overflow-wrap: anywhere; }
.settings-section { margin-top: 24px; }
.token-row, .member-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.token-row:last-child, .member-row:last-child { border-bottom: 0; padding-bottom: 0; }
.token-main, .member-main { flex: 1; min-width: 0; }
.token-main strong, .member-main strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.token-main small, .member-main small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.member-projects { color: var(--muted); font-size: 11px; }
.inline-note { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--amber-line); border-radius: var(--radius); background: var(--amber-soft); color: var(--amber); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.inline-note.error { border-color: var(--red-line); background: var(--red-soft); color: var(--red); }
.inline-note.neutral { border-color: var(--line); background: var(--surface); color: var(--muted); }
details summary { cursor: pointer; margin-top: 4px; font-size: 12px; font-weight: 500; }
details p { margin-top: 8px; }
.description-list { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px 14px; margin: 20px 0; font-size: 13px; }
.description-list dt { color: var(--muted); }
.description-list dd { margin: 0; overflow-wrap: anywhere; }
.activity-log { max-height: 240px; overflow: auto; font-size: 12px; }
.activity-log-item { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.activity-log-item:last-child { border-bottom: 0; }
.activity-log-item span:last-child { color: var(--muted); white-space: nowrap; }

/* Shared understanding: current state, proposed changes, evidence. */
.memory-intro { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.memory-intro > p { font-size: 16px; font-weight: 500; }
.memory-intro > span { max-width: 360px; color: var(--muted); font-size: 12px; }
.memory-composer { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.memory-composer-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; color: var(--muted); font-weight: 500; }
.memory-spark { display: none; }
.memory-composer textarea { min-height: 108px; padding: 4px 0 10px; border: 0; border-radius: 0; font-size: 15px; background: transparent; resize: vertical; }
.memory-examples { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.memory-example { min-height: 28px; padding: 3px 8px; border: 1px solid transparent; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 12px; }
.memory-example:hover { background: var(--surface-hover); color: var(--ink); }
.memory-compose-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; }
.memory-composer-hint { color: var(--muted); font-size: 11px; line-height: 1.7; }
.memory-compose-bottom .button { flex-shrink: 0; }
.memory-answer { margin: 0 0 22px; padding: 0; border: 0; background: transparent; }
.memory-answer > .eyebrow { margin-bottom: 8px; }
.memory-answer-text { font-size: 15px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-answer .memory-sources { margin-bottom: 0; }
.memory-answer > .form-hint { margin-top: 10px; }
#memory-answer > .memory-job { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.memory-revisions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px 0; border-block: 1px solid var(--line-soft); background: transparent; overflow: hidden; }
.memory-revision { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 14px; }
.memory-revision + .memory-revision { border-left: 1px solid var(--line-soft); }
.memory-revision > span { color: var(--muted); font-size: 11px; }
.memory-revision > strong { font-size: 14px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.memory-revision > small { color: var(--muted); font-size: 11px; line-height: 1.6; }
.memory-layout { display: block; }
.memory-main, .memory-aside { min-width: 0; }
.memory-section > .section-top, .memory-side-section > .section-top { margin-top: 24px; margin-bottom: 10px; }
.memory-section > .section-top h2, .memory-side-section > .section-top h2 { font-size: 15px; }
.memory-item-list { display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.memory-item { min-width: 0; padding: 18px 0; background: transparent; }
.memory-item + .memory-item { border-top: 1px solid var(--line-soft); }
.memory-item-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.memory-item-top > span:last-child { color: var(--muted); font-size: 11px; }
.memory-item > h3 { margin-bottom: 7px; font-size: 14px; overflow-wrap: anywhere; }
.memory-item-body { color: var(--ink); font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-item-bottom { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.memory-item-bottom > span { color: var(--muted); font-size: 11px; }
.memory-item-bottom .button { font-size: 12px; }
.memory-item-bottom .icon { width: 14px; height: 14px; }
.memory-soft-empty { padding: 14px 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.memory-sources { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.memory-source-row { min-width: 0; }
.memory-source-link { display: inline-flex; align-items: center; gap: 5px; padding: 2px 0; color: var(--blue); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; text-align: left; }
.memory-source-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.memory-source-link .icon { width: 13px; height: 13px; }
.memory-source-label { color: var(--muted); font-size: 12px; }
.memory-quote { margin-top: 4px; color: var(--muted); font-size: 12px; }
.memory-quote summary { min-height: 26px; margin-top: 0; font-size: 11px; font-weight: 400; }
.memory-quote blockquote { max-height: 330px; overflow: auto; margin: 6px 0 0; padding: 10px 12px; border-left: 3px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-review { margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.memory-review > summary { display: list-item; position: relative; margin: 0; padding: 13px 16px; background: var(--surface); font-size: 14px; font-weight: 600; line-height: 1.6; }
.memory-review > summary::marker { color: var(--muted); font-size: 12px; }
.memory-review[open] > summary { border-bottom: 1px solid var(--line); }
.memory-review > summary h2, .memory-review > summary h3 { display: inline; font-size: 14px; }
.memory-review > summary .badge, .memory-review > summary .status-badge { margin-left: 8px; vertical-align: middle; }
.memory-review > summary small, .memory-review > summary .memory-section-hint, .memory-review > summary .review-description { display: block; margin: 3px 0 0 14px; color: var(--muted); font-size: 12px; font-weight: 400; }
.memory-review-title { font-size: 14px; font-weight: 600; }
.memory-review > summary .memory-review-summary-hint { display: block; margin: 3px 0 0 14px; color: var(--muted); font-size: 12px; font-weight: 400; }
.memory-review > .section-top { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.memory-review > .section-top h2 { font-size: 14px; }
.memory-section-hint { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.memory-review > .memory-section-hint { padding: 12px 16px 0; }
.memory-pending-card { min-width: 0; padding: 16px; background: var(--paper); }
.memory-pending-card + .memory-pending-card { border-top: 1px solid var(--line); }
.memory-pending-card > h3 { margin: 8px 0; font-size: 14px; overflow-wrap: anywhere; }
.memory-change-preview { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-before, .memory-after { padding: 9px 12px; border-left: 3px solid var(--line); border-radius: 0; }
.memory-before { border-color: var(--line); background: var(--surface); color: var(--muted); }
.memory-after { border-color: var(--purple-line); background: var(--purple-soft); color: var(--purple); }
.memory-review-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.memory-review-actions > .button:first-child { margin-right: auto; }
.memory-review-actions .button { font-size: 12px; }
.memory-history-compare { margin-bottom: 20px; }
.memory-history-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.memory-history-entry { min-width: 0; padding: 12px 16px; }
.memory-history-entry + .memory-history-entry { border-top: 1px solid var(--line); }
.memory-history-entry > summary { min-height: 28px; margin: 0; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.memory-history-entry > .memory-item-body { padding-top: 10px; }
.memory-session { padding: 12px 0; border-bottom: 1px solid var(--line); }
.memory-session:first-of-type { padding-top: 0; }
.memory-session h3 { font-size: 12px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.memory-session-version { margin: 5px 0 3px; color: var(--ink); font-size: 12px; }
.memory-session > small { color: var(--muted); font-size: 11px; }
.memory-session > .badge, .memory-session > .status-badge { display: table; margin-top: 6px; }
.memory-session-summary { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-background { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1.7; }
.memory-background > .form-hint { margin-top: 10px; }
.memory-job { display: flex; align-items: flex-start; gap: 8px; min-width: 0; padding: 10px 0; }
.memory-job + .memory-job { border-top: 1px solid var(--line); }
.memory-job .spinner, .memory-job > .icon { width: 14px; height: 14px; margin-top: 3px; flex-shrink: 0; }
.memory-job > .icon { color: var(--status-fg, var(--muted)); }
.memory-job[data-tone="green"] > .icon { color: var(--green); }
.memory-job[data-tone="purple"] > .icon { color: var(--purple); }
.memory-job[data-tone="blue"] > .icon { color: var(--blue); }
.memory-job[data-tone="amber"] > .icon { color: var(--amber); }
.memory-job[data-tone="red"] > .icon { color: var(--red); }
.memory-job[data-tone="muted"] > .icon { color: var(--muted); }
.memory-job > div { min-width: 0; }
.memory-job strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.memory-job small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.memory-event { padding: 10px 0; border-bottom: 1px solid var(--line); }
.memory-event > p { font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.memory-event > small { color: var(--muted); font-size: 11px; }

/* Sources, exact versions and modal workflows. */
.drawer-backdrop { position: fixed; inset: 0; z-index: 39; background: var(--scrim); }
.source-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column; width: min(920px, 94vw); border-left: 1px solid var(--line); background: var(--paper); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; min-height: 52px; padding: 8px 24px; border-bottom: 1px solid var(--line-soft); background: var(--paper); }
.drawer-body { flex: 1; min-height: 0; padding: 22px 28px 36px; overflow: auto; overscroll-behavior: contain; }
.drawer-body h2 { font-size: 20px; line-height: 1.5; overflow-wrap: anywhere; }
.document-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.source-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; padding: 8px 0; }
.version-select { width: auto; min-width: 132px; max-width: 100%; padding: 6px 28px 6px 9px; background: var(--surface); font-size: 12px; }
.source-provenance { margin-bottom: 14px; padding: 0; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.source-text { margin: 0; color: var(--ink); font: 13px/1.85 var(--font); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.source-text:empty { display: none; }
.source-safety { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.drawer-anchor { margin-bottom: 14px; padding: 8px 12px; border: 1px solid var(--blue-line); border-radius: var(--radius); background: var(--blue-soft); color: var(--blue); font-size: 12px; }
.source-location-details { margin-bottom: 12px; padding: 8px 0; border-block: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.source-location-details summary { margin: 0; }
.source-location-details pre { margin: 10px 0 0; font: 11px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.modal { width: min(600px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 20px 24px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); outline: none; overflow: auto; }
.modal::backdrop { background: var(--scrim); }
.modal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal h2 { margin-bottom: 7px; font-size: 22px; }
.modal-subtitle { margin-bottom: 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.form-field { margin: 16px 0; }
.form-hint { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.form-error { margin: 10px 0; color: var(--red); font-size: 13px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 34px; cursor: pointer; font-size: 13px; font-weight: 400; }
.check-row small { color: var(--muted); font-size: 11px; }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 160px; padding: 20px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); text-align: center; cursor: pointer; }
.file-drop.dragover { border-color: var(--blue); background: var(--blue-soft); }
.file-drop .icon { width: 26px; height: 26px; margin-bottom: 10px; color: var(--muted); }
.file-drop strong { font-size: 14px; font-weight: 500; }
.file-drop small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.file-drop input { width: 100%; margin-top: 12px; padding: 0; border: 0; background: transparent; font-size: 12px; }
.selected-files { max-height: 180px; margin: 12px 0; overflow: auto; }
.file-line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; color: var(--muted); font-size: 12px; }
.file-line span:first-child { min-width: 0; overflow-wrap: anywhere; }
.context-box { max-height: 45vh; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: auto; color: var(--ink); font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.context-source-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.secret-token { min-height: 96px; background: var(--surface); font: 12px/1.8 var(--mono); word-break: break-all; }
.modal.modal-wide { width: min(980px, calc(100% - 32px)); }
.diff-controls { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.diff-controls .form-field { flex: 1; min-width: 0; margin: 0; }
.diff-controls > .button { margin-bottom: 1px; }
.diff-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.diff-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.diff-panel h3 { padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 12px; }
.diff-before h3 { background: var(--red-soft); color: var(--red); }
.diff-after h3 { background: var(--green-soft); color: var(--green); }
.diff-panel pre { max-height: 45vh; margin: 0; padding: 14px; overflow: auto; color: var(--ink); font: 12px/1.8 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Loading, empty states and feedback. */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 220px; padding: 32px 24px; text-align: center; }
.empty-icon { display: grid; place-items: center; margin-bottom: 12px; color: var(--muted); }
.empty-icon .icon { width: 28px; height: 28px; }
.empty-state h3 { font-size: 16px; }
.empty-state p { max-width: 480px; margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.empty-state .button { margin-top: 16px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 64px 20px; color: var(--muted); font-size: 13px; }
.spinner { display: inline-block; width: 16px; height: 16px; flex-shrink: 0; border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; height: 100vh; color: var(--muted); font-size: 13px; }
.boot-screen .brand-mark { font-size: 40px; }
.skeleton { height: 16px; border-radius: 4px; background: var(--line-soft); }
.skeleton-stack { display: flex; flex-direction: column; gap: 14px; }
.skeleton-stack .skeleton:last-child { width: 63%; }
.toasts { position: fixed; z-index: 80; bottom: 24px; left: 50%; display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); transform: translateX(-50%); pointer-events: none; }
.toast { max-width: 100%; padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--action-bg); color: var(--action-fg); font-size: 13px; line-height: 1.6; pointer-events: auto; overflow-wrap: anywhere; }
.toast.error { border-color: var(--red); background: var(--red); }
.noscript { position: fixed; inset: 0; z-index: 101; display: grid; place-items: center; padding: 24px; background: var(--paper); }

/* A single, quiet sign-in panel. */
.login-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 40px 20px; background: var(--paper); }
.login-story { width: 100%; max-width: 400px; margin-bottom: 24px; padding: 0; background: transparent; }
.login-story .brand { justify-content: center; font-size: 20px; }
.login-story .brand small { display: none; }
.login-story .brand-mark { font-size: 32px; }
.login-story::after, .login-foot, .login-story > div:nth-child(2) { display: none; }
.login-story h1, .login-story p { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--muted); text-align: center; }
.login-content { width: 100%; max-width: 400px; padding: 0; }
.login-card { width: 100%; padding: 24px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--paper); }
.login-card h2 { margin: 4px 0 8px; font-size: 22px; font-weight: 500; text-align: center; }
.login-card > .eyebrow { text-align: center; }
.login-card > .muted { margin-bottom: 20px; color: var(--muted); font-size: 13px; text-align: center; }
.login-card .wide { min-height: 38px; }
.login-card #login-form .button { margin-top: 14px; }
.divider-label { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-help { margin-top: 18px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.mobile-only, .sidebar-scrim { display: none; }

/* Keep the same 820px boundary as the accessible sidebar controller. */
@media (min-width: 1600px) {
  :root { --sidebar-width: 252px; }
  .sidebar { padding-inline: 16px; }
}
@media (max-width: 1180px) {
  .memory-layout { grid-template-columns: minmax(0, 1fr) 232px; gap: 20px; }
  .memory-intro { display: block; }
  .memory-intro > span { display: block; max-width: none; margin-top: 5px; }
}
@media (max-width: 1120px) {
  :root { --sidebar-width: 224px; }
  .topbar { padding-inline: 24px; }
  #main { padding-inline: 24px; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .table-head, .document-row { grid-template-columns: minmax(0, 1fr) 82px 140px; gap: 12px; }
  .table-head > :last-child, .document-row > .table-cell:last-child { display: none; }
}
@media (max-width: 1000px) {
  .memory-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .memory-aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
}
@media (max-width: 820px) {
  .mobile-only { display: flex; }
  .sidebar { z-index: 32; width: 260px; padding-bottom: max(16px, env(safe-area-inset-bottom)); visibility: hidden; pointer-events: none; transform: translateX(-100%); transition: transform .16s ease; }
  .sidebar.open { visibility: visible; pointer-events: auto; transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 31; display: block; background: var(--scrim); }
  .workspace { width: 100%; margin-left: 0; }
  .topbar { height: 60px; padding-inline: 16px; gap: 8px; }
  .global-search { max-width: none; }
  .global-search kbd { display: none; }
  #main { padding: 24px 24px 20px; }
  .page-heading { gap: 16px; }
  .source-drawer { width: min(760px, 96vw); }
}
@media (max-width: 570px) {
  body { font-size: 14px; }
  input, textarea, select { font-size: 16px; }
  .topbar { gap: 6px; height: 60px; padding-inline: 12px; }
  .topbar > .icon-button { width: 34px; min-height: 40px; }
  .topbar > .button { min-height: 36px; padding: 6px 9px; font-size: 12px; gap: 4px; }
  .topbar > .button .icon { width: 15px; height: 15px; }
  .global-search { height: 36px; padding-inline: 8px; gap: 6px; }
  .global-search > .icon { width: 15px; height: 15px; }
  .global-search input { font-size: 16px; }
  .global-search input::placeholder { font-size: 12px; }
  #main { padding: 20px 16px 16px; }
  .page-heading { gap: 12px; flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 16px; }
  .page-heading h1 { font-size: 24px; }
  .page-description { font-size: 12px; }
  .page-actions { justify-content: flex-start; }
  .status-legend-items { left: 0; right: auto; }
  .page-actions .button { min-height: 34px; font-size: 12px; }
  .section-top { margin-top: 20px; gap: 8px; }
  .section-top h2 { font-size: 15px; }
  .section-top .meta { font-size: 11px; }
  .hero { padding: 16px; }
  .hero h2 { font-size: 18px; }
  .hero p { font-size: 12px; }
  .stats-grid { margin-top: 12px; }
  .stat-card { padding: 12px 10px; }
  .stat-top { font-size: 11px; }
  .stat-top .icon { display: none; }
  .stat-value { font-size: 22px; }
  .stat-unit { margin-left: 3px; font-size: 10px; }
  .overview-grid { gap: 0; }
  .panel { padding: 14px; }
  .source-card { padding: 14px; }
  .source-card h3 { font-size: 14px; }
  .source-card-bottom { font-size: 11px; align-items: flex-start; }
  .source-excerpt { font-size: 12px; }
  .search-summary { align-items: flex-start; font-size: 12px; }
  .search-summary .icon { margin-top: 2px; }
  .library-toolbar { gap: 10px; }
  .library-filter { max-width: none; flex: 1; }
  .library-filter input { font-size: 16px; }
  .library-filter input::placeholder { font-size: 12px; }
  .library-count { font-size: 11px; }
  .table-head { display: none; }
  .document-row { grid-template-columns: minmax(0, 1fr) 80px; gap: 8px; min-height: 72px; padding: 12px; }
  .document-row:first-of-type { border-top: 0; }
  .document-row > .table-cell:nth-child(3) { display: none; }
  .document-row-title { gap: 8px; }
  .document-name { font-size: 12px; }
  .document-subtitle { font-size: 10px; }
  .document-row .source-icon { width: 27px; height: 32px; font-size: 8px; }
  .document-row > .table-cell { font-size: 11px; }
  .document-row .badge, .document-row .status-badge { font-size: 10px; padding-inline: 5px; }
  .pagination { font-size: 11px; gap: 8px; flex-wrap: wrap; }
  .pagination .button { min-height: 36px; font-size: 12px; padding-inline: 9px; }
  .connection-card { padding: 14px; }
  .connection-head { gap: 7px; flex-wrap: wrap; }
  .connection-card p { font-size: 12px; }
  .tabs { width: 100%; }
  .tab { flex: 1; min-height: 40px; padding-inline: 10px; font-size: 12px; }
  .update-card { padding: 14px; }
  .update-header .update-time { font-size: 10px; }
  .update-footer .button { min-height: 34px; }
  .endpoint { padding: 7px 9px; }
  .endpoint code { font-size: 11px; }
  .token-row, .member-row { align-items: flex-start; gap: 8px; flex-wrap: wrap; }
  .token-main, .member-main { flex-basis: 50%; }
  .token-row .button, .member-row .button { min-height: 34px; font-size: 12px; }
  .activity-log-item { gap: 10px; flex-wrap: wrap; }
  .memory-intro > p { font-size: 15px; }
  .memory-intro > span { font-size: 12px; }
  .memory-composer { padding: 12px; }
  .memory-composer-head { font-size: 13px; align-items: flex-start; }
  .memory-composer textarea { min-height: 108px; font-size: 16px; padding: 10px; }
  .memory-composer textarea::placeholder { font-size: 13px; }
  .memory-example { min-height: 34px; padding: 5px 8px; font-size: 11px; }
  .memory-compose-bottom { gap: 10px; align-items: flex-end; }
  .memory-compose-bottom .button { min-height: 40px; padding-inline: 10px; font-size: 12px; }
  .memory-composer-hint { font-size: 11px; }
  .memory-revisions { margin-top: 16px; }
  .memory-revision { padding: 10px; gap: 4px; }
  .memory-revision > span { font-size: 10px; }
  .memory-revision > strong { font-size: 14px; }
  .memory-revision > small { font-size: 10px; }
  .memory-aside { grid-template-columns: minmax(0, 1fr); }
  .memory-section > .section-top, .memory-side-section > .section-top { margin-top: 20px; }
  .memory-item { padding: 14px; }
  .memory-item-top { gap: 8px; align-items: flex-start; }
  .memory-item-top > span:last-child { font-size: 10px; }
  .memory-item-body { font-size: 13px; }
  .memory-item-bottom { flex-wrap: wrap; gap: 4px 8px; }
  .memory-item-bottom > span { font-size: 10px; }
  .memory-source-link { padding-block: 4px; font-size: 12px; }
  .memory-answer { padding: 14px; }
  .memory-answer-text { font-size: 13px; }
  .memory-review { margin-top: 20px; }
  .memory-review > summary { padding: 12px; }
  .memory-pending-card { padding: 12px; }
  .memory-review-actions .button { min-height: 38px; }
  .memory-review-actions > .button:first-child { width: 100%; margin-right: 0; justify-content: flex-start; }
  .memory-history-entry { padding: 12px; }
  .memory-history-entry > summary { font-size: 12px; }
  .memory-history-compare select { font-size: 16px; }
  .source-drawer { width: 100%; }
  .drawer-header { padding: 12px 16px; }
  .drawer-body { padding: 20px 16px 32px; }
  .drawer-body h2 { font-size: 21px; }
  .source-actions .button { min-height: 38px; font-size: 12px; }
  .version-select { min-height: 38px; font-size: 16px; }
  .source-text { font-size: 13px; }
  .modal, .modal.modal-wide { width: calc(100% - 24px); max-height: calc(100dvh - 24px); padding: 16px; }
  .modal h2 { font-size: 21px; }
  .modal-subtitle { font-size: 12px; }
  .modal input, .modal textarea, .modal select, #login-password { font-size: 16px; }
  .form-actions .button { min-height: 40px; }
  .check-row { min-height: 40px; }
  .file-drop { padding: 18px 12px; }
  .file-drop input { font-size: 12px; }
  .diff-controls { gap: 8px; flex-wrap: wrap; }
  .diff-controls > .button { width: 100%; }
  .diff-columns { grid-template-columns: minmax(0, 1fr); }
  .diff-panel pre { max-height: 30vh; }
  .context-box { max-height: 42dvh; }
  .empty-state { min-height: 200px; padding: 28px 16px; }
  .toasts { bottom: max(16px, env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }
  .toast { padding: 10px 12px; font-size: 12px; }
  .workspace-footer { flex-wrap: wrap; margin-top: 24px; padding-bottom: env(safe-area-inset-bottom); font-size: 10px; }
  .workspace-footer span:last-child { display: none; }
  .login-screen { justify-content: flex-start; padding: max(44px, env(safe-area-inset-top)) 20px 32px; }
  .login-story { margin-bottom: 20px; }
  .login-card { padding: 20px; }
  .login-card .wide { min-height: 42px; }
  .status-legend { gap: 6px 10px; font-size: 10px; }
}
/* Scopes and inventory use the same neutral controls as the project navigation. */
.branch-control { padding: 14px 12px 0; }
.branch-control label { color: var(--muted); font-size: 12px; }
.branch-control select { font-size: 12px; }
.branch-control .form-hint { margin-top: 6px; font-size: 10px; }
.scope-summary { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: -6px 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.scope-summary strong { color: var(--ink); overflow-wrap: anywhere; }
.catalog-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.catalog-filters .form-field { margin-bottom: 12px; }
.catalog-filters label { color: var(--muted); font-size: 12px; }
.catalog-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 8px; }
.catalog-summary > strong { font-size: 12px; margin-right: 6px; }
.catalog-count { padding: 3px 9px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; }
.catalog-count:hover, .catalog-count.active { background: var(--surface); }
.catalog-count.active { border-color: var(--ink); font-weight: 600; }
.catalog-note { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.memory-item-top { flex-wrap: wrap; }
.memory-item-scope { margin: 6px 0; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.memory-unverified { margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.memory-unverified > summary { font-size: 13px; font-weight: 500; cursor: pointer; }
.memory-unverified > .form-hint { margin: 12px 0; }
.conflict-bases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.conflict-basis { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.conflict-basis h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.conflict-basis > p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.conflict-difference, .conflict-question { margin-top: 12px; font-size: 13px; white-space: pre-wrap; }
.conflict-question { font-weight: 600; }
.conflict-options { margin: 8px 0 12px; padding-left: 22px; font-size: 13px; }
.conflict-options li + li { margin-top: 6px; }
.memory-proposed-detail { margin: 12px 0; font-size: 12px; }
.memory-proposed-detail > summary { cursor: pointer; }
.update-proposal-actions { font-size: 12px; }
.update-proposal-actions > summary { cursor: pointer; }
.source-relations { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.source-relations > summary { cursor: pointer; font-size: 13px; font-weight: 500; }
.source-relations > div { margin-top: 12px; }
.source-relations > .form-hint { margin-top: 8px; }
.related-source { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.related-source > .button { padding-left: 0; justify-content: flex-start; max-width: 100%; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.related-source > .badge { margin-left: 6px; }
.related-source > .form-hint { margin-top: 3px; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .catalog-filters { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .catalog-filters .form-field { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 8px; }
  .catalog-filters label { margin: 0; }
  .catalog-filters select, .branch-control select { font-size: 16px; }
  .catalog-count { min-height: 34px; }
  .catalog-summary > strong { width: 100%; }
  .scope-summary { margin-top: 0; }
  .conflict-bases { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Reading keeps source fidelity separate from indexing and project understanding. */
.source-drawer { width: min(920px, 94vw); }
.reader-tabs { margin-top: 12px; margin-bottom: 12px; }
.reader-preview-meta { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.reader-preview-meta .form-hint { flex: 1 1 240px; margin: 0; }
.reader-content, .reader-markdown, .source-preview { min-width: 0; }
.reader-markdown { font-size: 14px; line-height: 1.8; color: var(--ink); overflow-wrap: anywhere; }
.reader-markdown > :first-child { margin-top: 0; }
.reader-markdown p { margin: 12px 0; }
.reader-markdown h2, .reader-markdown h3, .reader-markdown h4, .reader-markdown h5, .reader-markdown h6 { margin: 24px 0 10px; line-height: 1.5; }
.reader-markdown h2 { font-size: 20px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.reader-markdown h3 { font-size: 17px; }
.reader-markdown h4, .reader-markdown h5, .reader-markdown h6 { font-size: 15px; }
.reader-markdown a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.reader-markdown ul, .reader-markdown ol { padding-left: 24px; margin: 12px 0; }
.reader-markdown li + li { margin-top: 5px; }
.reader-markdown blockquote { margin: 14px 0; padding: 2px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.reader-markdown hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.reader-markdown :not(pre) > code { padding: 2px 5px; border-radius: 3px; background: var(--surface); font: .9em/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: break-spaces; }
.reader-code-block { margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.reader-code-language { padding: 5px 12px; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 11px; }
.reader-code-block pre { margin: 0; padding: 14px; overflow-x: auto; background: var(--surface); font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; tab-size: 2; }
.reader-plain { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; }
.reader-table-scroll { max-width: 100%; overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.reader-table-scroll table { border-collapse: collapse; width: 100%; font-size: 13px; }
.reader-table-scroll th, .reader-table-scroll td { min-width: 100px; padding: 9px 12px; vertical-align: top; text-align: left; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.reader-table-scroll th { background: var(--surface); font-weight: 600; }
.reader-table-scroll tr:last-child td { border-bottom: 0; }
.reader-table-scroll th:last-child, .reader-table-scroll td:last-child { border-right: 0; }
.reader-message { margin: 26px 0; padding: 0; background: transparent; }
.reader-message[data-role="user"] { padding: 16px 18px; border-radius: 12px; background: var(--surface); }
.reader-message-header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 11px; color: var(--muted); }
.reader-message-header strong { color: var(--ink); font-size: 13px; }
.reader-hit { outline: 2px solid var(--blue); outline-offset: 2px; scroll-margin-top: 28px; }
.reader-attachment { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; }
.reader-attachment > span:first-child { font-weight: 500; }
.reader-attachment a { color: var(--blue); }
.reader-attachment small { flex-basis: 100%; }
.reader-unbound { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.reader-unbound h3 { font-size: 14px; }
.reader-image-frame { max-width: 100%; overflow: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.reader-image { display: block; max-width: 100%; max-height: 75vh; object-fit: contain; margin: auto; }
.reader-image-frame.natural-size .reader-image { max-width: none; max-height: none; margin: 0; }
.reader-media { display: block; width: 100%; max-height: 72vh; margin: 16px 0; background: var(--surface); border-radius: var(--radius); }
.reader-pdf { display: block; width: 100%; height: 72vh; border: 1px solid var(--line); margin: 12px 0; }
.reader-unavailable { padding: 24px; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: 13px; line-height: 1.8; }
.pdf-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pdf-controls input { width: 70px; min-height: 32px; padding: 5px 8px; }
.pdf-controls select { width: auto; min-height: 32px; padding: 5px 8px; }
.pdf-controls > span { margin-right: auto; color: var(--muted); font-size: 12px; }
.pdf-search { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.pdf-search > input { min-width: 140px; flex: 1 1 180px; }
.pdf-search > .form-hint { flex-basis: 100%; margin: 0; }
.pdf-canvas-box { overflow: auto; width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--surface); }
.pdf-page-canvas { display: block; margin: 0 auto; }
.pdf-page-text { margin: 12px 0; font-size: 12px; }
.pdf-page-text pre { max-height: 360px; overflow: auto; padding: 12px; background: var(--surface); }
.library-groups { margin-bottom: 16px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 20px 16px; }
.media-card { display: flex; flex-direction: column; padding: 0; text-align: left; min-width: 0; border: 1px solid transparent; border-radius: 10px; overflow: hidden; background: transparent; cursor: pointer; color: var(--ink); }
.media-card:hover { background: var(--surface); border-color: var(--line); }
.media-thumbnail-frame { display: flex; align-items: center; justify-content: center; position: relative; aspect-ratio: 4/3; overflow: hidden; border-radius: 9px; background: var(--surface); width: 100%; }
.media-thumbnail { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.media-placeholder { font-size: 13px; color: var(--muted); }
.media-card-body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 6px; width: 100%; min-width: 0; }
.media-card-body strong { width: 100%; font-size: 13px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.media-card-body .form-hint { margin: 0; }
@media (max-width: 600px) {
  .source-drawer { width: 100%; }
  .reader-message { padding: 12px; margin: 14px 0; }
  .reader-markdown { font-size: 14px; }
  .reader-markdown h2 { font-size: 18px; }
  .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .media-card-body { padding: 9px; }
  .media-card-body strong { font-size: 12px; }
  .media-card-body .document-subtitle { font-size: 10px; }
  .pdf-controls { gap: 6px; }
  .pdf-controls .button { padding: 6px 8px; }
}
.media-search-supplement { margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--line); }
.media-analysis { margin-top: 10px; }
.media-analysis .document-meta { margin: 10px 0; }
.media-analysis .reader-unbound { margin-top: 10px; padding-top: 8px; }


/* Work surfaces: context is stable; task content owns the center. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.sidebar { overflow: hidden; }
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sidebar-scroll .project-list { max-height: none; overflow: visible; }
.current-project-label { margin-top: 22px; }
.sidebar-bottom { flex-shrink: 0; padding-top: 12px; }
.sidebar .brand small { display: inline; margin-left: 5px; font-size: 11px; }
.theme-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin-bottom: 4px; border-radius: var(--radius); color: var(--muted); text-align: left; font-size: 12px; }
.theme-button:hover { background: var(--surface-hover); color: var(--ink); }
.theme-button .icon { width: 16px; height: 16px; }
.recent-reading { margin-top: 24px; }
.recent-reading-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 7px 10px; border-radius: var(--radius); text-align: left; color: var(--muted); font-size: 12px; line-height: 1.5; overflow: hidden; }
.recent-reading-item:hover { background: var(--surface-hover); color: var(--ink); }
.recent-reading-item .icon { width: 14px; height: 14px; }
.recent-reading-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-separator { color: var(--muted); opacity: .6; font-size: 12px; }

.topbar-context { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
#workspace-project { min-width: 0; max-width: 220px; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-context .branch-control { min-width: 0; max-width: 220px; padding: 0; }
.topbar-context .branch-control label, .topbar-context #branch-hint { display: none; }
.topbar-context .branch-control select { width: auto; max-width: 100%; min-height: 32px; padding: 4px 24px 4px 4px; border-color: transparent; background-color: transparent; font-size: 12px; text-overflow: ellipsis; }
.topbar-context .branch-control select:hover { background-color: var(--surface); }
.topbar-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.topbar-tools #add-button { background: transparent; border-color: transparent; color: var(--ink); }
.topbar-tools #add-button:hover { background: var(--surface); }
#main[data-view="memory"] { max-width: 980px; }
#main[data-view="memory"] .page-heading { margin-bottom: 18px; }
#main[data-view="memory"] .page-heading h1 { font-size: 15px; font-weight: 500; color: var(--muted); }
#main[data-view="memory"] .page-description { display: none; }
#main[data-view="memory"] #scope-summary { display: none; }
.work-surface { max-width: 780px; margin: 24px auto 30px; }
.work-prompt { margin-bottom: 24px; }
.work-prompt h2 { font-size: 27px; font-weight: 500; letter-spacing: -.6px; line-height: 1.5; }
.work-prompt p { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.work-surface .memory-composer-head { display: none; }
.work-surface .memory-composer textarea:focus { outline: none; }
.work-surface .memory-composer:focus-within { border-color: var(--muted); }
.work-surface .memory-compose-bottom { align-items: center; }
.composer-scope { flex: 1; min-width: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.memory-composer-shortcut { flex-shrink: 0; color: var(--muted); font-size: 11px; }
.work-context-status { margin-bottom: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.work-runtime-details { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.work-runtime-details > summary { color: var(--muted); font-size: 12px; }
.work-surface .memory-compose-bottom .button { border-radius: 8px; }
.work-details { max-width: 780px; margin: 0 auto 24px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.work-details > summary { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.work-details > summary:hover { color: var(--ink); }
.work-details[open] > summary { margin-bottom: 16px; color: var(--ink); }
.work-details .memory-aside { margin-top: 24px; }
.memory-layer { margin: 18px 0; }
.memory-layer > summary { padding-block: 8px; font-size: 14px; }
.memory-layer > summary .badge { margin-left: 6px; }
.memory-item-top > span:last-child { margin-left: auto; }
.memory-item-bottom > span:first-child { margin-right: auto; }
.memory-item-list .memory-item .badge.muted { border-color: transparent; background: transparent; padding-inline: 0; }
.memory-item-list .memory-item .badge + .badge { margin-left: 4px; }
.scope-summary { margin: -10px 0 20px; padding-bottom: 0; border: 0; font-size: 11px; }
.library-filter-details, .library-inventory-details { margin: 0 0 14px; }
.library-filter-details > summary, .library-inventory-details > summary { width: fit-content; min-height: 30px; margin: 0; padding: 4px 0; color: var(--muted); font-size: 12px; }
.library-filter-details[open] { padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.library-filter-details .catalog-filters { margin-top: 6px; }
.library-filter-details .catalog-filters .form-field { margin-top: 4px; }
.library-inventory-details > .catalog-summary { margin-top: 12px; }
.library-inventory-details .catalog-note { margin-bottom: 8px; }
.library-groups { margin-bottom: 18px; }
.library-toolbar { flex-wrap: wrap; gap: 10px; }
.library-toolbar .library-count { margin-left: auto; }
.library-toolbar .library-filter-details { margin: 0; }
.library-toolbar .library-filter-details > summary { min-height: 34px; padding: 5px 9px; border: 1px solid var(--line); border-radius: var(--radius); }
.library-toolbar .library-filter-details[open] { flex-basis: 100%; order: 3; }
.catalog-note { line-height: 1.8; }
.source-heading { margin-bottom: 4px; }
.source-context { margin-bottom: 4px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.reader-window-tools { display: flex; align-items: center; gap: 4px; }
.drawer-body > .reader-tabs { margin-left: 0; margin-right: 0; }
.source-toolbar { align-items: center; }
.source-toolbar .button { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.source-toolbar .version-select { min-height: 30px; }
.source-drawer .drawer-header > .eyebrow { flex: 1; }
.source-drawer .drawer-header .icon-button { width: 32px; height: 32px; }
.source-drawer .source-secondary-details { margin: 12px 0; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.reader-content { padding-top: 0; }
.drawer-body > * { max-width: 780px; margin-inline: auto; }
.reader-message .reader-markdown { line-height: 1.9; }
.reader-message[data-role="assistant"] { padding-inline: 2px; }
.reader-message[data-role="tool"], .reader-message[data-role="system"], .reader-message[data-role="developer"] { padding: 12px 14px; border-left: 2px solid var(--line); font-size: 12px; }
.reader-pdf, .pdf-canvas-box { border-color: var(--line-soft); }
.reader-code-block pre, .reader-plain { color: var(--ink); }
.document-table { border-color: var(--line-soft); }
.document-row { min-height: 64px; }
.document-row:hover .document-name { color: var(--ink); }
.settings-section > h2 { font-size: 15px; }
.login-card .inline-note { text-align: left; }
@media (min-width: 1280px) {
  body.reading-open .workspace { width: calc(100% - var(--sidebar-width) - var(--reader-width)); margin-right: var(--reader-width); }
  body.reading-open .source-drawer { width: var(--reader-width); }
  body.reading-open .drawer-backdrop { display: none; }
  body.reading-open .workspace .topbar { flex-wrap: wrap; gap: 8px; height: auto; padding: 10px 20px; }
  body.reading-open .topbar-context { flex-basis: 100%; }
  body.reading-open .topbar-tools { width: 100%; }
  body.reading-open .topbar-tools .global-search { flex: 1; width: auto; max-width: none; }
  body.reading-open #main { padding-inline: 22px; }
  body.reading-open .page-heading { flex-wrap: wrap; }
  body.reading-open .page-actions { justify-content: flex-start; }
  body.reading-open .memory-revisions { grid-template-columns: minmax(0, 1fr); }
  body.reading-open .memory-revision + .memory-revision { border-left: 0; border-top: 1px solid var(--line-soft); }
  body.reading-open .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  body.reading-open .overview-grid { grid-template-columns: minmax(0,1fr); }
  body.reading-open .document-row, body.reading-open .table-head { grid-template-columns: minmax(0,1fr) 85px; }
  body.reading-open .document-row > .table-cell:nth-child(n+3), body.reading-open .table-head > :nth-child(n+3) { display: none; }
  body.reading-expanded .source-drawer { width: calc(100% - var(--sidebar-width)); }
  body.reading-expanded .drawer-body { padding-inline: max(32px, calc((100vw - var(--sidebar-width) - 780px) / 2)); }
}
@media (max-width: 1120px) {
  .topbar { padding-inline: 20px; gap: 10px; }
  .topbar-tools .global-search { width: 180px; }
  .topbar-tools .global-search kbd { display: none; }
  #workspace-project { max-width: 150px; }
  .topbar-context { gap: 8px; }
  .topbar-context .branch-control { max-width: 180px; }
}
@media (max-width: 820px) {
  .topbar { height: auto; min-height: 56px; padding: 8px 16px; flex-wrap: wrap; gap: 6px; }
  .topbar > .mobile-only { min-height: 40px; }
  .topbar-context { flex: 1; gap: 8px; }
  .topbar-tools { gap: 4px; }
  .topbar-tools .global-search { width: 150px; min-width: 100px; }
  .topbar-tools #add-button > span:last-child { display: none; }
  .topbar-tools #add-button { min-width: 40px; }
  .sidebar.open { border-right-color: var(--line); }
  #main { padding: 24px; }
  .page-heading { margin-bottom: 20px; padding-bottom: 0; border: 0; }
  .work-surface { margin: 18px auto 28px; }
  .work-prompt h2 { font-size: 25px; }
  .source-drawer { width: min(920px, 96vw); }
}
@media (max-width: 600px) {
  .topbar { padding: 6px 12px; gap: 4px 8px; }
  .topbar-context { min-width: 0; width: calc(100% - 52px); }
  #workspace-project { max-width: 42%; font-size: 13px; }
  .topbar-context .branch-control { max-width: 58%; }
  .topbar-context .branch-control select { min-height: 44px; font-size: 16px; }
  .topbar-tools { flex-basis: 100%; width: 100%; gap: 8px; padding-bottom: 4px; }
  .topbar-tools .global-search { flex: 1; width: auto; height: 38px; }
  .topbar-tools #add-button { min-width: 44px; min-height: 44px; padding: 8px; }
  .topbar-tools #add-button > span:last-child { display: inline; }
  #main { padding: 20px 16px 16px; }
  .page-heading { gap: 10px; margin-bottom: 20px; }
  .page-heading h1 { font-size: 21px; }
  .page-description { max-width: 100%; font-size: 12px; }
  .page-actions { gap: 4px; }
  .scope-summary { margin-top: -8px; margin-bottom: 18px; }
  .work-surface { margin-top: 12px; }
  .work-prompt { margin-bottom: 20px; }
  .work-prompt h2 { font-size: 24px; }
  .work-prompt p { font-size: 12px; }
  .memory-composer { padding: 14px; border-radius: 14px; }
  .memory-composer textarea { padding: 2px 0 10px; min-height: 108px; font-size: 16px; }
  .memory-examples { gap: 4px; }
  .memory-composer-shortcut { display: none; }
  .library-toolbar .library-filter-details > summary { min-height: 44px; padding-block: 10px; }
  .memory-example { min-height: 40px; padding: 7px 8px; font-size: 12px; }
  .memory-compose-bottom { flex-wrap: wrap; gap: 8px; }
  .memory-compose-bottom .memory-composer-hint { flex: 1 1 150px; }
  .memory-compose-bottom .button { min-height: 44px; margin-left: auto; }
  .memory-item { padding: 16px 0; }
  .memory-item-bottom .button { min-height: 40px; }
  .memory-revisions { grid-template-columns: minmax(0,1fr); }
  .memory-revision { padding: 12px 0; }
  .memory-revision + .memory-revision { border-left: 0; border-top: 1px solid var(--line-soft); }
  .memory-revision > span, .memory-revision > small { font-size: 11px; }
  .work-details > summary, .memory-layer > summary { min-height: 44px; padding-block: 10px; }
  .tabs { width: 100%; }
  .tab { min-height: 44px; padding: 8px 10px; font-size: 12px; }
  .library-toolbar .library-filter { flex-basis: 200px; }
  .library-toolbar .library-count { font-size: 11px; }
  .library-filter-details > summary, .library-inventory-details > summary { min-height: 44px; padding: 10px 0; }
  .library-filter-details, .library-inventory-details { margin-bottom: 8px; }
  .catalog-filters select { min-height: 44px; }
  .catalog-count { min-height: 44px; }
  .media-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 10px; }
  .media-card-body { padding: 8px 3px; }
  .media-card-body strong { font-size: 12px; }
  .source-drawer { width: 100%; border-left: 0; }
  .drawer-header { min-height: 52px; padding: 4px 12px; }
  .source-drawer .drawer-header .icon-button { width: 44px; height: 44px; }
  .drawer-body { padding: 18px 16px max(28px, env(safe-area-inset-bottom)); }
  .drawer-body h2 { font-size: 19px; }
  .source-toolbar .button, .source-actions .button, .version-select { min-height: 44px; }
  .reader-message { padding: 0; margin: 24px 0; }
  .reader-message[data-role="user"] { padding: 14px; }
  .reader-preview-meta { gap: 7px; margin: 10px 0 16px; }
  .pdf-controls .button, .pdf-controls input, .pdf-controls select { min-height: 44px; }
  .pdf-search .button { min-height: 44px; }
  .pdf-search input { min-height: 44px; font-size: 16px; }
  .button, .icon-button, .check-row, .nav-item, .project-item, .theme-button, .recent-reading-item { min-height: 44px; }
  .button-small, .button-text { min-height: 40px; }
  .icon-button { min-width: 44px; }
  .source-card { padding: 16px 12px; }
  .connection-card { padding: 18px 0; }
  .update-card { padding: 18px 0; }
  .panel { padding: 16px 0; }
  .login-card { padding: 24px 18px; }
}
/* Cross-app media memory: human annotations remain distinct from analysis. */
.media-status { margin:12px 0 20px; padding:12px 14px; border:1px solid var(--line); border-radius:10px; }
.media-status-head,.media-reference-head { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.media-status-head > strong { flex:1; min-width:140px; font-size:13px; }
.media-status .form-hint { margin:6px 0 0; }
.media-reference { padding:16px 0; }
.media-reference-head .memory-source-link { flex:1 1 220px; min-width:0; }
.media-annotation-text { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.65; margin:10px 0; }
.media-annotation-list { display:grid; gap:10px; margin:12px 0; }
.media-annotation { padding:12px 14px; border:1px solid var(--line); border-radius:8px; }
.media-annotation.selected { border-color:var(--ink); background:var(--surface); }
.media-annotation .annotation-select { padding-left:0; text-align:left; }
.media-annotation-identity { margin:8px 0; color:var(--muted); overflow-wrap:anywhere; font-size:12px; }
.media-annotation-identity summary,.media-automatic-details summary { cursor:pointer; }
.media-automatic-details { border-top:1px solid var(--line); padding:14px 0; margin-top:14px; }
.media-references h3 { font-size:14px; margin:18px 0 4px; }
.source-media-memory > div { padding-top:12px; }
.reader-segment-status { padding:8px 0; }
@media (max-width:820px) {
  .media-status { padding:12px; }
  .media-status-head > strong { flex-basis:100%; }
  .media-annotation { padding:10px 12px; }
  .media-annotation .button,.media-reference .button { min-height:44px; }
}
.media-intake-details { margin-top:12px; padding-top:10px; border-top:1px solid var(--line-soft); font-size:12px; color:var(--muted); }
.media-intake-details summary { cursor:pointer; }
.media-intake-root { margin:12px 0; }
.source-media-memory > div > .button { margin:4px 6px 0 0; }
.media-coverage-details { color:var(--muted); font-size:12px; margin-top:10px; }
.media-coverage-details > summary { cursor:pointer; }
.media-coverage-details > .form-hint { margin-top:8px; }
