/* Shared dashboard primitives. Page layouts compose these; no route overrides. */
:root {
  --bg:#f8f6f3; --surface:#fff; --surface-soft:#f6f3ef; --ink:#17171c; --muted:#686875;
  --line:#e8e4e0; --line-strong:#d5cec8; --accent:#eaa277; --accent-soft:#fcf1e8;
  --accent-plum:#7652af; --success:#168260; --warn:#986619; --danger:#bc4545;
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-6:24px; --space-8:32px;
  --radius:20px; --radius-sm:12px; --control-height:44px;
  --shadow:0 8px 30px rgb(30 24 18 / 3%);
}
body[data-theme="dark"] { --bg:#141416; --surface:#1d1d20; --surface-soft:#252528; --ink:#f4f1ee; --muted:#b5b0ba; --line:#333237; --line-strong:#514c55; --accent-soft:#35271f; --accent-plum:#bea0ec; --success:#65cea3; --warn:#e4b66d; --danger:#ee8c8c; }
* { box-sizing:border-box; }
body { margin:0; color:var(--ink); background:var(--bg); font:14px/1.55 Inter,system-ui,sans-serif; }
button,input,textarea,select { font:inherit; }
button,a,input,select,textarea { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
a { color:inherit; text-decoration:none; }
img { display:block; max-width:100%; }
h1,h2,h3,p { margin:0; }
h1,h2,h3 { line-height:1.2; }
:focus-visible { outline:2px solid var(--accent-plum); outline-offset:3px; }
[hidden],.is-hidden { display:none !important; }
button:disabled,[aria-disabled="true"] { opacity:.5; cursor:not-allowed; }
.dashboard-app { display:grid; grid-template-columns:240px minmax(0,1fr); min-height:100vh; }
.dashboard-app.is-auth-loading .workspace-gate,.dashboard-app.is-auth-loading .app-panels { visibility:hidden; }
.app-sidebar { position:sticky; top:0; height:100dvh; overflow-y:auto; scrollbar-width:none; -ms-overflow-style:none; display:flex; flex-direction:column; gap:var(--space-6); padding:var(--space-4); border-right:1px solid var(--line); background:color-mix(in srgb,var(--surface) 65%,var(--bg)); }
.app-sidebar::-webkit-scrollbar { display:none; }
.app-sidebar__brand { display:flex; align-items:center; gap:var(--space-3); padding:var(--space-4); background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow); }
.app-sidebar__logo { width:36px; height:36px; border-radius:10px; }
.app-sidebar__brand strong { display:block; font-size:17px; letter-spacing:-.5px; }
.app-sidebar__brand span,.app-nav__item small { display:block; font-size:12px; color:var(--muted); }
.app-nav { display:grid; gap:var(--space-2); }
.app-nav__item { text-align:left; padding:var(--space-3) var(--space-4); color:var(--ink); background:transparent; border:1px solid transparent; border-radius:16px; }
.app-nav__item span { display:block; font-weight:600; }
.app-nav__item:hover { background:var(--surface-soft); }
.app-nav__item.is-active { border-color:var(--line); background:var(--surface); box-shadow:inset 2px 0 var(--accent); }
.dashboard-app--preview .app-nav { opacity:.46; }
.dashboard-app--preview .app-nav__item { cursor:default; }
.dashboard-app--preview .app-nav__item:hover { background:transparent; }
.app-sidebar__footer { display:grid; gap:var(--space-3); margin-top:auto; padding-top:var(--space-6); }
.app-sidebar__workspace-status { display:flex; align-items:center; gap:var(--space-3); padding:var(--space-3) var(--space-4); background:var(--surface); border:1px solid var(--line); border-radius:99px; }
.status-dot { width:8px; height:8px; flex-shrink:0; border-radius:50%; background:var(--success); box-shadow:0 0 0 5px color-mix(in srgb,var(--success) 12%,transparent); }
.app-sidebar__link { color:var(--muted); padding-inline:var(--space-3); font-size:13px; }
.app-main { width:100%; max-width:1640px; min-width:0; margin-inline:auto; padding:var(--space-8); }
.app-topbar { display:flex; align-items:flex-start; justify-content:space-between; gap:var(--space-6); margin-bottom:var(--space-8); }
.app-topbar h1 { font-family:Syne,Inter,sans-serif; font-size:clamp(32px,3.5vw,48px); font-weight:700; letter-spacing:-.055em; }
.app-topbar__description { margin-top:var(--space-2); color:var(--muted); font-size:16px; }
.app-topbar__eyebrow,.section-header__eyebrow,.workspace-gate__eyebrow { font-size:11px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); margin-bottom:var(--space-2); }
.app-topbar__actions,.connection-actions,.sources-filter-group,.ask-prompt-row,.brain-tabs,.answer-preview__meta { display:flex; align-items:center; gap:var(--space-2); flex-wrap:wrap; }
.theme-toggle,.ghost-button,.primary-button,.prompt-chip,.sources-filter { display:inline-flex; align-items:center; justify-content:center; gap:var(--space-2); min-height:var(--control-height); padding:10px 20px; border-radius:99px; border:1px solid var(--line); background:var(--surface); color:var(--ink); line-height:1.3; text-align:center; }
.primary-button,.sources-filter.is-active { background:var(--ink); color:var(--surface); border-color:var(--ink); font-weight:600; }
.ghost-button:hover,.sources-filter:not(.is-active):hover { border-color:var(--line-strong); background:var(--surface-soft); }
.theme-toggle { width:44px; padding:12px; }
.theme-toggle__icon,.theme-toggle__icon svg { display:block; width:18px; height:18px; }
.theme-toggle__icon--moon,body[data-theme="dark"] .theme-toggle__icon--sun { display:none; }
body[data-theme="dark"] .theme-toggle__icon--moon { display:block; }
.app-panels,.panel { display:grid; gap:var(--space-6); min-width:0; }
.panel { padding:0; border:0; background:transparent; }
.section-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:var(--space-4); }
.section-header h2 { font-size:20px; letter-spacing:-.04em; }
.section-header > div > p:last-child { color:var(--muted); margin-top:var(--space-2); }
/* Page identity lives in the shared header; section headers carry actions/status. */
.panel-section > .section-header > div:first-child { display:none; }
.plan-banner { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:var(--space-4); padding:20px var(--space-6); border:1px solid color-mix(in srgb,var(--accent) 55%,var(--line)); border-radius:var(--radius); }
.plan-banner__copy { display:flex; align-items:center; gap:var(--space-6); flex-wrap:wrap; }
.plan-banner__copy strong { font-size:20px; letter-spacing:-.04em; }
.plan-banner__copy p { color:var(--muted); padding-left:var(--space-6); border-left:1px solid var(--line-strong); }
.plan-banner__eyebrow,.plan-banner__stat,.plan-banner__hint { display:none; }
.plan-banner__meta { margin-left:auto; }
.plan-banner .primary-button { background:transparent; color:var(--ink); border:0; padding:0; }
.stats-grid,.source-summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); gap:var(--space-4); }
.overview-grid,.ingest-grid,.ask-grid,.team-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space-6); align-items:start; }
.card,.stat-card,.mini-stat-card,.ask-preview-topline__card,.brain-library-card,.brain-detail-card,.brain-add-card { min-width:0; padding:var(--space-6); border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); box-shadow:var(--shadow); }
.card { display:grid; gap:var(--space-4); align-content:start; }
.card__header,.brain-library-card__header,.brain-detail-card__top { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:var(--space-3); }
.card__header h3,.brain-library-card h3 { font-size:20px; letter-spacing:-.045em; }
.stat-card span,.stat-card small,.mini-stat-card span,.mini-stat-card small,.ask-preview-topline__card span,.ask-preview-topline__card small { display:block; color:var(--muted); font-size:13px; }
.stat-card strong,.mini-stat-card strong,.ask-preview-topline__card strong { display:block; margin:var(--space-3) 0; font-size:28px; letter-spacing:-.05em; line-height:1.2; overflow-wrap:anywhere; }
#stat-last-sync,#stat-agent-status { font-size:19px; }
.stack-form,.workspace-gate__form,#delete-workspace-form { display:grid; gap:var(--space-4); }
.auth-divider { display:flex; align-items:center; gap:var(--space-3); color:var(--text-muted); font-size:.78rem; text-transform:uppercase; letter-spacing:.08em; }
.auth-divider span { height:1px; flex:1; background:var(--border); }
.google-button { display:flex; justify-content:center; align-items:center; gap:.7rem; width:100%; min-height:42px; padding:.65rem 1rem; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface); color:var(--text); font:inherit; font-weight:600; cursor:pointer; }
.google-button:hover { background:var(--surface-raised); border-color:var(--text-muted); }
.google-button svg { width:18px; height:18px; flex:none; }
label { display:grid; gap:var(--space-2); min-width:0; font-size:13px; font-weight:500; }
input,select,textarea { width:100%; min-width:0; min-height:var(--control-height); padding:12px 14px; border:1px solid var(--line); border-radius:var(--radius-sm); color:var(--ink); background:var(--surface-soft); }
textarea { resize:vertical; min-height:120px; line-height:1.6; }
input::placeholder,textarea::placeholder { color:var(--muted); }
.stack-form > .primary-button { justify-self:start; }
.card-note,.sources-plan-note,.activity-item,.citation-card,.install-banner,.answer-preview__text,.oauth-summary > div { padding:var(--space-4); border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-soft); color:var(--muted); }
.card-note { font-size:13px; }
.card-note strong,.citation-card strong,.activity-item strong { color:var(--ink); }
.progress-list { margin:0; padding-left:20px; color:var(--muted); display:grid; gap:var(--space-3); }
.activity-list,.answer-preview,.answer-preview__citations,.sources-table,.oauth-summary { display:grid; gap:var(--space-3); }
.activity-item strong,.citation-card strong,.activity-item small,.citation-card small { display:block; }
.empty-state,.empty-copy,.sources-table__empty { padding:var(--space-6) 0; color:var(--muted); }
.section-header__badge,.pill,.source-status,.brain-status { display:inline-flex; align-items:center; gap:6px; min-height:30px; padding:4px 12px; border-radius:99px; font-size:12px; font-weight:600; background:var(--surface-soft); color:var(--muted); }
.pill--soft,.prompt-chip { background:color-mix(in srgb,var(--accent-plum) 10%,var(--surface)); color:var(--accent-plum); }
.pill--accent { background:var(--accent-soft); color:var(--ink); }
.source-status--indexed,.brain-status--approved { background:color-mix(in srgb,var(--success) 12%,var(--surface)); color:var(--success); }
.source-status--processing,.brain-status--pending,.brain-status--changes_requested { background:color-mix(in srgb,var(--warn) 12%,var(--surface)); color:var(--warn); }
.source-status--failed,.brain-status--rejected,.source-error { color:var(--danger); }
.file-picker { position:relative; display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); overflow:hidden; min-height:72px; padding:var(--space-4); border:1px dashed var(--line-strong); border-radius:var(--radius-sm); }
.file-picker input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.file-picker:focus-within,.brain-search:focus-within { outline:2px solid var(--accent-plum); outline-offset:3px; }
.file-picker__button { padding:8px 14px; border:1px solid var(--line); border-radius:99px; flex-shrink:0; }
#pdf-file-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crawl-fields,.brain-add-fields { display:grid; grid-template-columns:minmax(0,1fr) 160px; gap:var(--space-4); }
.sources-toolbar { display:flex; align-items:center; justify-content:space-between; gap:var(--space-4); flex-wrap:wrap; }
.sources-toolbar__hint { color:var(--muted); font-size:12px; }
.sources-table__row { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,120px),1fr)); gap:var(--space-4); padding:var(--space-4); background:var(--surface-soft); border-radius:var(--radius-sm); align-items:center; }
.sources-table__row > div { min-width:0; overflow-wrap:anywhere; }
.sources-table__row strong,.sources-table__row small { display:block; }
.sources-table__row small { color:var(--muted); font-size:12px; margin-top:4px; }
.sources-table__head,#sources-table .sources-table__row { grid-template-columns:minmax(0,1.5fr) .6fr .9fr 1fr .8fr 1fr; }
.sources-table__head { display:grid; gap:var(--space-4); padding:var(--space-3) var(--space-4); color:var(--muted); font-size:12px; border-bottom:1px solid var(--line); }
.source-actions { display:flex; flex-wrap:wrap; gap:var(--space-2); }
.source-action { border:0; background:transparent; color:var(--ink); padding:4px 0; font-size:12px; text-decoration:underline; text-underline-offset:3px; }
.source-action--danger { color:var(--danger); }
.ask-preview-topline { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:var(--space-4); }
.answer-preview__text { color:var(--ink); line-height:1.7; }
.answer-preview__text > * + * { margin-top:var(--space-3); }
.citation-match { display:block; color:var(--accent-plum); font-size:12px; margin-top:var(--space-2); }
.connection-summary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space-4); }
.connection-summary-grid span,.oauth-summary span { display:block; color:var(--muted); font-size:12px; }
.connection-summary-grid strong { overflow-wrap:anywhere; }
.brain-workspace { display:grid; grid-template-columns:minmax(0,.95fr) minmax(0,1.05fr); gap:var(--space-4); align-items:stretch; }
.brain-library-card,.brain-detail-card { display:flex; flex-direction:column; gap:var(--space-4); min-height:580px; }
.brain-search { display:flex; align-items:center; gap:var(--space-2); padding-inline:var(--space-4); border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-soft); }
.brain-search input { border:0; background:transparent; padding-inline:0; outline:none; }
.brain-search span { font-size:24px; color:var(--muted); }
.brain-tabs span { padding:2px 7px; border-radius:99px; background:color-mix(in srgb,currentColor 12%,transparent); font-size:12px; }
.brain-list { display:grid; gap:var(--space-3); }
.brain-list:empty { display:none; }
.brain-entry { width:100%; text-align:left; padding:var(--space-4); border:1px solid var(--line); border-radius:16px; background:var(--surface); color:var(--ink); }
.brain-entry:hover,.brain-entry.is-selected { border-color:var(--accent); background:color-mix(in srgb,var(--accent-soft) 45%,var(--surface)); }
.brain-entry__badges { display:flex; gap:var(--space-2); flex-wrap:wrap; }
.brain-entry strong { display:block; margin-top:var(--space-3); font-size:17px; letter-spacing:-.03em; }
.brain-entry p { margin:var(--space-2) 0 var(--space-3); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; color:var(--muted); }
.brain-entry small,.brain-library-card__note { color:var(--muted); font-size:12px; }
.brain-library-card__note { margin-top:auto; padding-top:var(--space-6); }
.brain-detail-card h3 { font-family:Syne,Inter,sans-serif; font-size:clamp(26px,2.5vw,38px); letter-spacing:-.05em; overflow-wrap:anywhere; }
.brain-detail-card__content { white-space:pre-wrap; overflow-wrap:anywhere; padding-block:var(--space-6); border-block:1px solid var(--line); font-size:16px; color:var(--muted); line-height:1.7; }
.brain-detail-card__meta { display:grid; grid-template-columns:70px minmax(0,1fr); gap:var(--space-2) var(--space-4); font-size:13px; }
.brain-detail-card__meta span { color:var(--muted); }
.brain-review-note { padding:var(--space-4); border-radius:var(--radius-sm); background:color-mix(in srgb,var(--accent-plum) 10%,var(--surface)); color:var(--accent-plum); }
.brain-answerable { margin-top:auto; padding:var(--space-4); border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-soft); }
.brain-review-actions { margin-top:auto; padding-top:var(--space-4); }
.brain-detail-card__empty { margin:auto; text-align:center; color:var(--muted); }
.brain-detail-card__empty strong { color:var(--ink); }
.workspace-gate { display:grid; place-items:center; min-height:70vh; }
.workspace-gate__card { width:min(100%,420px); padding:var(--space-8); border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); box-shadow:var(--shadow); display:grid; gap:var(--space-6); }
.workspace-gate__heading h2 { font:700 30px/1.1 Syne,Inter,sans-serif; letter-spacing:-.05em; }
.workspace-gate__heading p { margin-top:var(--space-2); color:var(--muted); }
.oauth-card { width:min(100%,560px); padding:var(--space-8); border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); display:grid; gap:var(--space-6); }
.workspace-gate h2,.oauth-card h1 { font:700 32px/1.15 Syne,Inter,sans-serif; letter-spacing:-.05em; }
.workspace-gate__card p,.oauth-card__copy,.oauth-footnote { color:var(--muted); }
.oauth-page { min-height:100vh; display:grid; place-items:center; padding:var(--space-6); }
.oauth-card__logo { width:48px; }
dialog { max-width:min(800px,92vw); max-height:85vh; padding:var(--space-6); border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--ink); }
dialog::backdrop { background:rgb(0 0 0 / 45%); }
dialog button { padding:8px 16px; border:1px solid var(--line); border-radius:99px; background:var(--surface-soft); color:var(--ink); }
dialog h2 { margin-block:var(--space-4); }
details { padding-top:var(--space-4); border-top:1px solid var(--line); }
summary { cursor:pointer; font-weight:600; }
details p,#delete-workspace-form { margin-top:var(--space-4); }
@media (max-width:1100px) {
 .dashboard-app { grid-template-columns:1fr; }
 .app-sidebar { position:static; height:auto; border-right:0; border-bottom:1px solid var(--line); gap:var(--space-4); }
 .app-sidebar__brand { max-width:240px; }
 .app-nav { grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); }
 .app-sidebar__footer { display:none; }
}
@media (max-width:760px) {
 .app-main { padding:var(--space-4); }
 .app-topbar { flex-wrap:wrap; }
 .overview-grid,.ingest-grid,.ask-grid,.team-grid,.brain-workspace,.ask-preview-topline { grid-template-columns:1fr; }
 .brain-library-card,.brain-detail-card { min-height:360px; }
 .sources-table__head { display:none; }
 #sources-table .sources-table__row { grid-template-columns:repeat(2,minmax(0,1fr)); }
 #sources-table [data-label]::before { content:attr(data-label); display:block; color:var(--muted); font-size:11px; }
 .brain-add-fields,.crawl-fields { grid-template-columns:1fr; }
 .plan-banner__copy { gap:var(--space-2); }
 .plan-banner__copy p { padding-left:0; border:0; }
 .plan-banner__meta { margin-left:0; }
 .workspace-gate__card { width:100%; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto !important; transition:none !important; } }

.drive-actions { display:flex; flex-wrap:wrap; gap:var(--space-3); align-items:center; }
.drive-folder-list { display:grid; gap:var(--space-2); }
.drive-folder-list button { justify-content:flex-start; text-align:left; overflow-wrap:anywhere; }
.drive-share-confirm { display:flex; align-items:flex-start; gap:var(--space-3); color:var(--muted); }
.drive-share-confirm input { width:18px; min-height:18px; flex:none; margin-top:3px; accent-color:var(--accent-plum); }
#drive-picker { padding:var(--space-4); border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-soft); }
#drive-picker[hidden], #drive-admin-controls[hidden] { display:none; }
