/* A persistent workspace around the same digital brain and stored materials. */
:root { --rail-width: 224px; --header-height: 80px; }
.ui-update { position: fixed; z-index: 18; top: calc(var(--header-height) + 10px); right: 14px; max-width: calc(100vw - 28px); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid #668c73; border-radius: 10px; background: #10251ff5; box-shadow: 0 10px 40px #0008; color: var(--mint); font-size: 12px; }
.ui-update .secondary { min-height: 38px; padding: 6px 12px; font-size: 12px; }
.topbar { position: fixed; inset: 0 0 auto; z-index: 12; height: var(--header-height); padding-inline: 28px; background: #0b151bef; backdrop-filter: blur(18px); gap: 20px; }
.topbar .brand { min-width: 0; flex: none; }
.topbar .top-context { margin-left: 22px; }
.global-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .primary { margin: 0; font-size: 12px; gap: 8px; white-space: nowrap; }
.primary-navigation svg, .header-search svg, #new-note svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
#new-note svg { width: 18px; height: 18px; }
.primary-navigation .nav-item > span:first-child { display: grid; place-items: center; }
.header-search { display: flex; align-items: center; gap: 9px; padding: 8px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; }
.header-search > span:first-child { font-size: 26px; line-height: 1; }
.header-search kbd { border: 1px solid var(--line); border-radius: 4px; min-width: 20px; padding: 0 5px; font-family: inherit; font-size: 11px; }
.header-search:hover { border-color: #668a7b; color: var(--text); }
.app-menu { position: relative; }
.app-menu > summary { display: grid; place-items: center; width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; list-style: none; cursor: pointer; letter-spacing: 2px; color: var(--mint); }
.app-menu > summary::-webkit-details-marker { display: none; }
.app-menu[open] > summary, .app-menu > summary:hover { background: #b4ebcf10; }
.app-menu-content { position: absolute; right: 0; top: calc(100% + 10px); width: 250px; max-width: calc(100vw - 24px); display: grid; padding: 10px; gap: 3px; border: 1px solid #446254; border-radius: 12px; background: #102027; box-shadow: 0 20px 70px #0009; max-height: calc(100dvh - 100px); overflow: auto; }
.app-menu-content .section-label { padding: 12px 10px 3px; font-size: 9px; }
.app-menu-content button { text-align: left; padding: 9px 10px; border-radius: 6px; min-height: 44px; font-size: 13px; }
.app-menu-content button:hover { background: #b4ebcf0c; }
.shell { display: block; padding-top: var(--header-height); }
.sidebar { position: fixed; z-index: 9; left: 0; top: var(--header-height); bottom: 35px; width: var(--rail-width); padding: 24px 14px; background: #0b151be8; gap: 28px; overflow-y: auto; overscroll-behavior: contain; }
.primary-navigation { display: grid; gap: 5px; }
.primary-navigation > .section-label { padding: 0 12px 10px; }
.primary-navigation .nav-item { justify-content: flex-start; width: 100%; min-height: 50px; gap: 12px; font-size: 13px; white-space: normal; position: relative; padding: 10px 12px; }
.primary-navigation .nav-item > span:first-child { width: 24px; font-size: 23px; }
.primary-navigation .nav-item .nav-count { margin-left: auto; }
.sidebar .projects-group { display: block; overflow: visible; padding: 0; }
.sidebar .section-heading { margin-bottom: 12px; }
.sidebar #projects { display: grid; gap: 4px; }
.sidebar .project-button { width: 100%; max-width: 100%; padding: 10px 12px; min-height: 42px; font-size: 12px; border: 0; margin: 0; justify-content: flex-start; white-space: normal; }
.sidebar .sidebar-hint { padding: 8px 12px; line-height: 1.8; }
.sidebar-bottom { margin-top: auto; padding: 18px 10px 0; }
main#workspace { margin-left: var(--rail-width); padding: 30px 32px 58px; min-width: 0; }
.workspace-heading { margin: 0 0 22px; align-items: center; }
.workspace-heading h1 { font-size: clamp(28px, 2.8vw, 38px); }
.workspace-heading .eyebrow { font-size: 9px; letter-spacing: 1.8px; margin-bottom: 7px; }
.knowledge-context { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: #0e1b2180; }
.knowledge-context label { display: flex; align-items: center; gap: 12px; margin: 0; min-width: 0; flex: 1; color: var(--muted); font-size: 11px; }
.knowledge-context select { margin: 0; max-width: 440px; width: 100%; min-width: 0; padding: 7px 10px; min-height: 38px; font-size: 12px; background: #0b171d; border: 1px solid var(--line); border-radius: 7px; }
.context-shortcuts { display: flex; gap: 6px; flex: none; }
.context-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 11px; }
.context-chip:hover, .context-chip.active { background: #b4ebcf0d; color: var(--mint); }
.context-chip .nav-count { margin: 0; }
.semantic-controls { margin-bottom: 14px; }
.semantic-controls .secondary { min-height: 38px; padding: 6px 14px; font-size: 12px; }
.work-surface { min-height: 470px; }
.graph-view { height: max(420px, calc(100dvh - 400px)); min-height: 420px; }
.list-view { min-height: 470px; }
.workspace-pane { min-width: 0; }
.view-switch button { min-height: 42px; font-size: 12px; padding: 7px 12px; }
.app-footer { position: fixed; inset: auto 0 0; z-index: 8; min-height: 35px; padding: 5px 24px; background: #081319f0; border-top: 1px solid var(--line); }
.app-footer #connection-state { margin-left: auto; }
.card-actions { display: grid; gap: 7px; position: sticky; bottom: -23px; background: #101b23f5; padding: 12px 0; border-top: 1px solid var(--line); }
.card-actions .secondary { width: 100%; min-height: 42px; margin: 0!important; font-size: 12px; }
.node-card h2 { overflow-wrap: anywhere; }
.toast { bottom: 55px; pointer-events: none; }
.assistant-workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr); gap: 24px; align-items: start; }
.assistant-main, .assistant-memory { min-width: 0; border: 1px solid var(--line); border-radius: 13px; padding: 24px; background: #0f1c23a6; }
.assistant-memory { position: sticky; top: calc(var(--header-height) + 24px); max-height: calc(100dvh - var(--header-height) - 80px); overflow-y: auto; }
.assistant-main > h2, .assistant-memory > h2 { margin-bottom: 10px; font-size: 23px; }
.assistant-main > p, .assistant-memory > p { font-size: 12px; line-height: 1.7; margin-bottom: 18px; }
.assistant-main form { display: grid; gap: 9px; margin-top: 22px; }
.assistant-main label { font-size: 12px; color: var(--muted); margin: 0; }
.assistant-main select, .assistant-main textarea { width: 100%; min-width: 0; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #0a171d; }
.assistant-main textarea { min-height: 145px; resize: vertical; }
.assistant-main form .primary { justify-self: start; margin-bottom: 18px; }
.assistant-workspace [data-archive-status] { font-size: 12px; line-height: 1.7; padding-block: 10px; }
.assistant-workspace [data-archive-retry] { margin-bottom: 15px; }
.assistant-workspace [data-archive-memory] > h3 { display: none; }
.assistant-workspace [data-archive-memory] article { margin-bottom: 12px; }
.assistant-empty-memory { padding: 18px 0; }

@media (max-width: 1150px) {
  :root { --rail-width: 198px; }
  main#workspace { padding-inline: 22px; }
  .topbar .top-context { display: none; }
  .assistant-workspace { grid-template-columns: minmax(0, 1fr); }
  .assistant-memory { position: static; max-height: none; }
}
@media (max-width: 850px) {
  :root { --header-height: 70px; }
  .topbar { padding-inline: 16px; gap: 10px; }
  .global-actions { gap: 8px; }
  .topbar .brand { font-size: 16px; }
  .topbar .brand svg { width: 32px; height: 32px; }
  .brand-caption { font-size: 7px; letter-spacing: 2px; }
  .topbar .primary { min-height: 44px; padding: 9px 12px; font-size: 12px; }
  .header-search { width: 44px; min-height: 44px; justify-content: center; padding: 6px; }
  .header-search > span:last-of-type, .header-search kbd { display: none; }
  .sidebar { top: auto; bottom: 0; right: 0; width: auto; padding: 5px 12px calc(5px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid #3b554e; overflow: visible; background: #0a171ff5; backdrop-filter: blur(18px); }
  .primary-navigation { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 4px; }
  .primary-navigation > .section-label, .sidebar .projects-group, .sidebar-bottom { display: none; }
  .primary-navigation .nav-item { min-width: 0; min-height: 58px; margin: 0; padding: 5px 2px; display: flex; flex-direction: column; justify-content: center; gap: 1px; text-align: center; border-radius: 8px; font-size: 10px; }
  .primary-navigation .nav-item.active { box-shadow: none; background: #b4ebcf10; }
  .primary-navigation .nav-item > span:first-child { width: auto; font-size: 24px; }
  .primary-navigation .nav-count { position: absolute; right: 8px; top: 1px; margin: 0; font-size: 8px; padding: 1px 4px; }
  main#workspace { margin-left: 0; padding: 24px 18px 110px; }
  .workspace-heading { gap: 8px; margin-bottom: 18px; align-items: center; }
  .workspace-heading h1 { font-size: 29px; }
  .workspace-heading .eyebrow { font-size: 7px; letter-spacing: 1.2px; }
  .knowledge-context { padding: 10px; margin-bottom: 14px; gap: 8px; }
  .knowledge-context label { min-width: 160px; }
  .knowledge-context label > span { display: none; }
  .knowledge-context select { font-size: 16px; min-height: 42px; }
  .context-shortcuts { width: 100%; }
  .context-chip { padding: 5px 8px; min-height: 38px; }
  .view-switch { padding: 3px; }
  .view-switch button { padding: 5px 8px; min-height: 38px; font-size: 11px; gap: 4px; }
  .semantic-controls { gap: 5px; margin-bottom: 10px; }
  .semantic-controls .secondary { font-size: 11px; min-height: 38px; padding: 5px 12px; }
  .graph-view { height: max(450px, calc(100dvh - 335px)); min-height: 450px; }
  .app-footer { position: static; margin-bottom: calc(68px + env(safe-area-inset-bottom)); padding: 8px 18px; font-size: 9px; }
  .app-footer #connection-state { margin-left: auto; }
  .local-label { max-width: 60%; white-space: normal; font-size: 7px; }
  .toast { bottom: calc(85px + env(safe-area-inset-bottom)); }
  .node-card:not([hidden]) { position: fixed; top: auto; left: 0; right: 0; width: 100%; bottom: calc(68px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 150px); padding-bottom: 12px; border-radius: 16px 16px 0 0; }
  .card-actions { bottom: -12px; }
  .assistant-main, .assistant-memory { padding: 18px; }
  .assistant-main select, .assistant-main textarea { font-size: 16px; }
}
@media (max-width: 420px) {
  .topbar { padding-inline: 12px; }
  .topbar .brand > span { display: none; }
  .topbar .brand { width: 34px; }
  main#workspace { padding-inline: 14px; }
  .workspace-heading h1 { font-size: 27px; }
  .view-switch button span { display: none; }
  .view-switch button { width: 38px; }
  .primary-navigation .nav-count { right: 3px; }
}
