:root {
  color-scheme: dark;
  --bg: #0d0f0c;
  --panel: #131510;
  --panel-2: #181b15;
  --panel-3: #20241c;
  --line: rgba(235, 241, 218, 0.1);
  --line-strong: rgba(235, 241, 218, 0.2);
  --text: #f2f4eb;
  --muted: #92998a;
  --subtle: #676e61;
  --accent: #d9ff73;
  --accent-ink: #161b0c;
  --accent-soft: rgba(217, 255, 115, 0.12);
  --violet: #b9a7ff;
  --violet-soft: rgba(155, 132, 255, 0.11);
  --blue: #8fd7ff;
  --blue-soft: rgba(79, 175, 231, 0.11);
  --danger: #ff8e83;
  --warn: #ffc96a;
  --ok: #9ce6a8;
  --radius: 14px;
  --mobile-host-chrome-height: 92px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
button, input, select, textarea { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
textarea { resize: none; }
::selection { background: rgba(217, 255, 115, 0.24); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(230, 238, 210, 0.15); border: 3px solid transparent; background-clip: padding-box; border-radius: 999px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.mobile-only, .mobile-bar, .mobile-chat-controls, .mobile-brain-button { display: none; }
.mobile-send-proxy { display: none; }
/* The phone types into the host's field over the front chat's field (public/host-input.js); the chat's own field
   shows the text, the host's field only the caret. */
.host-composer-input { display: none; }
html.host-input #composer-input { caret-color: transparent; pointer-events: none; }
.host-composer-input, .host-composer-input::placeholder { -webkit-text-fill-color: transparent; color: transparent; }
.eyebrow { color: var(--subtle); font-size: 10px; font-weight: 750; letter-spacing: 0.16em; margin: 0 0 6px; text-transform: uppercase; }

.login-page {
  align-items: center;
  background:
    radial-gradient(circle at 50% 25%, rgba(217, 255, 115, 0.08), transparent 28rem),
    linear-gradient(145deg, #0a0c09, #11140e);
  display: flex;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
}
.login-shell { max-width: 440px; width: 100%; }
.login-card { background: rgba(22, 25, 19, 0.9); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42); padding: 42px; }
.login-card h1 { font-size: clamp(34px, 8vw, 52px); letter-spacing: -0.055em; line-height: 0.98; margin: 12px 0 16px; }
.login-copy { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 34px; }
.login-card label { color: var(--muted); display: block; font-size: 12px; font-weight: 650; margin-bottom: 9px; }
.login-card > form > input { background: #0c0e0b; border: 1px solid var(--line-strong); border-radius: 11px; margin-bottom: 14px; outline: none; padding: 13px 14px; width: 100%; }
.login-card > form > input:focus { border-color: rgba(217,255,115,.62); box-shadow: 0 0 0 3px rgba(217,255,115,.09); }
.password-row { display: grid; gap: 10px; grid-template-columns: 1fr auto; }
.password-row input { background: #0c0e0b; border: 1px solid var(--line-strong); border-radius: 11px; min-width: 0; outline: none; padding: 13px 14px; }
.password-row input:focus { border-color: rgba(217, 255, 115, 0.62); box-shadow: 0 0 0 3px rgba(217, 255, 115, 0.09); }
.login-foot { color: var(--subtle); font-size: 11px; text-align: center; }
.form-error { color: var(--danger); font-size: 12px; min-height: 18px; }

.brand-mark { display: grid; height: 36px; place-items: center; position: relative; width: 36px; }
.brand-mark span { border: 2px solid var(--accent); border-radius: 9px; height: 25px; position: absolute; transform: rotate(30deg); width: 25px; }
.brand-mark span:last-child { opacity: 0.52; transform: rotate(-30deg); }
.brand-mark.small { height: 28px; width: 28px; }
.brand-mark.small span { border-radius: 7px; height: 20px; width: 20px; }
.brand-mark.disconnected { filter: grayscale(1); opacity: .42; }

.primary, .secondary { border-radius: 10px; font-weight: 720; padding: 12px 17px; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:hover { background: #e5ff9a; }
.secondary { background: var(--panel-3); color: var(--text); }

.app-shell { display: grid; grid-template-columns: 344px minmax(0, 1fr); height: 100dvh; max-width: 100vw; min-width: 0; overflow: hidden; transition: grid-template-columns 180ms ease; }
body.nav-collapsed .app-shell { grid-template-columns: 56px minmax(0,1fr); }
@media (min-width: 861px) { body.nav-collapsed .nav-list { display: none !important; } }
.workspace-grid { display: grid; height: 100%; min-height: 0; min-width: 0; overflow: hidden; position: relative; }
.workspace-grid.multi { gap: 1px; grid-auto-columns: minmax(max(320px, calc((100% - 3px) / 4)), 1fr); grid-auto-flow: column; grid-template-columns: none; overflow-x: auto; overflow-y: hidden; }
.workspace-grid.layout-columns { grid-auto-flow: column; grid-auto-columns: minmax(max(320px, calc((100% - 3px) / 4)), 1fr); grid-template-columns: none; overflow-x: auto; }
.workspace-grid.multi::-webkit-scrollbar-thumb { background-color: rgba(230, 238, 210, 0.3); }
.workspace-grid.layout-rows { grid-auto-flow: row; grid-auto-rows: minmax(500px,1fr); grid-template-columns: 1fr; overflow-x: hidden; overflow-y: auto; }
/* In the pane host the chat panel only shows the restore and empty screens; chats live in .chat-pane. */
.workspace-grid.has-panes > #chat-panel { display: none; }
.chat-pane { background: var(--bg); border-left: 1px solid var(--line); min-height: 500px; min-width: 0; position: relative; }
/* A waiting pane shows about:blank, whose light scheme would make Chrome paint it white against a dark page; with
   the frame on the default scheme it stays see-through and the theme's background shows. */
.chat-pane iframe { background: var(--bg); border: 0; color-scheme: normal; display: block; height: 100%; min-height: 0; width: 100%; }
.chat-pane.first-pane { border-left: 0; }
/* A chat jumped to glows briefly (public/pane-head.js). */
.chat-pane.pane-flash::after { animation: paneFlash 1.1s ease-out forwards; box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 70px rgba(217,255,115,.2); content: ""; inset: 0; pointer-events: none; position: absolute; z-index: 5; }
@keyframes paneFlash { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
/* The standby pane is booted and waiting for the next chat; it never shows. */
.workspace-grid > .chat-pane.standby-pane { display: none !important; }
.workspace-grid > .pane-dragging { opacity: .62; }
.workspace-grid > .pane-drop-before { box-shadow: inset 3px 0 0 var(--accent); }
.workspace-grid > .pane-drop-after { box-shadow: inset -3px 0 0 var(--accent); }
.workspace-grid.layout-rows > .pane-drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.workspace-grid.layout-rows > .pane-drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.workspace-grid > .chat-panel, .workspace-grid > .chat-pane, .workspace-grid > .brain-workspace-panel { transition: box-shadow 100ms ease, opacity 100ms ease; }
.pane-thread-drop-overlay { align-items: center; background: rgba(9,11,8,.78); border: 1px dashed var(--line-strong); color: var(--muted); display: flex; font-size: 11px; font-weight: 750; inset: 7px; justify-content: center; position: absolute; z-index: 70; }
.pane-thread-drop-target > .pane-thread-drop-overlay { background: rgba(217,255,115,.14); border-color: var(--accent); box-shadow: inset 0 0 0 2px rgba(217,255,115,.12); color: var(--accent); }
.pane-add-drop-zone { align-items: center; background: rgba(13,16,11,.92); border: 1px dashed rgba(217,255,115,.45); color: var(--accent); display: flex; flex-direction: column; gap: 7px; justify-content: center; min-width: 58px; position: fixed; width: clamp(58px,6vw,88px); z-index: 220; }
.pane-add-drop-zone.left { border-radius: 0 14px 14px 0; }
.pane-add-drop-zone.right { border-radius: 14px 0 0 14px; }
.pane-add-drop-zone.between { background: rgba(13,16,11,.82); border-radius: 14px; min-width: 42px; width: 42px; }
.pane-add-drop-zone.between.rows { flex-direction: row; height: 42px !important; min-height: 42px; min-width: 0; width: auto; }
.pane-add-drop-zone.between.rows span { writing-mode: horizontal-tb; }
.pane-add-drop-zone.full { background: rgba(13,16,11,.94); border-radius: 18px; border-width: 2px; }
.pane-add-drop-zone.full strong { font-size: 44px; }
.pane-add-drop-zone.full span { font-size: 11px; writing-mode: horizontal-tb; }
.pane-add-drop-zone strong { font-size: 27px; font-weight: 300; line-height: 1; }
.pane-add-drop-zone span { font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; writing-mode: vertical-rl; }
.pane-add-drop-zone.active { background: rgba(217,255,115,.17); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217,255,115,.09), inset 0 0 24px rgba(217,255,115,.08); }
.pane-cancel-drop-zone { align-items: center; backdrop-filter: blur(10px); background: rgba(28,18,17,.94); border: 1px solid rgba(255,142,131,.36); border-radius: 13px 13px 0 0; bottom: 0; color: #ff9c92; display: flex; font-size: 10px; font-weight: 800; gap: 9px; height: 48px; justify-content: center; letter-spacing: .045em; position: fixed; text-transform: uppercase; z-index: 230; }
.pane-cancel-drop-zone strong { font-size: 20px; font-weight: 400; line-height: 1; }
.pane-cancel-drop-zone.active { background: rgba(94,31,28,.96); border-color: rgba(255,142,131,.86); box-shadow: 0 -8px 34px rgba(255,92,82,.1),inset 0 0 24px rgba(255,142,131,.08); }
.workspace-tabs { display: none; }
.rail-chat.unread::after { background: var(--warn); box-shadow: 0 0 8px rgba(255,201,106,.45); }
.project-panel { border-right: 1px solid var(--line); min-height: 0; }
.project-panel { background: #0f110e; display: grid; grid-template-columns: 56px minmax(0,1fr); padding: 0; }
.panel-brand { align-items: center; display: flex; gap: 11px; padding: 0 8px 24px; }
.panel-brand .nav-toggle-button { margin-left: auto; margin-right: 0; }
.panel-brand div:last-child { display: flex; flex-direction: column; line-height: 1.18; }
.panel-brand strong { font-size: 16px; letter-spacing: -0.02em; }
.panel-brand span { color: var(--danger); font-size: 10px; }
.account-summary { align-items: center; background: transparent; border: 1px solid transparent; border-radius: 12px; color: var(--text); display: flex; flex: 0 0 auto; justify-content: center; padding: 6px 0; width: 44px; }
.account-summary:hover { background: rgba(255,255,255,.04); border-color: var(--line); }
.account-summary.switching { border-color: rgba(255,201,106,.36); }
.provider-capacities { align-items: center; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.provider-capacity { align-items: center; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
/* The rings alone show the pools; the percent stays in the tooltip. */
.provider-capacity > strong { display: none; }
.account-gauge { --available: 0; --gauge-accent: var(--accent); align-items: center; background: conic-gradient(var(--gauge-accent) calc(var(--available) * 1%), rgba(255,255,255,.08) 0); border-radius: 50%; display: flex; flex: 0 0 auto; height: 36px; justify-content: center; position: relative; width: 36px; }
.account-gauge::before { background: #11130f; border-radius: inherit; content: ""; inset: 4px; position: absolute; }
.account-gauge img { height: 16px; object-fit: contain; position: relative; width: 16px; z-index: 1; }
/* Each pool's ring in its provider's logo colour. */
.account-gauge.pool-codex { --gauge-accent: #f2f4eb; }
.account-gauge.pool-claude { --gauge-accent: #d97757; }
.account-summary.no-pool-access .account-gauge { background: var(--panel-3); border: 1px solid var(--line); }
.account-summary.no-pool-access .account-gauge::before { display: none; }
.nav-create-actions { display: grid; gap: 7px; grid-template-columns: minmax(0,1fr) auto; margin: 10px 2px 0; }
/* Rarely needed, so as quiet as „+ Projekt“ beside it. */
.new-thread-button { align-items: center; background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); display: flex; font-size: 11px; font-weight: 700; gap: 6px; justify-content: center; margin: 0; min-height: 34px; padding: 0 12px; }
.new-project-button { align-items: center; background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); display: flex; font-size: 10px; font-weight: 700; gap: 5px; min-height: 34px; padding: 0 11px; }
.new-project-button:hover { border-color: var(--line-strong); color: var(--text); }
.new-project-button span { color: var(--accent); font-size: 15px; }
.new-thread-button:hover { border-color: var(--line-strong); color: var(--text); }
.new-thread-button span { color: var(--accent); font-size: 15px; font-weight: 400; line-height: 12px; }
.project-list { display: flex; flex: 1; flex-direction: column; gap: 4px; min-height: 0; overflow-x: hidden; overflow-y: auto; }
.pinned-section { border-bottom: 1px solid var(--line); margin: 0 2px 8px; padding: 0 4px 8px; }
.pinned-title { color: var(--subtle); font-size: 8px; font-weight: 750; letter-spacing: .11em; padding: 4px 8px 6px; text-transform: uppercase; }
.pinned-section .thread-list { gap: 2px; }
/* „Angeheftet | Geöffnet“ above the projects (public/tree-tabs.js). */
.tree-tab-bar { display: flex; gap: 2px; padding: 2px 4px 6px; }
.tree-tab-bar button { align-items: baseline; background: transparent; border-radius: 7px; color: var(--subtle); display: flex; font-size: 9px; font-weight: 750; gap: 5px; letter-spacing: .09em; padding: 5px 8px; text-transform: uppercase; }
.tree-tab-bar button:hover { color: var(--text); }
.tree-tab-bar button.active { background: var(--panel-3); color: var(--text); }
.tree-tab-bar small { color: var(--subtle); font-family: var(--mono); font-size: 8px; letter-spacing: 0; }
.panel-sets-section { border-bottom: 1px solid var(--line); margin: 0 2px 7px; padding: 0 4px 7px; }
.panel-sets-head { align-items: center; display: grid; gap: 5px; grid-template-columns: minmax(0,1fr) 28px; }
.panel-sets-toggle { align-items: center; background: rgba(255,255,255,.025); border: 1px solid transparent; border-radius: 8px; color: var(--muted); display: flex; font-size: 9px; font-weight: 720; gap: 7px; min-height: 30px; min-width: 0; padding: 5px 8px; text-align: left; }
.panel-sets-toggle span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-sets-toggle small, .panel-set-load small { color: var(--subtle); font-family: var(--mono); font-size: 7px; }
.panel-sets-toggle::before { color: var(--subtle); content: ">"; font-family: var(--mono); font-size: 9px; transition: transform 120ms ease; }
.panel-sets-section.open .panel-sets-toggle::before { transform: rotate(90deg); }
.panel-set-add, .panel-set-rename, .panel-set-remove { align-items: center; background: transparent; border-radius: 7px; color: var(--subtle); display: flex; height: 28px; justify-content: center; padding: 0; width: 28px; }
.panel-set-add { background: rgba(255,255,255,.03); border: 1px solid var(--line); color: var(--accent); font-size: 16px; }
.panel-set-list { display: none; gap: 3px; padding-top: 5px; }
.panel-sets-section.open .panel-set-list { display: grid; }
.panel-set-row { align-items: center; display: grid; gap: 2px; grid-template-columns: minmax(0,1fr) 28px 32px 28px; }
.panel-set-update { align-items: center; background: transparent; border-radius: 7px; color: var(--subtle); display: flex; font-size: 14px; height: 28px; justify-content: center; padding: 0; width: 28px; }
.panel-set-update:hover { background: rgba(255,255,255,.06); color: var(--text); }
.panel-set-row.changed .panel-set-update { background: var(--accent-soft); color: var(--accent); }
.panel-set-load em { color: var(--accent); font-size: 8px; font-style: normal; font-weight: 700; }
.panel-set-row.active { background: rgba(185,167,255,.07); border-radius: 8px; }
.panel-set-load { align-items: center; background: transparent; border-radius: 7px; color: var(--muted); display: flex; font-size: 9px; gap: 7px; min-width: 0; padding: 7px 8px; text-align: left; }
.panel-set-load span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-set-row.active .panel-set-load { color: var(--text); font-weight: 720; }
.panel-set-rename { font-size: 8px; width: 32px; }
.panel-set-remove { color: var(--danger); font-size: 15px; }
.panel-set-empty { color: var(--subtle); font-size: 9px; padding: 8px; }
.project-tree { border: 1px solid transparent; border-radius: 12px; }
.project-tree-head { align-items: center; display: grid; grid-template-columns: minmax(0,1fr) 30px 30px 30px; }
.project-actions-trigger, .project-files-trigger, .project-new-chat { align-items: center; background: transparent; border-radius: 7px; color: var(--subtle); display: flex; font-size: 13px; height: 28px; justify-content: center; padding: 0; width: 28px; }
.project-actions-trigger { font-size: 10px; opacity: .3; }
.project-tree-head:hover .project-actions-trigger, .project-actions-trigger:focus, .project-actions-trigger[aria-expanded="true"] { opacity: 1; }
.project-actions-trigger:hover, .project-files-trigger:hover, .project-new-chat:hover { background: rgba(255,255,255,.06); color: var(--text); }
.project-files-trigger { opacity: .62; }
.folder-glyph { fill: none; height: 14px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.35; width: 17px; }
.project-tree.active { background: rgba(255,255,255,.018); border-color: var(--line); padding-bottom: 7px; }
.project-tree.active .project-tree-head { background: var(--panel-3); border-radius: 9px; }
.project-tree.worker-switching { filter: grayscale(.75); opacity: .55; }
.project-tree.project-move-target .project-tree-head { outline: 1px dashed rgba(217,255,115,.38); outline-offset: -2px; }
.project-tree.project-move-hover .project-tree-head { background: rgba(217,255,115,.13); box-shadow: inset 3px 0 0 var(--accent); outline-color: var(--accent); }
.project-tree.project-move-hover .project-name { color: var(--text); }
.project-item { align-items: center; background: transparent; border-radius: 9px; color: var(--muted); display: grid; gap: 9px; grid-template-columns: 18px minmax(0, 1fr); min-height: 38px; padding: 7px 9px; text-align: left; width: 100%; }
.project-item:has(.project-avatar) { grid-template-columns: 30px minmax(0, 1fr); }
.project-item:hover { background: rgba(255, 255, 255, 0.035); color: var(--text); }
.project-item.active { background: transparent; color: var(--text); }
/* A project with an unread answer: a quiet dot at its icon (paintProjectAttention). */
.project-tree.has-unread .project-item { position: relative; }
.project-tree.has-unread .project-item::after { background: var(--warn); border-radius: 50%; box-shadow: 0 0 0 2px var(--panel), 0 0 6px rgba(255,201,106,.35); content: ""; height: 6px; left: 23px; pointer-events: none; position: absolute; top: 9px; width: 6px; }
.project-avatar { align-items: center; background: #242720; border: 1px solid #3b4036; border-radius: 50%; color: #aeb5a5; display: flex; font-size: 10px; font-weight: 800; height: 30px; justify-content: center; position: relative; text-transform: uppercase; width: 30px; }
.project-avatar > span { position: relative; z-index: 1; }
.project-item.active .project-avatar { background: #32372d; border-color: #555d4d; color: #eef1e9; }
.project-name { color: var(--text); display: block; font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-kind { color: var(--subtle); display: block; font-size: 9px; margin-top: 2px; }
/* Folder, environment or personal: the project kind as an icon before its name. */
.project-kind-icon { align-items: center; color: var(--subtle); display: flex; height: 18px; justify-content: center; width: 18px; }
.project-kind-icon svg { height: 16px; width: 16px; }
.project-item.active .project-kind-icon, .project-item:hover .project-kind-icon { color: var(--muted); }
.project-footer { border-top: 1px solid var(--line); display: grid; gap: 10px; margin-top: 14px; padding: 14px 7px 0; }
.project-footer > div:last-child { display: flex; gap: 3px; }
.brain-tree-button { align-items: center; background: linear-gradient(110deg,rgba(217,255,115,.09),rgba(255,255,255,.025)); border: 1px solid var(--line); border-radius: 11px; color: var(--text); display: grid; gap: 9px; grid-template-columns: 30px minmax(0,1fr) auto; min-height: 48px; padding: 7px 10px; text-align: left; width: 100%; }
.brain-tree-button:hover { border-color: rgba(217,255,115,.3); }
.brain-tree-button > span:nth-child(2) { min-width: 0; }
.brain-tree-button strong, .brain-tree-button small { display: block; }
.brain-tree-button strong { font-size: 11px; }
.brain-tree-button small { color: var(--subtle); font-size: 8px; margin-top: 2px; }
.brain-tree-mark { align-items: center; background: var(--accent-soft); border: 1px solid rgba(217,255,115,.25); border-radius: 9px; color: var(--accent); display: flex; font-size: 11px; font-weight: 850; height: 30px; justify-content: center; width: 30px; }
.connection-chip { align-items: center; color: var(--muted); display: flex; font-size: 10px; gap: 6px; }
.connection-chip i, .status-chip i { background: var(--subtle); border-radius: 999px; height: 6px; width: 6px; }
.connection-chip.online i, .status-chip.active i { background: var(--ok); box-shadow: 0 0 8px rgba(156, 230, 168, 0.56); }
.connection-chip.reconnecting i { background: var(--warn); }
.text-button, .danger-text { background: transparent; color: var(--muted); font-size: 10px; padding: 5px; }
.text-button:hover { color: var(--text); }
.danger-text { color: var(--danger); }

.thread-panel { background: var(--panel); display: flex; flex-direction: column; min-width: 0; padding: 22px 16px 14px; }
.thread-panel-head { align-items: center; display: flex; justify-content: space-between; padding: 0 3px 16px; }
.thread-panel-head h2 { font-size: 19px; letter-spacing: -0.035em; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button, .quiet-icon, .tool-button { align-items: center; background: transparent; border-radius: 8px; color: var(--muted); display: inline-flex; justify-content: center; }
.icon-button { font-size: 16px; height: 32px; width: 32px; }
.icon-button:hover, .quiet-icon:hover, .tool-button:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.hamburger, .hamburger::before, .hamburger::after { background: currentColor; border-radius: 2px; content: ""; display: block; height: 1px; position: relative; width: 15px; }
.hamburger::before { position: absolute; top: -5px; }
.hamburger::after { position: absolute; top: 5px; }
.text-icon { font-size: 8px !important; font-weight: 750; letter-spacing: -.01em; }
.stop-glyph { background: currentColor; border-radius: 2px; display: block; height: 9px; width: 9px; }
.quiet-icon { font-size: 14px; height: 25px; width: 25px; }
.search-box { align-items: center; background: #0f110e; border: 1px solid var(--line); border-radius: 9px; display: flex; gap: 7px; padding: 8px 10px; }
.search-box span { color: var(--subtle); font-size: 17px; }
.search-glyph { border: 1px solid currentColor; border-radius: 50%; height: 10px; position: relative; width: 10px; }
.search-glyph::after { background: currentColor; content: ""; height: 1px; position: absolute; right: -4px; top: 8px; transform: rotate(45deg); width: 5px; }
.search-box input { background: transparent; border: 0; font-size: 12px; min-width: 0; outline: 0; width: 100%; }
.global-search-box { margin: 0 2px 11px; min-height: 39px; }
.tree-tools { align-items: center; display: grid; gap: 5px; grid-template-columns: minmax(0,1fr) 34px; padding: 5px 2px 0; }
.tree-tools .search-box { padding: 7px 9px; }
.tree-tools .icon-button { height: 34px; width: 34px; }
.search-result-count { color: var(--subtle); font-size: 8px; padding: 5px 2px 3px 4px; text-transform: uppercase; }
.thread-list { display: flex; flex-direction: column; gap: 3px; min-height: 0; }
.project-tree .thread-list { padding: 0 2px; }
.thread-row { align-items: center; display: grid; grid-template-columns: minmax(0,1fr) 60px; position: relative; }
.thread-row.worker-switching { filter: grayscale(1); opacity: .46; }
.thread-row.drag-before::before, .thread-row.drag-after::after { background: var(--accent); border-radius: 2px; box-shadow: 0 0 7px rgba(217,255,115,.35); content: ""; height: 2px; left: 5px; pointer-events: none; position: absolute; right: 5px; z-index: 4; }
.thread-row.drag-before::before { top: -2px; }
.thread-row.drag-after::after { bottom: -2px; }
.thread-row-actions { align-items: center; display: flex; gap: 2px; justify-content: center; }
.thread-row:hover .thread-split, .thread-row:hover .thread-pin, .thread-row:focus-within .thread-split, .thread-row:focus-within .thread-pin { opacity: 1; }
.thread-split, .thread-pin { align-items: center; background: transparent; border-radius: 6px; color: var(--subtle); display: flex; height: 24px; justify-content: center; opacity: .48; width: 28px; }
.thread-split:hover { background: rgba(255,255,255,.06); color: var(--accent); opacity: 1; }
.thread-add { font-size: 17px; font-weight: 300; line-height: 1; }
.thread-pin:hover { background: rgba(255,255,255,.06); color: var(--text); opacity: 1; }
.thread-pin.active { color: var(--accent); opacity: .9; }
.pin-glyph { fill: none; height: 13px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.35; width: 13px; }
.thread-pin.active .pin-glyph path:first-child { fill: currentColor; }
.project-actions-popover { background: #1b1e18; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,.58); min-width: 180px; padding: 5px; position: fixed; z-index: 125; }
.project-actions-popover button { background: transparent; border-radius: 7px; color: var(--muted); display: block; font-size: 11px; padding: 9px 10px; text-align: left; width: 100%; }
.project-actions-popover button:hover { background: rgba(255,255,255,.06); color: var(--text); }
.thread-item { background: transparent; border: 1px solid transparent; border-radius: 10px; color: var(--text); display: block; min-width: 0; padding: 6px 7px; text-align: left; width: 100%; }
.thread-item:hover { background: rgba(255, 255, 255, 0.025); }
.thread-item.active { background: var(--panel-3); border-color: var(--line); }
.thread-item.has-goal { padding-right: 34px; }
.thread-goal-toggle { align-items: center; background: rgba(255,255,255,.025); border: 1px solid transparent; border-radius: 7px; color: var(--subtle); display: flex; height: 23px; justify-content: center; position: absolute; right: 62px; top: 50%; transform: translateY(-50%); width: 26px; z-index: 2; }
.thread-goal-toggle:hover { background: rgba(217,255,115,.08); border-color: rgba(217,255,115,.16); color: var(--accent); }
.thread-goal-toggle.pause { color: var(--ok); }
.thread-goal-toggle.loading { opacity: .4; pointer-events: none; }
.goal-play-glyph { border-bottom: 5px solid transparent; border-left: 8px solid currentColor; border-top: 5px solid transparent; height: 0; margin-left: 2px; width: 0; }
.goal-pause-glyph { display: flex; gap: 3px; }
.goal-pause-glyph i { background: currentColor; border-radius: 1px; display: block; height: 10px; width: 3px; }
.thread-item-top { align-items: center; display: flex; gap: 7px; }
.thread-dot { background: var(--subtle); border-radius: 50%; flex: 0 0 auto; height: 6px; width: 6px; }
.thread-dot.running { animation: spin .75s linear infinite; background: transparent; border: 2px solid rgba(217,255,115,.2); border-right-color: var(--accent); box-shadow: 0 0 7px rgba(217,255,115,.22); box-sizing: border-box; height: 10px; width: 10px; }
.thread-dot.failed { background: var(--danger); }
.thread-name { flex: 1; font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-badge { border-radius: 999px; flex: 0 0 auto; font-size: 7px; font-weight: 800; letter-spacing: .03em; padding: 3px 5px; text-transform: uppercase; }
.thread-badge.unread { background: var(--accent); color: var(--accent-ink); }
.thread-badge.archived { background: rgba(255,196,94,.14); border: 1px solid rgba(255,196,94,.48); color: #ffd477; font-size: 8px; letter-spacing: .06em; padding: 4px 8px; }
.thread-empty { color: var(--subtle); font-size: 12px; padding: 28px 12px; text-align: center; }
.load-more, .load-older { background: transparent; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 10px; padding: 8px 12px; }
.load-more:hover, .load-older:hover { border-color: var(--line-strong); color: var(--text); }
/* In the tree a plain text line, no frame. */
.project-tree .load-more { border: 0; border-radius: 0; display: block; font-size: 11px; margin: 2px 0 1px; padding: 6px 12px; text-align: left; width: 100%; }

@media (min-width: 861px) and (pointer: fine) {
  .thread-row-draggable > .thread-item { cursor: grab; }
  .thread-row-draggable.dragging { opacity: .42; }
  .thread-row-draggable.dragging > .thread-item { cursor: grabbing; }
}
body.embed-mode.embed-desktop .chat-header { cursor: grab; user-select: none; }
body.embed-mode.embed-desktop .chat-header.pane-drag-source { cursor: grabbing; }
body.embed-mode.embed-desktop .chat-header button,
body.embed-mode.embed-desktop .chat-header a,
body.embed-mode.embed-desktop .chat-header input,
body.embed-mode.embed-desktop .chat-header select { cursor: pointer; }

.chat-panel { background: var(--bg); max-width: 100%; min-height: 0; min-width: 0; overflow: hidden; position: relative; }
body.pane-host #chat-panel > #chat-workspace { display: none !important; }
.panel-close { font-size: 20px; font-weight: 300; }
.workspace-restore { align-items: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; height: 100%; justify-content: center; max-width: 100%; min-width: 0; padding: 24px; text-align: center; }
.workspace-restore p { font-size: 12px; margin: 0; max-width: 100%; overflow-wrap: anywhere; }
.restore-mark { background: var(--accent); border-radius: 50%; height: 9px; width: 9px; }
.empty-state { align-items: center; display: flex; flex-direction: column; height: 100%; justify-content: center; padding: 40px; text-align: center; }
.empty-state h1 { font-size: clamp(35px, 5vw, 62px); letter-spacing: -0.06em; margin: 6px 0 14px; }
.empty-state > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; margin: 0 0 26px; max-width: 480px; }
.empty-orbit { border: 1px solid var(--line-strong); border-radius: 50%; display: grid; height: 74px; margin-bottom: 24px; place-items: center; width: 74px; }
.empty-orbit span { animation: orbit 5s linear infinite; background: var(--accent); border-radius: 50%; box-shadow: 0 0 18px var(--accent); height: 10px; transform: translateX(25px); width: 10px; }
.chat-workspace { display: grid; grid-template-areas: "header" "controls" "context" "activity" "handover" "goal" "history" "notice" "thinking" "composer"; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr) auto auto auto; height: 100%; max-width: 100%; min-height: 0; min-width: 0; overflow: hidden; }
.chat-header { grid-area: header; }
.control-strip { grid-area: controls; }
.context-strip { grid-area: context; }
.activity-banner { grid-area: activity; }
.handover-panel { grid-area: handover; }
.goal-panel { grid-area: goal; }
.history-scroll { grid-area: history; }
.jump-to-live { grid-area: history; }
.usage-limit-notice { grid-area: notice; }
.live-thinking-slot { grid-area: thinking; }
.composer-wrap { grid-area: composer; }
.chat-bottom-stack { display: contents; }
.chat-header { align-items: center; background: linear-gradient(90deg, var(--project-accent-soft, transparent), transparent 34%), #181b16; border-bottom: 1px solid var(--line-strong); box-shadow: inset 3px 0 0 var(--project-accent-strong, transparent); display: flex; justify-content: space-between; min-height: 70px; padding: 11px 25px; }
.chat-identity { align-items: center; display: flex; min-width: 0; }
.chat-identity > div { min-width: 0; }
.title-row { align-items: center; display: flex; gap: 8px; min-width: 0; }
.thread-provider-logo { flex: 0 0 auto; height: 15px; object-fit: contain; width: 15px; }
.title-row h1 { font-size: 18px; letter-spacing: -0.03em; margin: 0; max-width: min(50vw, 620px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { align-items: center; color: var(--subtle); display: flex; font-family: var(--mono); font-size: 9px; gap: 7px; margin-top: 3px; padding-left: 2px; }
.thread-project-badge { background: var(--project-accent, var(--accent)); border-radius: 999px; color: var(--project-accent-ink, var(--accent-ink)); display: inline-flex; flex: 0 1 auto; font-family: var(--font); font-size: 10px; font-weight: 800; max-width: min(38vw, 270px); overflow: hidden; padding: 4px 9px; text-overflow: ellipsis; white-space: nowrap; }
.status-chip { align-items: center; background: var(--panel-2); border-radius: 999px; color: var(--muted); display: inline-flex; font-family: var(--font); font-size: 9px; gap: 6px; padding: 4px 8px; }
.status-chip.active { color: var(--ok); }
.status-chip.failed { color: var(--danger); }
.status-chip.running { background: transparent; margin-left: 7px; padding: 0; }
.status-chip.running i { animation: spin .75s linear infinite; background: transparent; border: 2px solid rgba(217,255,115,.2); border-radius: 50%; border-right-color: var(--accent); box-shadow: 0 0 7px rgba(217,255,115,.22); box-sizing: border-box; height: 11px; width: 11px; }
.status-chip.running .status-chip-label { display: none; }
.header-actions { align-items: center; display: flex; gap: 5px; position: relative; }
.header-button { align-items: center; background: transparent; border-radius: 8px; color: var(--muted); display: flex; font-size: 11px; gap: 6px; padding: 8px 10px; }
.header-button:hover { background: var(--panel-2); color: var(--text); }
.document-glyph { border: 1.4px solid currentColor; border-radius: 2px; display: block; height: 16px; position: relative; width: 15px; }
.header-actions #document-open { flex: 0 0 40px; font-size: 0 !important; gap: 0; height: 40px; justify-content: center; min-height: 40px; min-width: 40px; padding: 0 !important; width: 40px; }
.document-glyph::before { background: currentColor; box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor; content: ""; height: 1px; left: 3px; position: absolute; right: 3px; top: 3px; }
.header-button.goal-active { background: var(--accent-soft); color: var(--accent); }
.header-button.goal-paused { background: rgba(255,201,106,.1); color: var(--warn); }
.header-button.goal-active span { font-size: 8px; }
.header-button .goal-dot { background: currentColor; border-radius: 50%; height: 7px; width: 7px; }
.header-button.goal-blocked { background: rgba(255,142,131,.13); color: var(--danger); }
.header-button.goal-limited { background: rgba(255,142,131,.13); color: var(--danger); }
.header-button.goal-complete { background: rgba(156,230,168,.12); color: var(--ok); }
.popover { background: #20231d; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4); min-width: 180px; padding: 5px; position: absolute; right: 0; top: 38px; z-index: 20; }
.header-actions .popover { right: 36px; }
.popover button { background: transparent; border-radius: 7px; color: var(--muted); display: block; font-size: 11px; padding: 9px 10px; text-align: left; width: 100%; }
.popover button:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.menu-setting { border-block: 1px solid var(--line); display: grid; gap: 6px; margin: 4px 0; padding: 8px 10px 9px; }
.menu-setting small { color: var(--subtle); font-size: 9px; letter-spacing: .03em; }
.menu-segmented { background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 8px; display: flex; gap: 2px; padding: 2px; }
.popover .menu-segmented button { border-radius: 6px; flex: 1 1 auto; font-size: 10px; padding: 5px 7px; text-align: center; white-space: nowrap; width: auto; }
.popover .menu-segmented button.active { background: rgba(185,167,255,.16); color: #ddd5ff; }
html[data-theme="light"] .popover .menu-segmented button.active { background: rgba(75,59,176,.1); color: #4b3bb0; }
.chat-preview-overlay { align-items: stretch; backdrop-filter: blur(5px); background: rgba(0,0,0,.72); display: flex; inset: 0; justify-content: center; padding: 18px; position: fixed; transition: background 90ms ease-out,backdrop-filter 90ms ease-out; z-index: 180; }
.chat-preview-shell { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: 0 30px 100px rgba(0,0,0,.72); height: 100%; max-width: 1320px; opacity: 1; overflow: hidden; transform: scale(1); transition: opacity 90ms ease-out,transform 110ms cubic-bezier(.22,1,.36,1); width: min(94vw,1320px); }
/* The preview is a chat pane placed over the shell (see syncPreviewPanePosition). */
.workspace-grid > .chat-pane.overlay-pane { border: 0; border-radius: 18px; display: block; min-height: 0; overflow: hidden; pointer-events: auto; position: fixed; transition: opacity 90ms ease-out, transform 90ms ease-out; visibility: visible; z-index: 185; }
body:not(.preview-open) .workspace-grid > .chat-pane.overlay-pane { display: none; }
body.preview-dragging .workspace-grid > .chat-pane.overlay-pane { opacity: 0; transform: scale(.96); }
body.document-focus .workspace-grid > .chat-pane.overlay-pane { display: block !important; }
.chat-preview-overlay.pane-dragging { backdrop-filter: none; background: transparent; pointer-events: none; }
.chat-preview-overlay.pane-dragging .chat-preview-shell { opacity: 0; pointer-events: auto; transform: scale(.96); }
.preview-drag-ghost { --drag-scale: .86; --drag-x: 0px; --drag-y: 0px; align-items: center; background: linear-gradient(145deg,rgba(31,35,27,.98),rgba(18,21,16,.98)); border: 1px solid rgba(217,255,115,.45); border-radius: 17px; box-shadow: 0 16px 46px rgba(0,0,0,.48),inset 0 1px 0 rgba(255,255,255,.045); color: var(--text); display: grid; gap: 3px; grid-template-columns: 34px minmax(0,1fr); height: 70px; left: 0; opacity: 0; padding: 11px 15px 11px 12px; pointer-events: none; position: fixed; top: 0; transform: translate3d(var(--drag-x),var(--drag-y),0) scale(var(--drag-scale)); transform-origin: center; transition: opacity 75ms ease-out,box-shadow 90ms ease-out,border-color 90ms ease-out; width: clamp(220px,24vw,330px); will-change: transform,opacity; z-index: 260; }
.preview-drag-ghost.visible { --drag-scale: 1; opacity: .98; }
.preview-drag-ghost::before { background: radial-gradient(circle at 35% 35%,#e8ffa8,var(--accent) 48%,#78962e 100%); border-radius: 11px; box-shadow: 0 0 18px rgba(217,255,115,.18); content: ""; grid-row: 1 / span 2; height: 30px; width: 30px; }
.preview-drag-ghost strong,.preview-drag-ghost span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-drag-ghost strong { font-size: 12px; font-weight: 760; }
.preview-drag-ghost span { color: var(--muted); font-size: 9px; font-weight: 650; }
.preview-drag-ghost.add-target { border-color: rgba(217,255,115,.8); box-shadow: 0 16px 46px rgba(0,0,0,.46),0 0 0 3px rgba(217,255,115,.1); }
.preview-drag-ghost.replace-target { border-color: rgba(185,167,255,.72); }
.preview-drag-ghost.cancel-target { border-color: rgba(255,142,131,.78); box-shadow: 0 16px 46px rgba(0,0,0,.46),0 0 0 3px rgba(255,142,131,.08); }
.preview-drag-ghost.settling { filter: blur(2px); opacity: 0; transition: transform 125ms cubic-bezier(.2,.8,.2,1),opacity 110ms ease-in,filter 110ms ease-in; }

.control-strip { align-items: end; background: rgba(19, 21, 16, 0.76); border-bottom: 1px solid var(--line); display: flex; gap: 13px; overflow-x: auto; padding: 8px 25px; }
.mobile-thread-settings { display: none; }
.control-strip label { color: var(--subtle); display: flex; flex-direction: column; flex: 0 0 auto; font-size: 8px; font-weight: 700; gap: 2px; letter-spacing: 0.08em; text-transform: uppercase; }
.control-strip select { appearance: none; background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 600; outline: 0; padding: 1px 18px 1px 0; text-transform: none; }
.control-strip label { position: relative; }
.control-strip label::after { bottom: 2px; content: "v"; font-size: 8px; pointer-events: none; position: absolute; right: 2px; }
.thread-meta .mobile-thread-settings { background: transparent; border: 0; border-radius: 0; color: var(--muted); display: inline-flex; font-family: var(--font); gap: 0; max-width: min(48vw,420px); min-height: 22px; padding: 0; width: auto; }
.thread-meta .mobile-thread-provider-logo { display: none; }
.mobile-thread-settings-copy { align-items: baseline; display: flex; gap: 7px; min-width: 0; }
.mobile-thread-settings-copy strong { color: var(--text); font-size: 12px; font-style: normal; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-thread-settings-copy small { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 600; white-space: nowrap; }
.mobile-thread-settings-copy small::before { color: var(--subtle); content: "·"; margin-right: 7px; }
.context-strip { align-items: center; background: #10120e; border-bottom: 1px solid var(--line); display: grid; gap: 14px; grid-template-columns: auto minmax(100px, 1fr) auto; padding: 7px 25px; }
.context-copy { align-items: baseline; display: flex; gap: 9px; min-width: 0; }
.context-copy span { color: var(--subtle); font-size: 9px; text-transform: uppercase; }
.context-copy strong { color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-track { background: var(--panel-3); border-radius: 999px; height: 4px; overflow: visible; position: relative; }
.context-track span { background: linear-gradient(90deg, var(--accent), var(--warn)); border-radius: inherit; display: block; height: 100%; transition: width 300ms ease; width: 0; }

.activity-banner { align-items: center; background: linear-gradient(90deg, rgba(185,167,255,.12), rgba(217,255,115,.06)); border-bottom: 1px solid rgba(185,167,255,.2); display: flex; gap: 11px; padding: 9px 25px; }
.activity-banner.queued { background: var(--accent-soft); border-bottom-color: rgba(217,255,115,.18); }
.activity-banner.worker-switching { background: rgba(255,201,106,.08); border-bottom-color: rgba(255,201,106,.2); }
.activity-banner.worker-switching strong { color: var(--warn); }
.activity-banner div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.activity-banner strong { color: #ddd5ff; font-size: 11px; }
.activity-banner.queued strong { color: var(--accent); }
.activity-banner span:not(.activity-spinner) { color: var(--muted); font-size: 9px; }
.activity-spinner { animation: spin 1s linear infinite; border: 2px solid rgba(185,167,255,.18); border-right-color: var(--violet); border-radius: 50%; flex: 0 0 auto; height: 17px; width: 17px; }
.activity-banner.queued .activity-spinner { animation: none; background: var(--accent); border: 0; box-shadow: 0 0 9px rgba(217,255,115,.32); height: 8px; margin: 4px; width: 8px; }

.goal-panel { -webkit-backdrop-filter: blur(18px) saturate(1.12); backdrop-filter: blur(18px) saturate(1.12); background: rgba(20,23,18,.82); border-bottom: 1px solid var(--line); padding: 15px 25px; }
.goal-head { align-items: start; display: flex; justify-content: space-between; }
.goal-head strong { font-size: 12px; }
.goal-panel textarea { background: rgba(10, 12, 9, 0.72); border: 1px solid var(--line); border-radius: 9px; line-height: 1.5; margin: 12px 0 9px; outline: none; padding: 10px; width: 100%; }
.goal-panel textarea:focus { border-color: rgba(217, 255, 115, 0.35); }
.goal-controls { align-items: center; display: flex; gap: 7px; }
.goal-controls input { background: var(--panel-3); border: 1px solid var(--line); border-radius: 8px; flex: 1 1 180px; font-size: 10px; min-width: 0; outline: none; padding: 8px; }
.goal-status-actions { display: grid; gap: 7px; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 0 0 9px; }
.goal-status-actions button { align-items: center; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 9px; color: var(--muted); display: flex; font-size: 10px; font-weight: 750; gap: 7px; justify-content: center; min-height: 36px; padding: 7px 9px; }
.goal-status-actions button:hover { border-color: var(--line-strong); color: var(--text); }
.goal-status-actions button.active { background: var(--accent-soft); border-color: rgba(217,255,115,.3); color: var(--accent); }
.goal-status-actions button[data-goal-status="stopped"].active { background: rgba(255,142,131,.1); border-color: rgba(255,142,131,.24); color: var(--danger); }
.goal-panel > .danger-text { display: block; margin-top: 8px; }
.small-button { font-size: 10px; padding: 8px 12px; }
.goal-metrics { color: var(--subtle); font-family: var(--mono); font-size: 9px; margin-top: 8px; }

.history-scroll { max-width: 100%; min-height: 0; min-width: 0; overflow-anchor: none; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 22px clamp(18px, 5vw, 74px) 40px; touch-action: pan-y; width: 100%; }
.jump-to-live { align-self: end; background: var(--panel-3); border: 1px solid var(--line-strong); border-radius: 999px; box-shadow: 0 8px 28px rgba(0,0,0,.38); color: var(--text); font-size: 19px; height: 38px; justify-self: end; margin: 0 20px 14px 0; padding: 0; position: relative; width: 38px; z-index: 4; }
.jump-to-live:hover { border-color: rgba(217,255,115,.45); color: var(--accent); }
.load-older { display: block; margin: 0 auto 22px; }
.timeline { margin: 0 auto; max-width: 940px; min-width: 0; width: 100%; }
.turn { border-bottom: 1px solid rgba(235, 241, 218, 0.06); max-width: 100%; min-width: 0; padding: 9px 0 20px; }
.turn + .turn { padding-top: 20px; }
.turn-head { align-items: center; color: var(--subtle); display: flex; font-family: var(--mono); font-size: 8px; gap: 8px; margin-bottom: 12px; text-transform: uppercase; }
.turn.turn-active > .turn-head { display: none; }
.turn-head .turn-state { background: var(--panel-2); border-radius: 99px; font-family: var(--font); padding: 3px 7px; }
.turn-head .inProgress { color: var(--ok); }
.item { margin: 9px 0; min-width: 0; }
.message { border-radius: 13px; line-height: 1.58; max-width: 100%; min-width: 0; overflow-wrap: anywhere; padding: 12px 14px; white-space: pre-wrap; }
.item.userMessage { align-items: flex-end; display: flex; flex-direction: column; justify-content: flex-end; }
.item.userMessage .message { background: var(--panel-3); max-width: min(82%, 760px); position: relative; }
.message-media { display: grid; gap: 7px; grid-template-columns: repeat(2, minmax(0, 220px)); }
.message-media + .message-copy { margin-top: 9px; }
.message-image { background: #090b08; border: 1px solid var(--line); border-radius: 9px; display: block; min-height: 70px; overflow: hidden; }
.message-image img { display: block; height: auto; max-height: 260px; object-fit: cover; width: 100%; }
.optimistic-message .message { border: 1px solid rgba(217,255,115,.12); }
.message-delivery { color: var(--subtle); font-size: 8px; margin: 3px 5px 0; }
.outbox-retry { align-self: flex-end; background: var(--panel-3); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); font-size: 9px; margin-top: 6px; padding: 6px 9px; }
.outbox-retry:hover { border-color: var(--accent); color: var(--accent); }
.outbox-failures { display: flex; flex-direction: column; gap: 10px; padding: 0 20px 20px; }
.pending-outbox-tail { display: flex; flex-direction: column; margin-top: 9px; min-width: 0; }
.outbox-cancel { align-items: center; background: rgba(255,142,131,.06); border: 0; border-radius: 6px; color: rgba(255,142,131,.7); display: flex; font-size: 15px; height: 22px; justify-content: center; left: -27px; padding: 0; position: absolute; top: 4px; width: 22px; }
.outbox-cancel:hover { background: rgba(255,142,131,.13); color: var(--danger); }
.outbox-edit { align-items: center; background: rgba(255,255,255,.035); border: 0; border-radius: 6px; color: var(--subtle); display: flex; font-size: 13px; height: 22px; justify-content: center; left: -53px; padding: 0; position: absolute; top: 4px; width: 22px; }
.outbox-edit:hover { background: rgba(255,255,255,.08); color: var(--text); }
.outbox-send-now { align-self: flex-end; background: color-mix(in srgb, var(--project-accent, var(--accent)) 11%, transparent); border: 1px solid color-mix(in srgb, var(--project-accent-strong, var(--accent)) 42%, transparent); border-radius: 999px; color: var(--project-accent-strong, var(--accent)); font-size: 9px; font-weight: 750; margin: 4px 5px 0; padding: 4px 9px; }
.outbox-send-now:hover { background: color-mix(in srgb, var(--project-accent, var(--accent)) 18%, transparent); }
.outbox-send-now:disabled { cursor: wait; opacity: .6; }
.outbox-failure-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; display: flex; flex-direction: column; padding: 12px; }
.outbox-failure-card time, .outbox-failure-card small, .outbox-empty { color: var(--muted); font-size: 10px; }
.outbox-failure-card p { margin: 8px 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.outbox-failure-card .outbox-retry { align-self: flex-start; }
.outbox-failure-card .outbox-send-now { align-self: flex-start; margin: 8px 0 0; }
.item.agentMessage .message { background: transparent; font-size: 14px; padding-left: 0; }
.item.agentMessage { position: relative; }
.item.agentMessage:is(.final_answer, .final) .message-bubble { background: rgba(255,255,255,.035); border-left: 1px solid var(--project-accent-strong, var(--accent)); border-radius: 11px; padding: 11px 13px; }
.item.agentMessage:is(.final_answer, .final) .message-bubble > .message { background: transparent; border-radius: 0; padding: 0; }
.answer-bar { color: var(--subtle); font-size: 10px; line-height: 1.4; white-space: normal; }
.answer-bar > summary { cursor: pointer; list-style: none; overflow: hidden; padding-right: 30px; text-overflow: ellipsis; white-space: nowrap; width: fit-content; max-width: 100%; }
.answer-bar > summary::-webkit-details-marker { display: none; }
.answer-bar > summary:hover, .answer-bar[open] > summary { color: var(--muted); }
.answer-bar-sources { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 5px; }
.answer-bar-writes { border-bottom: 1px solid var(--line); margin-bottom: 9px; padding-bottom: 5px; }
.answer-bar ul { display: grid; gap: 3px; list-style: none; margin: 6px 0 2px; padding: 0; }
.answer-bar li { color: var(--muted); overflow-wrap: anywhere; }
.answer-bar li strong { color: var(--text); font-weight: 600; }
.answer-bar li ul { gap: 1px; margin: 2px 0 3px 10px; }
.answer-bar li li { color: var(--subtle); }
.answer-bar li li::before { content: "– "; }
.message-copy-button { align-items: center; background: rgba(255,255,255,.018); border: 0; border-radius: 6px; bottom: 9px; color: var(--subtle); display: flex; height: 22px; justify-content: center; margin: 0; padding: 0; position: absolute; right: 6px; width: 24px; }
.message-copy-button:hover { background: rgba(255,255,255,.045); color: var(--muted); }
.message-copy-button svg { fill: none; height: 13px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.35; width: 13px; }
.message-copy-button span { display: none; font-size: 12px; font-weight: 800; }
.message-copy-button.copied { color: var(--ok); }
.message-copy-button.copied svg { display: none; }
.message-copy-button.copied span { display: inline; }
.user-copy-button:not(.copied) { color: rgba(148,158,143,.42); }
.message.markdown, .reasoning-text.markdown { white-space: normal; }
.message p, .reasoning-text p { margin: 0 0 .72em; }
.message p:last-child, .reasoning-text p:last-child { margin-bottom: 0; }
.message h1, .message h2, .message h3 { letter-spacing: -.025em; line-height: 1.25; margin: 1.1em 0 .45em; }
.message h1 { font-size: 1.35em; }
.message h2 { font-size: 1.2em; }
.message h3 { font-size: 1.08em; }
.message ul, .message ol { margin: .45em 0 .8em; padding-left: 1.55em; }
.message li { margin: .24em 0; }
.message code, .reasoning-text code { background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 5px; font-family: var(--mono); font-size: .9em; padding: .1em .34em; }
.message pre { background: #090b08; border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: 11px; line-height: 1.5; margin: .8em 0; max-height: 520px; overflow: auto; padding: 12px; white-space: pre; }
.message pre code { background: transparent; border: 0; padding: 0; }
.message a { color: var(--blue); text-decoration-color: rgba(143,215,255,.35); }
.brain-item-reference { border-bottom: 1px dotted color-mix(in srgb, var(--accent) 65%, transparent); color: var(--accent) !important; cursor: pointer; font-family: var(--mono); font-size: .92em; font-weight: 720; text-decoration: none; }
.brain-item-reference code { color: inherit; }
.brain-item-reference:hover, .brain-item-reference:focus-visible { border-bottom-style: solid; color: #e8ffa7 !important; outline: none; }
.message blockquote { border-left: 2px solid var(--line-strong); color: var(--muted); margin: .8em 0; padding-left: 12px; }
.markdown-table-wrap { border: 1px solid var(--line); border-radius: 10px; margin: .75em 0 1em; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.markdown-table-wrap table { border-collapse: collapse; font-size: .92em; min-width: 100%; width: max-content; }
.markdown-table-wrap th, .markdown-table-wrap td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.markdown-table-wrap th { background: rgba(255,255,255,.035); color: var(--text); font-weight: 700; white-space: nowrap; }
.markdown-table-wrap tr:last-child td { border-bottom: 0; }
.markdown-table-wrap :is(th,td):last-child { border-right: 0; }
.item.agentMessage.commentary .message { color: #ced5c4; }
body.hide-thinking-messages .item.agentMessage.commentary { display: none !important; }
.item.reasoning { color: #d3caff; }
.reasoning-details { background: linear-gradient(var(--violet-soft), var(--violet-soft)), var(--bg); border: 1px solid rgba(185, 167, 255, 0.13); border-radius: 11px; overflow: hidden; }
.reasoning-details > summary::-webkit-details-marker { display: none; }
.reasoning-label, .event-label { align-items: center; color: var(--violet); display: flex; font-size: 9px; font-weight: 750; gap: 6px; letter-spacing: 0.1em; margin-bottom: 7px; text-transform: uppercase; }
.reasoning-label { cursor: pointer; list-style: none; margin: 0; min-height: 28px; padding: 4px 9px; }
.reasoning-label::before { background: var(--violet); content: ""; flex: 0 0 auto; height: 5px; transform: rotate(45deg); width: 5px; }
.thinking-active .reasoning-details { border-color: rgba(217,255,115,.26); box-shadow: inset 2px 0 0 rgba(217,255,115,.65); }
.thinking-active .reasoning-label::before { background: var(--accent); box-shadow: 0 0 4px rgba(217,255,115,.28); }
.thinking-active .reasoning-preview { animation: thinkingText 1.6s ease-in-out infinite; }
.reasoning-preview { color: rgba(211,202,255,.72); flex: 1; font-size: 9px; font-weight: 500; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.reasoning-body { border-top: 1px solid rgba(185,167,255,.1); padding: 8px 10px; }
.reasoning-text { font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.reasoning-raw { border-top: 1px solid rgba(185, 167, 255, 0.12); color: rgba(221, 215, 255, 0.76); font-family: var(--mono); font-size: 10px; margin-top: 8px; padding-top: 8px; white-space: pre-wrap; }
.tool-card, .event-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.tool-group { color: var(--muted); margin: 7px 0 10px; }
.tool-group > summary { align-items: center; cursor: pointer; display: flex; font-size: 10px; gap: 8px; list-style: none; min-height: 28px; padding: 3px 5px; width: fit-content; }
.tool-group > summary::-webkit-details-marker { display: none; }
.tool-group > summary:hover { color: var(--text); }
.tool-group-icon { border-bottom: 1px solid currentColor; border-top: 1px solid currentColor; color: var(--subtle); height: 7px; width: 11px; }
.tool-group-title { white-space: nowrap; }
.tool-group-chevron { color: var(--subtle); transition: transform 150ms ease; }
.tool-group[open] .tool-group-chevron { transform: rotate(90deg); }
.tool-group-body { display: grid; gap: 6px; padding: 5px 0 5px 22px; }
.tool-group-body .item { margin: 0; }
.tool-group-body .tool-summary { min-height: 34px; }
.tool-summary { align-items: center; display: flex; gap: 9px; min-height: 38px; padding: 8px 11px; }
.tool-icon { align-items: center; background: var(--blue-soft); border-radius: 7px; color: var(--blue); display: flex; flex: 0 0 auto; font-size: 11px; height: 24px; justify-content: center; width: 24px; }
.tool-title { flex: 1; font-family: var(--mono); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-status { color: var(--subtle); font-size: 9px; }
.tool-status.completed { color: var(--ok); }
.tool-status.failed { color: var(--danger); }
.tool-body { border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 9px; line-height: 1.48; margin: 0; max-height: 320px; overflow: auto; padding: 11px; white-space: pre-wrap; }
.tool-output-full { background: none; border: 0; border-top: 1px solid var(--line); color: var(--accent); cursor: pointer; display: block; font: inherit; font-size: 11px; padding: 7px 11px; text-align: left; width: 100%; }
.tool-output-full:hover { text-decoration: underline; }
.event-card { border-left: 2px solid var(--accent); color: var(--muted); font-size: 10px; padding: 10px 12px; }
.event-card.compaction { border-left-color: var(--violet); }
.event-card.error { border-left-color: var(--danger); color: #ffc2bc; }
.event-card.model { border-left-color: var(--blue); }
.plan-card { background: var(--blue-soft); border: 1px solid rgba(143, 215, 255, 0.13); border-radius: 12px; color: #ccecff; line-height: 1.55; padding: 12px 14px; white-space: pre-wrap; }
.generated-image-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px; margin: 10px 0; max-width: 720px; overflow: hidden; }
.generated-image-card > a { background: #090b08; display: block; }
.generated-image-card img { display: block; height: auto; max-height: 620px; object-fit: contain; width: 100%; }
.generated-image-card figcaption { align-items: center; display: flex; gap: 12px; justify-content: space-between; padding: 9px 11px; }
.generated-image-card figcaption span:first-child { color: var(--text); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.generated-image-card figcaption span:last-child { color: var(--subtle); flex: 0 0 auto; font-size: 8px; }
.generated-image-placeholder { align-items: center; color: var(--muted); display: flex; justify-content: center; min-height: 180px; }
.generated-image-placeholder.loading { animation: shimmer 1.3s infinite; background: linear-gradient(90deg, #11140f, #1b2017, #11140f); background-size: 200% 100%; }
.attachment-message { border: 1px solid var(--line); border-radius: 8px; color: var(--muted); display: inline-flex; font-family: var(--mono); font-size: 9px; margin: 4px; padding: 6px 8px; }
.usage-limit-notice { background: rgba(255,142,131,.1); border: 1px solid rgba(255,142,131,.28); border-left: 3px solid var(--danger); color: #ffc2bc; display: flex; flex-direction: column; font-size: 10px; gap: 2px; margin: 0 clamp(18px,5vw,74px) 7px; max-width: calc(100% - 36px); min-width: 0; padding: 9px 11px; }
.usage-limit-notice strong { color: var(--danger); }
.live-thinking-slot { background: var(--bg); padding: 0 clamp(18px, 5vw, 74px) 4px; position: relative; }
.live-thinking-slot > .item { margin: 0 auto; max-width: 940px; }
.live-agent-shell { display: grid; gap: 4px; margin: 0 auto 4px; max-width: 940px; min-width: 0; width: 100%; }
.live-agent-toggle { background: rgba(185,167,255,.12); border: 1px solid rgba(185,167,255,.25); border-radius: 999px; color: #d8d0ff; font-family: var(--mono); font-size: 8px; font-weight: 700; justify-self: end; max-width: 100%; overflow: hidden; padding: 4px 8px; position: static; text-overflow: ellipsis; white-space: nowrap; }
.live-agent-toggle:hover, .live-agent-toggle[aria-expanded="true"] { background: rgba(185,167,255,.2); border-color: rgba(185,167,255,.4); color: #f0ecff; }
.live-agent-list { display: grid; gap: 4px; margin: 0; max-width: none; min-width: 0; width: 100%; }
.live-agent-row { align-items: center; background: rgba(185,167,255,.08); border: 1px solid rgba(185,167,255,.2); border-radius: 9px; display: flex; min-height: 32px; padding: 5px 9px; }
.live-agent-row > div { display: flex; flex-direction: column; min-width: 0; }
.live-agent-row strong { color: #ddd5ff; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-agent-row span { color: var(--muted); font-size: 8px; }
.composer-wrap { background: linear-gradient(to top, var(--bg) 72%, transparent); max-width: 100%; min-width: 0; padding: 0 clamp(18px, 5vw, 74px) max(17px, env(safe-area-inset-bottom)); width: 100%; }
.composer { background: #1b1e18; border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 17px 50px rgba(0, 0, 0, 0.25); margin: 0 auto; max-width: 940px; min-width: 0; padding: 11px 12px 9px; position: relative; width: 100%; }
.composer .composer-measure { max-width: 100%; pointer-events: none; }
.composer:focus-within { border-color: rgba(217, 255, 115, 0.26); }
.composer textarea { background: transparent; border: 0; line-height: 1.5; max-height: 220px; min-height: 28px; min-width: 0; outline: 0; overflow-x: hidden; overflow-wrap: anywhere; padding: 3px 4px 9px; position: relative; white-space: pre-wrap; width: 100%; z-index: 0; }
.compact-composer-open { display: none; }
.composer-toolbar { align-items: center; display: grid; gap: 5px; grid-template-columns: minmax(0, 1fr) max-content; max-width: 100%; min-width: 0; overflow: hidden; position: relative; width: 100%; z-index: 2; }
.composer-tools, .composer-actions { align-items: center; display: flex; gap: 5px; }
.composer-tools { flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.composer-actions { flex: 0 0 auto; min-width: max-content; position: relative; z-index: 1; }
.tool-button { background: rgba(255, 255, 255, 0.035); font-size: 15px; height: 29px; width: 29px; }
.dictation-button { gap: 5px; padding: 0 9px; width: auto; }
.dictation-button > span:last-child { font-size: 9px; font-weight: 700; }
.attach-button { cursor: pointer; position: relative; }
.plus-glyph, .plus-glyph::after { background: currentColor; border-radius: 1px; content: ""; display: block; height: 1.5px; width: 11px; }
.plus-glyph::after { transform: rotate(90deg); }
.mic-glyph { fill: none; height: 16px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.45; width: 16px; }
.tool-button.recording { animation: recordPulse 1.3s infinite; background: rgba(255, 142, 131, 0.14); color: var(--danger); }
.dictation-button.recording .mic-glyph { display: none; }
.dictation-button.recording::before { background: currentColor; border-radius: 2px; content: ""; height: 10px; width: 10px; }
.tool-button.starting { animation: thinkingText 1s ease-in-out infinite; color: var(--accent); }
.tool-button.processing { background: var(--accent-soft); }
.steer-toggle { align-items: center; color: var(--accent); display: flex; font-size: 9px; gap: 5px; margin-left: 5px; }
.steer-toggle select { background: #12140f; border: 1px solid var(--line); border-radius: 7px; color: var(--accent); font-size: 9px; outline: none; padding: 5px 6px; }
#composer-hint { color: var(--subtle); font-size: 8px; }
.send-button, .stop-button, .composer-goal-button { align-items: center; border-radius: 9px; display: inline-flex; flex: 0 0 auto; height: 31px; justify-content: center; line-height: 1; padding: 0; position: relative; width: 31px; z-index: 2; }
.send-button { background: var(--accent); color: var(--accent-ink); font-size: 19px; touch-action: manipulation; }
.send-button.empty:not(:disabled) { background: var(--panel-3); border: 1px solid var(--line); color: var(--subtle); }
.stop-button { background: rgba(255, 142, 131, 0.14); color: var(--danger); }
.composer-goal-button { background: rgba(178,158,255,.08); border: 1px solid rgba(190,174,255,.2); border-radius: 50%; color: #aa9bcf; font-size: 10px; font-weight: 800; height: 27px; width: 27px; }
.composer-goal-button.goal-active { animation: goalActiveGlow 2.4s ease-in-out infinite; background: radial-gradient(circle at 38% 32%, rgba(219,208,255,.2), rgba(178,158,255,.12) 62%, rgba(129,107,190,.08)); border-color: rgba(205,192,255,.42); color: #ded7ff; box-shadow: 0 0 0 0 rgba(190,174,255,0); }
.composer-goal-button.goal-active::after { animation: goalActiveHalo 2.4s ease-in-out infinite; border: 1px solid rgba(190,174,255,.18); border-radius: inherit; content: ""; inset: -7px; pointer-events: none; position: absolute; }
.composer-goal-button.goal-active > span:first-child { animation: goalActiveIcon 2.4s ease-in-out infinite; filter: drop-shadow(0 0 4px rgba(205,192,255,.45)); }
.composer-goal-button.goal-paused { background: rgba(178,158,255,.09); border-color: rgba(190,174,255,.22); color: #a99dc9; }
.composer-goal-button.goal-blocked, .composer-goal-button.goal-limited { background: rgba(201,143,186,.12); border-color: rgba(218,164,204,.26); color: #d9a9cb; }
.composer-goal-button.goal-complete { background: rgba(178,158,255,.07); border-color: rgba(190,174,255,.18); color: #9188aa; }
.composer-goal-button .goal-button-label { display: none; }
@keyframes goalActiveGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(190,174,255,0), 0 0 9px rgba(178,158,255,.08); } 50% { box-shadow: 0 0 0 3px rgba(190,174,255,.06), 0 0 17px rgba(178,158,255,.23); } }
@keyframes goalActiveHalo { 0%,100% { opacity: .3; transform: scale(.92); } 50% { opacity: .78; transform: scale(1.08); } }
@keyframes goalActiveIcon { 0%,100% { opacity: .74; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
  .composer-goal-button.goal-active, .composer-goal-button.goal-active::after, .composer-goal-button.goal-active > span:first-child { animation: none; }
}
.attachment-list { display: flex; gap: 7px; margin: 0 auto 7px; max-width: 940px; overflow-x: auto; }
.attachment-chip { align-items: center; background: var(--panel-3); border: 1px solid var(--line); border-radius: 9px; display: flex; flex: 0 0 auto; gap: 7px; max-width: 240px; padding: 6px 8px; }
.attachment-chip img { border-radius: 5px; height: 26px; object-fit: cover; width: 26px; }
.attachment-chip span { font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip button { background: transparent; color: var(--subtle); padding: 2px; }

.modal { background: #171a14; border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65); color: var(--text); max-height: min(850px, 92dvh); max-width: 650px; padding: 0; width: calc(100% - 30px); }
.modal { overflow-y: auto; }
.compact-modal { max-width: 520px; }
#project-settings-dialog { height: min(780px, 92dvh); max-width: 760px; }
/* Project settings: hero, tabs and grouped panes. */
.project-settings-head { align-items: center; }
.project-hero { align-items: center; display: flex; gap: 14px; min-width: 0; }
.project-hero > span { align-items: center; background: var(--project-accent, var(--accent)); border-radius: 14px; box-shadow: 0 10px 30px var(--project-accent-soft, rgba(0,0,0,.2)); color: var(--project-accent-ink, var(--accent-ink)); display: flex; flex-shrink: 0; font-size: 18px; font-weight: 800; height: 52px; justify-content: center; width: 52px; }
.project-hero > div { min-width: 0; }
.project-hero .eyebrow { margin-bottom: 4px; }
.project-hero h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-hero-meta { color: var(--muted); display: block; font-family: var(--mono); font-size: 10px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-section-tabs.project-tabs { grid-template-columns: repeat(var(--project-tab-count, 5), minmax(0,1fr)); }
@media (max-width: 620px) {
  .provider-section-tabs.project-tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
  .provider-section-tabs.project-tabs::-webkit-scrollbar { display: none; }
  .provider-section-tabs.project-tabs button { flex: 1 0 auto; padding: 8px 14px; }
  .project-hero > span { border-radius: 12px; height: 44px; width: 44px; }
  .project-appearance-grid { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .project-appearance-grid > label:first-child { grid-column: 1 / -1; }
  .project-danger-actions { grid-template-columns: minmax(0,1fr); }
  .project-settings-meta { grid-template-columns: 96px minmax(0,1fr); }
}
.project-pane { display: none; }
.project-pane.active { display: grid; gap: 12px; }
.project-group, .project-pane > .project-extension-card { background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.project-group { display: grid; gap: 12px; }
.project-group-head strong { display: block; font-size: 13px; }
.project-group-head span { color: var(--muted); display: block; font-size: 10px; line-height: 1.45; margin-top: 3px; }
.project-pane > .project-extension-card strong { font-size: 13px; }
.project-group-actions { align-items: center; display: flex; gap: 12px; justify-content: flex-end; }
.project-group-actions > p { flex: 1; margin: 0; min-height: 0; }
.project-appearance-grid { display: grid; gap: 10px; grid-template-columns: minmax(0,1fr) 88px 96px; }
.modal .project-appearance-grid label { margin: 0; }
.project-appearance-grid input[type="color"] { height: 40px; padding: 4px; }
.project-danger-actions { align-items: end; display: grid; gap: 10px; grid-template-columns: minmax(0,1fr) auto; }
.modal .project-danger-actions label { margin: 0; }
.project-danger-actions .danger-button { min-height: 40px; }
#project-settings-dialog > section > .form-error:empty { display: none; }
.form-help { color: var(--subtle); font-size: 10px; line-height: 1.5; margin: 10px 0; }
.project-settings-meta { display: grid; gap: 1px; grid-template-columns: 110px minmax(0,1fr); margin: 0; }
.project-settings-meta dt, .project-settings-meta dd { border-top: 1px solid var(--line); padding: 8px 0; }
.project-settings-meta dt:first-of-type, .project-settings-meta dt:first-of-type + dd { border-top: 0; }
.project-settings-meta dt { color: var(--subtle); font-size: 9px; text-transform: uppercase; }
.project-settings-meta dd { color: var(--text); font-family: var(--mono); font-size: 10px; margin: 0; overflow-wrap: anywhere; }
.project-extensions { display: grid; gap: 9px; margin: 0 0 14px; }
.project-extension-card { align-items: start; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 8px 12px; grid-template-columns: minmax(0,1fr) auto; padding: 13px 14px; }
.project-extension-card > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.project-extension-card strong { font-size: 12px; }
.project-extension-card span, .project-extension-card p { color: var(--muted); font-size: 10px; margin: 0; }
.project-extension-card code { color: var(--text); }
.project-extension-card > p { grid-column: 1 / -1; line-height: 1.45; }
.project-services-list { display: grid; gap: 12px; }
.project-services-list > .project-extension-card { background: rgba(255,255,255,.018); border-radius: 14px; padding: 14px 16px; }
.project-services-list > .project-extension-card strong { font-size: 13px; }
.project-service-actions { align-items: center; display: flex; gap: 10px; }
.project-service-card .service-status-connected { color: var(--ok); }
.project-service-card .service-status-warning { color: var(--warn); }
.project-service-login-link { font-size: 11px; grid-column: 1 / -1; }
.project-services-hint { color: var(--subtle); font-size: 10px; line-height: 1.5; margin: 0; }
.project-service-add { display: grid; gap: 10px; grid-template-columns: minmax(0,1fr); }
.project-service-add > div:first-child { display: grid; gap: 2px; }
.project-service-add > div:first-child span { color: var(--subtle); font-size: 10px; }
.project-service-add-grid { display: grid; gap: 8px; grid-template-columns: minmax(0,.8fr) minmax(0,1.4fr) minmax(0,1fr); }
.project-service-field { display: grid; gap: 4px; }
.project-service-field > span { color: var(--muted); font-size: 10px; font-weight: 650; }
.project-service-add > .small-button { justify-self: start; }
.project-service-keys, .project-service-new-key { display: grid; gap: 8px; }
.project-service-new-key { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.project-service-keys[hidden], .project-service-new-key[hidden] { display: none; }
.project-service-add > .project-service-actions { display: flex; gap: 10px; justify-self: start; align-items: center; }
.project-service-field-wide { grid-column: 1 / -1; }
.project-service-suggest { align-items: center; color: var(--subtle); display: flex; flex-wrap: wrap; font-size: 10px; gap: 6px; }
.project-service-suggest[hidden] { display: none; }
.project-service-suggestion { background: var(--accent-soft); border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text); cursor: pointer; font-size: 11px; padding: 3px 9px; }
@media (max-width: 860px) { .project-service-add-grid { grid-template-columns: minmax(0,1fr); } }
.project-server-targets { display: grid !important; gap: 7px !important; grid-column: 1 / -1; width: 100%; }
.project-server-target-row { align-items: center; background: rgba(0,0,0,.16); border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 8px; grid-template-columns: minmax(0,1fr) auto auto auto; padding: 9px 10px; }
.project-server-target-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.project-server-target-row strong,.project-server-target-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-server-target-form { display: grid; gap: 9px; grid-column: 1 / -1; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; }
.project-server-target-form label { color: var(--muted); display: grid; font-size: 9px; gap: 4px; }
.project-server-target-form input { background: #0c0e0b; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); min-width: 0; padding: 9px 10px; }
.project-server-target-form > label:last-of-type,.project-server-target-form > div { grid-column: 1 / -1; }
.project-server-target-form > div { display: flex; gap: 8px; justify-content: flex-end; }
.project-worker-card { grid-template-columns: minmax(0,1fr); }
.project-worker-head { align-items: center; display: flex !important; flex-direction: row !important; justify-content: space-between; }
.project-worker-head > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.project-brain-card { gap: 10px; grid-template-columns: minmax(0,1fr); }
.project-brain-card > p { line-height: 1.45; max-width: 70ch; }
.project-brain-card .project-worker-head > button { min-height: 38px; min-width: 142px; }
.project-worker-controls { display: grid; gap: 8px; grid-template-columns: repeat(3,minmax(0,1fr)) auto; }
.project-worker-controls label { min-width: 0; }
.project-worker-controls select { width: 100%; }
.project-worker-controls button { align-self: end; }
.project-members-card { grid-template-columns: minmax(0,1fr); }
.membership-controls { display: grid; gap: 9px; }
.permission-grid { display: grid; gap: 6px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.membership-actions { display: flex; gap: 8px; }
.github-device, .github-current, .github-repositories { grid-column: 1 / -1; }
.github-device { align-items: center; background: var(--panel-3); border-radius: 9px; display: flex; justify-content: space-between; padding: 9px 10px; }
.github-device code { color: var(--accent); font-size: 14px; letter-spacing: .08em; }
.github-device a { color: var(--accent); font-size: 10px; }
.github-device-actions { align-items: center; display: flex; gap: 9px; }
.github-device-actions .danger-text { margin: 0; }
.github-current { display: grid; gap: 8px; }
.github-list-head { align-items: baseline; display: flex; gap: 10px; justify-content: space-between; }
.github-list-head > span { color: var(--subtle); font-size: 8px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.github-list-head small { color: var(--muted); font-size: 10px; }
.github-list-head strong { color: var(--text); font-weight: 650; }
.github-repo-list { display: grid; gap: 6px; }
.github-repo { align-items: center; background: var(--panel-3); border: 1px solid var(--line); border-radius: 9px; display: grid; gap: 8px 12px; grid-template-columns: minmax(0,1fr) auto; padding: 10px 11px; }
.github-repo-main { display: grid; gap: 4px; min-width: 0; }
.github-repo-folder { color: var(--text); font-family: var(--mono); font-size: 11px; font-weight: 650; overflow-wrap: anywhere; }
.github-repo-line { align-items: center; display: flex; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.github-repo-name { color: var(--accent); font-size: 11px; font-weight: 650; overflow-wrap: anywhere; text-decoration: none; }
.github-repo-name:hover { text-decoration: underline; }
.github-repo .github-sync-state { padding: 2px 8px; }
.github-repo-meta { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.github-repo-actions { align-items: center; display: flex; gap: 8px; }
.github-repo-actions .danger-text { margin: 0; }
.modal .github-repo-move { align-items: end; display: flex; gap: 8px; grid-column: 1 / -1; padding: 0; }
.modal .github-repo-move label { flex: 1; margin: 0; min-width: 0; }
.modal .github-repo-move input { font-family: var(--mono); font-size: 11px; padding: 8px 10px; }
.github-repo-empty { color: var(--muted); font-size: 11px; margin: 0; }
.project-extension-card .github-error { color: var(--danger); font-size: 11px; grid-column: 1 / -1; margin: 0; min-height: 0; }
.project-extension-card .github-error:empty { display: none; }
.github-sync-state { border-radius: 999px; font-size: 10px; font-weight: 750; padding: 5px 10px; }
.github-sync-state[data-tone="ok"] { background: var(--accent-soft); color: var(--accent); }
.github-sync-state[data-tone="warn"] { background: rgba(255,196,94,.12); color: #ffc45e; }
.github-more-toggle { font-size: 10px; grid-column: 1 / -1; justify-self: start; padding: 4px 0; }
.github-more-toggle::before { content: '+ '; }
.github-more-toggle[aria-expanded="true"]::before { content: '− '; }
.github-repositories { border-top: 1px solid var(--line); display: grid; gap: 7px; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; padding-top: 10px; }
.github-repositories label { min-width: 0; }
.github-repositories input, .github-repositories select { width: 100%; }
.github-repositories #project-github-name { min-width: 0; }
.github-section-heading { border-top: 1px solid var(--line); font-size: 11px; margin: 8px 0 0; padding-top: 12px; }
.github-section-heading:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.github-list-status { color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.github-repositories #project-github-link { justify-self: start; }
.project-style-preview { align-items: center; display: flex; gap: 10px; margin-bottom: 10px; }
.project-style-preview span { align-items: center; background: var(--project-accent, var(--accent)); border-radius: 9px; color: var(--project-accent-ink, var(--accent-ink)); display: flex; font-size: 14px; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.project-style-preview strong { font-size: 13px; }
.project-style-controls { display: grid; gap: 9px; grid-template-columns: 96px minmax(0,1fr); }
.project-style-controls input[type="color"] { height: 39px; padding: 4px; }
#project-icon { text-align: center; }
.span-two { grid-column: 1 / -1; }
.tile-search { margin: 10px 0; }
.tile-thread-list { display: grid; gap: 4px; max-height: 46dvh; overflow: auto; }
.tile-thread-option { align-items: center; background: #10120e; border: 1px solid transparent; border-radius: 9px; color: var(--text); display: flex; gap: 8px; padding: 10px; text-align: left; width: 100%; }
.tile-thread-option:hover { border-color: var(--line-strong); }
.tile-thread-option i { background: var(--subtle); border-radius: 50%; height: 6px; width: 6px; }
.tile-thread-option span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-danger-zone { background: rgba(255,142,131,.045); border: 1px solid rgba(255,142,131,.18); border-radius: 14px; display: grid; gap: 12px; padding: 14px 16px; }
.project-danger-zone .project-group-head strong { color: var(--danger); }
.project-danger-zone > strong { color: var(--danger); font-size: 12px; }
.project-danger-zone > p { color: var(--muted); font-size: 10px; line-height: 1.5; }
.project-danger-zone code { color: var(--text); }
@media (max-width: 620px) {
  .project-extension-card { grid-template-columns: minmax(0,1fr); }
  .project-extension-card > button, .github-device, .github-current, .github-repositories { grid-column: 1; }
  .github-repositories { grid-template-columns: minmax(0,1fr); }
  .github-repo { grid-template-columns: minmax(0,1fr); }
  .modal .github-repo-move { flex-wrap: wrap; }
  .github-repositories #project-github-link { width: 100%; }
  .project-worker-controls, .pool-form { grid-template-columns: minmax(0,1fr); }
}
.account-dialog { max-width: 1180px; width: min(1180px,calc(100% - 24px)); }
.account-role { background: var(--panel-3); border: 1px solid var(--line); border-radius: 999px; color: var(--subtle); font-size: 8px; padding: 6px 8px; white-space: nowrap; }
.provider-section-tabs { background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 4px; grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 18px; padding: 4px; }
.provider-section-tabs button { background: transparent; border: 0; border-radius: 9px; color: var(--muted); font-size: 10px; font-weight: 750; min-height: 36px; padding: 8px 12px; }
.provider-section-tabs button:hover { color: var(--text); }
.provider-section-tabs button.active { background: var(--panel-3); box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 8px 24px rgba(0,0,0,.12); color: var(--text); }
.provider-section-pane { display: none; }
.provider-section-pane.active { display: block; }
.provider-connect { border: 1px solid var(--line); border-radius: 14px; gap: 14px; margin-top: 0; padding: 16px; }
.provider-connect.provider-section-pane.active { display: grid; }
.provider-pools-pane.active { display: grid; gap: 16px; }
.provider-connect-head { align-items: center; display: flex; gap: 14px; justify-content: space-between; }
.provider-connect-head strong, .provider-connect-head small { display: block; }
.provider-connect-head strong { font-size: 12px; }
.provider-connect-head small { color: var(--muted); font-size: 8px; margin-top: 2px; }
.provider-add-tabs { background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; display: flex; gap: 3px; padding: 3px; }
.provider-add-tabs button { background: transparent; border: 0; border-radius: 7px; color: var(--muted); font-size: 9px; padding: 7px 9px; }
.provider-add-tabs button.active { background: var(--accent-soft); color: var(--accent); }
.provider-add-pane { align-items: end; display: none; gap: 9px; grid-template-columns: minmax(0,1fr) auto; }
.provider-add-pane.active { display: grid; }
.provider-add-pane > label, .provider-add-pane input { width: 100%; }
.provider-add-pane > small { color: var(--muted); font-size: 8px; grid-column: 1 / -1; }
.provider-add-pane .github-device { grid-column: 1 / -1; }
.provider-connect .form-error { margin: 0; }
.api-provider-form { gap: 8px 10px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.api-provider-form > label { margin: 0; }
.api-provider-form > .setting-check, .api-provider-form > button, .api-provider-form > small { grid-column: 1 / -1; }
.api-provider-form > small { color: var(--subtle); font-size: 8px; line-height: 1.45; }
.provider-device-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: flex-end; }
.provider-device-actions .danger-text { margin: 0; padding: 5px; }
#claude-login-dialog { width: min(520px,calc(100% - 22px)); }
#claude-provider-device { align-items: end; display: grid; gap: 10px 12px; grid-template-columns: minmax(0,1fr) auto; }
#claude-provider-message { align-self: center; min-width: 0; }
#claude-provider-device > label { grid-column: 1; min-width: 0; }
#claude-provider-submit { grid-column: 2; }
/* Settings: tabs for preferences and (admins) users and machines. */
.settings-dialog { height: min(720px, 92dvh); max-width: 720px; }
.modal.settings-dialog form { padding: 0; }
.settings-identity { align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; display: flex; gap: 11px; margin: -4px 0 14px; padding: 10px 12px; }
.settings-avatar { align-items: center; background: var(--accent-soft); border-radius: 999px; color: var(--accent); display: inline-flex; flex-shrink: 0; font-size: 13px; font-weight: 780; height: 34px; justify-content: center; width: 34px; }
.settings-identity > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-identity strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-identity > div > span { color: var(--muted); font-size: 10px; }
.settings-tabs { grid-template-columns: repeat(var(--settings-tab-count, 4), minmax(0,1fr)); }
.settings-pane { display: none; }
.settings-pane.active { display: grid; gap: 12px; }
.settings-dialog[data-tab="users"] #settings-form, .settings-dialog[data-tab="machines"] #settings-form, .settings-dialog[data-tab="context"] #settings-form { display: none; }
.settings-overrides { align-items: center; display: grid; gap: 8px 16px; grid-template-columns: minmax(0,1fr) minmax(190px,240px); }
.settings-override-list { color: var(--muted); font-size: 10px; line-height: 1.5; }
.handover-evaluation { display: grid; gap: 10px; }
#settings-context .form-error { margin: 0; min-height: 0; }
#settings-context .form-error:empty { display: none; }
#settings-context .modal-actions { margin-top: 2px; }
.brain-journal-fold { border: 1px dashed var(--line); border-radius: 10px; margin: 6px 0; padding: 6px 10px; }
.brain-journal-fold > summary { color: var(--subtle); cursor: pointer; font-size: 10px; }
.brain-journal-fold[open] > summary { margin-bottom: 6px; }
.handover-eval-progress { align-items: center; display: grid; gap: 6px 12px; grid-template-columns: minmax(0,1fr) auto; }
.handover-eval-progress strong { color: var(--text); font-size: 11px; }
.handover-eval-progress small { color: var(--subtle); font-size: 9px; }
.handover-eval-bar { background: rgba(255,255,255,.06); border-radius: 999px; grid-column: 1 / -1; height: 4px; overflow: hidden; }
.handover-eval-bar span { background: #b9a7ff; display: block; height: 100%; }
.handover-eval-compare { display: grid; gap: 8px; margin: 12px 0; }
.handover-eval-table { border-collapse: collapse; font-size: 10px; width: 100%; }
.handover-eval-table th { color: var(--subtle); font-size: 9px; font-weight: 500; padding: 4px 6px; text-align: left; }
.handover-eval-table td { border-top: 1px solid var(--line); color: var(--muted); padding: 5px 6px; }
.handover-eval-table td.num { font-family: var(--mono); text-align: right; }
.handover-eval-table td.good { color: #9fe3a8; }
.handover-eval-table td.bad { color: #ffb4a3; }
html[data-theme="light"] .handover-eval-table td.good { color: #1f7a33; }
html[data-theme="light"] .handover-eval-table td.bad { color: #b3401f; }
html[data-theme="light"] .handover-eval-bar span { background: #4b3bb0; }
.settings-group { background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 12px; padding: 14px 16px; }
.settings-group-head strong, .settings-pane-head strong { display: block; font-size: 13px; }
.settings-group-head span, .settings-pane-head span { color: var(--muted); display: block; font-size: 10px; line-height: 1.45; margin-top: 3px; }
.answer-style-input { background: #0f110e; border: 1px solid var(--line); border-radius: 9px; color: var(--text); font: inherit; font-size: 12px; line-height: 1.45; margin-top: 8px; outline: 0; padding: 9px 11px; resize: vertical; width: 100%; }
.answer-style-input:focus { border-color: rgba(217, 255, 115, 0.38); }
.answer-style-foot { align-items: center; display: flex; justify-content: space-between; margin-top: 4px; }
.answer-style-foot small { color: var(--subtle); font-size: 10px; }
html[data-theme="light"] .answer-style-input { background: #fff; }
.modal label.settings-row { align-items: center; color: var(--text); display: grid; gap: 8px 16px; grid-template-columns: minmax(0,1fr) minmax(190px,240px); margin: 0; }
.settings-row > span { display: flex; flex-direction: column; gap: 3px; }
.settings-row strong { color: var(--text); font-size: 11px; }
.settings-row small { color: var(--subtle); font-size: 9px; font-weight: 400; }
.modal .settings-row select, .modal .settings-row input { margin-top: 0; }
.modal .settings-group .setting-check { margin: 0; }
.settings-pane-head { align-items: center; display: flex; gap: 12px; justify-content: space-between; margin-bottom: 2px; }
.settings-pane-head > button { flex-shrink: 0; white-space: nowrap; }
#settings-form .form-error:empty { display: none; }
#settings-form .modal-actions { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.brain-workspace-panel { background: var(--bg); border-left: 1px solid var(--line); container-type: inline-size; display: flex; flex-direction: column; min-height: 0; min-width: 340px; overflow: hidden; position: relative; }
.brain-panel-header { align-items: center; background: linear-gradient(90deg,rgba(217,255,115,.07),transparent 38%),#181b16; border-bottom: 1px solid var(--line-strong); cursor: grab; display: flex; justify-content: space-between; min-height: 70px; padding: 11px 22px; }
.brain-panel-header.pane-drag-source { cursor: grabbing; }
.brain-panel-header h2 { font-size: 16px; letter-spacing: -.025em; margin: 1px 0 0; }
.brain-panel-header .eyebrow { font-size: 8px; margin: 0; }
.brain-panel-body { align-self: center; flex: 1; min-height: 0; overflow: auto; padding: 20px 22px 28px; width: min(100%,960px); }
.brain-health { align-items: center; background: linear-gradient(110deg,rgba(217,255,115,.075),rgba(255,255,255,.025)); border: 1px solid var(--line); border-radius: 13px; display: flex; gap: 11px; margin-bottom: 18px; min-height: 62px; padding: 12px 14px; }
.brain-health.ready { border-color: rgba(217,255,115,.25); }
.brain-health.error { border-color: rgba(255,142,131,.32); }
.brain-health.ready::before, .brain-health.error::before { background: var(--ok); border-radius: 50%; box-shadow: 0 0 10px rgba(156,230,168,.38); content: ""; flex: 0 0 auto; height: 8px; width: 8px; }
.brain-health.error::before { background: var(--danger); box-shadow: 0 0 10px rgba(255,142,131,.3); }
.brain-health > div { min-width: 0; }
.brain-health strong, .brain-health small { display: block; }
.brain-health strong { font-size: 12px; letter-spacing: -.01em; }
.brain-health small { color: var(--muted); font-size: 9px; line-height: 1.45; margin-top: 3px; }
.brain-scope-grid { display: grid; gap: 10px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.brain-scope-grid label { color: var(--muted); display: grid; font-size: 9px; font-weight: 700; gap: 6px; margin-top: 0; min-width: 0; }
.brain-panel-body input, .brain-panel-body select, .brain-panel-body textarea { background-color: #0f110e; border: 1px solid var(--line); border-radius: 10px; color: var(--text); outline: 0; padding: 10px 12px; transition: border-color 120ms ease,box-shadow 120ms ease,background-color 120ms ease; width: 100%; }
.brain-panel-body input::placeholder, .brain-panel-body textarea::placeholder { color: #686e63; }
.brain-panel-body input:hover, .brain-panel-body select:hover, .brain-panel-body textarea:hover { background-color: #12140f; border-color: var(--line-strong); }
.brain-panel-body input:focus, .brain-panel-body select:focus, .brain-panel-body textarea:focus { background-color: #12140f; border-color: rgba(217,255,115,.42); box-shadow: 0 0 0 3px rgba(217,255,115,.07); }
.brain-panel-body select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.25 6 6.25l5-5' fill='none' stroke='%238b9284' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-position: right 12px center; background-repeat: no-repeat; cursor: pointer; padding-right: 34px; }
.brain-scope-grid select { margin: 0; min-height: 42px; width: 100%; }
.brain-search-form { display: grid; gap: 9px; grid-template-columns: minmax(0,1fr) auto; margin: 14px 0 15px; }
.brain-search-form input { margin: 0; min-height: 42px; min-width: 0; }
.brain-search-form button { min-height: 42px; }
.brain-knowledge { align-items: start; display: grid; gap: 14px; grid-template-columns: minmax(190px,250px) minmax(0,1fr); min-height: 320px; }
.brain-page-list { align-content: start; display: grid; gap: 2px; max-height: calc(100vh - 260px); overflow-x: hidden; overflow-y: auto; padding-right: 2px; position: sticky; top: 0; }
.brain-nav-row { align-items: center; background: transparent; border: 1px solid transparent; border-radius: 9px; color: var(--muted); cursor: pointer; display: flex; font-size: 10px; gap: 6px; min-height: 32px; padding: 6px 8px 6px calc(6px + var(--depth, 0) * 14px); text-align: left; transition: background 120ms ease, border-color 120ms ease, color 120ms ease; width: 100%; }
.brain-nav-row:hover { background: rgba(255,255,255,.03); border-color: var(--line); color: var(--text); }
.brain-nav-row.active { background: var(--accent-soft); border-color: rgba(217,255,115,.22); color: var(--text); }
.brain-nav-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.brain-icon, .brain-nav-icon, .brain-chevron { display: inline-flex; flex: 0 0 auto; }
.brain-icon svg, .brain-nav-icon svg, .brain-chevron svg { display: block; height: 100%; width: 100%; }
.brain-nav-toggle { align-items: center; color: var(--subtle); display: inline-flex; flex: 0 0 14px; height: 14px; justify-content: center; }
.brain-nav-toggle .brain-chevron { height: 11px; opacity: 0; transition: transform 140ms ease; width: 11px; }
.brain-nav-toggle.clickable { border-radius: 4px; cursor: pointer; }
.brain-nav-toggle.clickable .brain-chevron { opacity: 1; }
.brain-nav-toggle.expanded .brain-chevron { transform: rotate(90deg); }
.brain-nav-toggle.clickable:hover { background: var(--line); color: var(--text); }
.brain-nav-icon { color: var(--accent); height: 13px; opacity: .85; width: 13px; }
.brain-nav-row:not(.active) .brain-nav-icon { color: var(--muted); }
.brain-nav-dot { border: 1.5px solid var(--subtle); border-radius: 50%; flex: 0 0 auto; height: 7px; margin: 0 3px; width: 7px; }
.brain-nav-dot.pinned { background: var(--subtle); }
.brain-nav-row.area.active .brain-nav-dot { border-color: var(--accent); }
.brain-nav-row.area.active .brain-nav-dot.pinned { background: var(--accent); }
.brain-page-refresh .brain-icon { height: 14px; width: 14px; }
.brain-nav-label { flex: 1; font-weight: 620; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-nav-row.area .brain-nav-label { font-weight: 540; }
.brain-nav-badges { align-items: center; display: flex; flex: 0 0 auto; gap: 4px; }
.brain-nav-open { background: rgba(255,201,106,.14); border-radius: 999px; color: var(--warn); font-size: 8px; font-weight: 760; line-height: 1; padding: 3px 6px; }
.brain-nav-count { color: var(--subtle); font-size: 8px; font-variant-numeric: tabular-nums; }
.brain-nav-heading { align-items: center; background: transparent; border: 0; color: var(--subtle); cursor: default; display: flex; font-size: 7.5px; font-weight: 780; gap: 6px; justify-content: space-between; letter-spacing: .08em; margin: 12px 0 4px; padding: 0 8px; text-align: left; text-transform: uppercase; width: 100%; }
.brain-nav-heading .brain-chevron { display: none; height: 11px; transition: transform 140ms ease; width: 11px; }
.brain-nav-heading-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-page-head > .brain-head-actions { flex: 0 0 auto; }
.brain-page .brain-page-markdown h1 { font-size: 14px; }
.brain-page .brain-page-markdown h2 { font-size: 12.5px; }
.brain-page .brain-page-markdown h3, .brain-page .brain-page-markdown h4 { font-size: 11.5px; }
.brain-nav-empty { border: 1px dashed var(--line); border-radius: 10px; color: var(--subtle); font-size: 9px; line-height: 1.45; margin-top: 10px; padding: 10px; }
.brain-page { background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 14px; min-height: 320px; min-width: 0; padding: 18px 20px 22px; }
.brain-head-actions { align-items: center; display: flex; flex: 0 0 auto; gap: 7px; }
.brain-head-actions .secondary { font-size: 9px; min-height: 30px; padding: 5px 10px; }
.brain-breadcrumb { align-items: center; display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 5px; }
.brain-crumb { background: transparent; border: 0; border-radius: 5px; color: var(--subtle); cursor: pointer; font-size: 8.5px; padding: 1px 3px; }
.brain-crumb:hover { background: var(--line); color: var(--text); }
.brain-crumb-sep { color: var(--subtle); font-size: 8px; opacity: .6; }
.brain-area-description { color: var(--muted); font-size: 10.5px; line-height: 1.5; margin: -4px 0 14px; }
.brain-section { margin-top: 18px; }
.brain-section:first-of-type { margin-top: 4px; }
.brain-section-title { align-items: center; color: var(--text); display: flex; font-size: 10px; font-weight: 760; gap: 7px; letter-spacing: .01em; margin: 0 0 9px; }
.brain-section-title.clickable { cursor: pointer; }
.brain-section-title.clickable:hover { color: var(--accent); }
.brain-section-count { background: var(--line); border-radius: 999px; color: var(--muted); font-size: 8px; font-weight: 700; padding: 2px 6px; }
.brain-page-stamp { color: var(--subtle); display: block; font-size: 8px; margin-top: 10px; }
.brain-banner { align-items: center; background: rgba(255,201,106,.07); border: 1px solid rgba(255,201,106,.2); border-radius: 11px; color: var(--warn); display: flex; font-size: 10px; gap: 9px; margin-bottom: 14px; padding: 10px 12px; }
.brain-stats { display: grid; gap: 9px; grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 6px; }
.brain-stat { background: var(--panel-3); border: 1px solid var(--line); border-radius: 12px; color: var(--text); display: grid; gap: 3px; padding: 12px 14px; text-align: left; }
button.brain-stat { cursor: pointer; transition: border-color 120ms ease, transform 120ms ease; }
button.brain-stat:hover { border-color: rgba(217,255,115,.3); transform: translateY(-1px); }
.brain-stat strong { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.brain-stat span { color: var(--muted); font-size: 9px; }
.brain-area-grid { display: grid; gap: 9px; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); }
.brain-area-card { align-content: start; background: var(--panel-3); border: 1px solid var(--line); border-radius: 12px; color: var(--text); cursor: pointer; display: grid; gap: 6px; min-height: 96px; padding: 12px 13px; text-align: left; transition: border-color 120ms ease, transform 120ms ease, background 120ms ease; }
.brain-area-card:hover { border-color: rgba(217,255,115,.32); transform: translateY(-1px); }
.brain-area-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brain-area-card-top { align-items: start; display: flex; gap: 8px; justify-content: space-between; }
.brain-area-card strong { font-size: 11px; letter-spacing: -.01em; }
.brain-area-card p { -webkit-box-orient: vertical; -webkit-line-clamp: 3; color: var(--muted); display: -webkit-box; font-size: 9.5px; line-height: 1.45; margin: 0; overflow: hidden; }
.brain-area-card small { color: var(--subtle); font-size: 8px; }
.brain-card-children { display: flex; flex-wrap: wrap; gap: 4px; }
.brain-card-children span { border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 7.5px; padding: 2px 6px; }
.brain-open-pill { background: rgba(255,201,106,.13); border-radius: 999px; color: var(--warn); flex: 0 0 auto; font-size: 7.5px; font-weight: 760; padding: 3px 7px; white-space: nowrap; }
.brain-item-list { display: grid; gap: 6px; }
.brain-item { align-items: start; background: var(--panel-3); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 11px; display: grid; gap: 8px 10px; grid-template-columns: auto minmax(0,1fr); padding: 9px 10px 9px 11px; }
/* The text gets the whole width; status and actions share the row below it at every width. */
.brain-item > .brain-item-body { grid-column: 2; grid-row: 1; }
.brain-item > .brain-item-status { grid-column: 2; grid-row: 2; justify-self: start; }
.brain-item > .brain-entry-actions { align-self: center; grid-column: 2; grid-row: 2; justify-self: end; position: static; transform: none; }
.brain-item.status-open { border-left-color: var(--warn); }
.brain-item.status-in_progress { border-left-color: var(--accent); }
.brain-item.status-blocked { border-left-color: var(--danger); }
.brain-item.status-done { border-left-color: var(--ok); opacity: .78; }
.brain-item.status-rejected { opacity: .6; }
.brain-item.targeted { animation: brainItemTarget 1.15s ease-out 2; border-color: rgba(217,255,115,.72); box-shadow: 0 0 0 2px rgba(217,255,115,.14), 0 8px 28px rgba(0,0,0,.22); opacity: 1; }
@keyframes brainItemTarget { 50% { background: rgba(217,255,115,.13); box-shadow: 0 0 0 3px rgba(217,255,115,.2), 0 8px 28px rgba(0,0,0,.22); } }
.brain-item.status-done .brain-item-body > p, .brain-item.status-rejected .brain-item-body > p { text-decoration: line-through; text-decoration-color: var(--subtle); }
.brain-item-kind { align-items: center; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--muted); display: flex; font-size: 9px; font-weight: 800; height: 20px; justify-content: center; margin-top: 1px; width: 20px; }
.brain-item-kind.question { border-color: rgba(152,184,255,.35); color: #b9ccff; }
.brain-item-kind .brain-icon { height: 11px; width: 11px; }
.brain-item-body { display: grid; gap: 4px; min-width: 0; }
.brain-item-body > p { font-size: 10.5px; font-weight: 600; line-height: 1.45; margin: 0; overflow-wrap: anywhere; }
.brain-item-details { -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); display: -webkit-box; font-size: 9.5px; line-height: 1.45; overflow: hidden; overflow-wrap: anywhere; }
.brain-item-updates { color: var(--muted); display: grid; font-size: 9px; gap: 2px; line-height: 1.4; list-style: none; margin: 0; padding: 0 0 0 9px; border-left: 1px solid var(--line); }
.brain-item-updates li { -webkit-box-orient: vertical; -webkit-line-clamp: 3; display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; }
.brain-item-body[role="button"] { cursor: pointer; }
.brain-item-body[role="button"]:focus-visible { border-radius: 6px; outline: 1px solid var(--accent); outline-offset: 3px; }
.brain-item.expanded .brain-item-details, .brain-item.expanded .brain-item-updates li { -webkit-line-clamp: unset; display: block; overflow: visible; }
.brain-item.expanded .brain-item-details { color: var(--text); font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.brain-item-more { background: transparent; border: 0; color: var(--accent); cursor: pointer; font-size: 8.5px; font-weight: 600; min-height: 0; padding: 0 2px; }
.brain-item-more:hover { text-decoration: underline; }
.brain-item-meta { align-items: center; color: var(--subtle); display: flex; flex-wrap: wrap; font-size: 8px; gap: 6px; }
.brain-panel-body select.brain-item-status { font-size: 9px; min-height: 28px; padding: 4px 26px 4px 8px; width: auto; }
.brain-area-chip { background: var(--accent-soft); border: 1px solid rgba(217,255,115,.18); border-radius: 999px; color: var(--accent); cursor: pointer; font-size: 8px; font-weight: 650; max-width: 100%; overflow: hidden; padding: 2px 7px; text-overflow: ellipsis; white-space: nowrap; }
.brain-area-chip:hover { border-color: rgba(217,255,115,.4); }
.brain-area-chip.static { cursor: default; }
.brain-pending-pill { background: rgba(255,201,106,.1); border-radius: 999px; color: var(--warn); font-size: 7.5px; font-weight: 700; padding: 2px 7px; }
.brain-filters { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 14px; }
.brain-filter { background: transparent; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); cursor: pointer; font-size: 9px; padding: 5px 10px; }
.brain-filter:hover { border-color: var(--line-strong); color: var(--text); }
.brain-filter.active { background: var(--accent-soft); border-color: rgba(217,255,115,.3); color: var(--accent); font-weight: 700; }
.brain-finished { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.brain-finished > summary { color: var(--muted); cursor: pointer; font-size: 9.5px; font-weight: 700; margin-bottom: 9px; }
.brain-more { margin-top: 9px; }
.brain-area-edit { background: rgba(255,255,255,.02); border: 1px solid var(--line-strong); border-radius: 12px; display: grid; gap: 10px; grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 14px; padding: 13px 14px; }
.brain-area-edit > label { color: var(--muted); display: grid; font-size: 9px; font-weight: 700; gap: 5px; min-width: 0; }
.brain-area-edit > label:nth-child(2) { grid-column: 1 / -1; }
.brain-area-edit textarea { resize: vertical; }
.brain-area-edit .brain-check { align-items: center; display: flex; gap: 8px; grid-column: 1 / -1; }
.brain-area-edit .brain-check input { accent-color: var(--accent); flex: 0 0 auto; margin: 0; width: auto; }
.brain-area-edit .brain-check span { color: var(--muted); font-weight: 600; }
.brain-edit-actions { align-items: center; display: flex; gap: 8px; grid-column: 1 / -1; justify-content: flex-end; }
.brain-edit-status { color: var(--muted); flex: 1; font-size: 9px; }
.brain-doc-list { display: grid; gap: 4px; }
.brain-doc { align-items: center; border: 1px solid var(--line); border-radius: 9px; display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: space-between; padding: 7px 10px; }
.brain-doc code { color: var(--text); font-size: 9px; overflow-wrap: anywhere; }
.brain-doc small { align-items: center; color: var(--subtle); display: flex; flex-wrap: wrap; font-size: 8px; gap: 6px; }
.brain-doc.error code { color: var(--muted); }
.brain-doc.error small { color: var(--warn); }
.brain-doc-path { color: var(--muted); font-size: 8px; }
.brain-decision { border: 1px solid var(--line); border-radius: 11px; display: grid; gap: 6px; margin-bottom: 6px; padding: 9px 11px; }
.brain-decision p { color: var(--text); font-size: 10px; line-height: 1.45; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.brain-decision-top { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; }
.brain-decision-top small { color: var(--subtle); font-size: 8px; margin-left: auto; }
.brain-decision-target { color: var(--muted); font-size: 8.5px; line-height: 1.4; }
.brain-action-badge { border-radius: 999px; font-size: 7.5px; font-weight: 780; letter-spacing: .02em; padding: 3px 7px; background: var(--line); color: var(--muted); }
.action-new_fact .brain-action-badge { background: var(--accent-soft); color: var(--accent); }
.action-new_item .brain-action-badge { background: rgba(255,201,106,.13); color: var(--warn); }
.action-update_item .brain-action-badge { background: rgba(156,230,168,.12); color: var(--ok); }
.action-supersede .brain-action-badge { background: rgba(152,184,255,.12); color: #b9ccff; }
.action-ignore { opacity: .62; }
.brain-area-log { display: grid; gap: 5px; list-style: none; margin: 0; padding: 0; }
.brain-area-log li { align-items: baseline; border-bottom: 1px solid var(--line); color: var(--muted); display: flex; flex-wrap: wrap; font-size: 9px; gap: 7px; line-height: 1.45; padding: 5px 0; }
.brain-area-log small { color: var(--subtle); font-size: 8px; margin-left: auto; }
.brain-log-actor { color: var(--accent); font-size: 8px; font-weight: 780; text-transform: uppercase; }
html[data-theme="light"] .brain-page, html[data-theme="light"] .brain-area-edit { background: #fff; }
html[data-theme="light"] .brain-nav-row:hover { background: rgba(22,34,26,.04); }
html[data-theme="light"] .brain-nav-row.active, html[data-theme="light"] .brain-filter.active, html[data-theme="light"] .brain-area-chip { border-color: rgba(59,125,34,.28); }
html[data-theme="light"] .brain-item-kind.question, html[data-theme="light"] .action-supersede .brain-action-badge { color: var(--blue); }
html[data-theme="light"] .brain-panel-body input, html[data-theme="light"] .brain-panel-body select, html[data-theme="light"] .brain-panel-body textarea { background-color: #fff; }
.brain-page-head { align-items: start; border-bottom: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; margin-bottom: 14px; padding-bottom: 11px; }
.brain-page-head > div { flex: 1; min-width: 0; }
.brain-page-head h3 { font-size: 15px; letter-spacing: -.02em; margin: 0; }
.brain-page-head small { color: var(--subtle); display: block; font-size: 8px; margin-top: 3px; }
.brain-page-markdown { color: var(--muted); font-size: 11px; line-height: 1.58; overflow-wrap: anywhere; }
.brain-page-markdown h1, .brain-page-markdown h2, .brain-page-markdown h3 { color: var(--text); margin: 18px 0 8px; }
.brain-page-markdown h1:first-child, .brain-page-markdown h2:first-child, .brain-page-markdown h3:first-child { margin-top: 0; }
.brain-page-markdown ul, .brain-page-markdown ol { padding-left: 19px; }
.brain-page-markdown code { color: var(--accent); }
.brain-page-stale { background: rgba(255,201,106,.09); border-radius: 999px; color: var(--warn); font-size: 7px; padding: 4px 7px; }
.brain-page-refresh { align-items: center; background: transparent; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); display: flex; flex: 0 0 auto; height: 30px; justify-content: center; padding: 0; width: 30px; }
.brain-page-refresh:hover { border-color: var(--line-strong); color: var(--text); }
.brain-results { display: grid; gap: 8px; min-height: 72px; padding-right: 2px; }
.brain-empty { align-items: center; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); display: flex; font-size: 10px; justify-content: center; min-height: 72px; padding: 18px; text-align: center; }
.brain-memory { background: var(--panel-3); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 7px; padding: 11px 12px; }
.brain-memory-head { align-items: center; display: flex; gap: 7px; justify-content: space-between; }
.brain-memory-meta { align-items: center; display: flex; flex-wrap: wrap; gap: 5px; }
.brain-scope-badge, .brain-memory-tag { border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 8px; padding: 3px 6px; }
.brain-scope-badge.personal { background: rgba(152,184,255,.08); color: #b9ccff; }
.brain-scope-badge.project { background: var(--accent-soft); color: var(--accent); }
.brain-memory p { font-size: 11px; line-height: 1.5; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.brain-memory small { color: var(--subtle); font-size: 8px; }
.brain-memory .danger-text { margin: 0; padding: 3px 5px; }
.brain-memory.derived { background: transparent; border-style: dashed; }
.brain-memory.derived p { color: var(--muted); }
.brain-derived-tag { color: var(--subtle); cursor: help; font-size: 8px; font-style: italic; letter-spacing: .02em; }
.brain-derived-divider { align-items: center; color: var(--subtle); display: flex; font-size: 9px; gap: 8px; margin-top: 6px; }
.brain-derived-divider::before, .brain-derived-divider::after { border-top: 1px solid var(--line); content: ""; flex: 1 1 18px; }
.brain-sources-panel { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 13px; }
.brain-sources-panel > summary { color: var(--subtle); cursor: pointer; font-size: 9px; font-weight: 700; margin-left: 12px; }
.brain-sources-panel[open] > summary { color: var(--text); margin-bottom: 10px; }
.brain-remember-panel { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 13px; }
.brain-remember-panel > summary { color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; list-style-position: outside; margin-left: 12px; }
.brain-remember-panel[open] { background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px 14px; }
.brain-remember-panel[open] > summary { color: var(--text); margin: 0 0 12px 12px; }
.brain-remember-panel label, .brain-jev-panel label { color: var(--muted); display: grid; font-size: 9px; font-weight: 700; gap: 6px; margin-top: 11px; min-width: 0; width: 100%; }
.brain-remember-panel textarea { min-height: 104px; resize: vertical; }
.brain-remember-actions { align-items: center; display: flex; gap: 10px; justify-content: space-between; margin-top: 12px; }
.brain-remember-actions span { color: var(--muted); font-size: 9px; }
.brain-remember-actions button { min-height: 40px; min-width: 112px; }
.brain-jev-panel { background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; padding: 11px 12px; }
.brain-jev-panel > summary { color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.brain-jev-panel[open] > summary { color: var(--text); margin-bottom: 10px; }
.brain-jev-head strong, .brain-jev-head small { display: block; }
.brain-jev-head strong { font-size: 11px; }
.brain-jev-head small { color: var(--muted); font-size: 9px; line-height: 1.45; margin-top: 3px; }
.brain-jev-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.brain-jev-actions .danger-text { margin-left: auto; }
.brain-admin-panel { background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; padding: 11px 12px; }
.brain-admin-panel > summary { color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.brain-admin-panel[open] > summary { color: var(--text); margin-bottom: 8px; }
.brain-admin-panel > p { color: var(--subtle); font-size: 9px; line-height: 1.45; margin: 0 0 10px; }
.brain-admin-grid { display: grid; gap: 9px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.brain-admin-grid label { color: var(--muted); display: grid; font-size: 9px; font-weight: 700; gap: 6px; min-width: 0; }
.brain-admin-actions { align-items: center; display: flex; gap: 10px; justify-content: space-between; margin-top: 11px; }
.brain-admin-actions span { color: var(--muted); font-size: 9px; }
@container (max-width: 560px) {
  .brain-panel-body { padding-inline: 14px; }
  .brain-scope-grid, .brain-search-form { grid-template-columns: minmax(0,1fr); }
  .brain-admin-grid { grid-template-columns: minmax(0,1fr); }
  .brain-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .brain-area-edit { grid-template-columns: minmax(0,1fr); }
  .brain-page { padding: 14px; }
  .brain-page-head { flex-wrap: wrap; }
  .brain-search-form button { width: 100%; }
}
/* Beside the cards the area navigation needs room of its own; below that it becomes a row
   of chips above them, so the cards keep the whole width. */
@container (max-width: 760px) {
  .brain-knowledge { grid-template-columns: minmax(0,1fr); }
  .brain-page-list { border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 5px; max-height: none; padding-bottom: 10px; position: static; }
  .brain-page-list > .brain-nav-row:not(.area) { background: var(--panel-3); border-color: var(--line); border-radius: 999px; flex: 0 0 auto; min-height: 30px; padding: 5px 11px 5px 9px; width: auto; }
  .brain-page-list > .brain-nav-row:not(.area) .brain-nav-toggle { display: none; }
  .brain-page-list > .brain-nav-row:not(.area).active { background: var(--accent-soft); border-color: rgba(217,255,115,.3); }
  .brain-page-list > .brain-nav-heading { background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; flex: 1 0 100%; font-size: 8.5px; margin: 4px 0 0; min-height: 34px; }
  .brain-page-list > .brain-nav-heading .brain-chevron { display: inline-flex; transform: rotate(90deg); }
  .brain-page-list.areas-open > .brain-nav-heading .brain-chevron { transform: rotate(-90deg); }
  .brain-page-list > .brain-nav-row.area { display: none; flex: 1 0 100%; }
  .brain-page-list.areas-open > .brain-nav-row.area { display: flex; }
}
.users-list { display: grid; gap: 7px; margin-bottom: 14px; }
.users-pane .users-list { margin-bottom: 0; }
.users-pane:not(.editing) .user-form { display: none; }
.users-pane.editing .users-list, .users-pane.editing #user-create-trigger { display: none; }
.users-pane:not(.editing) #user-editor-back { display: none; }
.user-card { align-items: center; background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; display: flex; gap: 10px; justify-content: space-between; padding: 10px 11px; }
.user-card strong, .user-card span { display: block; }
.user-card span { color: var(--muted); font-size: 9px; }
.user-form { border-top: 1px solid var(--line); display: grid; gap: 9px; grid-template-columns: repeat(2,minmax(0,1fr)); padding-top: 14px; }
.user-form > label { min-width: 0; }
.user-form > label > input:not([type="checkbox"]), .user-form > label > select { width: 100%; }
.user-form .form-error, .user-form .modal-actions { grid-column: 1 / -1; }
.modal-head-actions { align-items: center; display: flex; gap: 7px; }
.pool-manager, .claude-pool-manager { background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 14px; margin-top: 0; padding: 16px; }
.pool-manager-head { align-items: center; display: flex; gap: 12px; justify-content: space-between; }
.pool-manager-head strong { display: block; font-size: 13px; }
.pool-manager-head span { color: var(--muted); font-size: 10px; }
.pool-list { display: grid; gap: 7px; margin: 12px 0; }
.pool-card { align-items: center; background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; display: flex; gap: 10px; justify-content: space-between; padding: 10px 11px; }
.pool-card div { min-width: 0; }
.pool-card strong { display: block; font-size: 11px; }
.pool-card span { color: var(--muted); display: block; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-form { display: grid; gap: 8px; grid-template-columns: minmax(0,1.4fr) minmax(0,1.4fr) 92px 92px auto; }
.pool-form label { min-width: 0; }
.pool-form input, .pool-form select { width: 100%; }
.pool-form button { align-self: end; }
.pool-form .form-error { grid-column: 1 / -1; }
.pool-accounts-field { grid-column: span 1; }
.pool-account-choices { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.pool-account-choice { background: var(--panel-3); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; max-width: 100%; overflow: hidden; padding: 7px 9px; text-overflow: ellipsis; white-space: nowrap; }
.pool-account-choice.selected { background: var(--accent-soft); border-color: rgba(217,255,115,.28); color: var(--accent); }
@media (max-width: 620px) {
  #project-settings-dialog, .account-dialog, .settings-dialog { border-radius: 0; height: 100dvh; max-height: 100dvh; max-width: none; width: 100vw; }
  #project-settings-dialog > section, .account-dialog > section, .account-dialog > form, .settings-dialog > section { max-width: 100%; overflow-x: hidden; padding: 16px 14px; width: 100%; }
  .project-worker-card:not(.editing) .project-worker-controls { display: none; }
  .project-worker-controls { grid-template-columns: minmax(0,1fr); }
  .pool-manager:not(.editing) .pool-form, .claude-pool-manager:not(.editing) .pool-form { display: none; }
  .pool-form { grid-template-columns: minmax(0,1fr); }
  .pool-card { padding: 11px; }
  .pool-account-choice { flex: 1 1 calc(50% - 5px); }
  .user-form, .permission-grid { grid-template-columns: minmax(0,1fr); }
  .modal label.settings-row { grid-template-columns: minmax(0,1fr); }
  .brain-jev-actions > button { min-height: 40px; }
  .provider-connect { grid-template-columns: minmax(0,1fr); }
  .provider-connect .github-device, .provider-connect .form-error { grid-column: 1; }
  .provider-connect-head { align-items: stretch; flex-direction: column; }
  .provider-section-tabs { margin-bottom: 12px; }
  .account-list { grid-template-columns: minmax(0,1fr); }
  .account-detail-body { grid-template-columns: minmax(0,1fr); }
  .provider-add-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .provider-add-tabs button { min-width: 0; padding-inline: 5px; }
  .provider-add-pane.active { align-items: stretch; grid-template-columns: minmax(0,1fr); }
  .provider-add-pane > * { grid-column: 1 !important; }
  #claude-provider-device { align-items: stretch; grid-template-columns: minmax(0,1fr); }
  #claude-provider-device > *, #claude-provider-submit { grid-column: 1; }
  #claude-provider-device .provider-device-actions { justify-content: flex-start; }
  .settings-dialog { overflow-x: hidden; }
  .user-card { min-width: 0; }
  .user-card > div { min-width: 0; }
  .user-card strong, .user-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-form input, .user-form select { max-width: 100%; min-width: 0; }
  .project-members-card:not(.editing) .membership-controls { display: none; }
  .project-members-card, .membership-controls, .permission-grid, .membership-controls select { max-width: 100%; min-width: 0; width: 100%; }
  .membership-actions { align-items: stretch; flex-direction: column; }
  .membership-actions button { margin: 0; max-width: 100%; width: 100%; }
}
@media (min-width: 621px) and (max-width: 940px) {
  .account-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.account-switch-banner { align-items: center; background: rgba(255,201,106,.075); border: 1px solid rgba(255,201,106,.22); border-radius: 11px; display: flex; gap: 11px; margin: 0 0 14px; padding: 11px 12px; }
.account-switch-banner.success { background: rgba(156,230,168,.07); border-color: rgba(156,230,168,.22); }
.account-switch-banner.error { background: rgba(255,142,131,.07); border-color: rgba(255,142,131,.22); }
.account-switch-banner.success .activity-spinner, .account-switch-banner.error .activity-spinner { animation: none; border: 0; height: 9px; width: 9px; }
.account-switch-banner.success .activity-spinner { background: var(--ok); }
.account-switch-banner.error .activity-spinner { background: var(--danger); }
.account-switch-banner > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-switch-banner strong { font-size: 11px; }
.account-switch-banner span:not(.activity-spinner) { color: var(--muted); font-size: 9px; overflow-wrap: anywhere; }
.account-list { align-items: stretch; display: grid; gap: 10px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.account-empty-note, .account-access-note { background: #10120e; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 10px; padding: 13px; }
.account-empty-note, .account-access-note, .account-switch-banner { grid-column: 1 / -1; }
.account-access-note { align-items: center; display: flex; justify-content: space-between; }
.account-access-note strong { color: var(--text); font-size: 11px; }
.account-access-note span { color: var(--warn); font-weight: 700; }
.account-card { align-items: start; align-self: stretch; background: #10120e; border: 1px solid var(--line); border-radius: 13px; display: grid; gap: 9px; grid-template-columns: minmax(0,1fr); height: 100%; padding: 13px 14px; position: relative; }
.account-card:has(.account-profile-details[open]) { grid-column: 1 / -1; height: auto; }
.account-card.active { background: linear-gradient(105deg, rgba(217,255,115,.075), #10120e 58%); border-color: rgba(217,255,115,.25); }
.account-card.worker-active { border-color: rgba(217,255,115,.48); }
.account-card.project-active { background: linear-gradient(105deg, rgba(217,255,115,.13), #10120e 65%); border: 2px solid var(--accent); padding: 12px 13px; }
.account-card-main { min-width: 0; }
.account-card-main > strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name-row { align-items: center; display: flex; gap: 7px; min-width: 0; }
.account-name-row > strong { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-plan-badge { background: rgba(217,255,115,.1); border: 1px solid rgba(217,255,115,.25); border-radius: 999px; color: var(--accent); flex: 0 0 auto; font-size: 7px; font-weight: 800; letter-spacing: .08em; line-height: 1; padding: 4px 6px 3px; }
.account-reset-badge { background: rgba(255,201,106,.08); border: 1px solid rgba(255,201,106,.22); border-radius: 999px; color: var(--warn); flex: 0 0 auto; font-size: 7px; font-weight: 800; letter-spacing: .05em; line-height: 1; margin-left: auto; padding: 4px 6px 3px; }
.account-expired-badge { background: rgba(255,120,110,.08); border: 1px solid rgba(255,120,110,.3); border-radius: 999px; color: var(--danger, #ff786e); flex: 0 0 auto; font-size: 7px; font-weight: 800; letter-spacing: .05em; line-height: 1; margin-left: auto; padding: 4px 6px 3px; }
.account-card.auth-expired .account-budget-value, .account-card.auth-expired .claude-usage small { color: var(--danger, #ff786e); }
.account-running-badge { background: rgba(217,255,115,.12); border: 1px solid rgba(217,255,115,.34); border-radius: 999px; color: var(--accent); flex: 0 0 auto; font-size: 7px; font-weight: 850; letter-spacing: .07em; line-height: 1; margin-left: auto; padding: 4px 7px 3px; }
.account-card-meta { color: var(--subtle); font-size: 10px; margin-top: 4px; }
.account-profile-details { min-width: 0; }
.account-profile-details:not([open]) > :not(summary) { display: none; }
.account-profile-details > summary { cursor: pointer; list-style: none; min-width: 0; padding-right: 22px; }
.account-profile-details > summary::-webkit-details-marker { display: none; }
.account-profile-details > summary::after { color: var(--muted); content: "+"; font-family: var(--mono); font-size: 12px; position: absolute; right: 12px; top: 10px; }
.account-profile-details[open] > summary::after { content: "−"; }
.account-detail-body { border-top: 1px solid var(--line); display: grid; gap: 12px; grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 12px; padding-top: 12px; }
.account-detail-body.single { grid-template-columns: minmax(0,1fr); }
.account-detail-body > .account-detail-section, .account-detail-body > .account-provider-controls, .account-detail-body > .account-detail-actions, .account-detail-body > .api-provider-editor { align-self: start; background: rgba(255,255,255,.018); border: 1px solid var(--line); border-radius: 11px; margin: 0; min-width: 0; padding: 12px; }
.account-detail-section { margin: 0; }
.account-detail-section > strong { color: var(--muted); display: block; font-family: var(--mono); font-size: 9px; margin-bottom: 7px; }
.account-detail-actions { border-top: 1px solid var(--line); display: flex; gap: 7px; margin-top: 9px; padding-top: 9px; }
.account-detail-actions button { flex: 1 1 0; min-width: 0; white-space: normal; }
.account-budget { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; width: 100%; }
.account-budget-head { align-items: baseline; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.account-budget-value { color: var(--text); font-family: var(--mono); font-size: 13px !important; }
.account-budget-reset { color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 650; }
.account-budget-track { background: #22251f; border: 1px solid rgba(255,255,255,.04); border-radius: 999px; display: flex; height: 9px; min-width: 120px; overflow: hidden; width: 100%; }
.account-budget-track span { display: block; flex: 0 0 auto; height: 100%; }
.account-budget-protected { background: repeating-linear-gradient(135deg, rgba(159,200,255,.55) 0 3px, rgba(159,200,255,.25) 3px 6px); }
.account-budget-protected.breached { background: repeating-linear-gradient(135deg, rgba(255,142,131,.6) 0 3px, rgba(255,142,131,.25) 3px 6px); }
.account-budget-pool { background: var(--accent); }
.account-special-resets { align-items: flex-start; background: rgba(255,201,106,.07); border: 1px solid rgba(255,201,106,.2); border-radius: 9px; color: var(--warn); display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; }
.account-special-resets strong { font-size: 10px !important; }
.account-special-resets span { color: var(--muted); font-size: 9px; }
.account-special-reset { align-items: center; display: grid; gap: 8px; grid-template-columns: minmax(0,1fr) auto; width: 100%; }
.account-special-reset button { font-size: 8px; padding: 5px 8px; }
.account-special-reset button:disabled { cursor: not-allowed; opacity: .42; }
.account-provider-controls { display: grid; gap: 9px; }
.account-provider-controls .account-detail-actions { border-top: 0; margin-top: 0; padding-top: 0; }
.account-provider-controls > .account-manual-switch { background: var(--accent-soft); border-color: rgba(217,255,115,.28); color: var(--accent); width: 100%; }
.account-auto-reset { margin: 0; }
.account-pool-limits { background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 7px 8px; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 9px; width: 100%; }
.account-pool-limits label { font-size: 8px; margin: 0; min-width: 0; }
.account-pool-limits label.inactive { opacity: .45; }
.account-pool-limits input { font-family: var(--mono); font-size: 10px; margin-top: 4px; min-width: 0; padding: 7px 8px; }
.account-pool-limits small { color: var(--muted); font-size: 8px; grid-column: 1 / -1; }
.account-pool-limits button { grid-column: 1 / -1; width: 100%; }
.account-card button { background: var(--panel-3); border: 1px solid var(--line); border-radius: 9px; color: var(--text); font-size: 9px; font-weight: 700; padding: 9px 11px; white-space: nowrap; }
.api-account-card.active { border-color: rgba(127,183,255,.52); }
.api-budget { display: grid; gap: 5px; margin-top: 9px; }
.api-budget-head { align-items: baseline; display: flex; gap: 8px; justify-content: space-between; }
.api-budget-head strong { font-family: var(--mono); font-size: 11px !important; }
.api-budget-head span { color: var(--muted); font-family: var(--mono); font-size: 9px; }
.api-budget-track { background: #22251f; border-radius: 999px; display: block; height: 8px; overflow: hidden; }
.api-budget-track > span { background: #7fb7ff; display: block; height: 100%; }
.api-provider-editor { border-top: 1px solid var(--line); display: grid; gap: 7px 8px; grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 9px; padding-top: 9px; }
.api-provider-editor label { font-size: 8px; margin: 0; }
.api-provider-editor input { font-family: var(--mono); font-size: 10px; margin-top: 4px; min-width: 0; padding: 7px 8px; }
.api-provider-editor .setting-check, .api-provider-editor .account-detail-actions { grid-column: 1 / -1; }
.account-card:not(.active) button:hover { border-color: rgba(217,255,115,.3); color: var(--accent); }
.account-card.active button { color: var(--accent); cursor: default; }
.danger-button { background: rgba(255,142,131,.16); border-radius: 9px; color: var(--danger); font-size: 10px; font-weight: 750; padding: 10px 12px; }
.setting-check { align-items: flex-start; background: #0f110e; border: 1px solid var(--line); border-radius: 10px; display: flex !important; gap: 10px; padding: 11px; }
.setting-check input { accent-color: var(--accent); margin: 2px 0 0; width: auto; }
.setting-check span { display: flex; flex-direction: column; gap: 3px; }
.setting-check strong { color: var(--text); font-size: 11px; }
.setting-check small { color: var(--subtle); font-size: 9px; font-weight: 400; }
body.embed-mode .app-shell, html.pane-embed .app-shell { display: block; padding: 0; }
html.pane-embed .app-shell { transition: none; }
html.pane-hydrating.pane-embed .chat-workspace { visibility: hidden; }
body.embed-mode .project-panel, body.embed-mode .mobile-bar, body.embed-mode .nav-toggle-button,
html.pane-embed .project-panel, html.pane-embed .mobile-bar, html.pane-embed .nav-toggle-button { display: none !important; }
body.embed-mode .workspace-grid, html.pane-embed .workspace-grid { height: 100dvh; }
.modal::backdrop { backdrop-filter: blur(8px); background: rgba(4, 5, 3, 0.72); }
.modal form, .modal > section { padding: 24px; }
.modal-head { align-items: flex-start; display: flex; justify-content: space-between; margin-bottom: 20px; }
.modal-head h2 { font-size: 24px; letter-spacing: -0.045em; margin: 0; }
.modal label { color: var(--muted); display: block; font-size: 10px; font-weight: 650; margin: 11px 0; }
.modal label > span { color: var(--subtle); font-weight: 400; }
.modal input, .modal select, .modal textarea { background: #0f110e; border: 1px solid var(--line); border-radius: 9px; display: block; margin-top: 6px; outline: 0; padding: 10px 11px; width: 100%; }
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: rgba(217, 255, 115, 0.38); }
.modal .setting-check { align-items: center; display: grid !important; gap: 10px; grid-template-columns: 18px minmax(0,1fr); margin: 0; max-width: 100%; min-width: 0; width: 100%; }
.modal .setting-check input[type="checkbox"] { accent-color: var(--accent); background: transparent; border: 0; border-radius: 4px; height: 18px; margin: 0; padding: 0; width: 18px; }
.modal .setting-check > span { min-width: 0; overflow-wrap: anywhere; }
.modal .user-form { padding: 14px 0 0; }
.modal-grid { display: grid; gap: 0 11px; grid-template-columns: 1fr 1fr; }
.new-project-progress { align-items: center; background: rgba(185,167,255,.07); border: 1px solid rgba(185,167,255,.22); border-radius: 11px; display: flex; gap: 11px; margin-top: 14px; padding: 11px 12px; }
.new-project-progress.hidden { display: none; }
.new-project-progress strong { display: block; font-size: 11.5px; }
.new-project-progress small { color: var(--muted); display: block; font-size: 10px; margin-top: 3px; }
.new-project-import { background: #0f110e; border: 1px solid var(--line); border-radius: 11px; margin-top: 15px; padding: 12px; }
.new-project-import > strong { display: block; font-size: 11px; }
.new-project-import > strong span, .new-project-import > span { color: var(--subtle); font-size: 9px; font-weight: 400; }
.new-project-import-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 8px; }
.modal .file-picker-button, .sidebar-files .file-picker-button { align-items: center; cursor: pointer; display: inline-flex; font-size: 10px; justify-content: center; margin: 0; padding: 10px 12px; }
.new-project-import .text-button { margin-left: 6px; }
.sidebar-files { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.files-dialog { max-width: 880px; overflow: hidden; }
.files-dialog > .sidebar-files { display: flex; height: min(820px,90dvh); min-height: 420px; overflow: hidden; position: relative; }
.files-dialog #files-back { display: none; }
.files-dialog .sidebar-files-head { display: block; padding: 0; position: absolute; right: 18px; top: 17px; z-index: 4; }
.files-dialog .sidebar-files-head > div { display: none; }
.files-dialog .files-breadcrumbs { padding-right: 38px; }
.project-panel.files-mode .nav-list > .nav-create-actions,
.project-panel.files-mode .nav-list > .global-search-box,
.project-panel.files-mode .nav-list > .project-list { display: none !important; }
.project-panel.files-mode .nav-list > .sidebar-files { animation: sidebarFilesIn 180ms ease-out; display: flex; }
.sidebar-files-head { align-items: center; display: grid; gap: 8px; grid-template-columns: auto minmax(0,1fr) auto; padding: 3px 2px 12px; }
.sidebar-files-head > div { min-width: 0; }
.sidebar-files-head .eyebrow { font-size: 8px; margin-bottom: 2px; }
.sidebar-files-head h2 { font-size: 13px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-files-head .secondary { font-size: 9px; padding: 8px 9px; }
.sidebar-files .files-toolbar { display: grid; grid-template-columns: 38px minmax(0,1fr) minmax(0,1fr); }
.sidebar-files .files-toolbar > :nth-child(4), .sidebar-files .files-toolbar > :nth-child(5) { grid-column: span 3; width: 100%; }
.sidebar-files .files-toolbar > button { padding: 8px 7px; }
.sidebar-files .form-error { flex: 0 0 auto; margin: 7px 0 0; }
@keyframes sidebarFilesIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }
.files-breadcrumbs { align-items: center; display: flex; flex: 0 0 auto; gap: 5px; min-width: 0; overflow-x: auto; padding: 2px 0 11px; }
.files-breadcrumbs button { background: transparent; color: var(--muted); flex: 0 0 auto; font-size: 10px; padding: 5px 3px; }
.files-breadcrumbs button.active { color: var(--text); font-weight: 700; }
.files-breadcrumbs span { color: var(--subtle); font-size: 9px; }
.files-toolbar { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 7px; }
.files-toolbar > button { font-size: 10px; padding: 10px 12px; }
.files-toolbar .files-icon-button { width: 38px; }
.files-view-options { align-items: center; display: flex; flex: 0 0 auto; justify-content: flex-end; margin-top: 7px; }
.files-hidden-toggle { align-items: center; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); cursor: pointer; display: inline-flex; font-family: var(--mono); font-size: 9px; gap: 6px; padding: 5px 9px; }
.modal .files-hidden-toggle input[type="checkbox"], .sidebar-files .files-hidden-toggle input[type="checkbox"] { accent-color: var(--accent); background: transparent; border: 0; height: 14px; margin: 0; padding: 0; width: 14px; }
.files-progress { background: var(--panel-3); border-radius: 999px; flex: 0 0 auto; height: 28px; margin-top: 10px; overflow: hidden; position: relative; }
.files-progress > span { background: rgba(217,255,115,.18); bottom: 0; left: 0; position: absolute; top: 0; transition: width 120ms linear; width: 0; }
.files-progress > strong { align-items: center; bottom: 0; display: flex; font-size: 9px; left: 10px; max-width: calc(100% - 20px); overflow: hidden; position: absolute; right: 10px; text-overflow: ellipsis; top: 0; white-space: nowrap; }
.files-selection-bar { align-items: center; border-bottom: 1px solid var(--line); display: flex; flex: 0 0 auto; justify-content: space-between; margin-top: 10px; padding: 8px 0; }
.files-selection-bar span { color: var(--muted); font-size: 9px; }
.files-list { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: auto; padding-top: 4px; }
.files-row { align-items: center; border-bottom: 1px solid rgba(235,241,218,.06); display: grid; gap: 8px; grid-template-columns: 18px minmax(0,1fr) auto; min-width: 0; padding: 6px 2px; }
.modal .files-row input[type="checkbox"], .sidebar-files .files-row input[type="checkbox"] { accent-color: var(--accent); background: transparent; border: 0; height: 17px; margin: 0; padding: 0; width: 17px; }
.files-entry-main { align-items: center; background: transparent; color: var(--text); display: flex; gap: 9px; min-width: 0; padding: 5px 2px; text-align: left; }
.files-entry-main > span:last-child { min-width: 0; }
.files-entry-main strong, .files-entry-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-entry-main strong { font-size: 11px; }
.files-entry-main small { color: var(--subtle); font-size: 8px; margin-top: 2px; }
.files-entry-icon { align-items: center; background: var(--panel-3); border-radius: 7px; color: var(--accent); display: flex; flex: 0 0 auto; font-size: 17px; height: 29px; justify-content: center; width: 31px; }
.files-entry-icon::before { border: 1.4px solid currentColor; border-radius: 2px; content: ""; display: block; height: 10px; width: 14px; }
.files-row.directory .files-entry-icon::before { border-radius: 2px; height: 9px; position: relative; transform: translateY(1px); }
.files-row.file .files-entry-icon { color: var(--muted); }
.files-row.file .files-entry-icon::before { border-radius: 1px; height: 14px; width: 11px; }
.files-row.link .files-entry-icon::before { border-style: dashed; }
.files-row.link { opacity: .5; }
.files-row-actions { display: flex; gap: 2px; }
.files-row-actions svg { fill: none; height: 14px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; width: 14px; }
.files-row-actions .files-remove { color: var(--danger); }
.files-empty { color: var(--subtle); font-size: 11px; padding: 50px 12px; text-align: center; }
.new-thread-advanced { border-top: 1px solid var(--line); margin-top: 13px; padding-top: 10px; }
.new-thread-advanced > summary { color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; list-style-position: inside; padding: 5px 0; }
.modal-actions { align-items: center; display: flex; gap: 8px; justify-content: flex-end; margin-top: 19px; }
#new-thread-form > .modal-actions { background: #171a14; bottom: -1px; border-top: 1px solid var(--line); margin-left: -2px; margin-right: -2px; padding: 11px 2px 2px; position: sticky; z-index: 2; }
.modal-actions.split { justify-content: space-between; }
.approval-modal pre { background: #0d0f0c; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-family: var(--mono); font-size: 10px; max-height: 50dvh; overflow: auto; padding: 13px; white-space: pre-wrap; }
.approval-fields { display: grid; gap: 12px; }
.approval-field { background: #0f110e; border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.approval-field strong { display: block; font-size: 12px; margin-bottom: 5px; }
.approval-field p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0 0 9px; }
.approval-options { display: grid; gap: 6px; }
.approval-options label { align-items: flex-start; background: var(--panel-2); border-radius: 8px; cursor: pointer; display: flex; gap: 8px; margin: 0; padding: 8px; }
.approval-options input { accent-color: var(--accent); margin: 2px 0 0; width: auto; }
.approval-options span { color: var(--text); font-size: 10px; }
.approval-options small { color: var(--subtle); display: block; margin-top: 2px; }
.toast-stack { align-items: flex-end; bottom: auto; display: flex; flex-direction: column; gap: 7px; max-width: 380px; pointer-events: none; position: fixed; right: 24px; top: 24px; z-index: 400; }
.toast { animation: toastIn 180ms ease; background: #25291f; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 10px 35px rgba(0,0,0,.38); color: var(--text); font-size: 11px; line-height: 1.45; padding: 11px 13px; }
.toast.error { border-color: rgba(255, 142, 131, 0.35); color: #ffc2bc; }

.skeleton { animation: shimmer 1.3s infinite; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; border-radius: 8px; height: 52px; margin: 4px 0; }

@media (max-width: 620px) {
  #project-settings-dialog, .account-dialog, .files-dialog { border-radius: 0; height: 100dvh; inset: 0; margin: 0; max-height: 100dvh; max-width: none; overflow-x: hidden; width: 100vw; }
  #project-settings-dialog > section, .account-dialog > section { max-width: 100%; overflow-x: hidden; padding: 16px 14px; width: 100%; }
  .files-dialog > .sidebar-files { height: 100dvh; max-width: 100%; min-height: 0; padding: max(16px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom)); width: 100%; }
  .modal-head { gap: 12px; }
  .modal-head > div:first-child, .project-worker-head > div:first-child { min-width: 0; }
  .modal-head h2, .project-worker-head strong, .project-worker-head span { overflow-wrap: anywhere; }
  .project-appearance, .project-extension-card, .project-danger-zone { max-width: 100%; min-width: 0; overflow: hidden; width: 100%; }
  .project-worker-head { gap: 10px; }
  .project-worker-head > button { flex: 0 0 auto; }
  .permission-grid { grid-template-columns: minmax(0,1fr); }
  .modal .setting-check { min-height: 46px; padding: 10px 11px; }
  .modal .user-form { padding: 14px 0 0; }
  .files-toolbar { display: grid; grid-template-columns: 38px repeat(2,minmax(0,1fr)); }
  .files-toolbar > :nth-child(4), .files-toolbar > :nth-child(5) { grid-column: span 3; width: 100%; }
  .files-row { gap: 7px; }
  .files-row-actions .quiet-icon { height: 36px; width: 36px; }
}

@keyframes pulse { 50% { opacity: 0.4; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes orbit { to { transform: rotate(360deg) translateX(25px); } }
@keyframes recordPulse { 50% { box-shadow: 0 0 0 6px rgba(255,142,131,0.08); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes thinkingText { 50% { opacity: .48; } }

@media (min-width: 861px) {
  .header-actions .mobile-brain-button { align-items: center; background: var(--accent-soft); border: 1px solid rgba(217,255,115,.24); border-radius: 9px; color: var(--accent); display: flex; font-size: 11px; font-weight: 850; height: 36px; justify-content: center; min-height: 36px; min-width: 36px; padding: 0; width: 36px; }
  .header-actions .mobile-brain-button:hover { background: rgba(217,255,115,.15); border-color: rgba(217,255,115,.4); }
  .control-strip { display: none !important; }
  .header-actions #document-open { background: rgba(255,255,255,.055); border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text); font-size: 11px; min-height: 40px; padding: 9px 12px; }
  .header-actions #document-open:hover { background: rgba(255,255,255,.09); border-color: rgba(217,255,115,.26); }
  .header-actions #document-open .document-glyph { height: 19px; width: 18px; }
  body.embed-desktop .chat-workspace { position: relative; }
  body.embed-desktop .goal-panel:not(.hidden) { border: 1px solid var(--line-strong); border-radius: 13px; bottom: var(--goal-panel-bottom,82px); box-shadow: 0 18px 50px rgba(0,0,0,.42); left: auto; max-height: calc(100% - var(--goal-panel-bottom,82px) - 18px); overflow: auto; position: absolute; right: 18px; top: auto; width: min(560px,calc(100% - 36px)); z-index: 17; }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 292px minmax(0, 1fr); }
  .header-button { font-size: 0; }
  .header-button.goal-active { font-size: 9px; }
  .header-button span { font-size: 14px; }
  .control-strip { gap: 9px; }
}

@media (max-width: 860px) {
  html, body { max-width: 100vw; overflow-x: hidden; }
  .mobile-bar { align-items: center; background: #0f110e; border-bottom: 1px solid var(--line); display: flex; gap: 6px; height: 52px; justify-content: space-between; padding: 0 8px; position: fixed; top: 0; transform: translate3d(0,0,0); transition: transform 220ms cubic-bezier(.22,1,.36,1); width: 100%; will-change: transform; z-index: 80; }
  .toast-stack { max-width: calc(100vw - 16px); right: 8px; top: 100px; }
  .toast { max-width: 100%; }
  .mobile-chat-controls { align-items: center; display: flex; flex: 1; gap: 4px; justify-content: flex-end; min-width: 0; }
  .mobile-chat-fallback { color: var(--text); display: none; flex: 1; font-size: 12px; font-weight: 750; text-align: center; }
  .mobile-chat-controls.no-thread .mobile-chat-fallback { display: block; }
  .mobile-chat-controls.no-thread .mobile-thread-settings, .mobile-chat-controls.no-thread .header-actions { display: none; }
  .mobile-bar .mobile-thread-settings { flex: 1 1 126px; max-width: 154px; min-width: 84px; }
  .mobile-bar .mobile-thread-settings-copy { gap: 5px; max-width: 100%; overflow: hidden; }
  .mobile-bar .mobile-thread-settings-copy strong { font-size: 10.5px; min-width: 0; }
  .mobile-bar .mobile-thread-settings-copy small { flex: 0 0 auto; font-size: 9px; }
  .mobile-bar .header-actions { align-self: center; flex: 0 0 auto; grid-area: auto; justify-self: auto; margin: 0; position: relative; z-index: 1; }
  .mobile-bar > #mobile-projects { background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 11px; color: var(--text); flex: 0 0 auto; height: 40px; min-height: 40px; min-width: 40px; width: 40px; }
  .mobile-brain-button { align-items: center; background: var(--accent-soft); border: 1px solid rgba(217,255,115,.28); border-radius: 11px; color: var(--accent); display: flex; flex: 0 0 auto; font-size: 11px; font-weight: 850; height: 40px; justify-content: center; min-height: 40px; min-width: 40px; padding: 0; width: 40px; }
  .mobile-brain-button:active { background: rgba(217,255,115,.17); }
  .brand-dot { background: var(--accent); border-radius: 50%; height: 7px; width: 7px; }
  .mobile-only { display: inline-flex; }
  .app-shell { display: block; padding-top: 0; }
  body.nav-collapsed .app-shell { display: block; }
  body.nav-collapsed .project-panel { opacity: 1; pointer-events: auto; }
  .project-panel { bottom: 0; box-shadow: 18px 0 60px rgba(0,0,0,.58); max-width: calc(100vw - 24px); position: fixed; top: var(--mobile-host-chrome-height); transform: translateX(-105%); transition: transform 180ms ease; width: 372px; z-index: 50; }
  body.booting .project-panel { transition: none !important; visibility: hidden !important; }
  .project-panel.open { transform: translateX(0); }
  .project-tree-head { grid-template-columns: minmax(0,1fr) repeat(3,34px); }
  .project-actions-trigger, .project-files-trigger, .project-new-chat { height: 42px; min-height: 42px; min-width: 34px; width: 34px; }
  .chat-panel { height: 100%; }
  .workspace-grid { grid-auto-columns: minmax(0,1fr); grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); height: 100dvh; max-width: 100vw; position: relative; width: 100%; }
  .workspace-grid.multi, .workspace-grid.layout-columns, .workspace-grid.layout-rows { display: grid; grid-auto-columns: minmax(0,1fr); grid-auto-flow: row; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); max-width: 100vw; overflow: hidden; }
  .workspace-grid, .workspace-grid.multi, .workspace-grid.layout-columns, .workspace-grid.layout-rows { overflow: clip; }
  .workspace-grid > .workspace-tabs { display: flex; left: 0; position: absolute; right: 0; top: 52px; z-index: 70; }
  .workspace-grid > .chat-panel, .workspace-grid > .chat-pane, .workspace-grid > .brain-workspace-panel { grid-column: 1; grid-row: 1; }
  .workspace-grid.multi > .chat-panel, .workspace-grid.multi > .chat-pane, .workspace-grid.multi > .brain-workspace-panel {
    display: block;
    grid-column: 1;
    grid-row: 1;
    height: 100%;
    max-width: 100%;
    min-height: 0;
    pointer-events: none;
    visibility: hidden;
    width: 100%;
  }
  .chat-pane { border-left: 0; min-height: 0; }
  .chat-pane iframe { max-width: 100%; min-width: 0; }
  .workspace-grid.multi > .mobile-pane-active { pointer-events: auto; visibility: visible; z-index: 1; }
  .workspace-grid.multi > .brain-workspace-panel, .brain-workspace-panel { display: flex; flex-direction: column; height: 100%; max-width: 100%; overscroll-behavior: none; padding-top: var(--mobile-host-chrome-height); width: 100%; }
  .brain-panel-header { cursor: default; min-height: 62px; padding: 9px 14px; }
  .brain-panel-header .panel-close { height: 40px; width: 40px; }
  .brain-panel-body { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px 12px max(20px,env(safe-area-inset-bottom)); }
  body.brain-pane-active #mobile-chat-controls > :not(.mobile-chat-fallback) { display: none !important; }
  body.brain-pane-active #mobile-chat-controls .mobile-chat-fallback { display: inline-flex; }
  body.brain-pane-active > .brain-workspace-panel { border: 0; display: flex !important; height: 100dvh; inset: 0; max-height: 100dvh; max-width: 100vw; min-height: 100dvh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); pointer-events: auto !important; position: fixed; visibility: visible !important; width: 100vw; z-index: 500; }
  .workspace-grid > .pane-loading::before { align-items: center; background: var(--bg); color: var(--muted); content: "Chat wird geladen …"; display: flex; font-family: var(--mono); font-size: 11px; inset: 0; justify-content: center; padding-top: 42px; position: absolute; z-index: 30; }
  .workspace-grid > .pane-loading::after { animation: spin 900ms linear infinite; border: 2px solid var(--line-strong); border-right-color: var(--accent); border-radius: 50%; content: ""; height: 18px; left: calc(50% - 9px); position: absolute; top: calc(50% - 22px); width: 18px; z-index: 31; }
  .workspace-grid > .pane-loading > iframe { visibility: hidden; }
  .workspace-tabs { -webkit-touch-callout: none; -webkit-user-select: none; align-items: center; background: #10120e; border-bottom: 1px solid var(--line); gap: 4px; min-width: 0; overflow-x: auto; padding: 5px 7px; transform: translate3d(0,0,0); transition: transform 220ms cubic-bezier(.22,1,.36,1), opacity 150ms ease; user-select: none; will-change: transform; }
  body:not(.embed-mode).mobile-header-hidden .mobile-bar { transform: translate3d(0,-100%,0); }
  body:not(.embed-mode).mobile-header-hidden .workspace-tabs { opacity: 0; pointer-events: none; transform: translate3d(0,calc(-100% - 52px),0); }
  body:not(.embed-mode) .mobile-send-proxy.active { background: transparent; border: 0; display: block; margin: 0; opacity: .001; padding: 0; position: fixed; touch-action: manipulation; z-index: 200; }
  body:not(.embed-mode) .host-composer-input:not(.hidden) { -webkit-appearance: none; -webkit-tap-highlight-color: transparent; appearance: none; background: transparent; border: 0; border-radius: 0; box-sizing: border-box; caret-color: var(--text); display: block; margin: 0; outline: 0; overflow-x: hidden; overflow-wrap: anywhere; overflow-y: auto; position: fixed; resize: none; white-space: pre-wrap; z-index: 40; }
  /* Over the preview's chat (z-index 185) while it is the chat in front. */
  body.preview-open:not(.embed-mode) .host-composer-input:not(.hidden) { z-index: 186; }
  body:has(.project-panel.open) .host-composer-input, body.brain-pane-active .host-composer-input, body.preview-dragging .host-composer-input { display: none !important; }
  .workspace-tab { -webkit-touch-callout: none; -webkit-user-select: none; background: var(--panel-2); border: 1px solid transparent; border-radius: 8px; color: var(--muted); flex: 0 0 auto; font-size: 9px; max-width: 160px; overflow: hidden; padding: 7px 10px; position: relative; text-overflow: ellipsis; user-select: none; white-space: nowrap; }
  .workspace-tab.tab-dragging { opacity: .42; }
  .workspace-tab.tab-drop-before::before, .workspace-tab.tab-drop-after::before { background: var(--accent); border-radius: 2px; content: ""; height: calc(100% - 8px); position: absolute; top: 4px; width: 2px; }
  .workspace-tab.tab-drop-before::before { left: 0; }
  .workspace-tab.tab-drop-after::before { right: 0; }
  .workspace-tab.active { background: linear-gradient(180deg, rgba(185,167,255,.17), rgba(185,167,255,.075)); border-color: rgba(185,167,255,.5); box-shadow: inset 0 -2px 0 var(--violet), 0 0 0 1px rgba(185,167,255,.08); color: var(--text); font-weight: 760; }
  .workspace-tab.unread { border-color: rgba(255,201,106,.42); box-shadow: inset 3px 0 0 var(--warn); color: var(--text); }
  .workspace-tab.active.unread { border-color: rgba(185,167,255,.5); box-shadow: inset 3px 0 0 var(--warn), inset 0 -2px 0 var(--violet), 0 0 0 1px rgba(185,167,255,.08); }
  .workspace-tab.running { padding-right: 23px; }
  .workspace-tab.running::after { animation: spin .8s linear infinite; background: transparent; border: 1.25px solid var(--line-strong); border-radius: 50%; border-right-color: var(--muted); box-shadow: none; box-sizing: border-box; content: ""; height: 6px; position: absolute; right: 9px; top: calc(50% - 3px); width: 6px; }
  .workspace-tab.loading { color: var(--text); opacity: .72; }
  .workspace-tab.loading::after { animation: spin 1s linear infinite; border: 1px solid var(--line-strong); border-right-color: var(--accent); border-radius: 50%; content: ""; height: 8px; margin-left: 7px; position: static; width: 8px; }
  body.embed-mode .chat-panel, body.embed-mode .workspace-grid,
  html.pane-embed .chat-panel, html.pane-embed .workspace-grid { height: 100dvh; }
  body.embed-mode .app-shell, html.pane-embed .app-shell { padding-top: 0; }
  .chat-workspace { grid-template-areas: "controls" "activity" "handover" "goal" "history" "notice" "thinking" "context" "composer"; grid-template-rows: auto auto auto auto minmax(0,1fr) auto auto auto auto; }
  .chat-header { display: contents; }
  .chat-identity { display: none; }
  body:not(.embed-mode) .control-strip { display: none; }
  body.embed-mode:not(.preview-mode) .chat-workspace { position: relative; }
  body.embed-mobile:not(.preview-mode) .chat-workspace { padding-top: var(--mobile-host-chrome-height); }
  body.embed-mobile.host-header-hidden:not(.preview-mode) .chat-workspace { padding-top: 0; }
  body.embed-mode:not(.preview-mode) .control-strip { background: transparent; border: 0; height: 0; min-height: 0; overflow: visible; padding: 0; }
  body.embed-mode:not(.preview-mode) .mobile-thread-settings { display: none; }
  body.embed-mode:not(.preview-mode) .header-actions { display: none; }
  .nav-toggle-button { display: none; }
  .header-actions { align-self: center; gap: 1px; grid-area: controls; justify-self: end; margin-right: 7px; z-index: 8; }
  .header-actions .header-button, .header-actions .icon-button { height: 36px; min-height: 36px; min-width: 36px; padding: 0; width: 36px; }
  .header-actions .header-button { gap: 0; justify-content: center; }
  .header-actions .header-button, .header-actions .header-button.goal-active { font-size: 0; }
  .header-actions .icon-button { font-size: 16px; }
  .header-actions .panel-close { font-size: 20px; }
  .header-actions .header-button span { font-size: 13px; }
  .mobile-bar .header-actions { gap: 1px; }
  .mobile-bar .header-actions #document-open { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; color: var(--text); height: 38px; min-height: 38px; min-width: 38px; width: 38px; }
  .mobile-bar .header-actions #document-open .document-glyph { height: 18px; width: 17px; }
  .mobile-bar .header-actions #more-toggle,
  .mobile-bar .header-actions #panel-close { background: transparent; border: 1px solid transparent; border-radius: 9px; color: var(--muted); height: 36px; min-height: 36px; min-width: 36px; width: 36px; }
  .mobile-bar .header-actions #more-toggle { font-size: 13px; letter-spacing: 1px; }
  .mobile-bar .header-actions #panel-close { font-size: 22px; }
  .header-actions #goal-toggle { background: transparent; position: relative; }
  .header-actions #goal-toggle .goal-dot { background: transparent; border-radius: 0; height: auto; width: auto; }
  .header-actions #goal-toggle .goal-dot::before { content: "G"; font-size: 13px; font-weight: 800; }
  .header-actions #goal-toggle.goal-active::after { background: var(--accent); border: 2px solid #0f110e; border-radius: 50%; content: ""; height: 5px; position: absolute; right: 4px; top: 4px; width: 5px; }
  .header-actions .popover { right: 36px; top: 34px; }
  .control-strip { align-items: center; min-height: 42px; overflow: visible; padding: 4px 118px 4px 9px; }
  .control-strip > label { display: none; }
  .mobile-thread-settings { align-items: center; background: rgba(178,158,255,.075); border: 1px solid rgba(190,174,255,.15); border-radius: 999px; color: #bbb0dc; display: flex; font-family: var(--mono); font-size: 10.5px; font-weight: 650; gap: 5px; justify-content: flex-start; max-width: 154px; min-height: 34px; overflow: hidden; padding: 4px 11px; text-align: left; width: 100%; }
  .mobile-thread-provider-logo { flex: 0 0 auto; height: 15px; object-fit: contain; width: 15px; }
  .mobile-thread-settings span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .context-strip { background: transparent; border: 0; display: block; height: 2px; min-height: 2px; padding: 0 10px; }
  .context-copy { display: none; }
  .context-track { height: 2px; max-width: none; width: 100%; }
  .context-handover { display: none; }
  .activity-banner { padding-left: 10px; padding-right: 10px; }
  .history-scroll { padding: 10px 14px 24px; }
  .usage-limit-notice { margin: 0 10px 6px; max-width: calc(100% - 20px); }
  .live-thinking-slot { padding: 0 10px 6px; }
  body.embed-mobile .activity-banner:not(.hidden) { border: 1px solid rgba(185,167,255,.2); border-radius: 11px; left: 8px; position: absolute; right: 8px; top: 89px; transform: translate3d(0,0,0); transition: transform 220ms cubic-bezier(.22,1,.36,1); z-index: 16; }
  body.embed-mobile .goal-panel:not(.hidden) { border: 1px solid var(--line); border-radius: 11px; bottom: calc(var(--bottom-overlay-height,70px) + 6px); left: 8px; max-height: calc(100% - var(--bottom-overlay-height,70px) - 22px); overflow: auto; position: fixed; right: 8px; top: auto; z-index: 17; }
  body.embed-mobile.host-header-hidden .activity-banner:not(.hidden) { transform: translate3d(0,-81px,0); }
  body.embed-mobile .chat-bottom-stack { bottom: 0; display: flex; flex-direction: column; gap: 4px; left: 0; pointer-events: none; position: absolute; right: 0; z-index: 10; }
  body.embed-mobile .chat-bottom-stack > * { pointer-events: auto; }
  body.embed-mobile .usage-limit-notice { margin: 0 10px; max-width: calc(100% - 20px); }
  body.embed-mobile .live-thinking-slot { background: transparent; padding-bottom: 0; }
  body.embed-mobile .context-strip { margin-bottom: -4px; }
  body.embed-mobile .composer-wrap { position: relative; z-index: 12; }
  body.embed-mobile .jump-to-live { bottom: calc(var(--bottom-overlay-height, 70px) + 8px); margin: 0; position: absolute; right: 14px; z-index: 13; }
  body.embed-mobile #live-anchor { height: calc(var(--bottom-overlay-height, 70px) + 8px); pointer-events: none; }
  .composer-wrap { padding: 0 7px max(7px, env(safe-area-inset-bottom)); }
  body.keyboard-open .composer-wrap { padding-bottom: 7px; }
  body.embed-mode.keyboard-open .workspace-grid,
  body.embed-mode.keyboard-open .chat-panel { height: calc(100dvh - var(--cora-keyboard-inset, 0px)); }
  body.embed-mode.keyboard-open .composer-wrap { background: var(--bg); position: relative; transform: none; z-index: 12; }
  body.embed-mode.keyboard-open .composer-wrap::after { background: var(--bg); content: ""; height: 100dvh; left: 0; pointer-events: auto; position: absolute; right: 0; top: 100%; }
  body.ios-standalone .composer-wrap { transform: translateY(5px); }
  body.ios-standalone:not(.keyboard-open) .composer-wrap:not(.composer-wrap-compact) { transform: translateY(max(5px, calc(env(safe-area-inset-bottom) - 14px))); }
  body.ios-standalone:not(.keyboard-open) .composer-wrap.composer-wrap-compact { align-self: center; background: transparent; margin: 0 0 6px; max-width: calc(100% - 48px); padding: 0; position: relative; transform: none; width: max-content; z-index: 12; }
  .composer { border-radius: 13px; padding: 7px 8px 6px; }
  .composer.composer-idle { align-items: center; border-radius: 999px; column-gap: 7px; display: grid; grid-template-columns: 40px 40px minmax(88px,1fr) 40px; max-width: calc(100vw - 48px); overflow: hidden; padding: 7px 9px; width: min(328px,calc(100vw - 48px)); }
  .composer.composer-idle.composer-stop-visible { grid-template-columns: 40px 40px minmax(68px,1fr) 40px 40px; width: min(376px,calc(100vw - 48px)); }
  .composer.composer-idle > textarea { display: none; }
  .composer.composer-idle > .composer-toolbar, .composer.composer-idle .composer-tools, .composer.composer-idle .composer-actions { display: contents; }
  .composer.composer-idle #attach-button { border-radius: 50%; grid-column: 1; grid-row: 1; height: 40px; width: 40px; }
  .composer.composer-idle #voice-live { border-radius: 50%; grid-column: 2; grid-row: 1; height: 40px; justify-content: center; padding: 0; width: 40px; }
  .composer.composer-idle #voice-live .voice-label, .composer.composer-idle #steer-label, .composer.composer-idle #composer-hint, .composer.composer-idle #send-message { display: none; }
  .composer.composer-idle .compact-composer-open { align-items: center; background: rgba(255,255,255,.035); border-radius: 999px; color: var(--muted); display: flex; grid-column: 3; grid-row: 1; height: 40px; justify-content: center; min-width: 108px; padding: 0 14px; }
  .composer.composer-idle #stop-turn { border-radius: 50%; grid-column: 4; grid-row: 1; height: 40px; width: 40px; }
  .composer.composer-idle #goal-toggle { align-self: center; grid-column: 4; grid-row: 1; height: 34px; justify-self: center; width: 34px; }
  .composer.composer-idle.composer-stop-visible #stop-turn { grid-column: 5; }
  .goal-panel { padding: 13px 14px; }
  .goal-controls { align-items: stretch; flex-wrap: wrap; }
  .goal-controls input { min-width: 150px; }

  body.embed-desktop .chat-workspace {
    grid-template-areas: "header" "controls" "context" "activity" "handover" "goal" "history" "notice" "thinking" "composer";
    grid-template-rows: auto auto auto auto auto auto minmax(0,1fr) auto auto auto;
  }
  body.embed-desktop .chat-header { display: flex; min-height: 70px; padding: 11px 25px; }
  body.embed-desktop .chat-identity { display: flex; }
  body.embed-desktop .header-actions { align-items: center; display: flex !important; gap: 5px; grid-area: auto; justify-self: auto; margin-right: 0; position: relative; z-index: auto; }
  body.embed-desktop .header-actions .header-button { font-size: 11px; height: auto; min-height: 0; min-width: 0; padding: 8px 10px; width: auto; }
  body.embed-desktop .header-actions .icon-button { font-size: 16px; height: 32px; min-height: 0; min-width: 0; padding: 0; width: 32px; }
  body.embed-desktop .header-actions .header-button span { font-size: 14px; }
  body.embed-desktop .header-actions .header-button.goal-active { background: var(--accent-soft); font-size: 11px; }
  body.embed-desktop .header-actions #goal-toggle .goal-dot { background: currentColor; border-radius: 50%; height: 7px; width: 7px; }
  body.embed-desktop .header-actions #goal-toggle .goal-dot::before,
  body.embed-desktop .header-actions #goal-toggle.goal-active::after { content: none; }
  body.embed-desktop .header-actions .popover { right: 36px; top: 38px; }
  body.embed-mode.embed-desktop:not(.preview-mode) .control-strip { align-items: end; background: rgba(19,21,16,.76); border: 0; border-bottom: 1px solid var(--line); display: flex; gap: 13px; height: auto; min-height: 0; overflow-x: auto; padding: 8px 25px; }
  body.embed-desktop .control-strip > label { display: flex; }
  body.embed-desktop .mobile-thread-settings { display: none; }
  body.embed-desktop .context-strip { align-items: center; background: #10120e; border-bottom: 1px solid var(--line); border-top: 0; display: grid; gap: 14px; grid-template-columns: auto minmax(100px,1fr); height: auto; min-height: 0; padding: 7px 25px; }
  body.embed-desktop .context-copy { display: flex; }
  body.embed-desktop .context-copy span { display: inline; }
  body.embed-desktop .context-track { height: 4px; max-width: none; width: auto; }
  body.embed-desktop .chat-workspace.composer-input-active .context-strip { display: grid; }
  body.embed-desktop .history-scroll { padding: 22px clamp(18px,5vw,74px) 40px; }
  body.embed-desktop .usage-limit-notice { margin: 0 clamp(18px,5vw,74px) 7px; max-width: calc(100% - 36px); }
  body.embed-desktop .live-thinking-slot { padding: 0 clamp(18px,5vw,74px) 4px; }
  body.embed-desktop .composer-wrap { padding: 0 clamp(18px,5vw,74px) max(17px,env(safe-area-inset-bottom)); }
  body.keyboard-open .composer-wrap { padding-bottom: 7px; }
  body.embed-desktop .composer { border-radius: 16px; padding: 11px 12px 9px; }
  body.embed-desktop .composer.composer-idle textarea { height: auto !important; min-height: 28px; padding: 3px 4px 9px; }
  body.embed-desktop .composer.composer-idle .composer-tools > .tool-button { display: inline-flex; }
  body.embed-desktop .composer.composer-idle .composer-tools > .steer-toggle:not(.hidden) { display: flex; }
  body.embed-desktop .composer.composer-idle #composer-hint { display: inline; }
  body.embed-desktop .composer.composer-idle .send-button,
  body.embed-desktop .composer.composer-idle .stop-button { height: 31px; width: 31px; }
}

/* A narrow desktop pane keeps its identity. Only action labels collapse; the
   true mobile header remains exclusive to the mobile workspace with tabs. */
@media (max-width: 620px) {
  body.embed-mode.embed-desktop .chat-header { display: flex; gap: 6px; min-height: 58px; padding: 8px 9px 8px 13px; }
  body.embed-mode.embed-desktop .chat-identity { display: flex; flex: 1; min-width: 0; overflow: hidden; }
  body.embed-mode.embed-desktop .title-row h1 { font-size: 16px; max-width: 100%; }
  body.embed-mode.embed-desktop .thread-project-badge { max-width: min(36vw,180px); }
  body.embed-mode.embed-desktop .header-actions { flex: 0 0 auto; gap: 1px; }
  body.embed-mode.embed-desktop .header-actions .header-button,
  body.embed-mode.embed-desktop .header-actions .icon-button {
    height: 31px;
    min-height: 31px;
    min-width: 31px;
    padding: 0;
    width: 31px;
  }
  body.embed-mode.embed-desktop .header-actions .header-button,
  body.embed-mode.embed-desktop .header-actions .header-button.goal-active { font-size: 0; gap: 0; justify-content: center; }
  body.embed-mode.embed-desktop .header-actions .header-button span { font-size: 13px; }
  body.embed-mode.embed-desktop .header-actions .icon-button { font-size: 15px; }
  body.embed-mode.embed-desktop .header-actions .panel-close { font-size: 19px; }
  body.embed-mode.embed-desktop .header-actions .popover { right: 32px; top: 33px; }
}

@media (max-width: 460px) {
  body.embed-mode.embed-desktop:not(.preview-mode) .control-strip {
    align-items: center;
    background: rgba(19,21,16,.76);
    border: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 0;
    height: auto;
    min-height: 36px;
    overflow: visible;
    padding: 3px 9px;
  }
  body.embed-mode.embed-desktop .control-strip > label { display: none; }
  body.embed-mode.embed-desktop:not(.preview-mode) .mobile-thread-settings {
    align-items: center;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex: 1;
    font-family: var(--mono);
    font-size: 9px;
    gap: 5px;
    justify-content: space-between;
    max-width: 100%;
    min-height: 28px;
    min-width: 0;
    overflow: hidden;
    padding: 2px 5px;
    text-align: left;
    width: 100%;
  }
  body.embed-mode.embed-desktop .context-strip {
    align-items: center;
    background: #10120e;
    border-bottom: 1px solid var(--line);
    border-top: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: auto minmax(60px,1fr);
    min-height: 25px;
    padding: 4px 10px;
  }
  body.embed-mode.embed-desktop .context-copy { display: flex; min-width: 0; }
  body.embed-mode.embed-desktop .context-copy span { display: none; }
  body.embed-mode.embed-desktop .context-copy strong { font-size: 8px; white-space: nowrap; }
  body.embed-mode.embed-desktop .context-track { height: 3px; max-width: none; width: auto; }
}

@media (max-width: 520px) {
  .chat-preview-overlay { padding: 0; }
  .chat-preview-shell { border: 0; border-radius: 0; max-width: none; width: 100vw; }
  .workspace-grid > .chat-pane.overlay-pane { border-radius: 0; }
  .workspace-grid.multi > .chat-pane.overlay-pane { pointer-events: auto; visibility: visible; }
  .login-card { padding: 30px 23px; }
  .password-row { grid-template-columns: 1fr; }
  .item.userMessage .message { max-width: 92%; }
  .message-media { grid-template-columns: minmax(0, 1fr); }
  .modal form { padding: 19px; }
  #new-thread-dialog { max-height: calc(100dvh - 22px); width: calc(100% - 20px); }
  #new-thread-dialog .modal-head { margin-bottom: 12px; }
  #new-thread-dialog .modal-head h2 { font-size: 22px; }
  #new-thread-dialog label { margin: 8px 0; }
  #new-thread-dialog textarea { max-height: 104px; }
  .modal-grid { grid-template-columns: 1fr; }
  .api-provider-form { grid-template-columns: minmax(0,1fr); }
  .api-provider-form > * { grid-column: 1 !important; }
  .account-list { gap: 7px; grid-template-columns: minmax(0,1fr); }
  .account-card { align-items: stretch; padding: 9px; }
  .account-card.project-active { padding: 8px; }
  .account-card-main > strong { font-size: 10px; }
  .account-name-row > strong { font-size: 10px; }
  .account-card-meta { font-size: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-budget { gap: 5px; margin-top: 8px; }
  .account-budget-head { gap: 3px; }
  .account-budget-value { font-size: 10px !important; }
  .account-budget-reset { font-size: 9px; }
  .account-budget-track { height: 7px; min-width: 0; width: 100%; }
  .account-profile-details > summary::after { font-size: 10px; right: 8px; top: 7px; }
  .account-detail-actions { flex-direction: column; }
  .account-card button { width: 100%; }
  .modal-actions.split { align-items: stretch; flex-direction: column-reverse; }
  .modal-actions.split button { width: 100%; }
  #composer-hint { display: none; }
  .steer-toggle span { display: none; }
}

/* Desktop panes can be narrow columns; their chrome follows pane mode, not iframe width. */
body.embed-desktop .control-strip { display: none !important; }
body.embed-desktop .header-actions #document-open { background: rgba(255,255,255,.055); border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text); font-size: 11px; min-height: 40px; padding: 9px 12px; }
body.embed-desktop .header-actions #document-open:hover { background: rgba(255,255,255,.09); border-color: rgba(217,255,115,.26); }
body.embed-desktop .header-actions #document-open .document-glyph { height: 19px; width: 18px; }
body.embed-desktop .thread-meta .mobile-thread-settings { display: inline-flex !important; flex: 0 1 auto; max-width: min(48vw,420px); min-width: 0; width: auto; }
body.embed-desktop .chat-workspace { position: relative; }
body.embed-desktop .goal-panel:not(.hidden) { border: 1px solid var(--line-strong); border-radius: 13px; bottom: calc(var(--bottom-overlay-height,86px) + 6px); box-shadow: 0 18px 50px rgba(0,0,0,.42); grid-area: auto; left: auto; max-height: calc(100% - var(--bottom-overlay-height,86px) - 24px); overflow: auto; position: absolute; right: 18px; top: auto; width: min(560px,calc(100% - 36px)); z-index: 17; }

@media (max-width: 620px) {
  .account-detail-body { grid-template-columns: minmax(0,1fr); }
  body.embed-desktop .thread-meta { gap: 7px; max-width: 100%; min-width: 0; }
  body.embed-desktop .thread-meta .mobile-thread-settings { flex: 1 1 auto; max-width: none; }
  body.embed-desktop .thread-meta .mobile-thread-settings-copy { max-width: 100%; overflow: hidden; }
  body.embed-desktop .header-actions #document-open { font-size: 0; height: 40px; min-height: 40px; min-width: 40px; padding: 0; width: 40px; }
}

@media (max-height: 680px) and (min-width: 861px) {
  .chat-header { min-height: 58px; padding-bottom: 7px; padding-top: 7px; }
  .control-strip { padding-bottom: 5px; padding-top: 5px; }
  .context-strip { padding-bottom: 5px; padding-top: 5px; }
  .history-scroll { padding-bottom: 20px; padding-top: 12px; }
  .composer-wrap { padding-bottom: 8px; }
}

@media (pointer: coarse) {
  .icon-button, .tool-button { min-height: 40px; min-width: 40px; }
  .thread-item { min-height: 36px; }
  .thread-split { min-height: 40px; min-width: 36px; opacity: .72; }
  .thread-row-actions .thread-split, .thread-row-actions .thread-pin { min-height: 30px; min-width: 28px; opacity: .72; }
  .project-actions-trigger { min-height: 40px; min-width: 36px; opacity: .72; }
  .send-button, .stop-button { height: 40px; width: 40px; }
  .composer-goal-button { height: 34px; width: 34px; }
  .composer textarea { font-size: 16px; }
}
.provider-kind-heading { color: var(--muted); font-family: var(--mono); font-size: 10px; grid-column: 1 / -1; letter-spacing: .08em; margin-top: 4px; text-transform: uppercase; }
.claude-account-card { min-width: 0; overflow: hidden; }
.claude-account-summary { align-items: center; display: flex; gap: 9px; min-width: 0; }
.claude-account-card .account-card-main { flex: 1 1 auto; min-width: 0; }
.claude-usage { border-top: 1px solid var(--line); display: grid; gap: 5px; margin-top: 9px; padding-top: 8px; }
.claude-usage > small { color: var(--muted); font-size: 9px; }
.claude-usage-row { align-items: baseline; display: grid; gap: 4px 8px; grid-template-columns: minmax(58px,auto) auto 1fr; }
.claude-usage-row > span { color: var(--muted); font-size: 9px; }
.claude-usage-row > strong { color: var(--text); font-family: var(--mono); font-size: 10px; white-space: nowrap; }
.claude-usage-row > time { font-size: 9px; justify-self: end; white-space: nowrap; }
.claude-provider-icon { align-items: center; color: #d97757; display: inline-flex; flex: 0 0 auto; font-size: 12px; justify-content: center; }
.thread-provider-icon { background: center / contain no-repeat url("/cora/assets/provider-chatgpt.svg"); display: inline-block; flex: 0 0 auto; height: 12px; margin-right: 1px; width: 12px; }
.thread-provider-icon.claude { background-image: url("/cora/assets/provider-claude.svg"); }

@media (max-width: 520px) {
  .claude-account-card .account-card-main { width: 100%; }
  .claude-usage-row { grid-template-columns: minmax(0,1fr) auto; }
  .claude-usage-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .claude-usage-row > time { grid-column: 1 / -1; justify-self: start; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}

/* Documents a person added to the Brain */
.brain-doc-button { align-items: center; display: inline-flex; gap: 6px; justify-content: center; position: relative; }
.brain-doc-button svg { flex: 0 0 auto; height: 15px; width: 15px; }
.files-row-actions .brain-doc-button svg { height: 14px; width: 14px; }
.brain-doc-button[data-phase="none"] { color: var(--subtle); }
.brain-doc-button[data-phase="none"]:hover { color: var(--accent); }
.brain-doc-button[data-phase="ready"], .brain-doc-button[data-phase="sorting"] { color: var(--accent); }
.brain-doc-button[data-phase="working"] { color: var(--accent); }
.brain-doc-button[data-phase="working"] svg { animation: brain-doc-pulse 1.2s ease-in-out infinite; }
.brain-doc-button[data-phase="changed"] { color: var(--warn); }
.brain-doc-button[data-phase="failed"] { color: var(--danger); }
.brain-doc-dot { background: currentColor; border: 2px solid var(--bg); border-radius: 50%; display: none; height: 8px; position: absolute; right: 1px; top: 1px; width: 8px; }
.brain-doc-button[data-phase="changed"] .brain-doc-dot, .brain-doc-button[data-phase="failed"] .brain-doc-dot { display: block; }
.brain-doc-button.secondary .brain-doc-dot { right: -3px; top: -3px; }
@keyframes brain-doc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.document-brain-slot { align-items: center; display: inline-flex; gap: 2px; }
.document-brain-slot .brain-doc-button.secondary { min-height: 32px; padding: 5px 11px; white-space: nowrap; }
.document-brain-slot .brain-doc-button.secondary[data-phase="ready"], .document-brain-slot .brain-doc-button.secondary[data-phase="sorting"] { background: var(--accent-soft); border-color: rgba(217,255,115,.3); }
.document-brain-slot .brain-doc-button.secondary[data-phase="changed"] { border-color: rgba(255,201,106,.4); }
.brain-doc-remove { color: var(--subtle); }
.brain-doc-remove:hover { color: var(--danger); }
.brain-doc-cards { display: grid; gap: 8px; }
.brain-doc-card { background: var(--panel-3); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; display: grid; gap: 8px; padding: 11px 13px; }
.brain-doc-card.phase-changed { border-left-color: var(--warn); }
.brain-doc-card.phase-failed { border-left-color: var(--danger); }
.brain-doc-card.phase-working, .brain-doc-card.phase-sorting { border-left-color: var(--line-strong); }
.brain-doc-card-top { align-items: start; display: flex; gap: 10px; justify-content: space-between; }
.brain-doc-card-title { display: grid; gap: 3px; min-width: 0; }
.brain-doc-card-title strong { font-size: 11px; }
.brain-doc-card-title code { color: var(--subtle); font-size: 8.5px; overflow-wrap: anywhere; }
.brain-doc-card p { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 0; }
.brain-doc-card-meta { align-items: center; color: var(--subtle); display: flex; flex-wrap: wrap; font-size: 8.5px; gap: 7px; }
.brain-doc-card-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.brain-doc-card-actions button { font-size: 9px; min-height: 30px; padding: 5px 11px; }
.brain-doc-badge { border-radius: 999px; flex: 0 0 auto; font-size: 7.5px; font-weight: 760; padding: 3px 8px; white-space: nowrap; }
.brain-doc-badge.phase-ready { background: var(--accent-soft); color: var(--accent); }
.brain-doc-badge.phase-sorting, .brain-doc-badge.phase-working { background: var(--line); color: var(--muted); }
.brain-doc-badge.phase-changed { background: rgba(255,201,106,.13); color: var(--warn); }
.brain-doc-badge.phase-failed { background: rgba(255,142,131,.12); color: var(--danger); }
.brain-doc-error { color: var(--danger); }
.brain-doc-empty { align-items: flex-start; display: grid; gap: 6px; justify-items: start; text-align: left; }
.brain-doc-empty strong { color: var(--text); font-size: 11px; }
.brain-doc-list .brain-doc { background: transparent; cursor: pointer; display: grid; gap: 3px; justify-content: stretch; text-align: left; width: 100%; }
.brain-doc-list .brain-doc:hover { border-color: var(--line-strong); }
.brain-doc-list .brain-doc strong { color: var(--text); font-size: 10px; }
.brain-doc-list .brain-doc small { color: var(--muted); font-size: 9px; line-height: 1.4; }
button.brain-doc-path { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-family: inherit; font-size: 8px; padding: 0; text-decoration: underline; text-decoration-color: var(--line-strong); }
button.brain-doc-path:hover { color: var(--accent); }
.brain-doc-button.secondary[data-phase="none"] { color: var(--text); }
.brain-doc-button.secondary[data-phase="none"] svg { color: var(--accent); }

/* Live Brain panel: changes arrive in place, never under the reader's hands. */
.brain-page-wrap { min-width: 0; position: relative; }
.brain-live-hint { align-items: center; background: var(--accent); border: 0; border-radius: 999px; box-shadow: 0 6px 22px rgba(0,0,0,.28); color: var(--accent-ink); cursor: pointer; display: flex; font-family: inherit; font-size: 9px; font-weight: 720; gap: 6px; margin: -44px auto 14px; padding: 6px 12px; position: sticky; bottom: 14px; width: max-content; z-index: 4; }
.brain-live-hint.hidden { display: none; }
.brain-live-hint i { animation: brain-live-pulse 1.6s ease-in-out infinite; background: currentColor; border-radius: 50%; height: 6px; width: 6px; }
.brain-live-hint b { font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.brain-live-new { animation: brain-live-in .32s ease-out, brain-live-ring 1.8s ease-out; }
.brain-live-changed { animation: brain-live-ring 1.8s ease-out; }
.brain-live-leaving { animation: brain-live-out .26s ease-in forwards; pointer-events: none; }
@keyframes brain-live-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes brain-live-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes brain-live-ring { from { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; } to { outline: 2px solid transparent; outline-offset: 2px; } }
@keyframes brain-live-pulse { 50% { opacity: .35; } }
.brain-recent-list { display: grid; gap: 0; }
.brain-decision.compact { gap: 4px; padding: 7px 10px; }
.brain-decision.compact p { font-size: 9.5px; }
.action-checking { border-style: dashed; }
.action-checking .brain-action-badge { align-items: center; background: rgba(152,184,255,.1); color: #b9ccff; display: inline-flex; gap: 5px; }
.brain-checking-dot { animation: brain-live-pulse 1.2s ease-in-out infinite; background: currentColor; border-radius: 50%; display: inline-block; height: 5px; width: 5px; }
.action-duplicate { opacity: .72; }
.action-failed .brain-action-badge { background: rgba(255,120,120,.12); color: var(--danger, #ff8a8a); }
html[data-theme="light"] .action-checking .brain-action-badge { background: rgba(60,90,200,.08); color: #3553b8; }
@media (prefers-reduced-motion: reduce) {
  .brain-live-new, .brain-live-changed, .brain-live-leaving, .brain-live-hint i, .brain-checking-dot { animation: none; }
}

/* Document tree overlay: every entry of one document, by outline or by area. */
.brain-doc-modal { display: none; height: min(880px, 92dvh); max-width: 1080px; overflow: hidden; }
.brain-doc-modal[open] { display: flex; }
.brain-doc-shell { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 20px 22px 0; width: 100%; }
.brain-doc-head { gap: 16px; margin-bottom: 14px; }
.brain-doc-head > div:first-child { min-width: 0; }
.brain-doc-head h2 { font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-doc-head code { color: var(--muted); display: block; font-size: 10px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-doc-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.brain-doc-stat { align-items: baseline; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 11px; display: flex; gap: 6px; padding: 7px 11px; }
.brain-doc-stat strong { font-size: 15px; letter-spacing: -.02em; }
.brain-doc-stat span { color: var(--muted); font-size: 10px; }
.brain-doc-stat.running { align-items: center; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent); }
.brain-doc-stat.running span { color: var(--accent); }
.brain-doc-stat.failed { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); font-size: 10px; }
.brain-doc-toolbar { align-items: center; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 12px; }
.brain-doc-modes { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 10px; display: inline-flex; padding: 3px; }
.brain-doc-modes button { background: transparent; border: 0; border-radius: 7px; color: var(--muted); cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; padding: 6px 12px; }
.brain-doc-modes button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.brain-doc-filters { display: flex; flex-wrap: wrap; gap: 5px; }
#brain-doc-query { flex: 1 1 200px; font-size: 12px; margin: 0; min-width: 160px; }
.brain-doc-tree { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 2px 22px; }
.brain-doc-node { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 7px; }
.brain-doc-node > .brain-doc-entries > .brain-doc-node { margin: 6px 0 6px 4px; }
.brain-doc-node-head { align-items: center; cursor: pointer; display: flex; gap: 9px; list-style: none; padding: 10px 12px; }
.brain-doc-node-head::-webkit-details-marker { display: none; }
.brain-doc-node-head::before { border-bottom: 1.6px solid var(--subtle); border-right: 1.6px solid var(--subtle); content: ""; flex: 0 0 auto; height: 6px; transform: rotate(-45deg); transition: transform .15s ease; width: 6px; }
.brain-doc-node[open] > .brain-doc-node-head::before { transform: rotate(45deg); }
.brain-doc-node-no { background: rgba(255,255,255,.05); border-radius: 6px; color: var(--muted); font-size: 10px; font-weight: 750; min-width: 22px; padding: 2px 5px; text-align: center; }
.brain-doc-node-title { color: var(--text); flex: 1; font-size: 12.5px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-doc-node-count { color: var(--subtle); flex: 0 0 auto; font-size: 10px; }
.brain-doc-node-state { color: var(--accent); font-size: 10px; font-weight: 700; }
.brain-doc-node-state.muted { color: var(--subtle); font-weight: 500; }
.brain-doc-node.state-reading { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.brain-doc-node.state-waiting { opacity: .55; }
.brain-doc-node-link { background: transparent; border: 0; color: var(--subtle); cursor: pointer; font-size: 12px; padding: 0 2px; }
.brain-doc-node-link { align-items: center; display: inline-flex; }
.brain-doc-node-link .brain-icon { height: 13px; width: 13px; }
.brain-doc-node-link:hover { color: var(--accent); }
.brain-doc-node-summary { color: var(--muted); font-size: 11px; line-height: 1.5; margin: -2px 14px 8px 44px; }
.brain-doc-entries { display: grid; gap: 5px; padding: 0 10px 10px 14px; }
.brain-doc-entry { border-left: 2px solid var(--line-strong); display: grid; gap: 4px; padding: 5px 0 5px 11px; }
.brain-doc-entry p { color: var(--text); font-size: 11.5px; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.brain-doc-entry-meta { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; }
.brain-doc-entry.kind-stored { border-left-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.brain-doc-entry.kind-stored .brain-action-badge { background: var(--accent-soft); color: var(--accent); }
.brain-doc-entry.kind-known { border-left-color: var(--line-strong); opacity: .72; }
.brain-doc-entry.kind-items { border-left-color: var(--warn); }
.brain-doc-entry.kind-items .brain-action-badge { background: rgba(255,201,106,.13); color: var(--warn); }
.brain-doc-entry.kind-checking { border-left-style: dashed; }
.brain-doc-entry.kind-checking .brain-action-badge { align-items: center; background: rgba(152,184,255,.1); color: #b9ccff; display: inline-flex; gap: 5px; }
.brain-doc-entry.kind-dropped, .brain-doc-entry.kind-failed { opacity: .5; }
.brain-doc-empty-line { color: var(--subtle); font-size: 10.5px; padding: 2px 0 4px 11px; }
.brain-doc-card-name { background: transparent; border: 0; color: var(--text); cursor: pointer; font: inherit; font-weight: 700; padding: 0; text-align: left; }
.brain-doc-card-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
html[data-theme="light"] .brain-doc-modal { background: #fff; }
html[data-theme="light"] .brain-doc-stat, html[data-theme="light"] .brain-doc-modes { background: rgba(22,34,26,.03); }
@media (max-width: 700px) {
  .brain-doc-shell { padding: 16px 14px 0; }
  .brain-doc-node-summary { margin-left: 14px; }
  .brain-doc-entries { padding-left: 8px; }
}
.brain-doc-node-change { background: rgba(152,184,255,.12); border-radius: 999px; color: #b9ccff; font-size: 9px; font-weight: 750; padding: 2px 8px; }
.brain-doc-node-change.new { background: var(--accent-soft); color: var(--accent); }
.brain-doc-node.state-removed { border-style: dashed; opacity: .8; }
.brain-doc-entry.kind-removed { border-left-color: var(--danger); opacity: .7; }
.brain-doc-entry.kind-removed p { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.brain-doc-entry.kind-removed .brain-action-badge { background: rgba(255,120,120,.12); color: var(--danger); }
.brain-doc-stat.change { color: var(--muted); font-size: 10.5px; }
.brain-doc-card-change { color: #b9ccff; display: block; font-size: 9px; margin-top: 4px; }
html[data-theme="light"] .brain-doc-node-change, html[data-theme="light"] .brain-doc-card-change { color: #3553b8; }

/* Editing Brain entries in place: facts of an area, open items, search results. */
.brain-fact-list { display: grid; gap: 6px; }
.brain-fact, .brain-memory, .brain-item { position: relative; }
.brain-fact { border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 4px; padding: 8px 76px 8px 11px; }
.brain-fact p { color: var(--text); font-size: 11px; line-height: 1.5; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.brain-fact-meta { color: var(--subtle); display: flex; flex-wrap: wrap; font-size: 8.5px; gap: 8px; }
.brain-entry-actions { display: flex; gap: 4px; opacity: 0; position: absolute; right: 8px; top: 6px; transition: opacity .12s ease; }
.brain-fact:hover .brain-entry-actions, .brain-memory:hover .brain-entry-actions, .brain-item:hover .brain-entry-actions, .brain-entry-actions:focus-within { opacity: 1; }
.brain-entry-action { align-items: center; background: var(--panel, #1c2019); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer; display: inline-flex; height: 26px; justify-content: center; padding: 0; width: 26px; }
.brain-entry-action .brain-icon { height: 13px; width: 13px; }
.brain-entry-action:hover { border-color: var(--line-strong); color: var(--accent); }
.brain-entry-action.danger:hover { color: var(--danger); }
.brain-memory .brain-entry-actions { top: 8px; }
.brain-entry-editor { display: grid; gap: 7px; margin-top: 2px; }
.brain-entry-editor textarea { font: inherit; font-size: 11.5px; line-height: 1.5; margin: 0; min-height: 60px; resize: vertical; width: 100%; }
.brain-entry-saved { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.brain-entry-busy { opacity: .5; pointer-events: none; }
@media (hover: none) {
  .brain-entry-actions { opacity: 1; }
}
html[data-theme="light"] .brain-entry-action { background: #fff; }
.brain-entry-editor .brain-edit-actions { align-items: center; display: flex; gap: 6px; justify-content: flex-end; }
.brain-entry-editor .brain-edit-actions button { border-radius: 9px; font-size: 11px; min-height: 0; padding: 6px 12px; }
.brain-entry-editor .brain-edit-status { color: var(--muted); flex: 1; font-size: 10px; }

/* Knowledge tree overlay. */
.brain-tree-node { border-radius: 11px; }
.brain-tree-node .brain-doc-entries { padding-left: 16px; }
.brain-tree-node > .brain-doc-node-head .brain-doc-node-title { font-size: 12.5px; }
.brain-tree-node .brain-tree-node > .brain-doc-node-head .brain-doc-node-title { font-size: 12px; font-weight: 600; }
.brain-tree-node .brain-fact, .brain-tree-node .brain-item { background: rgba(255,255,255,.012); }
.brain-tree-node summary.drop-target { background: var(--accent-soft); border-radius: 10px; outline: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent); }
.brain-tree-node [draggable="true"] { cursor: grab; }
.brain-tree-node [draggable="true"].dragging { opacity: .45; }
.brain-tree-move { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; margin-top: 6px; }
.brain-tree-move span { color: var(--muted); font-size: 10.5px; }
.brain-tree-move select { flex: 1 1 200px; font-size: 11px; margin: 0; min-width: 160px; }
.brain-tree-move button { border-radius: 9px; font-size: 11px; min-height: 0; padding: 6px 12px; }
#brain-tree-query { flex: 1 1 240px; font-size: 12px; margin: 0; min-width: 180px; }
#brain-tree-subtitle { font-family: inherit; }
.brain-fact:has(.brain-entry-actions > :nth-child(3)) { padding-right: 106px; }
.brain-memory:has(.brain-entry-actions) { padding-right: 76px; }

/* Chat journal: history of an entry and chat hits in the search. */
.brain-history-body { display: grid; gap: 12px; }
.brain-journal-group { border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 2px; padding: 10px 12px 12px; }
.brain-journal-group-head { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 10px; margin-bottom: 6px; padding-bottom: 8px; }
.brain-journal-group-head strong { flex: 1; font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-journal-group-head small { color: var(--subtle); font-size: 10px; }
.brain-journal-group-head button { border-radius: 9px; font-size: 11px; min-height: 0; padding: 5px 11px; }
.brain-journal-message { border-left: 2px solid var(--line-strong); display: grid; gap: 3px; padding: 6px 0 6px 11px; }
.brain-journal-message.role-user { border-left-color: var(--accent); }
.brain-journal-message.role-final { border-left-color: #b9ccff; }
.brain-journal-head { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.brain-journal-role { font-size: 9.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.brain-journal-message.role-user .brain-journal-role { color: var(--accent); }
.brain-journal-message.role-commentary .brain-journal-role { color: var(--muted); }
.brain-journal-message.role-final .brain-journal-role { color: #b9ccff; }
.brain-journal-head small { color: var(--subtle); font-size: 9.5px; }
.brain-journal-chat { color: var(--muted) !important; font-weight: 650; }
.brain-journal-via { background: rgba(152,184,255,.1); border-radius: 999px; color: #b9ccff !important; padding: 1px 7px; }
.brain-journal-head .brain-doc-node-link { margin-left: auto; }
.brain-journal-text { color: var(--text); font-size: 11.5px; line-height: 1.55; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.brain-journal-text mark { background: var(--accent-soft); border-radius: 3px; color: var(--accent); padding: 0 2px; }
.brain-journal-message.collapsed .brain-journal-text { -webkit-box-orient: vertical; -webkit-line-clamp: 8; display: -webkit-box; overflow: hidden; }
.brain-journal-more { background: transparent; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 10.5px; justify-self: start; padding: 0; }
.brain-journal-message:not(.collapsed) .brain-journal-more::after { content: " (weniger)"; }
.brain-journal-results { display: grid; gap: 8px; }
.brain-journal-results .brain-journal-message { border: 1px solid var(--line); border-left-width: 2px; border-radius: 10px; padding: 8px 11px; }
.brain-journal-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
html[data-theme="light"] .brain-journal-message.role-final { border-left-color: #3553b8; }
html[data-theme="light"] .brain-journal-message.role-final .brain-journal-role, html[data-theme="light"] .brain-journal-via { color: #3553b8 !important; }
.brain-history-summary { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 12px; display: grid; gap: 6px; padding: 12px 14px; }
.brain-history-summary strong { color: var(--accent); font-size: 11px; letter-spacing: .02em; }
.brain-history-summary p { color: var(--text); font-size: 12px; line-height: 1.6; margin: 0; }
.brain-history-summary small { color: var(--muted); font-size: 10px; }
.brain-journal-related { border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 8px; padding: 10px 12px; }
.brain-journal-related > .brain-journal-head strong { color: var(--text); flex: 1; font-size: 12px; min-width: 0; }
.brain-journal-related .brain-journal-message { border-left: 2px solid var(--line); padding-left: 10px; }

/* ---------- context hand-over ---------- */
.context-track #context-fill { overflow: hidden; position: relative; z-index: 1; }
.context-track .context-limit { background: rgba(255,35,55,.48); border-radius: 0 999px 999px 0; bottom: 0; box-shadow: inset 0 0 5px rgba(255,30,50,.32); height: auto; pointer-events: none; position: absolute; right: 0; top: 0; transform: none; width: auto; z-index: 2; }
.context-track .context-limit::before { background: #ff243f; border-radius: 2px; box-shadow: 0 0 5px rgba(255,36,63,.72), 0 0 0 2px #10120e; bottom: -3px; content: ""; left: 0; position: absolute; top: -3px; width: 2px; }
.context-strip.near-limit #context-fill { background: linear-gradient(90deg, var(--warn), #ff9d6a); }
.context-strip.near-limit .context-copy strong { color: var(--warn); }
.context-handover { background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); cursor: pointer; font-size: 9px; font-weight: 700; justify-self: end; letter-spacing: .02em; padding: 3px 10px; transition: border-color 160ms ease, color 160ms ease, background 160ms ease; white-space: nowrap; }
.context-handover:hover, .context-strip.near-limit .context-handover { background: rgba(185,167,255,.1); border-color: rgba(185,167,255,.55); color: #ddd5ff; }
.handover-glyph { background: conic-gradient(from 200deg, #b9a7ff, var(--accent), #b9a7ff); border-radius: 50%; flex: 0 0 auto; height: 18px; mask: radial-gradient(circle, transparent 4px, #000 4.5px); -webkit-mask: radial-gradient(circle, transparent 4px, #000 4.5px); position: relative; width: 18px; }
.handover-panel { background: linear-gradient(95deg, rgba(185,167,255,.13), rgba(217,255,115,.05) 70%); border-bottom: 1px solid rgba(185,167,255,.25); display: grid; gap: 9px; padding: 11px 25px 12px; }
.handover-panel .handover-glyph { animation: handover-spin 2.4s linear infinite; }
@keyframes handover-spin { to { transform: rotate(360deg); } }
.handover-panel.failed { background: linear-gradient(95deg, rgba(255,107,107,.12), rgba(255,201,106,.05) 70%); border-bottom-color: rgba(255,107,107,.3); }
.handover-panel.failed .handover-glyph { animation: none; background: #ff8f8f; }
.handover-head { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; min-width: 0; }
.handover-copy { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.handover-copy .eyebrow { margin: 0; }
.handover-copy strong { color: #ddd5ff; font-size: 12px; }
.handover-panel.failed .handover-copy strong { color: #ffb3b3; }
.handover-copy span { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.handover-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-left: auto; }
.handover-steps { counter-reset: step; display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; overflow: visible; padding: 0; }
.handover-steps li { align-items: center; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 999px; color: var(--subtle); counter-increment: step; display: flex; flex: 0 0 auto; font-size: 9px; gap: 6px; padding: 4px 10px 4px 5px; white-space: nowrap; }
.handover-steps li::before { align-items: center; background: var(--panel-3); border-radius: 50%; color: var(--subtle); content: counter(step); display: inline-flex; font-size: 8px; font-weight: 800; height: 15px; justify-content: center; width: 15px; }
.handover-steps li.done { border-color: rgba(217,255,115,.3); color: var(--muted); }
.handover-steps li.done::before { background: var(--accent); color: var(--accent-ink); content: "✓"; }
.handover-steps li.active { background: rgba(185,167,255,.12); border-color: rgba(185,167,255,.55); color: #ddd5ff; }
.handover-steps li.active::before { animation: pulse 1.4s ease-in-out infinite; background: #b9a7ff; color: #1a1530; }
.handover-steps li.failed { border-color: rgba(255,107,107,.55); color: #ffb3b3; }
.handover-steps li.failed::before { background: #ff8f8f; color: #2a0f0f; content: "!"; }
.handover-scores { display: flex; flex-wrap: wrap; gap: 5px; }
.handover-score { background: rgba(217,255,115,.08); border: 1px solid rgba(217,255,115,.22); border-radius: 6px; color: var(--muted); font-family: var(--mono); font-size: 9px; padding: 2px 7px; }
.handover-score.weak { background: rgba(255,201,106,.1); border-color: rgba(255,201,106,.4); color: var(--warn); }
.handover-capsule summary, .chain-capsule summary { color: #ddd5ff; cursor: pointer; font-size: 10px; font-weight: 700; }
.handover-capsule-body { background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 11px; line-height: 1.55; margin-top: 7px; max-height: 42vh; overflow: auto; padding: 10px 14px; }
.handover-capsule-body h2 { color: #ddd5ff; font-size: 11px; letter-spacing: .02em; margin: 12px 0 4px; }
.handover-capsule-body h2:first-child { margin-top: 0; }
.chain-bar { align-items: center; background: linear-gradient(90deg, rgba(185,167,255,.1), transparent 75%); border: 1px solid rgba(185,167,255,.22); border-radius: 12px; display: flex; gap: 11px; margin: 14px 0 8px; padding: 8px 11px; }
.chain-bar > div:not(.chain-bar-actions) { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.chain-bar strong { color: #ddd5ff; font-size: 11px; }
.chain-bar small { color: var(--muted); font-size: 9px; }
.chain-bar-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chain-capsule { position: relative; }
.chain-capsule[open] .handover-capsule-body { position: absolute; right: 0; top: 24px; width: min(620px, 80vw); z-index: 20; background: #15171a; box-shadow: 0 18px 50px rgba(0,0,0,.45); }
.turn-handover:not(.expanded) > :not(.turn-head):not(.handover-card) { display: none !important; }
/* Only the start prompt (the capsule) folds away; messages sent while the new session works stay visible. */
.turn-handover-start:not(.show-prompt) > .item.userMessage.handover-prompt { display: none !important; }
.handover-card { align-items: center; background: linear-gradient(90deg, rgba(185,167,255,.1), rgba(255,255,255,.015)); border: 1px solid rgba(185,167,255,.24); border-radius: 12px; display: flex; gap: 10px; margin: 4px 0 8px; padding: 8px 11px; }
.handover-card > div { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 0; }
.handover-card strong { color: #ddd5ff; font-size: 11px; }
.handover-card small { color: var(--muted); font-size: 9px; }
.turn.turn-handover:not(.expanded) { border-bottom: 0; padding: 3px 0; }
.turn.turn-handover:not(.expanded) > .turn-head { display: none; }
.turn.turn-handover:not(.expanded) > .handover-card { margin: 0; padding: 6px 11px; }
.turn.turn-handover:not(.expanded) + .turn { padding-top: 12px; }
.turn-handover .turn-head { opacity: .7; }
/* After a hand-over: the capsule steps of the earlier session fold away, the transition is one line. */
.chain-timeline > .turn.turn-handover:not(.expanded) { display: none; }
.handover-card.handover-line { background: none; border: 0; border-top: 1px solid rgba(185,167,255,.22); border-radius: 0; gap: 8px; margin: 6px 0 10px; padding: 7px 2px 0; }
.handover-card.handover-line .handover-glyph { transform: scale(.7); }
.handover-card.handover-line > div { align-items: baseline; flex-direction: row; gap: 7px; overflow: hidden; white-space: nowrap; }
.handover-card.handover-line small { overflow: hidden; text-overflow: ellipsis; }
.handover-card.handover-line > button { background: none; border: 0; color: var(--violet); font-size: 10px; min-height: 0; padding: 2px 4px; }
.thread-badge.handover { background: rgba(185,167,255,.16); border: 1px solid rgba(185,167,255,.5); color: #ddd5ff; }
.handover-dialog { max-width: 520px; }
.handover-dialog-copy { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0 0 14px; }
.handover-provider-choice { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }
.handover-provider-choice label { cursor: pointer; margin: 0; position: relative; }
.handover-provider-choice input { opacity: 0; position: absolute; }
.handover-provider-choice span { border: 1px solid var(--line-strong); border-radius: 12px; display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 10px 11px; transition: border-color 160ms ease, background 160ms ease; }
.handover-provider-choice strong { color: var(--text); font-size: 12px; }
.handover-provider-choice small { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.handover-provider-choice input:checked + span { background: rgba(185,167,255,.1); border-color: rgba(185,167,255,.65); }
.handover-provider-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.project-handover-card p { color: var(--muted); font-size: 11px; line-height: 1.5; }
html[data-theme="light"] .context-track .context-limit { background: rgba(220,20,45,.36); }
html[data-theme="light"] .context-track .context-limit::before { background: #d91535; box-shadow: 0 0 4px rgba(217,21,53,.45), 0 0 0 2px #fff; }
html[data-theme="light"] .handover-copy strong, html[data-theme="light"] .chain-bar strong, html[data-theme="light"] .handover-card strong, html[data-theme="light"] .handover-capsule summary, html[data-theme="light"] .chain-capsule summary { color: #4b3bb0; }
html[data-theme="light"] .handover-steps li.active { color: #4b3bb0; }
html[data-theme="light"] .handover-capsule-body { background: rgba(255,255,255,.7); }
html[data-theme="light"] .chain-capsule[open] .handover-capsule-body { background: #fff; }
html[data-theme="light"] .thread-badge.handover { color: #4b3bb0; }

/* The iPhone app: the page reaches under the status bar, whose height (--app-safe-top, set by app.js) stays free above
   the bar. A band in the bar's colour lies behind the clock; the bar slides away under it and text runs out beneath it. */
@media (max-width: 860px) {
  html.cora-app { --mobile-host-chrome-height: calc(92px + var(--app-safe-top, 0px)); }
  html.cora-app body:not(.embed-mode)::before { background: #0f110e; content: ""; height: var(--app-safe-top, 0px); left: 0; pointer-events: none; position: fixed; right: 0; top: 0; z-index: 85; }
  html.cora-app[data-theme="light"] body:not(.embed-mode)::before { background: #f1f3f1; }
  html.cora-app body:not(.embed-mode) .mobile-bar { height: calc(52px + var(--app-safe-top, 0px)); padding-top: var(--app-safe-top, 0px); }
  html.cora-app .workspace-grid > .workspace-tabs { top: calc(52px + var(--app-safe-top, 0px)); }
  html.cora-app body:not(.embed-mode).mobile-header-hidden .workspace-tabs { transform: translate3d(0, calc(-100% - 52px - var(--app-safe-top, 0px)), 0); }
  html.cora-app .toast-stack { top: calc(100px + var(--app-safe-top, 0px)); }
  html.cora-app #project-settings-dialog, html.cora-app .account-dialog { padding-top: var(--app-safe-top, 0px); }
  /* Without open chats there are no tabs: the menu and the assistant's circle start right below the bar. */
  html.cora-app body:not(.embed-mode):has(#workspace-tabs.hidden) { --mobile-host-chrome-height: calc(52px + var(--app-safe-top, 0px)); }
  /* A chat in the overlay starts below the status bar (its pane follows the shell). */
  html.cora-app .chat-preview-overlay { padding-top: var(--app-safe-top, 0px); }
  /* Chat panes: with the bar slid away (scrolling) the first lines, the banner and the ring stay below the status bar. */
  html.cora-app body.embed-mobile.host-header-hidden:not(.preview-mode) .chat-workspace { padding-top: var(--app-safe-top, 0px); }
  html.cora-app body.embed-mobile:not(.preview-mode) .activity-banner:not(.hidden) { top: calc(89px + var(--app-safe-top, 0px)); }
}

/* A failing service the Brain needs (public/service-notice.js): one line at the top, above everything. */
.service-notice { align-items: baseline; background: rgba(255,142,131,.12); border-bottom: 1px solid rgba(255,142,131,.35); color: var(--text); display: flex; flex-wrap: wrap; font-size: 13px; gap: 4px 10px; left: 0; padding: 8px 14px calc(8px + 0px); padding-top: calc(8px + env(safe-area-inset-top, 0px)); position: fixed; right: 0; top: 0; z-index: 1000; }
.service-notice strong { color: var(--danger); }
.service-notice span { color: var(--muted, inherit); }
.service-notice-close { background: none; border: 0; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; margin-left: auto; padding: 0 4px; }
.brain-health.degraded strong { color: var(--danger); }
