/* Davo polish with Terapist's readable, structured operational workspace. */
:root {
  --brand: #087f83;
  --brand-strong: #08685d;
  --brand-soft: rgba(72, 196, 191, .12);
  --sidebar-bg: #0b2348;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}
html[data-theme="light"] {
  --bg: #f4f7f5;
  --surface: #fff;
  --surface-2: #edf4f1;
  --surface-3: #e4eeea;
  --text: #142522;
  --muted: #536b64;
  --subtle: #596e68;
  --line: #dfe7e4;
  --line-strong: #bfcec8;
  --shadow: 0 12px 35px rgba(23, 58, 51, .07);
}
.sidebar {
  background: var(--sidebar-bg);
  color: #edf3fc;
  --surface: #102c52;
  --surface-2: #17385e;
  --surface-3: #20466b;
  --text: #edf3fc;
  --muted: #becfe1;
  --subtle: #adbed3;
  --line: rgba(203, 221, 245, .15);
  --line-strong: rgba(203, 221, 245, .28);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #587391 transparent;
}
.sidebar > * { flex-shrink: 0; }
.sidebar .history-list { flex: 1 0 96px; }
.sidebar .new-chat { min-height: 44px; margin-block: 22px 18px; font-size: 13px; }
.side-nav { gap: 3px; }
.side-nav .nav-group-label { margin: 13px 0 4px; padding-inline: 11px; font-size: 10px; font-weight: 650; letter-spacing: .1em; color: var(--subtle); text-transform: uppercase; }
.side-nav .nav-group-label:first-child { margin-top: 0; }
.side-nav .nav-item { min-height: 44px; height: auto; padding-block: 10px; font-size: 13px; }
.side-nav .nav-item.active { background: rgba(89, 202, 195, .12); box-shadow: inset 3px 0 #58c8c0; color: #fff; }
.side-nav .nav-item.active svg { color: #8bd7d8; }
.sidebar .profile-copy strong { font-size: 12px; }
.sidebar .profile-copy small, .sidebar .history-row { font-size: 12px; }
.sidebar .history-empty, .sidebar .saved-empty { font-size: 11px !important; }
.sidebar .history-pin { width: 36px; min-height: 36px; }
.topbar { border-bottom: 1px solid var(--line); }
.workspace-select { font-size: 13px; }
.knowledge-view, .memory-view { padding-block: 32px 48px; }
.memory-heading h1 { font-size: clamp(26px, 4vw, 34px); letter-spacing: -.035em; }
.memory-heading p, .knowledge-library-head p { font-size: 14px; line-height: 1.6; }
.knowledge-form { padding: clamp(18px, 3vw, 26px); border-radius: 20px; }
.knowledge-form textarea, .memory-editor textarea, .memory-editor input, .memory-editor select { font-size: 15px; line-height: 1.6; }
.knowledge-form-foot > span, .knowledge-activity, .knowledge-report, .knowledge-source-list a, .knowledge-error { font-size: 13px; }
.knowledge-card { padding: 20px; border-radius: 18px; box-shadow: 0 4px 18px rgba(0, 0, 0, .04); }
.knowledge-card h3 { font-size: 16px; }
.knowledge-status { font-size: 12px; }
.knowledge-library-head h2 { font-size: 20px; }
.knowledge-form-foot button, .memory-save, .voice-start {
  min-height: 44px; background: var(--brand-strong); color: #fff; font-size: 14px;
  transition: background var(--motion), box-shadow var(--motion);
}
.knowledge-form-foot button:hover, .memory-save:hover, .voice-start:hover { background: #07584f; }
.knowledge-actions button, .knowledge-cancel, .knowledge-delete, .memory-back { min-height: 40px; font-size: 13px; }
.icon-button:not(.tiny) { min-width: 40px; min-height: 40px; }
:is(button, a, input, textarea, select, summary):focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
html[data-theme="light"] :is(button, a, input, textarea, select, summary):focus-visible { outline-color: #087f83; }
.sidebar :is(button, a, input):focus-visible { outline-color: #8bd7d8; }
.knowledge-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
/* Keep Davo's cinematic hero; use the lighter workspace palette in light mode. */
html[data-theme="light"] #view:has(#welcome:not(.hidden))::before { opacity: .06; }
html[data-theme="light"] #app:has(#welcome:not(.hidden)) .topbar { background: var(--surface); color: var(--text); }
html[data-theme="light"] .welcome h1, html[data-theme="light"] .home-greeting { color: var(--text); }
html[data-theme="light"] .welcome .hero-copy { color: var(--muted); }
html[data-theme="light"] :is(.home-feature, .home-actions a, .home-quote, .welcome .voice-shortcut, .welcome .suggestion-chip, .welcome .composer) { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
html[data-theme="light"] :is(.home-feature small, .home-actions small, .home-feature-link, .home-greeting time, .welcome .composer-hint) { color: var(--muted); }
html[data-theme="light"] .home-greeting time { background: var(--surface); border-color: var(--line); }
html[data-theme="light"] .home-feature-icon { color: #087f83; }
@media (max-width: 760px) {
  .sidebar { height: 100dvh; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .knowledge-view, .memory-view { padding: 24px 16px calc(92px + var(--safe-b)); }
  .knowledge-card { padding: 16px; }
  .knowledge-form-foot { align-items: stretch; flex-direction: column; gap: 12px; }
  .knowledge-form-foot button { width: 100%; }
  .knowledge-actions { flex-wrap: wrap; }
  .knowledge-actions button, .knowledge-cancel, .knowledge-delete, .memory-back, .history-pin { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
