/* ==========================================================================
   Orax desktop UI
   ========================================================================== */

/* Pause every animation, including generated content, with the window lifecycle. */
html.orax-paused * {
  animation-play-state: paused !important;
}

html.orax-paused *::before,
html.orax-paused *::after {
  animation-play-state: paused !important;
}

/* Design tokens */
.confirm-delete-card { color: var(--text); }
.confirm-delete-copy { margin: 0; color: var(--text-2); line-height: 1.6; }
.confirm-delete-related { margin: 8px 0 0; color: var(--text-muted); line-height: 1.5; }
.confirm-delete-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.confirm-delete-submit { background: #b91c1c !important; color: #fff !important; border-color: #b91c1c !important; }
.confirm-delete-submit:hover { background: #991b1b !important; }
.confirm-delete-actions button:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

html {
  --accent-warm: color-mix(in srgb, var(--primary) 8%, transparent);
  --bg-sidebar: var(--bg-panel);
  --bg-chrome: color-mix(in srgb, var(--bg-panel) 74%, var(--bg-element));
  --bg-elev: var(--bg-element);
  --bg-input: color-mix(in srgb, var(--bg-element) 92%, var(--text));
  --bg-hover: color-mix(in srgb, var(--text) 6%, var(--bg-element));
  --bg-active: color-mix(in srgb, var(--primary) 13%, transparent);
  --bg-bubble: var(--bg-element);
  --bubble-fg: var(--text);
  --bg-code: color-mix(in srgb, var(--bg-element) 92%, var(--text));
  --border-strong: var(--border-active);
  --text-2: color-mix(in srgb, var(--text) 78%, var(--text-muted));
  --text-faint: var(--text-muted);
  --accent-2: var(--secondary);
  --warn: var(--warning);
  --danger: var(--error);
  --btn-primary-bg: var(--primary);
  --btn-primary-fg: var(--bg);
  --error-fg: var(--error);
  --toggle-knob: var(--text);
  --scroll-thumb: var(--border-active);
  /* Chat status colours follow the theme: the accent for a running turn, a
     warm amber for a waiting answer, success green and error red. */
  --status-running: var(--accent);
  --status-needs: light-dark(#B85C0C, #E39A4B);
  --status-unread: var(--success);
  --status-failed: var(--error);
}

/* Proportions: one rem source for spacing, type, width and radius. The Font
   size setting writes --text-size, so every rem below follows that control. */
:root {
  --space-1: .25rem;  --space-2: .5rem;   --space-3: .75rem;  --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem;  --space-7: 1.75rem; --space-8: 2rem;
  --space-10: 2.5rem; --space-12: 3rem;   --space-16: 4rem;
  --radius-s: .375rem; --radius: .375rem; --radius-l: .5rem; --radius-xl: .5rem;

  --text-body: 1rem;        --leading-body: 1.6;
  --text-secondary: .875rem; --leading-secondary: 1.45;
  --text-small: .75rem;     --leading-small: 1.4;
  --text-h1: 1.5rem;        --leading-h1: 1.25;
  --text-h2: 1.25rem;       --leading-h2: 1.3;
  --text-h3: 1.0625rem;     --leading-h3: 1.35;
  --text-code: .875rem;     --leading-code: 1.55;

  --message-max-width: 72ch;
  --sidebar-min: 14rem;
  --sidebar-width: 18rem;
  --sidebar-max: 30rem;
  --composer-min-height: 2.5rem;
  --composer-max-height: min(40vh, 18rem);
  --composer-gap: var(--space-2);
  --control-gap: var(--space-1);
  --section-gap: var(--space-6);

  /* One rem value per layout width. */
  --rail-w: 2.75rem;
  --sidebar-w: clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max));
  --panel-w: 18.75rem;
  --titlebar-h: 2.5rem;
  --thread-w: 47.5rem;
}

html { font-size: var(--text-size, 15px); }

:root, :root[data-theme="orax"] {
  --primary: #D4D4D7;
  --secondary: #D4D4D7;
  --accent: #D4D4D7;
  --text: #F2F2F2;
  --text-muted: #8A8A8A;
  --bg: #0A0A0A;
  --bg-panel: #111111;
  --bg-element: #1A1A1A;
  --border: #2A2A2A;
  --border-active: #D4D4D7;
  --border-subtle: #2A2A2A;
  --md-heading: #D4D4D7;
  --md-link: #D4D4D7;
  --md-code: #D4D4D7;
  --md-quote: #D4D4D7;
  --diff-add: #7FD88F;
  --diff-del: #E06C75;
  --success: #7FD88F;
  --warning: var(--text-muted);
  --error: #E06C75;
  --info: #56B6C2;
  
  --shadow: none;
  --font: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  
  color-scheme: dark;
}

:root[data-theme="ember"] {
  --primary: var(--accent);
  --secondary: var(--accent, #D4D4D7);
  --accent: #9D7CD8;
  --text: #EEEEEE;
  --text-muted: #808080;
  --bg: #0A0A0A;
  --bg-panel: #141414;
  --bg-element: #1E1E1E;
  --border: #3C3C3C;
  --border-active: #606060;
  --border-subtle: #3C3C3C;
  --md-heading: #9D7CD8;
  --md-link: var(--accent);
  --md-code: #7FD88F;
  --md-quote: #D4D4D7;
  --diff-add: #4FD6BE;
  --diff-del: #C53B53;
  --success: #7FD88F;
  --warning: var(--text-muted);
  --error: #E06C75;
  --info: #56B6C2;
  
  --shadow: none;
  --font: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  
  color-scheme: dark;
}

:root[data-theme="orax-light"] {
  --primary: #5A5A62;
  --secondary: #5A5A62;
  --accent: #D4D4D7;
  --btn-primary-bg: #18181B;
  --btn-primary-fg: #FFFFFF;
  --text: #18181B;
  --text-muted: #6B6B6B;
  --bg: #F4F4F4;
  --bg-panel: #FFFFFF;
  --bg-element: #FFFFFF;
  --border: #E5E5E5;
  --border-active: #5A5A62;
  --border-subtle: #E5E5E5;
  --md-heading: #5A5A62;
  --md-link: #5A5A62;
  --md-code: #5A5A62;
  --md-quote: #5A5A62;
  --diff-add: #15803D;
  --diff-del: #B91C1C;
  --success: #15803D;
  --warning: var(--text-muted);
  --error: #B91C1C;
  --info: var(--accent, #D4D4D7);
  
  --shadow: none;
  --font: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  
  color-scheme: light;
}

:root[data-theme="mailanzu-light"] {
  --primary: #0A0A0C;
  --secondary: #0A0A0C;
  --accent: #5A5A62;
  --text: #0A0A0C;
  --text-muted: #5A5A62;
  --bg: #FFFFFF;
  --bg-panel: #FFFFFF;
  --bg-element: #F5F5F5;
  --border: #ECECEF;
  --border-active: #D4D4D7;
  --border-subtle: #ECECEF;
  --md-heading: #0A0A0C;
  --md-link: #0A0A0C;
  --md-code: #0A0A0C;
  --md-quote: #5A5A62;
  --diff-add: #16A34A;
  --diff-del: #DC2626;
  --success: #16A34A;
  --warning: var(--text-muted);
  --error: #DC2626;
  --info: var(--accent, #D4D4D7);
  
  --shadow: none;
  --font: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  
  color-scheme: light;
}

:root[data-theme="mailanzu-dark"] {
  --primary: #F5F5F5;
  --secondary: #F5F5F5;
  --accent: #D4D4D7;
  --text: #F5F5F5;
  --text-muted: #9A9AA3;
  --bg: #0E0E10;
  --bg-panel: #0E0E10;
  --bg-element: #1F1F23;
  --border: #202024;
  --border-active: #3A3A42;
  --border-subtle: #202024;
  --md-heading: #F5F5F5;
  --md-link: #F5F5F5;
  --md-code: #D4D4D7;
  --md-quote: #9A9AA3;
  --diff-add: #22C55E;
  --diff-del: #EF4444;
  --success: #22C55E;
  --warning: var(--text-muted);
  --error: #EF4444;
  --info: #56B6C2;
  
  --shadow: none;
  --font: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  
  color-scheme: dark;
}

:root[data-theme="custom"] {
  --primary: #D4D4D7;
  --secondary: #D4D4D7;
  --accent: #D4D4D7;
  --text: #F2F2F2;
  --text-muted: #8A8A8A;
  --bg: #0A0A0A;
  --bg-panel: #111111;
  --bg-element: #1A1A1A;
  --border: #2A2A2A;
  --border-active: #D4D4D7;
  --border-subtle: #2A2A2A;
  --md-heading: #D4D4D7;
  --md-link: #D4D4D7;
  --md-code: #D4D4D7;
  --md-quote: #D4D4D7;
  --diff-add: #7FD88F;
  --diff-del: #E06C75;
  --success: #7FD88F;
  --warning: var(--text-muted);
  --error: #E06C75;
  --info: #56B6C2;
  
  --shadow: none;
  --font: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  
  color-scheme: dark;
}

:root[data-theme] {
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Reset and base */
*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  font: 400 var(--text-body)/var(--leading-body) var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden], .hidden { display: none !important; }

.settings-row > .row-main { min-width: 0; }
.settings-row > .row-main > .row-help {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
}
.settings-search { width: 100%; margin: 8px 0 16px; }
.settings-nav-group:last-child { margin-top: auto; }
.settings-detail-drawer {
  box-sizing: border-box;
  position: fixed;
  inset: 0 0 0 auto;
  width: min(600px, 100vw);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 24px;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
}
.settings-detail-drawer::backdrop { background: #0006; }
.settings-drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-drawer-actions { display: flex; align-items: center; gap: 6px; }
.settings-detail-drawer.is-bottom-docked {
  inset: auto 0 0 0;
  width: 100vw;
  max-width: 100vw;
  height: min(50vh, 560px);
  border-top: 1px solid var(--border);
  border-left: 0;
}
.settings-detail-drawer.is-minimized {
  inset: auto 0 0 auto;
  width: min(600px, 100vw);
  height: 44px;
  min-height: 44px;
  padding: 0 12px;
  overflow: hidden;
  border-top: 1px solid var(--border);
}
.settings-detail-drawer.is-minimized > :not(.settings-drawer-heading) { display: none; }
.settings-detail-drawer.is-minimized .settings-drawer-heading { height: 43px; gap: 8px; }
.settings-detail-drawer.is-minimized .settings-drawer-heading h2 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.settings-detail-drawer.is-minimized .settings-drawer-actions { flex: none; }
.settings-detail-drawer.is-bottom-docked.is-minimized { width: 100vw; }
.account-list-row { cursor: pointer; }
.account-primary { flex: 1; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.btn.settings-search-result {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 52px;
  padding: 12px;
  font-weight: 400;
  text-align: left;
  white-space: normal;
}
.settings-search-result > .row-title,
.settings-search-result > .row-help {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.settings-search-result > .row-help { margin-top: 4px; }
.settings-search-highlight { outline: 2px solid var(--primary); outline-offset: 3px; }
.account-status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--text-3); }
.account-status-dot.connected { background: var(--ok, #56a874); }
.account-status-dot.needs-reconnect, .sb-approval-badge { color: var(--warn, #D4D4D7); }
.account-status-dot.needs-reconnect { background: currentColor; }
.sb-approval-badge { font-size: 18px; line-height: 1; }
.composer > .composer-project-slot { padding: 10px 12px 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { color: var(--text); background: color-mix(in srgb, var(--primary) 40%, transparent); }

* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border: 1px solid transparent; border-radius: 8px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--scroll-thumb) 80%, var(--text)); border: 1px solid transparent; background-clip: padding-box; }

/* Application grid */
.app {
  --session-tabs-h: 0px;
  --window-drag-strip-h: 0px;
  /* The bot workspace mirrors the sidebar column so both workspaces share one
     width, and a collapsed sidebar collapses both. */
  --bot-sidebar-w: clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max));
  /* The bot workspace starts below the header: drag strip plus titlebar. */
  --window-titlebar-h: calc(var(--window-drag-strip-h) + var(--titlebar-h));
  --window-header-h: calc(var(--window-titlebar-h) + var(--session-tabs-h));
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-w) clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max)) minmax(0, 1fr) auto;
  grid-template-rows: var(--window-header-h) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
/* ORAXBOT reuses the shell: the header, rail, side panel and window chrome stay
   live, and only the code views inside the main column step aside. */
html[data-bot-mode="1"] #main > * { display: none; }
.app.sidebar-collapsed { --bot-sidebar-w: 0px; }
[data-desktop="1"] .app { --window-drag-strip-h: 40px; }
[data-desktop="1"][data-platform="win32"] .app {
  --window-drag-strip-h: max(40px, env(titlebar-area-height, 40px));
}
.app:has(.session-tabs:not([hidden])) { --session-tabs-h: 40px; }
.rail {
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 0;
  background: var(--bg-chrome);
  border-right: 1px solid var(--border-subtle);
}
.rail-spacer { flex: 1; }
.sidebar {
  z-index: 2;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
}
.app > .window-header { grid-column: 1 / -1; grid-row: 1; z-index: 4; min-width: 0; }
.app > .rail { grid-column: 1; grid-row: 2; }
.app > .sidebar { grid-column: 2; grid-row: 2; }
.main { position: relative; grid-column: 3; grid-row: 2; display: flex; flex-direction: column; min-width: min(480px, 100vw); min-height: 0; background: var(--bg); }
.app > .panel { grid-column: 4; grid-row: 2; }
.panel-collapsed-hint {
  flex: 0 0 auto;
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border-subtle);
}
.app.panel-dock-bottom {
  grid-template-columns: var(--rail-w) clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max)) minmax(0, 1fr) 0;
  grid-template-rows: var(--window-header-h) minmax(0, 1fr) minmax(34px, 42vh);
}
.app.panel-dock-bottom.sidebar-collapsed {
  grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) 0;
}
.app.panel-dock-bottom.panel-dock-minimized {
  grid-template-rows: var(--window-header-h) minmax(0, 1fr) 34px;
}
.app.panel-dock-bottom > :is(.rail, .sidebar) { grid-row: 2 / 4; }
.app.panel-dock-bottom > .panel {
  grid-column: 3 / 5;
  grid-row: 3;
  width: auto;
  min-width: 0;
  max-width: none;
  border-top: 1px solid var(--border-subtle);
  border-left: 0;
}
.app.panel-overlay > .panel {
  position: absolute;
  top: var(--window-header-h);
  right: 0;
  bottom: 0;
  z-index: 30;
  height: auto;
  max-width: calc(100vw - 24px);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.22);
}
html body .app.panel-overlay > .panel {
  width: min(var(--panel-w), calc(100vw - 24px));
  min-width: min(300px, calc(100vw - 24px));
}
.app > .popup-layer { grid-column: 1 / -1; }
.app.sidebar-collapsed { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) auto; }
.app.sidebar-collapsed .sidebar {
  width: 0;
  visibility: hidden;
  border-right-width: 1px;
}
.app.settings-mode.sidebar-collapsed { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) auto; }
.app.settings-mode.sidebar-collapsed > .sidebar {
  width: 0;
  visibility: hidden;
  border-right-width: 1px;
}

/* The native buttons and drag area have a row that chat controls cannot cover. */
.window-drag-strip {
  display: none;
  justify-content: flex-end;
  height: var(--window-drag-strip-h);
  background: var(--bg);
  -webkit-app-region: drag;
}
[data-desktop="1"] .window-drag-strip { display: flex; }

/* The top row: three groups (start controls, page title, end controls) with a
   thin divider at each boundary. Every control in the row is one size, so the
   row reads as a single line of equal buttons. */
.titlebar {
  --titlebar-control-h: 28px;
  --titlebar-control-radius: var(--radius-s);
  --titlebar-gap: 6px;
  --titlebar-group-gap: 10px;
  position: relative;
  display: flex;
  container: window-titlebar / inline-size;
  align-items: center;
  gap: var(--titlebar-group-gap);
  height: var(--titlebar-h);
  padding: 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
  -webkit-app-region: no-drag;
}
.window-header :is(button, a, input, select, textarea, [role="button"], [role="tab"], [role="menu"], [role="menuitem"], [contenteditable="true"]) {
  -webkit-app-region: no-drag;
}
.titlebar-group { display: flex; flex: 0 0 auto; align-items: center; gap: var(--titlebar-gap); min-width: 0; }
.titlebar-group-start::after,
.titlebar-group-end::before {
  content: "";
  flex: 0 0 1px;
  align-self: center;
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
}
.titlebar-group-start::after { margin-inline-start: calc(var(--titlebar-gap) - 2px); }
.titlebar-group-end::before { margin-inline-end: calc(var(--titlebar-gap) - 2px); }
/* The product name is carried by the segmented switch, so the plain label is
   kept in the DOM for assistive tech and native window titles only. */
.titlebar-app-name {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}
.titlebar-title { display: flex; flex: 1 1 auto; align-items: center; gap: 4px; min-width: 0; padding: 0; overflow: hidden; font-size: 13px; font-weight: 600; }
.session-tabs-row {
  display: flex;
  min-width: 0;
  height: var(--session-tabs-h);
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--border-subtle);
  -webkit-app-region: no-drag;
}
.session-tabs-row:has(> .session-tabs[hidden]) { display: none; }
/* Each product keeps its own tab strip. The bot strip lists the selected bot's
   chats and only exists in ORAXBOT mode; the code strip is hidden there but
   never torn down, so both come back exactly as they were. */
.bot-tabs {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 4px 8px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.bot-tabs::-webkit-scrollbar { display: none; }
.bot-tabs[hidden] { display: none; }
.bot-tabs .bot-tab-avatar { width: 16px; height: 16px; min-width: 16px; flex: 0 0 16px; }
.bot-tabs .bot-tab-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bot-tabs .session-tab-icon { flex-basis: 16px; }
html:not([data-bot-mode="1"]) .bot-tabs { display: none; }
html[data-bot-mode="1"] .session-tabs-row { display: flex; }
html[data-bot-mode="1"] .session-tabs-row:not(:has(.bot-tabs:not([hidden]))) { display: none; }
html[data-bot-mode="1"] .session-tabs-row > :is(#sessionTabs, #sessionTabOverflow) { display: none; }
html[data-bot-mode="1"] .app:has(.bot-tabs:not([hidden])) { --session-tabs-h: 40px; }
.session-tabs {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 4px 8px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-app-region: no-drag;
}
.session-tabs[hidden] { display: none; }
.session-tabs::-webkit-scrollbar { display: none; }
.session-tab-overflow {
  display: flex;
  flex: 0 0 auto;
  direction: ltr;
  align-items: center;
  gap: 2px;
  padding-inline: 4px;
  border-inline-start: 1px solid var(--border-subtle);
}
.session-tab-overflow[hidden] { display: none; }
.session-tab-overflow > .icon-btn {
  flex: 0 0 30px;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  color: var(--text);
}
.session-tab-overflow .icon-btn:disabled { opacity: .35; }
.session-tab-overflow .icon-btn[aria-expanded="true"] { background: var(--bg-hover); }
.session-tab-list-popup .popup-item { min-width: 0; }
.session-tab-list-popup .session-tab-title { flex: 1; }
.session-tab-item {
  display: flex;
  container-type: inline-size;
  flex: 1 0 0;
  align-items: center;
  min-width: 56px;
  max-width: 224px;
  height: 30px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px 8px 4px 4px;
  background: var(--bg-panel);
}
.session-tab-item:hover { background: var(--bg-hover); }
.session-tab-item:has([aria-selected="true"]) { border-color: var(--border); background: var(--bg); }
.session-tab { display: flex; flex: 1; align-items: center; gap: 4px; min-width: 0; height: 100%; padding: 0; padding-inline-start: 5px; color: var(--text-muted); background: transparent; font-size: 12px; text-align: start; }
.session-tab[hidden] { display: none; }
.session-tab:hover, .session-tab[aria-selected="true"] { color: var(--text); }
.session-tab[aria-selected="true"] { font-weight: 700; }
.session-tab-title { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.session-tab-icon { display: flex; flex: 0 0 14px; }
@container (width < 64px) {
  .session-tab { padding-inline: 2px 0; }
  .session-tab .session-tab-icon,
  .session-tab .session-tab-running { display: none; }
  .session-tab-item:has(.session-tab-running) .session-tab-title { color: var(--primary); }
  .session-tab-item > .session-tab-close { flex-basis: 16px; margin-inline: 0; }
  .session-tab-item:not(:is(:hover, :focus-within, :has([aria-selected="true"]))) > .session-tab-close { display: none; }
}
.session-tab-running { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.session-tab-item:has(.session-tab-running) .session-tab-icon { color: var(--primary); }
.session-tab-close { flex: 0 0 18px; width: 18px; height: 22px; margin: 0 2px; padding: 0; color: var(--text-muted); background: transparent; border-radius: 4px; opacity: 0; pointer-events: none; }
.session-tab-item:is(:hover, :focus-within, :has([aria-selected="true"])) .session-tab-close { opacity: 1; pointer-events: auto; }
@media (hover: none) { html:not([data-desktop="1"]) .session-tab-close { opacity: 1; pointer-events: auto; } }
.session-tab-close:hover { color: var(--text); background: var(--bg-hover); }
.session-tab-item:has(> .session-tab-rename) { min-width: min(160px, 100%); }
.session-tab-rename { flex: 1; min-width: 0; height: 24px; margin-left: 4px; padding: 0 4px; border: 1px solid var(--primary); border-radius: 4px; background: var(--bg); color: var(--text); font-size: 12px; }
.linux-window-controls { display: none; flex: 0 0 auto; align-self: stretch; align-items: stretch; -webkit-app-region: no-drag; }
.linux-window-control { display: grid; width: 42px; min-width: 42px; padding: 0; place-items: center; border: 0; border-radius: 0; color: var(--text-muted); background: transparent; -webkit-app-region: no-drag; }
.linux-window-control:hover { color: var(--text); background: var(--bg-hover); }
.linux-window-control:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.linux-window-control svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
[data-desktop="1"][data-platform="linux"] .linux-window-controls { display: flex; }
.session-tab:focus-visible, .session-tab-close:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.titlebar-nav { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.titlebar-text-btn { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 9px; color: var(--text-muted); font-size: 12px; font-weight: 550; white-space: nowrap; background: transparent; border-radius: var(--titlebar-control-radius); -webkit-app-region: no-drag; }
.titlebar-text-btn:hover { color: var(--text); background: var(--bg-hover); }
/* Text buttons keep their word at full width and become their icon (with the
   same tooltip) once the row runs out of space. */
.titlebar-btn-icon { display: none; align-items: center; justify-content: center; }
.titlebar-btn-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
@container window-titlebar (width < 960px) {
  .titlebar-compact,
  .orax-desk-button { width: var(--titlebar-control-h); padding: 0; gap: 0; }
  .titlebar-compact .titlebar-btn-label,
  .orax-desk-button .orax-desk-label { display: none; }
  .titlebar-compact .titlebar-btn-icon { display: inline-flex; }
}
/* The CLI skin wraps every label in brackets, so its row runs out of words
   earlier than the Desktop one. */
@container window-titlebar (width < 1200px) {
  :root[data-view="cli"] .titlebar-compact,
  :root[data-view="cli"] .orax-desk-button { width: var(--titlebar-control-h); padding: 0; gap: 0; }
  :root[data-view="cli"] .titlebar-compact .titlebar-btn-label,
  :root[data-view="cli"] .orax-desk-button .orax-desk-label { display: none; }
  :root[data-view="cli"] .titlebar-compact .titlebar-btn-icon { display: inline-flex; }
}
/* The product switch and the view switch are one control in two places: same
   frame, same height, same selected token. */
.orax-mode-switch { display: inline-flex; flex: 0 0 auto; align-items: center; height: var(--titlebar-control-h); padding: 2px; border: 1px solid var(--border-subtle); border-radius: var(--radius-s); background: var(--bg-element); -webkit-app-region: no-drag; }
.orax-mode-option { height: calc(var(--titlebar-control-h) - 6px); padding: 0 7px; color: var(--text-muted); font-size: 11px; letter-spacing: .02em; background: transparent; border-radius: calc(var(--titlebar-control-radius) - 2px); }
.orax-mode-option:hover { color: var(--text); background: var(--bg-hover); }
.orax-mode-option.is-active { color: var(--text); background: var(--bg-active); box-shadow: inset 0 0 0 1px var(--border-subtle); }
/* Desktop view | CLI view. The CLI skin redraws it as a bracketed terminal
   segment group without touching this rule. */
.view-switch { display: inline-flex; flex: 0 0 auto; align-items: center; height: var(--titlebar-control-h); padding: 2px; border: 1px solid var(--border-subtle); border-radius: var(--radius-s); background: var(--bg-element); -webkit-app-region: no-drag; }
.view-switch-option { height: calc(var(--titlebar-control-h) - 6px); padding: 0 8px; color: var(--text-muted); font-size: 11px; font-weight: 550; background: transparent; border-radius: calc(var(--titlebar-control-radius) - 2px); }
.view-switch-option:hover { color: var(--text); background: var(--bg-hover); }
.view-switch-option.is-active { color: var(--text); background: var(--bg-active); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.view-switch-option:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.orax-desk-anchor { position: relative; flex: 0 0 auto; -webkit-app-region: no-drag; }
.orax-desk-button { display: inline-flex; align-items: center; gap: 5px; }
/* Desk's own window surface. */
.orax-desk-dialog {
  --desk-accent: var(--accent);
  --desk-paper: light-dark(#fff, #1b1e24);
  --desk-side: var(--bg-panel);
  --desk-ink: var(--text);
  --desk-muted: light-dark(#535e73, #b1bdd0);
  --desk-line: light-dark(#dce1eb, #414955);
  width: min(880px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  color: var(--desk-ink);
  background: var(--desk-paper);
  border: 1px solid var(--desk-line);
  border-radius: 10px;
  box-shadow: 0 22px 60px #0005;
}
.orax-desk-window { background: var(--bg); }
.orax-desk-window .orax-desk-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
/* The popped-out window is the frame, so the panel stretches to it instead of
   stopping at its own content height and leaving an empty band underneath. */
.orax-desk-window .orax-desk-body, .orax-desk-window .orax-desk-screen { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.orax-desk-window .orax-desk-home, .orax-desk-window .orax-desk-stage { flex: 1 1 auto; }
.orax-desk-dialog::backdrop { background: color-mix(in srgb, var(--bg, #0A0A0A) 40%, transparent); }
.orax-desk-bar, .orax-desk-session-bar {
  display: flex;
  min-height: 45px;
  padding: 6px 13px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--desk-line);
}
.orax-desk-bar strong { margin-right: auto; }
.orax-desk-home { display: grid; grid-template-columns: minmax(205px, 29%) minmax(0, 1fr); min-height: 360px; }
.orax-desk-local { padding: 24px 18px; background: var(--desk-side); border-right: 1px solid var(--desk-line); }
.orax-desk-local p { margin: 13px 0 24px; color: var(--desk-muted); text-align: center; }
.orax-desk-mark { margin: 0 auto; color: var(--desk-accent); width: fit-content; }
.orax-desk-credential { margin-bottom: 19px; padding-left: 8px; border-left: 2px solid var(--desk-accent); }
.orax-desk-credential > span { color: var(--desk-muted); }
.orax-desk-credential > div { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.orax-desk-credential output { flex: 1; user-select: all; overflow-wrap: anywhere; }
.orax-desk-id { font-size: 22px; }
.orax-desk-remote { display: flex; flex-direction: column; padding: 24px 18px 0; }
.orax-desk-availability { display: block; margin-top: auto; padding: 9px 0; color: var(--desk-muted); border-top: 1px solid var(--desk-line); }
.orax-desk-remote form { display: grid; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--desk-line); }
.orax-desk-remote form button { justify-self: end; }
.orax-desk-dialog input, .orax-desk-dialog button {
  border: 1px solid var(--desk-line);
  border-radius: 6px;
  color: var(--desk-ink);
  background: var(--desk-paper);
  font: inherit;
}
.orax-desk-dialog input { width: 100%; padding: 8px 10px; }
.orax-desk-dialog input[aria-invalid="true"] { border-color: var(--danger); }
.orax-desk-dialog button { min-height: 30px; padding: 3px 11px; cursor: pointer; }
.orax-desk-dialog button:disabled { cursor: default; opacity: .55; }
.orax-desk-dialog button.orax-desk-primary { color: var(--btn-primary-fg); background: var(--btn-primary-bg); border-color: transparent; }
.orax-desk-dialog :is(input, button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.orax-desk-relay-state p { margin-bottom: 10px; text-align: left; }
.orax-desk-card { width: min(420px, 100%); margin: 32px auto; padding: 0 18px; display: grid; gap: 12px; }
.orax-desk-card h2, .orax-desk-card p { margin: 0; }
.orax-desk-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.orax-desk-consent > button { flex: 1; }
.orax-desk-question { color: var(--desk-muted); }
.orax-desk-allow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--desk-line); }
.orax-desk-allow > span { color: var(--desk-muted); }
.orax-desk-dialog .orax-desk-preapprove {
  min-height: 30px;
  padding: 3px 8px;
  border: 1px solid var(--desk-line);
  border-radius: 6px;
  color: var(--desk-ink);
  background: var(--desk-paper);
  font: inherit;
}
.orax-desk-preapproval { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--desk-muted); }
.orax-desk-preapproval:empty { display: none; }
.orax-desk-mode { color: var(--desk-muted); }
.orax-desk-mode-line { color: var(--desk-muted); }
.orax-desk-settings-link { margin-left: 6px; color: var(--desk-accent); }
.orax-desk-dialog .orax-desk-incoming { width: min(540px, 100%); }
.orax-desk-dialog .orax-desk-host { width: min(660px, 100%); margin-top: 20px; }
.orax-desk-host .orax-desk-permissions { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.orax-desk-profiles { display: flex; flex-wrap: wrap; gap: 8px; }
.orax-desk-profiles > button { flex: 1 1 45%; justify-content: center; }
.orax-desk-profiles > button[aria-pressed="true"] { border-color: var(--desk-accent); box-shadow: inset 0 0 0 1px var(--desk-accent); }
.orax-desk-custom { display: grid; gap: 8px; }
.orax-desk-permissions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2px 10px; }
.orax-desk-permission { display: flex; align-items: center; gap: 7px; min-height: 26px; color: var(--desk-ink); font-size: 12px; }
.orax-desk-permission.is-unavailable { color: var(--desk-muted); }
.orax-desk-dialog input[type="checkbox"] { width: 15px; height: 15px; min-width: 15px; padding: 0; margin: 0; accent-color: var(--desk-accent); }
.orax-desk-monitors { display: flex; gap: 6px; align-items: center; }
.orax-desk-monitors > button { min-width: 30px; min-height: 26px; padding: 0 8px; }
.orax-desk-monitors > button[aria-pressed="true"] { border-color: var(--desk-accent); box-shadow: inset 0 0 0 1px var(--desk-accent); }
.orax-desk-dialog .orax-desk-tool-select, .orax-desk-dialog .orax-desk-preapprove {
  min-height: 28px; padding: 2px 8px; border: 1px solid var(--desk-line); border-radius: 6px;
  color: var(--desk-ink); background: var(--desk-paper); font: inherit;
}
.orax-desk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 7px 12px; border-bottom: 1px solid var(--desk-line); }
.orax-desk-tools > button { min-height: 28px; padding: 2px 9px; }
.orax-desk-tools > button[aria-pressed="true"] { border-color: var(--desk-accent); }
.orax-desk-swap-ask { display: inline-flex; align-items: center; gap: 6px; }
.orax-desk-swap { display: grid; gap: 6px; }
.orax-desk-viewer-swap { padding: 0 12px; }
.orax-desk-viewer-swap:empty { display: none; }
.orax-desk-viewer-swap p { margin: 8px 0 0; }
.orax-desk-shortcuts { display: flex; align-items: center; gap: 5px; color: var(--desk-muted); font-size: 12px; }
.orax-desk-extras { display: grid; gap: 4px; }
.orax-desk-extras:empty { display: none; }
.orax-desk-clipboard { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 10px; border: 1px solid var(--desk-line); border-radius: 7px; color: var(--desk-muted); font-size: 12px; }
.orax-desk-clipboard > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orax-desk-session-info { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--desk-muted); }
.orax-desk-timer { color: var(--desk-muted); font-variant-numeric: tabular-nums; }
.orax-desk-chat { border: 1px solid var(--desk-line); border-radius: 8px; overflow: hidden; }
.orax-desk-chat-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; background: var(--desk-side); }
.orax-desk-chat-body { display: none; padding: 8px; }
.orax-desk-chat.is-open .orax-desk-chat-body { display: block; }
.orax-desk-chat-log { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow: auto; margin-bottom: 8px; }
.orax-desk-chat-line { margin: 0; padding: 5px 8px; border-radius: 7px; background: var(--desk-side); color: var(--desk-ink); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.orax-desk-chat-line.is-mine { align-self: flex-end; background: var(--bg-element); }
.orax-desk-chat-form { display: flex; gap: 6px; }
.orax-desk-chat-form input { flex: 1; }
.orax-desk-stage.is-actual { display: block; overflow: auto; place-items: start; }
.orax-desk-stage.is-actual img, .orax-desk-stage img.is-actual {
  max-width: none; max-height: none; object-fit: none; width: auto; height: auto; margin: 0;
}
.orax-desk-message { padding: 9px 14px; margin: 0; color: var(--desk-muted); border-top: 1px solid var(--desk-line); }
.orax-desk-message:empty { display: none; }
.orax-desk-dialog.orax-desk-viewer { width: min(1440px, calc(100vw - 28px)); }
.orax-desk-session-bar { justify-content: center; }
.orax-desk-stage { display: grid; place-items: center; background: #111; min-height: 170px; }
.orax-desk-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 165px);
  object-fit: contain;
  color: #fff;
  touch-action: none;
  user-select: none;
}
@media (max-width: 540px) {
  .orax-desk-home { grid-template-columns: minmax(0, 1fr); }
  .orax-desk-local { border-right: 0; border-bottom: 1px solid var(--desk-line); }
}
.chat-title-text { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -webkit-app-region: no-drag; }
.titlebar-actions { display: flex; flex: 0 1 auto; align-items: center; gap: var(--titlebar-gap); min-width: 0; }
.titlebar-actions > * { flex-shrink: 0; }
.titlebar-actions > .rules-chip { flex: 0 1 auto; max-width: min(18rem, 30vw); }
.titlebar-actions > .device-chip { gap: 5px; height: var(--titlebar-control-h); padding-inline: 8px; color: var(--text-2); background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--titlebar-control-radius); cursor: pointer; }
.titlebar-actions > .usage-meter { height: var(--titlebar-control-h); min-height: var(--titlebar-control-h); padding-inline: 10px; border-radius: var(--titlebar-control-radius); }
.titlebar-actions > .keep-awake-indicator { color: var(--text-muted); line-height: 0; }
.status-dot { width: 8px; height: 8px; margin: 0 8px; border-radius: 8px; background: var(--success); }
.status-dot.offline, .status-dot.bad { background: var(--error);  }

/* Scrollable views */
.thread-view, .settings-view { min-height: 0; flex: 1; overflow: hidden; }
.thread-view { display: flex; flex-direction: column; }
.thread { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 20px 24px 0; scroll-behavior: smooth; }
/* Reserve actual overlap from the status row, composer or approval host.
   Normal-flow siblings already consume their own height. The
   welcome screen sizes its own column and must keep its HEAD~2 composition,
   so the measured pad only applies once a conversation is on screen. */
#thread:not(:has(.home)) { padding-bottom: var(--thread-bottom-pad, 0px); }
.thread-inner { width: 100%; max-width: var(--thread-w); margin: 0 auto; padding: 0 0 32px; }
.settings-view { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.settings-page-host { width: 100%; min-width: 0; }

/* Settings use their own left column so page headings stay visible. */
.settings-layout {
  display: grid;
  flex: 1;
  grid-template-columns: 232px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.settings-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 20px 12px 24px;
  overflow: hidden;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
}
.settings-sidebar-title {
  padding: 0 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.settings-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 0 4px 8px;
  overflow-y: auto;
}
.settings-nav-group { display: flex; flex-direction: column; gap: 4px; }
.settings-nav-label {
  padding: 0 12px 4px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  
}
.settings-nav-item {
  display: flex;
  width: 100%;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
}
.settings-nav-item:hover { color: var(--text); background: var(--bg-hover); }
.settings-nav-item[aria-current="page"] {
  color: var(--text);
  background: var(--bg-active);
  border-color: color-mix(in srgb, var(--primary) 28%, transparent);
}
.settings-nav-item .ic-wrap { display: inline-flex; flex: 0 0 15px; color: currentColor; }
.settings-content {
  min-width: 0;
  min-height: 0;
  padding: 40px 32px 72px;
  overflow-y: auto;
}
.settings-content .settings-page { margin: 0 auto; }

/* Generic controls */
.icon-btn {
  display: inline-flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border-radius: var(--radius-s);
}
.icon-btn:hover { color: var(--text); background: var(--bg-hover); }
.icon-btn.active { color: var(--text); background: var(--bg-active); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.btn {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { color: var(--btn-primary-fg); background: var(--btn-primary-bg); border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--btn-primary-bg) 88%, var(--btn-primary-fg)); }
.btn-secondary { color: var(--text-2); background: var(--bg-elev); border-color: var(--border); }
.btn-secondary:hover { color: var(--text); background: var(--bg-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--error); background: transparent; border-color: color-mix(in srgb, var(--error) 45%, var(--border)); }
.btn-danger:hover { color: var(--error); background: color-mix(in srgb, var(--error) 10%, transparent); border-color: color-mix(in srgb, var(--error) 60%, var(--border)); }
.btn-danger:hover { filter: brightness(1.08); }
.btn svg { width: 15px; height: 15px; }
.input, .select, .textarea {
  width: 100%;
  min-height: 32px;
  padding: 8px 8px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  outline: none;
}
.textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary);  }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.select { appearance: auto; padding-right: 12px; }
.toggle { position: relative; display: inline-flex; flex: 0 0 32px; width: 32px; height: 18px; cursor: pointer; }
.toggle input[type="checkbox"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle::before { content: ""; width: 32px; height: 18px; background: var(--border); border-radius: 8px; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--toggle-knob); border-radius: 8px; transition: transform .15s, background .15s; }
.toggle:has(input:checked)::before { background: var(--primary); }
.toggle:has(input:checked)::after { transform: translateX(14px); background: var(--toggle-knob); }
.toggle input:focus-visible ~ * { outline: 2px solid var(--primary); outline-offset: 2px; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 4px 8px; color: var(--text-2); font-size: 12px; background: var(--bg-hover); border-radius: var(--radius-s); white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; font-size: 12px; line-height: 18px; color: var(--text-muted); background: var(--bg-hover); border-radius: 6px; }
.pill-ok { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.pill-warn { color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.pill-bad { color: var(--error); background: color-mix(in srgb, var(--error) 12%, transparent); }
.pill-muted { color: var(--text-muted); background: var(--bg-hover); }
.pill-pending { color: var(--text-2); background: var(--bg-hover); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); font-size: 13px; }
.ellipsis { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kbd { display: inline-block; min-width: 20px; padding: 4px 4px; color: var(--text-muted); font: 12px/16px var(--mono); text-align: center; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 4px; }
.divider { height: 1px; margin: 12px 0; background: var(--border); }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 140px; padding: 24px; color: var(--text-muted); font-size: 13px; text-align: center; }
.empty svg { width: 24px; height: 24px; color: var(--text-faint); stroke: currentColor; fill: none; }
.empty-copy { max-width: 28rem; color: var(--text-faint); font-size: 12px; line-height: 1.5; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 1.5px solid color-mix(in srgb, currentColor 20%, transparent); border-top-color: currentColor; border-radius: 999px; opacity: 0; vertical-align: -2px; animation: spin .9s linear infinite .3s, spinner-reveal 1ms linear .3s forwards; }
.shimmer { color: var(--text-muted) !important; }
.skeleton-line { min-height: 10px; overflow: hidden; background: linear-gradient(90deg, var(--bg-hover) 0%, color-mix(in srgb, var(--text) 9%, var(--bg-hover)) 50%, var(--bg-hover) 100%); background-size: 220% 100%; border-radius: 6px; animation: shimmer 1.6s ease-in-out infinite; }
.skeleton-chip { width: 9rem; height: 14px; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; min-height: 0; }
html body .sidebar { overflow-y: hidden; }
.sb-chat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sb-needs-you { flex: 0 0 auto; min-height: 0; max-height: 35%; display: flex; flex-direction: column; padding: 8px; border-bottom: 1px solid var(--border-subtle); }
.sb-needs-heading { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 4px 6px 8px; color: var(--text); font-size: 12px; font-weight: 600; }
.sb-needs-count { margin-left: auto; padding: 0 6px; border: 1px solid var(--border-subtle); border-radius: 4px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.sb-needs-list { min-height: 0; overflow-y: auto; }
html body .sb-needs-row { width: 100%; min-height: 44px; height: auto; gap: 6px; text-align: left; }
.sb-needs-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.sb-needs-detail { color: var(--text-muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sb-needs-empty { padding: 4px 6px; color: var(--text-muted); font-size: 12px; }
.sb-needs-row:focus-visible { outline: 2px solid var(--text-muted); outline-offset: -2px; }
#toggleSidebar { position: relative; }
.sb-needs-toggle-count { position: absolute; top: 1px; right: 1px; width: 6px; height: 6px; min-width: 0; padding: 0; border: 0; border-radius: 50%; background: var(--text); pointer-events: none; }
.sb-header { display: flex; align-items: center; gap: 8px; height: var(--titlebar-h); padding: 0 8px 0 12px; border-bottom: 1px solid var(--border-subtle); }
.sb-title { flex: 1; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.sb-actions { display: flex; align-items: center; gap: 4px; }
.sb-search { position: relative; margin: 8px 8px 4px; }
.sb-search .input { height: 30px; min-height: 30px; padding-left: 28px; font-size: 12px; }
.sb-search svg { position: absolute; top: 8px; left: 8px; width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }
.sb-section { padding: 12px 8px 0; }
.sb-label { display: flex; align-items: center; min-height: 20px; padding: 0 8px; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.sb-row { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 12px; color: var(--text-2); text-align: left; background: transparent; border-radius: var(--radius-s); }
.sb-row:hover { color: var(--text); background: var(--bg-hover); }
.sb-row.active { color: var(--text); background: var(--bg-active); }
.sb-row-icon { display: inline-flex; flex: 0 0 16px; align-items: center; justify-content: center; width: 16px; height: 16px; color: var(--text-muted); }
.sb-row-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; }
.sb-row-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sb-row-end { display: flex; align-items: center; gap: 4px; margin-left: auto; color: var(--text-muted); font-size: 12px; }
.sb-row-end .icon-btn { width: 28px; height: 28px; flex-basis: 28px; opacity: 0; }
.sb-row:hover .sb-row-end .icon-btn { opacity: 1; }
.sb-empty { padding: 8px 12px 8px; color: var(--text-faint); font-size: 12px; }

/* Thread: empty and messages */
.hero { display: flex; min-height: calc(100vh - var(--titlebar-h) - 170px); flex-direction: column; align-items: center; justify-content: center; padding: 32px 0 56px; text-align: center; }
.hero-title { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 500; letter-spacing: 0; }
.hero-sub { max-width: 460px; margin: 12px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.day-divider { margin: 8px 0 24px; color: var(--text-muted); font-size: 12px; text-align: center; }
.turn { padding: 0 0 28px; }
.msg-user { width: fit-content; max-width: 75%; margin: 0 0 24px auto; padding: 8px 16px; color: var(--bubble-fg); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-bubble); border-radius: var(--radius-l); }
.msg-agent { max-width: 100%; margin: 0 0 16px; color: var(--text); font-size: 15px; line-height: 1.62; overflow-wrap: anywhere; }
.msg-agent + .msg-agent { margin-top: -4px; }
.thinking { display: flex; align-items: center; gap: 8px; margin: 12px 0 20px; color: var(--text-muted); font-size: 13px; }
.msg-error { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0; padding: 8px 12px; color: var(--error-fg); font-size: 13px; line-height: 1.5; background: color-mix(in srgb, var(--error) 9%, transparent); border: 1px solid var(--border); border-radius: var(--radius-s); }
.msg-error svg { flex: 0 0 15px; width: 15px; height: 15px; margin-top: 4px; color: var(--error); }
.msg-error-copy { min-width: 0; flex: 1 1 auto; }
.msg-error-message { font-weight: 500; }
.msg-error-action { margin-top: 2px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.msg-error-details-toggle { margin-top: 6px; padding: 0; color: var(--text-muted); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; background: transparent; border: 0; }
.msg-error-details-toggle:hover { color: var(--text); }
.msg-error-details { max-height: 180px; margin: 6px 0 0; padding: 8px; overflow: auto; color: var(--text-muted); font: 12px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-s); }
.msg-interrupted { display: flex; align-items: center; gap: 10px; margin: 12px 0; padding: 12px 13px; color: var(--text); font-size: 12.5px; line-height: 1.5; background: color-mix(in srgb, var(--warning, #D4D4D7) 10%, var(--bg-elevated, transparent)); border: 1px solid color-mix(in srgb, var(--warning, #D4D4D7) 30%, transparent); border-radius: var(--radius-s); }
.msg-interrupted-icon { flex: 0 0 16px; width: 16px; height: 16px; color: var(--warning, #D4D4D7); }
.msg-interrupted-copy { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
.msg-interrupted-copy strong { font-weight: 600; }
.msg-interrupted-copy span { color: var(--text-muted); }
.msg-interrupted-actions { flex: 0 0 auto; }
.msg-stopped { margin: 12px 0; color: var(--text-muted); font-size: 12px; }
.worked { display: flex; align-items: center; gap: 8px; margin: 20px 0 0; padding-bottom: 8px; color: var(--text-muted); font-size: 12px; border-bottom: 1px solid var(--border-subtle); }
.worked::before { content: ""; width: 5px; height: 5px; border-radius: 8px; background: var(--text-faint); }
.msg-actions { display: flex; gap: 4px; margin: 4px 0 0 -4px; opacity: .6; }
.msg-actions:hover { opacity: 1; }

/* Markdown */
.md { min-width: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { margin: 24px 0 8px; color: var(--text); font-weight: 600; line-height: 1.35; }
.md h1 { font-size: 20px; }
.md h2 { font-size: 15px; }
.md h3, .md h4 { font-size: 15px; }
.md ul, .md ol { margin: 8px 0 12px; padding-left: 24px; }
.md li { margin: 4px 0; padding-left: 4px; }
.md li::marker { color: var(--text-muted); }
.md strong { font-weight: 500; color: var(--text); }
.md a { color: var(--secondary); }
.md code { padding: 4px 4px; color: var(--text); font: 13px/1.45 var(--mono); background: var(--bg-code); border-radius: 4px; }
.md pre { position: relative; margin: 12px 0 16px; padding: 12px 12px; overflow: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.md pre code { padding: 0; font: 13px/1.55 var(--mono); background: transparent; white-space: pre; }
.codeblock { position: relative; }
.codeblock .copy-code, .md .copy-code { position: absolute; top: 8px; right: 8px; }
.md blockquote { margin: 12px 0; padding: 4px 0 4px 12px; color: var(--text-2); border-left: 1px solid var(--border); }
.md table { width: 100%; margin: 12px 0 16px; border-spacing: 0; border-collapse: collapse; font-size: 13px; }
.md th, .md td { padding: 8px 8px; text-align: left; vertical-align: top; border: 1px solid var(--border); }
.md th { color: var(--text); font-weight: 500; background: var(--bg-elev); }
.md tr:nth-child(even) td { background: color-mix(in srgb, var(--bg-elev) 45%, transparent); }
.md hr { height: 1px; margin: 20px 0; background: var(--border); border: 0; }
.md img { display: block; max-width: 100%; margin: 12px 0; border-radius: var(--radius); }

/* Tool steps */
.steps { margin: 4px 0 16px; color: var(--text-muted); font-size: 13px; }
.steps-summary { display: inline-flex; align-items: center; gap: 8px; min-height: 26px; padding: 0 8px 0 0; color: var(--text-muted); background: transparent; border-radius: var(--radius-s); }
.steps-summary:hover { color: var(--text-2); background: var(--bg-hover); }
.steps-summary svg { width: 14px; height: 14px; }
.steps-summary .chevron { width: 12px; height: 12px; transition: transform .15s; }
.steps-summary.open .chevron { transform: rotate(90deg); }
.steps-list { display: none; margin: 4px 0 4px; padding: 0 0 0 8px; border-left: 1px solid var(--border-subtle); }
.steps-summary.open + .steps-list, .steps-list.open { display: block; }
.step { display: flex; align-items: flex-start; gap: 8px; min-height: 25px; padding: 4px 8px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.step:hover { color: var(--text-2); }
.step-icon { display: inline-flex; flex: 0 0 14px; align-items: center; justify-content: center; width: 14px; height: 14px; margin-top: 4px; color: var(--text-faint); }
.step-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.step-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.step-thumb { display: block; width: 160px; max-height: 110px; margin: 4px 0 4px; object-fit: cover; object-position: top left; background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--radius-s); }

/* Approval */
.approval { margin: 12px 0 16px; padding: 12px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-s); }
.approval-title { margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.approval-args { margin: 4px 0 12px; padding: 8px 8px; overflow: auto; color: var(--text-muted); font: 12px/1.45 var(--mono); white-space: pre-wrap; background: var(--bg-input); border-radius: 4px; }
.approval-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.approval-actions .btn { max-width: 100%; min-width: 0; height: auto; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.approval-actions .approval-note { flex: 1 1 100%; }
.approval-diff { width: 100%; min-width: 0; }

/* Composer */
.composer-wrap { flex: 0 0 auto; width: 100%; max-width: calc(var(--thread-w) + 48px); margin: 0 auto; padding: 8px 24px 16px; background: var(--bg); }
.composer { position: relative; display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 12px 12px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-xl);  }
.composer:focus-within { border-color: var(--border);  }
.composer-input { width: 100%; min-height: var(--composer-min-height); max-height: var(--composer-max-height); padding: var(--space-1) var(--space-2); overflow-y: auto; color: var(--text); font: 400 var(--text-body)/var(--leading-body) var(--font); background: transparent; border: 0; outline: 0; resize: none; }
.composer-input::placeholder { color: var(--text-faint); }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.slash-menu { position: absolute; right: 0; bottom: calc(100% + 8px); left: 0; z-index: 20; max-height: min(360px, calc(100vh - 140px)); padding: 4px; overflow-y: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;  }
.slash-menu[hidden] { display: none; }
.slash-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 4px 8px; color: var(--text-2); text-align: left; background: transparent; border-radius: var(--radius-s); cursor: pointer; }
.slash-row:hover, .slash-row.active { color: var(--text); background: var(--bg-hover); }
.slash-name { flex: 0 0 auto; color: var(--text); font-size: 13px; font-weight: 500; }
.slash-desc { min-width: 0; overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.access-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; color: var(--text-muted); font-size: 12px; background: transparent; border-radius: var(--radius-s); }
.access-chip:hover { color: var(--text-2); background: var(--bg-hover); }
.access-chip.full { color: var(--warning); }
.access-chip svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }
.model-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; max-width: 230px; padding: 0 8px; overflow: hidden; color: var(--text-muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; background: transparent; border-radius: var(--radius-s); }
.model-chip:hover { color: var(--text-2); background: var(--bg-hover); }
.model-chip svg { flex: 0 0 12px; width: 12px; height: 12px; }
.mic-btn { position: relative; flex-basis: auto; width: auto; min-width: 28px; padding: 0 4px; }
.mic-btn.listening { color: var(--error-fg); }
.mic-btn.listening::after { content: ''; position: absolute; inset: 0; border-radius: inherit; animation: mic-pulse 1.4s ease-out infinite; pointer-events: none; }
.mic-lang { font-size: 12px; margin-left: 4px; opacity: .8; }
.plan-indicator { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; color: var(--secondary); font-size: 12px; background: color-mix(in srgb, var(--primary) 12%, transparent); border-radius: var(--radius-s); }
.plan-indicator:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.plan-indicator svg { width: 12px; height: 12px; stroke: currentColor; fill: none; }
.send-btn { display: inline-flex; flex: 0 0 28px; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; color: var(--text-muted); background: var(--bg-hover); border-radius: 50%; transition: background .15s, color .15s; }
.send-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.send-btn.ready { color: var(--btn-primary-fg); background: var(--btn-primary-bg); }
.send-btn.ready:hover { background: color-mix(in srgb, var(--btn-primary-bg) 88%, var(--btn-primary-fg)); }

/* Popups, effort selector and model list */
.popup-layer { position: fixed; inset: 0; z-index: 30; overflow: visible; pointer-events: none; }
/* The narrow sidebar drawer is at 40 and its backdrop is at 39. */
.popup-layer:has(.sidebar-chat-popup) { z-index: 41; }
.popup { position: absolute; width: 270px; max-height: min(480px, calc(100vh - 90px)); padding: 8px; overflow-y: auto; color: var(--text); background: var(--bg-elev); border-radius: 8px;  pointer-events: auto; }
.popup-title { padding: 8px 8px 8px; font-size: 12px; font-weight: 600; }
.popup-group-label { padding: 8px 8px 4px; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.popup-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 4px 8px; color: var(--text-2); font-size: 13px; text-align: left; background: transparent; border-radius: var(--radius-s); }
.popup-item:hover, .popup-item.selected { color: var(--text); background: var(--bg-hover); }
.popup-item:disabled, .popup-item.is-disabled { color: var(--text-faint); background: transparent; opacity: 0.55; cursor: default; }
.popup-item svg { flex: 0 0 15px; width: 15px; height: 15px; color: var(--text-muted); stroke: currentColor; fill: none; }
.popup-item .check { margin-left: auto; color: var(--text); }
.popup-item-desc { display: block; margin-top: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.popup-sep { height: 1px; margin: 4px 4px; background: var(--border); }
.popup-search { width: 100%; min-height: 30px; margin: 4px 0 4px; padding: 4px 8px; color: var(--text); font-size: 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-s); outline: 0; }
.popup-search:focus { border-color: var(--primary); }
.effort-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px; }
.effort-label { color: var(--secondary); font-size: 13px; font-weight: 500; }
.effort-model { display: flex; flex: 1; align-items: center; gap: 4px; min-width: 0; color: var(--text-muted); font-size: 12px; text-align: left; background: transparent; }
.effort-model:hover { color: var(--text-2); }
.effort-model svg { width: 12px; height: 12px; }
.effort-slider { position: relative; display: flex; align-items: stretch; justify-content: space-between; gap: 4px; min-height: 40px; margin: 4px 8px 4px; }
.effort-slider::before { content: ""; position: absolute; top: 18px; right: 5px; left: 5px; height: 2px; background: var(--border); }
.effort-stop { position: relative; z-index: 1; display: inline-flex; flex: 1 1 0; flex-direction: column; align-items: center; gap: 4px; min-width: 36px; min-height: 40px; padding: 12px 4px 4px; color: var(--text-muted); font: inherit; font-size: 12px; line-height: 1.2; text-align: center; background: transparent; border: 0; border-radius: var(--radius-s); cursor: pointer; }
.effort-stop:hover { color: var(--text-2); background: var(--bg-hover); }
.effort-stop.on { color: var(--secondary); }
.effort-stop:disabled { cursor: default; opacity: .55; }
.effort-dot { display: block; width: 10px; height: 10px; background: var(--border); border: 1px solid var(--bg-elev); border-radius: 8px; }
.effort-stop.on .effort-dot { background: var(--secondary);  }
.effort-stop-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.effort-slider::before { top: 15px; right: 18px; left: 18px; }
.popup.model-list-popup { width: clamp(300px, 34vw, 360px); min-width: 300px; max-width: 360px; }
.model-row { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; width: 100%; min-height: 40px; padding: 4px 8px; color: var(--text-2); font-size: 13px; text-align: left; background: transparent; border-radius: var(--radius-s); }
.model-list-popup .model-row { text-align: start; }
.model-provider-label { margin-block-start: 4px; border-block-start: 1px solid var(--border-subtle); color: var(--text); font-weight: 600; }
.model-category-label { padding-inline-start: 12px; color: var(--text-muted); font-size: 12px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; }
.model-row-tag, .model-row-local { padding-inline: 4px; color: var(--primary); background: var(--bg-active); border-radius: var(--radius-s); font-size: 12px; }
.model-row:hover, .model-row.selected { color: var(--text); background: var(--bg-hover); }
.model-row.cli-tool-row:disabled,
.model-row.cli-tool-row:disabled:hover,
.model-row.cli-tool-row:disabled.selected { color: var(--text-muted); font-size: 13px; background: transparent; cursor: default; }
.cli-tool-row:disabled .model-row-tag { color: var(--text-muted); background: transparent; }
.cli-tool-picker-row { display: flex; flex-direction: column; align-items: stretch; min-width: 0; overflow: hidden; }
.cli-tool-picker-row .model-row { min-width: 0; }
.cli-tool-picker-row .model-row-line2 { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.cli-enable-action { align-self: flex-end; max-width: calc(100% - 16px); margin: 0 8px 4px; padding: 0; border: 0; background: transparent; color: var(--primary); font: inherit; cursor: pointer; }
.cli-enable-action:hover, .cli-enable-action:focus-visible { text-decoration: underline; }
.model-row-line1, .model-row-line2 { display: flex; align-items: center; min-width: 0; }
.model-row-line1 { gap: 8px; }
.model-row-name { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.model-row-check { display: inline-flex; flex: 0 0 auto; color: var(--text); }
.model-row-check svg { width: 13px; height: 13px; }
.model-row-line2 { gap: 4px; overflow: hidden; color: var(--text-muted); font-size: 12px; line-height: 1.35; white-space: nowrap; }
.model-row-line2 > * { flex: 0 0 auto; }
.model-row-line2 > .model-row-id { flex: 0 1 auto; min-width: 52px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.model-row-line2 > .model-row-price { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.model-row-sep, .model-row-context, .model-row-accounts, .model-row-vision { white-space: nowrap; }
.model-row-vision { display: inline-flex; align-items: center; }
.model-row-vision svg { width: 12px; height: 12px; color: var(--text-muted); stroke: currentColor; fill: none; }
.model-row-line2 .speed-badge { margin-left: 0; font-size: inherit; line-height: inherit; }
.model-meta { flex: 0 0 auto; color: var(--text-muted); font-size: 12px; }

/* Right panel */
.panel { position: relative; z-index: 2; display: flex; flex-direction: column; width: var(--panel-w); min-width: 0; height: 100%; min-height: 0; overflow: hidden; background: var(--bg-panel); border: 0; border-left: 1px solid var(--border-subtle); border-radius: 0;  }
.panel-chrome { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; min-height: var(--titlebar-h); padding: 0 6px 0 10px; background: var(--bg-panel); border-bottom: 1px solid var(--border-subtle); }
.panel-tabs { display: flex; flex: 1 1 auto; align-items: stretch; gap: 4px; min-width: 0; overflow: hidden; }
.panel-tab { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; gap: 4px; height: calc(var(--titlebar-h) - 1px); padding: 0 8px; color: var(--text-muted); font-size: 12px; font-weight: 500; white-space: nowrap; background: transparent; border-radius: 0; }
.panel-tab:hover { color: var(--text); background: var(--bg-hover); }
.panel-tab[aria-selected="true"] { color: var(--text); }
.panel-tab[aria-selected="true"]::after { position: absolute; right: 8px; bottom: 0; left: 8px; height: 2px; background: var(--primary); border-radius: 2px 2px 0 0; content: ""; }
.panel-tab svg { flex: 0 0 14px; width: 14px; height: 14px; stroke: currentColor; fill: none; }
.panel-tab-label { min-width: 0; white-space: nowrap; }
.panel-more[data-active="true"] { color: var(--text); background: var(--bg-hover); }
.panel-more[data-active="true"]::after { position: absolute; right: 8px; bottom: 0; left: 8px; height: 2px; background: var(--primary); border-radius: 2px 2px 0 0; content: ""; }
.panel-tab:focus-visible, .panel-more:focus-visible, .panel-close:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.panel-close { flex: 0 0 26px; width: 26px; height: 26px; margin-left: 2px; color: var(--text-muted); }
.panel-close:hover { color: var(--text); background: var(--bg-hover); }
.panel-tab-menu-popup { width: max-content; min-width: 200px; max-width: min(300px, calc(100vw - 16px)); padding: 6px; }
.panel-tab-menu-item { min-height: 32px; white-space: normal; }
.panel-tab-menu-item[aria-checked="true"] { color: var(--text); background: var(--bg-hover); }
.panel-tab-menu-label { min-width: 0; white-space: normal; overflow-wrap: normal; }
.panel-card { flex: 1 1 auto; min-height: 0; padding: 12px 12px; overflow-y: auto; }
.panel-scrim { display: none; }
.panel-section + .panel-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.panel-head { display: flex; align-items: center; justify-content: space-between; min-height: 24px; margin-bottom: 8px; color: var(--text-2); font-size: 12px; font-weight: 500; }
.panel-empty { padding: 12px 4px; color: var(--text-faint); font-size: 12px; line-height: 1.5; }
.panel-thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.panel-file { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 8px 8px; overflow: hidden; color: var(--text-2); font-size: 12px; text-align: left; background: var(--bg-hover); border-radius: var(--radius-s); }
.panel-file:hover { color: var(--text); background: var(--bg-active); }
.panel-file svg { flex: 0 0 14px; width: 14px; height: 14px; color: var(--text-muted); }

/* Settings */
.settings-page { width: 100%; max-width: 760px; margin: 0 auto; }
.settings-title { margin: 0 0 24px; font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: 0; overflow-wrap: anywhere; }
.settings-intro { max-width: 650px; margin: -12px 0 24px; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.stat-card-label, .stat-card-help { color: var(--text-2); }
.project-commands-page .row-control .input { width: min(420px, 46vw); }
.project-commands-page .project-command-note { flex: 1 0 100%; margin: 0; }
.project-commands-page .project-command-actions { justify-content: flex-start; gap: 8px; }
.group { margin: 0 0 24px; }
.group-title { margin: 0 0 8px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.appearance-note { margin-top: 12px; color: var(--text-muted); font-size: 12px; }
/* Clip rounded cards without creating nested scroll containers. Chromium on
   Windows can leave parts of those containers unpainted after parent scrolling. */
.group-card { overflow: clip; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.group-card > .row + .row, .group-card > .account-card + .account-card { border-top: 1px solid var(--border-subtle); }
.plan-gate-card { margin: 0 12px 12px; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: calc(var(--radius) - 4px); background: var(--bg); }
.row { display: flex; align-items: center; gap: 20px; min-height: 52px; padding: 12px 12px; }
.row + .row { border-top: 1px solid var(--border-subtle); }
.row-main { flex: 1; min-width: 0; }
.row-title { color: var(--text); font-size: 13px; font-weight: 600; }
.row-help { margin-top: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.row-control { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; color: var(--text-muted); }
.browser-profile-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.browser-profile-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.browser-profile-pill { flex: 0 0 auto; padding: 2px 6px; font-size: 11px; line-height: 16px; }
.browser-profile-list .row-help { overflow-wrap: anywhere; }
.browser-profile-menu { display: flex; flex-direction: column; gap: 2px; min-width: 240px; max-width: 320px; }
.browser-profile-menu .browser-profile-option { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 7px 8px; color: var(--text); font-size: 13px; text-align: left; background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
.browser-profile-menu .browser-profile-option:hover { background: var(--bg-hover); }
.browser-profile-menu .browser-profile-option[aria-current="true"] { background: var(--bg-hover); }
.browser-profile-menu .browser-profile-option:disabled { color: var(--text-faint); cursor: default; }
.browser-profile-menu .browser-profile-option small { color: var(--text-muted); font-size: 11px; }
.browser-profile-consent { display: flex; flex-direction: column; gap: 8px; max-width: 300px; padding: 4px; }
.browser-profile-consent p { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.5; }
.browser-profile-consent-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-control .input, .row-control .select { width: 210px; }
.account-card { padding: 12px; }
.account-head { display: flex; align-items: flex-start; gap: 8px; }
.account-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; color: var(--text-2); font-size: 12px; font-weight: 500;  letter-spacing: 0; background: var(--bg-hover); border-radius: 4px; }
.account-meta { flex: 1; min-width: 0; }
.account-status { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.account-actions { display: flex; align-items: center; gap: 4px; }
.account-toggle:has(input:checked)::before { background: var(--text-2); }
.account-toggle:has(input:checked)::after { background: var(--bg); }
.add-key-form { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.add-key-form .input { flex: 1 1 230px; width: auto; }
.add-key-form .btn { flex: 0 0 auto; }
.model-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.model-table th, .model-table td { overflow-wrap: anywhere; white-space: normal; min-width: 0; }
.model-table .account-head { flex-wrap: wrap; }
.model-table .chip { white-space: normal; }
.model-table .btn { max-width: 100%; min-width: 0; white-space: normal; }
@media (max-width: 1000px) {
  .model-table, .model-table tbody { display: block; }
  .model-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .model-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model-table td:first-child { grid-column: 1 / -1; }
  .model-table td::before { content: attr(data-label); display: block; font-weight: 500; margin-bottom: 4px; }
  .model-table[hidden], .model-table tr[hidden] { display: none; }
}
.model-table th, .model-table td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-subtle); }
.model-table th { color: var(--text-muted); font-size: 12px; font-weight: 500; }
.model-table tr:last-child td { border-bottom: 0; }
.model-table tr:hover td { background: var(--bg-hover); }

/* Modal and image lightbox */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; background: color-mix(in srgb, var(--bg) 68%, transparent);  }
.modal { display: flex; flex-direction: column; width: min(620px, 100%); max-height: 82vh; overflow: hidden; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);  }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--border-subtle); }
.modal-body { padding: 16px; overflow: auto; color: var(--text-2); font-size: 13px; }
.lightbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 88%, transparent); }
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: var(--radius-s);  }
.lightbox .icon-btn { position: absolute; top: 16px; right: 16px; color: var(--text); background: color-mix(in srgb, var(--text) 10%, transparent); }

/* Session recovery */
.session-expired-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  
}
.session-expired-card {
  display: flex;
  flex-direction: column;
  width: min(470px, 100%);
  max-height: calc(100vh - 48px);
  padding: 28px;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  
}
.session-expired-mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text);
}
.session-expired-mark svg { width: 22px; height: 22px; }
.session-expired-title { margin: 0 0 8px; color: var(--text); font-size: 20px; font-weight: 600; line-height: 1.25; letter-spacing: 0; }
.session-expired-copy { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.session-expired-steps { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 20px; padding-left: 20px; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.session-expired-steps strong { color: var(--text); font-weight: 500; }
.session-expired-label { margin-bottom: 8px; color: var(--text-2); font-size: 12px; font-weight: 500; }
.session-expired-form { display: flex; align-items: center; gap: 8px; }
.session-expired-input { flex: 1 1 auto; min-width: 0; }
.session-expired-submit { flex: 0 0 auto; }
.session-expired-error { min-height: 1.35em; margin-top: 8px; color: var(--error); font-size: 12px; line-height: 1.35; }
@media (max-width: 560px) {
  .session-expired-form { flex-direction: column; align-items: stretch; }
  .session-expired-submit { width: 100%; }
}

/* Toasts */
.toast-layer { position: fixed; bottom: 76px; left: 50%; z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { max-width: min(440px, calc(100vw - 32px)); padding: 9px 12px; color: var(--text); font-size: 13px; text-align: left; pointer-events: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-s); animation: toast-in .16s ease-out; }
.toast-message { line-height: 1.45; }
.toast-action { margin-top: 2px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.toast-details-toggle { margin-top: 5px; padding: 0; color: var(--text-muted); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; background: transparent; border: 0; }
.toast-details-toggle:hover { color: var(--text); }
.toast-details { max-height: 160px; margin: 6px 0 0; padding: 8px; overflow: auto; color: var(--text-muted); font: 12px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-s); }
.toast.ok { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.toast.bad { color: var(--error-fg); border-color: color-mix(in srgb, var(--error) 50%, var(--border)); }

/* Chat alerts: one clickable card per finished or waiting chat. They borrow
   the toast surface so the app keeps one notification language. */
.chat-alert-layer {
  position: fixed;
  right: 20px;
  bottom: 76px;
  z-index: 71;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.chat-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 14px 10px 12px;
  color: var(--text);
  text-align: left;
  pointer-events: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: 0 8px 24px color-mix(in srgb, #000 18%, transparent);
  animation: chat-alert-in .16s ease-out;
}

.chat-alert:hover {
  background: color-mix(in srgb, var(--bg-elev) 92%, var(--text));
  border-color: var(--border-active);
}

.chat-alert:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.chat-alert-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--status-unread);
}

.chat-alert-dot.is-needs { background: var(--status-needs); }
.chat-alert-dot.is-failed { background: var(--status-failed); }

.chat-alert-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-alert-title,
.chat-alert-reason {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-alert-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.chat-alert-reason {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

@keyframes chat-alert-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Motion */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinner-reveal { to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mic-pulse {
  0% {  }
  70%, 100% {  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .mic-btn.listening::after { animation: none; }
}

/* Responsive shell below 1100px. The chat track may shrink, and the right pane
   never owns a grid track: it floats or is closed, so a hidden pane reserves
   zero width. Desktop >=1100px keeps its saved dock geometry. */
@media (max-width: 1099px) {
  html body #app > .panel { display: none; }
  .app { grid-template-columns: var(--rail-w) clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max)) minmax(0, 1fr) 0; }
  .app.sidebar-collapsed,
  .app.settings-mode.sidebar-collapsed { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) 0; }
  .app > .main { min-width: 0; }
}

/* Narrow windows */
@media (max-width: 900px) {
  .app { grid-template-columns: var(--rail-w) 0 minmax(0, 1fr) 0; }
  .app > .rail { grid-column: 1; }
  .app > .sidebar { grid-column: 2; width: 0; visibility: hidden; border-right-width: 1px; }
  .app:not(.sidebar-collapsed) > .sidebar { position: absolute; top: var(--window-header-h); bottom: 0; left: var(--rail-w); width: min(var(--sidebar-w), calc(100vw - var(--rail-w))); visibility: visible; z-index: 40; }
  .app > .main { grid-column: 3; }
  .app > .panel { grid-column: 4; }
  .app > .popup-layer { grid-column: 1 / -1; }
  .thread { padding-right: 16px; padding-left: 16px; }
  .settings-layout { grid-template-columns: 190px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .settings-sidebar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    min-height: 0;
    padding: 20px 12px 24px;
    border-right: 1px solid var(--border-subtle);
    border-bottom: 0;
  }
  .settings-sidebar-title { padding: 0 8px; white-space: normal; }
  .settings-nav { display: flex; }
  .settings-content { padding: 24px 16px 72px; }
  .composer-wrap { padding-right: 16px; padding-left: 16px; }
  .row { gap: 12px; }
  .row-control .input, .row-control .select { width: 160px; }
}

@media (max-width: 640px) {
  .settings-layout { grid-template-columns: 156px minmax(0, 1fr); }
  .settings-sidebar { padding: 16px 8px 24px; }
  .settings-content { padding: 20px 12px 72px; }
  .settings-nav-item { padding-right: 8px; padding-left: 8px; }
}

/* thinking */
.thinking-block { margin: 4px 0 8px; }
.thinking-summary { display: flex; align-items: center; gap: 4px; max-width: 100%; padding: 4px 0; color: var(--text-muted); font-size: 13px; line-height: 1.4; text-align: left; background: transparent; }
.thinking-summary:hover { color: var(--text-2); }
.thinking-summary .chevron { display: inline-flex; transition: transform .15s ease; }
.thinking-block.open .thinking-summary .chevron { transform: rotate(90deg); }
.thinking-text { display: none; max-height: 320px; margin: 4px 0 8px; padding: 0 0 0 16px; overflow: auto; color: var(--text-muted); font-family: var(--font); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.thinking-block.open .thinking-text { display: block; }
.speed-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.effort-fast { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 8px; text-align: left; background: transparent; border-radius: var(--radius-s); }
.effort-fast:hover { background: var(--bg-hover); }
.effort-fast-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.effort-fast-title { color: var(--text-2); font-size: 13px; font-weight: 500; }
.effort-fast-desc { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.effort-fast-check { display: inline-flex; color: var(--secondary); }
.effort-fast-check svg { width: 14px; height: 14px; }

/* ==== review ==== */
.review { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.review button:disabled { opacity: .5; cursor: default; }
.review-head { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.review-title-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.review-branch { flex: 1; min-width: 0; color: var(--text); font-size: 12px; font-weight: 500; }
.review-refresh { flex: 0 0 auto; gap: 4px; padding: 4px 4px; color: var(--text-muted); font-size: 12px; }
.review-refresh-icon { display: inline-flex; }
.review-meta { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; }
.review-group { min-width: 0; }
.review-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 21px; margin-bottom: 4px; color: var(--text-2); font-size: 12px; font-weight: 500; }
.review-count { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; color: var(--text-muted); font-size: 12px; background: var(--bg-hover); border-radius: 8px; }
.review-files { display: flex; flex-direction: column; gap: 4px; }
.review-file-row { display: flex; align-items: center; gap: 4px; min-width: 0; border-radius: var(--radius-s); }
.review-file-row:hover { background: var(--bg-hover); }
.review-file { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; padding: 4px 4px 4px 8px; color: var(--text-2); font-size: 12px; text-align: left; background: transparent; border: 0; border-radius: var(--radius-s); cursor: pointer; }
.review-file:hover, .review-file.active { color: var(--text); background: var(--bg-active); }
.review-path { flex: 1; min-width: 0; }
.review-status { display: inline-flex; flex: 0 0 16px; align-items: center; justify-content: center; width: 16px; height: 16px; font: 500 12px/1 var(--mono); background: var(--bg-hover); border-radius: 4px; }
.review-status.added { color: var(--success); background: color-mix(in srgb, var(--success) 13%, transparent); }
.review-status.deleted, .review-status.conflict { color: var(--error); background: color-mix(in srgb, var(--error) 13%, transparent); }
.review-status.modified { color: var(--warning); background: color-mix(in srgb, var(--warning) 13%, transparent); }
.review-status.renamed { color: var(--secondary); background: color-mix(in srgb, var(--secondary) 13%, transparent); }
.review-status.untracked { color: var(--text-muted); }
.review-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; padding-right: 4px; }
.review-mini-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; color: var(--text-muted); font: 500 13px/1 var(--mono); background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.review-mini-btn:hover { color: var(--text); background: var(--bg-active); }
.review-mini-btn.danger { color: var(--text-muted); }
.review-mini-btn.danger:hover { color: var(--error); background: var(--bg-active); }
.review-mini-btn svg { width: 12px; height: 12px; }
.review-commit { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.review-commit-input { width: 100%; min-height: 58px; max-height: 150px; font-size: 12px; }
.review-commit-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.review-commit-hint { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.review-commit-btn { flex: 0 0 auto; padding: 4px 8px; font-size: 12px; }
.review-diff-wrap { min-width: 0; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.review-diff-wrap .review-group-head { align-items: flex-start; }
.review-diff-badge { flex: 0 0 auto; padding: 4px 4px; color: var(--text-muted); font: 500 12px/15px var(--mono); background: var(--bg-hover); border-radius: 6px; }
.review-diff { max-height: 380px; overflow: auto; font: 12px/1.55 var(--mono); background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--radius-s); }
.review-diff-line { display: grid; grid-template-columns: 2.7ch 2.7ch minmax(0, 1fr); min-width: max-content; color: var(--text-2); }
.review-diff-line.add { color: var(--text); background: color-mix(in srgb, var(--success) 13%, transparent); }
.review-diff-line.del { color: var(--text); background: color-mix(in srgb, var(--error) 13%, transparent); }
.review-diff-line.hunk, .review-diff-line.meta { grid-template-columns: minmax(0, 1fr); color: var(--text-muted); background: var(--bg-hover); }
.review-diff-line.hunk .review-ln, .review-diff-line.meta .review-ln { display: none; }
.review-ln { padding: 0 4px; color: var(--text-faint); text-align: right; user-select: none; border-right: 1px solid var(--border-subtle); }
.review-code { min-width: 0; padding: 0 4px; white-space: pre; }
.review-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px; font-size: 12px; text-align: center; }
.review-error { padding: 8px 8px; color: var(--error-fg); font-size: 12px; line-height: 1.45; word-break: break-word; background: color-mix(in srgb, var(--error) 8%, transparent); border-radius: var(--radius-s); }
.review-notice { padding: 4px 8px; color: var(--success); font-size: 12px; word-break: break-word; background: color-mix(in srgb, var(--success) 8%, transparent); border-radius: var(--radius-s); }
.review-truncated { margin-bottom: 4px; color: var(--warning); font-size: 12px; }
/* ==== command-palette-and-shortcuts ==== */
.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: color-mix(in srgb, var(--bg) 46%, transparent);
  
}
.palette {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(640px, calc(100vh - 48px));
  overflow: hidden;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  
}
.palette-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.palette-search-icon { display: inline-flex; color: var(--text-muted); }
.palette-search-icon svg { width: 17px; height: 17px; }
.palette-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  color: var(--text);
  font: 15px/1.5 var(--font);
  background: transparent;
  border: 0;
  outline: 0;
}
.palette-input::placeholder { color: var(--text-faint); }
.palette-results {
  flex: 1 1 auto;
  min-height: 96px;
  padding: 4px;
  overflow-y: auto;
}
.palette-group-title {
  padding: 8px 8px 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}
.palette-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 36px;
  padding: 8px 8px;
  color: var(--text-2);
  text-align: left;
  background: transparent;
  border-radius: var(--radius-s);
}
.palette-row:hover, .palette-row.selected { color: var(--text); background: var(--bg-hover); }
.palette-row:disabled { opacity: .48; }
.palette-row-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.palette-row-title { overflow: hidden; font-size: 13px; line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; }
.palette-row-detail { overflow: hidden; color: var(--text-muted); font-size: 12px; line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; }
.palette-keys { display: inline-flex; flex: 0 0 auto; gap: 4px; }
.palette-key {
  display: inline-block;
  min-width: 19px;
  padding: 4px 4px;
  color: var(--text-muted);
  font: 12px/16px var(--mono);
  text-align: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.palette-unassigned { flex: 0 0 auto; color: var(--text-faint); font-size: 12px; }
.palette-empty { padding: 20px 12px 24px; color: var(--text-muted); font-size: 12px; text-align: center; }
.palette-footer {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  color: var(--text-faint);
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
}

.shortcut-toolbar { display: flex; align-items: center; gap: 8px; margin: 0 0 20px; }
.shortcut-search { flex: 1; max-width: 380px; }
.shortcut-message {
  margin: 0 0 20px;
  padding: 8px 12px;
  color: var(--text-2);
  font-size: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}
.shortcut-group { margin-bottom: 24px; }
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 56px;
  padding: 8px 12px;
}
.group-card > .shortcut-row + .shortcut-row { border-top: 1px solid var(--border-subtle); }
.shortcut-row.shortcut-editing { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--bg-hover); }
.shortcut-main { flex: 1; min-width: 0; }
.shortcut-title { color: var(--text); font-size: 13px; font-weight: 600; }
.shortcut-help { margin-top: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.shortcut-control { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.shortcut-keys { display: inline-flex; gap: 4px; }
.shortcut-conflict .kbd { color: var(--warning); border-color: var(--warning); }
.shortcut-unassigned { color: var(--text-faint); font-size: 12px; }
.shortcut-waiting { color: var(--secondary); font-size: 12px; font-weight: 500; }
.shortcut-fixed { color: var(--text-faint); font-size: 12px; }
.shortcut-edit { min-height: 26px; padding: 0 8px; color: var(--text-muted); font-size: 12px; }
.shortcut-empty { padding: 24px 0; text-align: center; }

@media (max-width: 700px) {
  .palette-backdrop { padding: 12px 8px; }
  .palette { max-height: calc(100vh - 24px); }
  .palette-footer { gap: 8px; }
  .shortcut-toolbar { align-items: stretch; flex-direction: column; }
  .shortcut-search { max-width: none; }
  .shortcut-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .shortcut-control { width: 100%; justify-content: space-between; }
}
/* ==== orax-brand-themes ==== */
:root[data-theme^="orax-"] .icon-btn.active,
:root[data-theme^="orax-"] .sb-row.active {
  color: var(--primary);
  background: var(--bg-active);
}

:root[data-theme^="orax-"] .sb-row.active {
  
}

.appearance-theme-panel { padding: 12px; }
.appearance-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  align-items: stretch;
}
.appearance-theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.appearance-theme-card:hover { background: var(--bg-hover); }
.appearance-theme-card[aria-pressed="true"] {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}
.appearance-theme-preview {
  position: relative;
  display: flex;
  width: 100%;
  height: 76px;
  overflow: hidden;
  border: 1px solid;
  border-radius: var(--radius-s);
}
.appearance-theme-preview-side { flex: 0 0 24%; border-right: 1px solid; }
.appearance-theme-preview-body { position: relative; flex: 1; padding: 8px 8px; }
.appearance-theme-preview-line { width: 55%; height: 3px; border-radius: 2px; opacity: .3; }
.appearance-theme-preview-line.short { width: 72%; margin-top: 4px; opacity: .16; }
.appearance-theme-preview-bubble {
  position: absolute;
  right: 7px;
  bottom: 8px;
  display: flex;
  align-items: center;
  width: 46%;
  height: 17px;
  padding: 0 4px;
  border: 1px solid;
  border-radius: 5px;
}
.appearance-theme-preview-copy { width: 65%; height: 2px; border-radius: 1px; opacity: .75; }
.appearance-theme-preview-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 2px; }
.appearance-theme-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; }
.appearance-theme-name { overflow: hidden; font-size: 12px; font-weight: 500; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.appearance-theme-check {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--btn-primary-fg);
  background: var(--primary);
  border-radius: 8px;
}
.appearance-color {
  width: 44px;
  height: 28px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  cursor: pointer;
}
.appearance-color::-webkit-color-swatch-wrapper { padding: 0; }
.appearance-color::-webkit-color-swatch { border: 0; border-radius: 3px; }

@media (max-width: 900px) {
  .appearance-theme-grid { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
}
/* ==== mentions-attachments ==== */
.mention-menu { max-height: min(280px, calc(100vh - 160px)); }
.mention-row { gap: 8px; }
.mention-icon { display: inline-flex; flex: 0 0 14px; color: var(--text-muted); }
.mention-name { max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-dir { flex: 1; }
.attachment-input { display: none; }
.attachment-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 4px; }
.attachment-tray[hidden] { display: none; }
.attachment-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 220px; min-height: 30px; padding: 4px 4px 4px 8px; color: var(--text-2); background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius-s); }
.attachment-thumb { width: 24px; height: 24px; flex: 0 0 24px; object-fit: cover; border-radius: 4px; }
.attachment-file-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: 0 0 24px; color: var(--text-muted); background: transparent; border-radius: 0; }
.attachment-chip-name { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-remove { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; color: var(--text-muted); background: transparent; border-radius: 4px; }
.attachment-remove:hover { color: var(--text); background: var(--bg-elev); }
.composer.drag-active { border-color: var(--border); }
.composer.drag-active::after { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 13px; content: 'Drop images or text files'; background: color-mix(in srgb, var(--bg-elev) 92%, transparent); border: 1px dashed var(--border); border-radius: var(--radius-xl); pointer-events: none; }
/* ==== account weights ==== */
.share-bar-wrap { display: flex; flex-direction: column; gap: 8px; }
.share-bar { display: flex; width: 100%; min-height: 28px; overflow: hidden; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-s); }
.share-segment { display: flex; align-items: center; min-width: 3px; padding: 0 8px; overflow: hidden; color: var(--btn-primary-fg); font-size: 12px; font-weight: 500; white-space: nowrap; }
.share-segment span { overflow: hidden; text-overflow: ellipsis; }
.share-color-0 { background: var(--primary); }
.share-color-1 { background: var(--success); }
.share-color-2 { background: var(--warning); }
.share-color-3 { background: var(--error); }
.share-color-4 { background: var(--secondary); }
.account-share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.account-share-label { display: grid; grid-template-columns: 100px auto auto; align-items: center; gap: 8px; min-width: 0; }
.account-field-label { white-space: nowrap; margin-top: 0; }
.account-model-select { width: 210px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-main-action { flex: 0 0 auto; margin-left: auto; }
.share-input { width: 72px; min-height: 26px; padding: 4px 8px; text-align: right; }
.account-served { font-size: 12px; white-space: nowrap; }
.traffic-shares-body { padding: 0 4px; }
.traffic-shares-body .row-help { margin: 0; }
.traffic-shares-body .share-bar-wrap { margin-top: 4px; }
.provider-picker-view { padding: 16px; }
.provider-search-wrap { position: relative; display: flex; align-items: center; margin-bottom: 16px; }
.provider-search-wrap .ic-wrap { position: absolute; left: 12px; display: flex; color: var(--text-muted); pointer-events: none; }
.provider-search { width: 100%; min-height: 40px; padding-left: 40px; background: var(--bg-input); }
.provider-gallery-section + .provider-gallery-section { margin-top: 20px; }
.provider-gallery-heading { margin: 0 0 8px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: 0;  }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.provider-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 96px;
  padding: 12px;
  color: var(--text);
  text-align: left;
  background: var(--bg-element);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.provider-card:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  
  transform: translateY(-1px);
}
.provider-card:focus-visible { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 2px; }
.provider-card.is-connected { border-color: color-mix(in srgb, var(--success) 38%, var(--border-subtle)); }
.provider-card-body { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.provider-card-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; }
.provider-card-name { flex: 1; min-width: 90px; color: var(--text); font-size: 13px; font-weight: 500; line-height: 1.3; }
.provider-card-description {
  display: -webkit-box;
  min-height: 32px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.provider-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.provider-card-meta .provider-auth-badges { margin-top: 0; }
.provider-card-count { flex: 0 0 auto; margin-left: auto; color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.provider-auth-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.provider-auth-badge { display: inline-flex; align-items: center; min-height: 18px; padding: 0 8px; color: var(--text-muted); font-size: 12px; font-weight: 500; background: color-mix(in srgb, var(--text) 6%, transparent); border-radius: 4px; }
.provider-search-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 150px; padding: 24px; color: var(--text-muted); text-align: center; }
.provider-search-empty .ic-wrap { display: flex; margin-bottom: 4px; color: var(--text-faint); }
.provider-logo { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; color: var(--text-2); }
.provider-logo > svg { display: block; width: 100%; height: 100%; }
.provider-logo-mark { display: block; width: 100%; height: 100%; background: currentColor; -webkit-mask: var(--provider-icon) center / contain no-repeat; mask: var(--provider-icon) center / contain no-repeat; }
.provider-logo-fallback { color: var(--text-2); background: var(--bg-hover); border: 1px solid var(--border-subtle); border-radius: 7px; }
.provider-logo-letter { font-weight: 500; line-height: 1; }
.provider-logo-openai { --provider-icon: url('/ui/img/providers/openai.svg'); }
.provider-logo-anthropic { --provider-icon: url('/ui/img/providers/anthropic.svg'); }
.provider-logo-google { --provider-icon: url('/ui/img/providers/google.svg'); }
.provider-logo-deepseek { --provider-icon: url('/ui/img/providers/deepseek.svg'); }
.provider-logo-openrouter { --provider-icon: url('/ui/img/providers/openrouter.svg'); }
.provider-logo-groq { --provider-icon: url('/ui/img/providers/groq.svg'); }
.provider-logo-xai { --provider-icon: url('/ui/img/providers/xai.svg'); }
.provider-logo-fireworks { --provider-icon: url('/ui/img/providers/fireworks.svg'); }
.provider-logo-mistral { --provider-icon: url('/ui/img/providers/mistral.svg'); }
.provider-logo-github-copilot { --provider-icon: url('/ui/img/providers/github-copilot.svg'); }
.provider-logo-opencode-go { --provider-icon: url('/ui/img/providers/opencode-go.svg'); }
.provider-logo-opencode-zen { --provider-icon: url('/ui/img/providers/opencode-zen.svg'); }
.provider-logo-local { --provider-icon: url('/ui/img/providers/local.svg'); }
.provider-logo-opencode { --provider-icon: url('/ui/img/providers/opencode.svg'); }
.provider-logo-ollama { --provider-icon: url('/ui/img/providers/ollama.svg'); }
.provider-logo-lmstudio { --provider-icon: url('/ui/img/providers/lmstudio.svg'); }
.provider-logo-llamacpp { --provider-icon: url('/ui/img/providers/llamacpp.svg'); }
.provider-logo-vllm { --provider-icon: url('/ui/img/providers/vllm.svg'); }
.provider-logo-nim { --provider-icon: url('/ui/img/providers/nim.svg'); }
.provider-logo-openai-compatible { --provider-icon: url('/ui/img/providers/openai-compatible.svg'); }
.provider-logo-fallback { --provider-icon: url('/ui/img/providers/fallback.svg'); }
.provider-connected { display: inline-flex; align-items: center; gap: 4px; color: var(--success); font-size: 12px; font-weight: 500; white-space: nowrap; }
.provider-connected-dot { width: 6px; height: 6px; background: var(--success); border-radius: 8px;  }
.provider-connect { padding: 16px; }
.provider-connect-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.provider-back { min-height: 28px; padding: 4px 8px; color: var(--text-muted); font-size: 12px; }
.provider-back .ic-wrap { display: flex; }
.provider-connect-head { display: flex; align-items: flex-start; gap: 12px; margin-top: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); }
.provider-connect-head .provider-logo { width: 40px; height: 40px; padding: 4px; background: var(--bg-hover); border: 1px solid var(--border-subtle); border-radius: 8px; }
.provider-connect-copy { min-width: 0; }
.provider-connect-title { margin: 0; color: var(--text); font-size: 15px; font-weight: 600; line-height: 1.3; }
.provider-connect-description { margin: 4px 0 8px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.provider-connect-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 16px; }
.provider-connect-actions:empty { display: none; }
.provider-signin { min-height: 36px; padding: 8px 16px; font-weight: 500; }
.provider-signin:disabled { opacity: .65; }
.provider-api-alternative { min-height: 34px; padding: 4px 12px; color: var(--text-muted); }
.provider-oauth-status:not(:empty) { margin-top: 12px; }
.provider-oauth-note { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.provider-oauth-link { color: var(--secondary); text-decoration: underline; text-underline-offset: 2px; }
.provider-oauth-link:hover { color: var(--text); }
.provider-device-host { margin-top: 12px; }
.provider-device { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-s); }
.provider-device-body { display: flex; flex-direction: column; gap: 8px; }
.provider-device-body[hidden], .provider-device-expired[hidden] { display: none !important; }
.provider-device-label { color: var(--text-muted); font-size: 12px; }
.provider-device-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.provider-device-code { padding: 4px 12px; color: var(--text); font-family: var(--mono); font-size: 20px; font-weight: 500; letter-spacing: 0; background: var(--bg-element); border: 1px solid var(--border); border-radius: var(--radius-s); }
.provider-device-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.provider-copy-code { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.provider-copy-code.is-copied { color: var(--text); }
.provider-device-open { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.provider-device-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 12px; }
.provider-device-expiry { display: inline-flex; align-items: center; gap: 4px; }
.provider-device-countdown { color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.provider-device-cancel { min-height: 26px; padding: 4px 8px; color: var(--text-muted); font-size: 12px; }
.provider-device-expired { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.provider-device-expired-note { display: flex; align-items: center; gap: 8px; color: var(--warning); font-size: 12px; font-weight: 500; }
.provider-device-expired-note .ic-wrap { display: flex; }
.provider-device-new { min-height: 30px; padding: 4px 12px; font-size: 12px; }
.provider-device-status { gap: 8px; }
.provider-device-status .spinner { width: 10px; height: 10px; border-top-color: currentColor; vertical-align: 0; }
.provider-device-starting { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; }
.provider-device-connected { gap: 4px; }
.provider-key-host { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.provider-key-host[hidden] { display: none !important; }
.provider-key-host .add-key-form { padding: 0; background: transparent; border: 0; }
.provider-custom-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.provider-custom-form .input { width: 100%; }
.provider-custom-form > .btn { justify-self: start; }
.provider-custom-form > .row-help,
.provider-custom-form > .provider-custom-help { grid-column: 1 / -1; }
.provider-custom-help { color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.account-provider { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; min-width: 0; }
.account-provider .provider-logo { color: var(--text-muted); }
@media (max-width: 620px) {
  .provider-grid { grid-template-columns: 1fr; }
  .provider-custom-form { grid-template-columns: 1fr; }
  .provider-connect-head { gap: 12px; }
  .provider-connect-head .provider-logo { width: 34px; height: 34px; }
}

/* ==== agents ==== */
.bot-gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; padding: 12px; }
.bot-gallery-card { min-width: 0; padding: 14px; background: color-mix(in srgb, var(--bot-color) 5%, var(--bg-elev)); border: 1px solid color-mix(in srgb, var(--bot-color) 28%, var(--border)); border-radius: 14px; }
.bot-gallery-head, .bot-specialist { display: flex; align-items: center; gap: 11px; min-width: 0; }
.bot-specialist { padding: 12px; border-bottom: 1px solid var(--border-subtle); }
.bot-specialist:last-child { border-bottom: 0; }
.bot-gallery-title, .bot-gallery-title .row-help { min-width: 0; }
.bot-gallery-title { flex: 1; }
.bot-name-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.bot-role-tag { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 7px; color: var(--text-2); font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--bot-color) 12%, var(--bg)); border: 1px solid color-mix(in srgb, var(--bot-color) 30%, var(--border)); border-radius: 999px; }
.bot-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.bot-status-card { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; color: var(--text-muted); font-size: 11px; background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 9px; }
.bot-status-card strong { color: var(--text-2); font-size: 12px; font-weight: 600; }
.bot-avatar { position: relative; display: inline-block; flex: 0 0 44px; width: 44px; height: 44px; color: var(--bot-ink); }
.bot-avatar-small { flex-basis: 26px; width: 26px; height: 26px; }
.bot-mark-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bot-mark-blob { fill: var(--bot-color); stroke: color-mix(in srgb, var(--bot-color) 76%, #000); stroke-width: 1.3; }
.bot-mark-eye { fill: var(--bot-ink); }
.bot-shape-circle .bot-mark-blob { d: path('M32 3A29 29 0 1 1 32 61A29 29 0 1 1 32 3Z'); }
.bot-shape-rounded-square .bot-mark-blob { d: path('M15 4h34c7 0 11 4 11 11v34c0 7-4 11-11 11H15C8 60 4 56 4 49V15C4 8 8 4 15 4Z'); }
.bot-shape-pill .bot-mark-blob { d: path('M17 8h30a24 24 0 0 1 0 48H17a24 24 0 0 1 0-48Z'); }
.bot-shape-triangle .bot-mark-blob { d: path('M32 4c2 0 4 2 6 5l22 39c3 6 0 11-7 11H11c-7 0-10-5-7-11L26 9c2-3 4-5 6-5Z'); }
.bot-shape-hexagon .bot-mark-blob { d: path('M18 5h28l14 27-14 27H18L4 32 18 5Z'); }
.bot-shape-cloud .bot-mark-blob { d: path('M17 55C7 55 2 48 5 39c-5-8 1-17 11-17C18 10 32 5 41 14c10-2 18 7 15 17 8 7 3 21-8 22-10 4-21 3-31 2Z'); }
.bot-shape-drop .bot-mark-blob { d: path('M32 3c5 10 22 25 22 38a22 22 0 0 1-44 0C10 28 27 13 32 3Z'); }
.bot-character-preview { display:flex; min-height:116px; align-items:center; justify-content:center; gap:14px; padding:20px; background:color-mix(in srgb,var(--bot-color) 6%,var(--bg)); border:1px solid var(--border-subtle); border-radius:20px; }
.bot-character-preview .bot-avatar { width:76px; height:76px; flex-basis:76px; filter:drop-shadow(0 12px 16px color-mix(in srgb,#000 18%,transparent)); }
.bot-character-grid { display:grid; grid-template-columns:repeat(6, 36px); gap:10px; }
.bot-character-swatch, .bot-character-shape { display:grid; place-items:center; cursor:pointer; border:1px solid var(--border); }
.bot-character-swatch { width:36px; height:36px; background:var(--swatch); border:3px solid var(--bg); border-radius:50%; box-shadow:0 0 0 1px var(--border); }
.bot-character-shape { width:48px; height:48px; padding:0; color:var(--text-2); font-size:0; background:var(--bg); border-radius:14px; }
.bot-character-shape::before { width:24px; height:24px; content:''; background:var(--text-muted); border-radius:48% 52% 44% 56% / 58% 43% 57% 42%; }
.bot-character-shape:nth-child(2)::before { border-radius:8px; }
.bot-character-shape:nth-child(3)::before { width:28px; border-radius:999px; }
.bot-character-shape:nth-child(4)::before { clip-path:polygon(50% 4%,96% 94%,4% 94%); }
.bot-character-shape:nth-child(5)::before { clip-path:polygon(25% 4%,75% 4%,100% 50%,75% 96%,25% 96%,0 50%); }
.bot-character-shape:nth-child(6)::before { border-radius:55% 45% 60% 40% / 45% 60% 40% 55%; }
.bot-character-shape:nth-child(7)::before { clip-path:polygon(50% 0,90% 45%,82% 82%,50% 100%,18% 82%,10% 45%); }
.bot-character-swatch[aria-pressed="true"], .bot-character-shape[aria-pressed="true"] { outline:2px solid var(--text); outline-offset:2px; }
.active-bot-avatar { display: inline-flex; margin-right: 7px; vertical-align: middle; }
.agent-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; max-width: 150px; padding: 0 8px; overflow: hidden; color: var(--text-muted); font-size: 12px; white-space: nowrap; background: transparent; border-radius: var(--radius-s); }
.agent-chip:hover { color: var(--text-2); background: var(--bg-hover); }
.agent-chip svg { flex: 0 0 13px; width: 13px; height: 13px; stroke: currentColor; fill: none; }
.agent-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.agent-page-head .settings-intro { margin-bottom: 0; }
.agent-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border-subtle); }
.agent-card:last-child { border-bottom: 0; }
.agent-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.agent-card-copy { min-width: 0; }
.agent-form { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.agent-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.agent-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.agent-account-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.agent-account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; padding: 4px 0; border-bottom: 1px solid var(--border-subtle); }
.agent-account-row:last-child { border-bottom: 0; }
.agent-account-choice { display: flex; align-items: center; gap: 8px; min-width: 0; }
.agent-tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 16px; }
.agent-tool-choice { display: flex; align-items: center; gap: 8px; min-height: 30px; color: var(--text-2); font-size: 13px; }
.agent-radio-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; }
.agent-radio-copy { display: flex; flex-direction: column; gap: 4px; }
.agent-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.agent-form-actions .row-help { flex: 1; color: var(--error); }
@media (max-width: 700px) { .agent-form-grid, .bot-gallery-grid { grid-template-columns: 1fr; } .agent-page-head { flex-direction: column; } }

.bot-profile { width: min(860px, 100%); margin: 0 auto; color: var(--text); }
.bot-profile-back { margin-bottom: 18px; }
.bot-profile-hero { display: flex; align-items: center; gap: 20px; padding: 14px 2px 30px; border-bottom: 1px solid var(--border); }
.bot-profile-mark { display: grid; place-items: center; width: 112px; height: 112px; background: #050505; border: 1px solid var(--border); border-radius: 28px; box-shadow: 0 18px 40px rgba(0,0,0,.12); }
.bot-profile-mark .bot-avatar { width: 72px; height: 72px; flex-basis: 72px; border-radius: 22px; }
.bot-profile-hero h1 { margin: 0; font-size: clamp(30px, 5vw, 46px); line-height: 1; letter-spacing: -.04em; }
.bot-profile-hero p { margin: 9px 0 0; color: var(--text-muted); font-size: 15px; }
.bot-profile-stack { display: grid; gap: 14px; padding: 22px 0 50px; }
.bot-profile-section, .bot-profile-block { width: 100%; padding: 22px; color: var(--text); text-align: left; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 20px; box-shadow:0 10px 30px color-mix(in srgb,#000 5%,transparent); }
.bot-profile-section { display: flex; align-items: center; justify-content: space-between; gap: 18px; cursor: pointer; }
.bot-profile-section:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.bot-profile-section-copy { display: grid; gap: 6px; }
.bot-profile-section-copy strong, .bot-profile-block h2 { font-size: 17px; letter-spacing: -.01em; }
.bot-profile-section-copy > span, .bot-profile-block p { color: var(--text-muted); font-size: 13px; }
.bot-profile-section-action, .bot-source-link { color: var(--text); font-size: 12px; font-weight: 650; white-space: nowrap; }
.bot-profile-block-head, .bot-connector-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bot-profile-block h2, .bot-profile-block p { margin: 0; }
.bot-profile-block p { margin-top: 6px; }
.bot-profile-empty { padding: 28px 0 8px; color: var(--text-muted); font-size: 13px; text-align: center; }
.bot-connector-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 18px; }
.bot-connector-card { display: grid; min-height:132px; align-content:center; gap: 12px; padding: 20px; text-align:center; background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 20px; }
.bot-connector-heading { flex-direction:column; justify-content:center; }
.bot-added-state { padding: 5px 11px; color:var(--btn-primary-fg); background:var(--btn-primary-bg); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border:0; border-radius: 999px; }
.bot-connector-card .bot-source-link { justify-self:center; }
.bot-source-link { width: max-content; padding: 0; background: none; border: 0; border-bottom: 1px solid currentColor; cursor: pointer; }
.bot-instructions-editor { position: fixed; z-index: 80; inset: 0; display: flex; flex-direction: column; padding: 18px; color: var(--text); background: var(--bg); }
.bot-instructions-editor header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding-bottom: 16px; }
.bot-instructions-editor header > div { display: grid; gap: 2px; text-align: center; }
.bot-instructions-editor header > div span { color: var(--text-muted); font-size: 11px; }
.bot-instructions-editor header > .btn:last-child { justify-self: end; }
.bot-instructions-area { flex: 1; width: min(900px, 100%); margin: 0 auto; padding: clamp(18px, 4vw, 42px); resize: none; color: var(--text); font: 15px/1.7 var(--font-sans); background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; outline: 0; }
.bot-instructions-area:focus { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
@media (max-width: 600px) { .bot-profile-hero { align-items: flex-start; flex-direction: column; } .bot-profile-mark { width: 88px; height: 88px; } .bot-profile-section { align-items: flex-start; flex-direction: column; } .bot-instructions-editor { padding: 10px; } }

/* Structural accents */
.sb-row.active,
.icon-btn.active,
.review-file.active,
.popup-item.selected,
.model-row.selected,
.palette-row.selected,
.slash-row.active,
.effort-stop.on,
.appearance-theme-card[aria-pressed="true"] {
  color: var(--primary);
}

.sb-row.active {
  
}

.divider,
.md hr {
  background: var(--primary);
}

.msg-user {
  border-left: 0;
}

.md h1,
.md h2,
.md h3,
.md h4 {
  color: var(--md-heading);
}

a,
.md a {
  color: var(--md-link);
}

.md code {
  color: var(--md-code);
}

.md pre code {
  color: var(--text);
}

.md blockquote {
  color: var(--md-quote);
  border-left-color: var(--md-quote);
}

.steps-summary,
.step-text {
  color: var(--secondary);
}

.thinking-text {
  color: var(--text-muted);
  font-style: italic;
}

.model-chip,
.agent-chip,
.model-chip:hover,
.agent-chip:hover {
  color: var(--primary);
}

.panel-head {
  color: var(--text-2);
  
}

.panel-section + .panel-section {
  border-top-color: var(--border-subtle);
}

.composer:focus-within {
  border-color: var(--border);
  
}

.appearance-theme-card[aria-pressed="true"] {
  border-color: var(--primary);
  outline-color: color-mix(in srgb, var(--primary) 55%, transparent);
}

.review-diff-line.add {
  color: var(--diff-add);
  background: color-mix(in srgb, var(--diff-add) 14%, transparent);
}

.review-diff-line.del {
  color: var(--diff-del);
  background: color-mix(in srgb, var(--diff-del) 14%, transparent);
}

.review-status.added {
  color: var(--diff-add);
  background: color-mix(in srgb, var(--diff-add) 13%, transparent);
}

.review-status.deleted,
.review-status.conflict {
  color: var(--diff-del);
  background: color-mix(in srgb, var(--diff-del) 13%, transparent);
}

/* UN2 interaction polish: consistent pressed feedback, pending lock, and
   hit areas. Hover and focus-visible styles live beside each control. */
button:not(:disabled):active {
  filter: brightness(0.94);
}

button:disabled {
  cursor: default;
  opacity: 0.58;
}

.titlebar-text-btn,
.panel-close,
.access-chip,
.model-chip,
.agent-chip,
.plan-indicator,
.shortcut-edit,
.provider-device-cancel,
.composer-project {
  min-height: 28px;
}

.panel-close,
.review-mini-btn,
.attachment-remove {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
}

.steps-summary,
.toggle {
  min-height: 28px;
}

.app.booting #usageMeter {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .panel-tab,
  .panel-more,
  .panel-close,
  .panel-tab-menu-popup,
  .panel-tab-menu-item {
    transition: none;
    animation: none;
  }

  .skeleton-line,
  .toast {
    animation: none;
  }

  .spinner,
  .approval-spinner {
    opacity: 1;
    animation: none;
  }
}

.app.settings-mode > .panel { display: none; }
.run-feedback {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  width: 100%;
  max-width: calc(var(--thread-w) + 48px);
  margin: 0 auto;
  padding: 8px 24px;
  color: var(--text-muted);
  font-size: 12px;
}
.approval-attention-pill {
  position: sticky;
  bottom: 0;
  display: block;
  margin: 8px auto;
  border-radius: 999px;
  background: var(--bg-panel);
}
.appearance-view-control { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.appearance-view-option { position: relative; cursor: pointer; }
.appearance-view-option + .appearance-view-option { border-left: 1px solid var(--border); }
.appearance-view-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.appearance-view-option span { display: block; padding: 5px 12px; color: var(--text-2); }
.appearance-view-option input:checked + span { background: var(--bg-hover); color: var(--text); }
.appearance-view-option input:focus-visible + span { outline: 2px solid var(--text); outline-offset: -2px; }

/* A detected coding CLI (Claude Code, Codex, Copilot CLI, ...) opens as a plain
   binary: the chat is that program's own terminal, not an engine conversation.
   Every opened CLI chat keeps its own window; the inactive ones stay mounted and
   hidden so their program keeps running. */
.binary-cli-view {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 12px 14px 14px;
  background: var(--bg);
}
.binary-cli-window { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.cli-binary-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle, var(--border));
  border-bottom: 0;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
}
.cli-binary-logo {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  color: var(--text-2);
}
.cli-logo-openai { --provider-icon: url('/ui/img/providers/openai.svg'); }
.cli-logo-anthropic { --provider-icon: url('/ui/img/providers/anthropic.svg'); }
.cli-logo-google { --provider-icon: url('/ui/img/providers/google.svg'); }
.cli-logo-opencode { --provider-icon: url('/ui/img/providers/opencode.svg'); }
.cli-logo-github-copilot { --provider-icon: url('/ui/img/providers/github-copilot.svg'); }
.cli-logo-fallback { --provider-icon: url('/ui/img/providers/fallback.svg'); }
.cli-binary-heading { min-width: 0; flex: 1; }
.cli-binary-titleline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cli-binary-title {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cli-binary-folder {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 42%;
  padding: 1px 7px;
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: var(--bg-element);
  border-radius: var(--radius-s);
}
.cli-binary-folder .ic-wrap { flex: 0 0 auto; display: inline-flex; }
.cli-binary-badge,
.sb-binary-tag,
.cli-binary-tag {
  flex: 0 0 auto;
  padding: 0 6px;
  border: 1px solid var(--border-subtle, var(--border));
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  text-transform: lowercase;
}
.cli-binary-subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.cli-binary-notice {
  margin: 6px 0 0;
  padding: 4px 8px;
  border-left: 2px solid var(--border-subtle, var(--border));
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}
.cli-binary-notice[hidden] { display: none; }
.cli-binary-head-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.cli-binary-status { color: var(--text-muted); font-size: 12px; }
/* The padded box draws the frame; the inner box is what the fit addon measures,
   so its padding cannot push the terminal past the panel. */
.cli-binary-term {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 10px 12px 12px;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle, var(--border));
  border-radius: 0 0 var(--radius-l) var(--radius-l);
}
.cli-binary-terminal { flex: 1; min-width: 0; min-height: 0; }
.cli-binary-terminal .xterm { height: 100%; }
.cli-binary-error { max-width: 520px; margin: 32px auto; color: var(--text); font-size: 13px; line-height: 1.5; text-align: left; }
.cli-binary-error-detail { color: var(--text-muted); font-size: 12px; overflow-wrap: anywhere; }
.sb-binary-logo {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  color: var(--text-2);
}
.sb-row-chat .sb-binary-tag { margin-left: 2px; }
/* A CLI row carries the logo plus a small state badge, the title, and a second
   line with the branch and folder. The row still uses the sidebar's own row
   styles; only these additions are binary-specific. */
.sb-binary-logo-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}
.sb-binary-logo-wrap .sb-binary-logo { width: 16px; height: 16px; }
.sb-row-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 1px; min-width: 0; }
.sb-row-body .sb-row-text { flex: 0 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sb-row-chat.is-binary .sb-row-body .sb-row-text { flex: 0 0 auto; }
.sb-row-detail {
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sb-row-chat.is-binary { min-height: 38px; padding-top: 4px; padding-bottom: 4px; }
.sb-binary-status {
  position: absolute;
  right: -5px;
  bottom: -4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 11px;
  height: 11px;
  color: var(--text-muted);
  background: var(--bg-panel);
  border-radius: 50%;
}
.sb-binary-status svg { width: 8px; height: 8px; }
.sb-binary-status .spinner { width: 7px; height: 7px; }
.sb-binary-status.is-running { color: var(--info); }
.sb-binary-status.is-exited { color: var(--success); }
.sb-binary-status.is-failed { color: var(--error); }

/* The start panel is the new-binary-chat screen: recent folders, detected
   CLIs and recent chats, all local. It reuses the sidebar row styles. */
.binary-cli-start {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
}
.binary-cli-start[hidden] { display: none; }
.binary-cli-start-inner {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 28px 48px;
}
.bc-start-head { display: flex; flex-direction: column; gap: 4px; }
.bc-start-title { margin: 0; color: var(--text); font-size: 22px; font-weight: 650; line-height: 1.2; }
.bc-start-sub { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.bc-start-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 4px; }
.bc-start-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle, var(--border));
  border-radius: 999px;
  cursor: pointer;
}
.bc-start-tool:hover { color: var(--text); background: var(--bg-hover); }
.bc-start-tool.is-active { color: var(--text); background: var(--bg-active); border-color: var(--border-active); }
.bc-start-tool .provider-logo-mark { width: 15px; height: 15px; flex: 0 0 15px; }
.bc-start-tools-loading,
.bc-start-tools-empty { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.bc-start-card {
  margin-top: 16px;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle, var(--border));
  border-radius: var(--radius-l);
}
.bc-start-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle, var(--border));
}
.bc-start-search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 10px;
  color: var(--text-muted);
  background: var(--bg-element);
  border: 1px solid transparent;
  border-radius: var(--radius-s);
}
.bc-start-search:focus-within { border-color: var(--border-active); }
.bc-start-search-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  background: transparent;
  border: 0;
  outline: none;
}
.bc-start-new { flex: 0 0 auto; }
.bc-start-section { padding: 10px 8px 12px; }
.bc-start-section + .bc-start-section { border-top: 1px solid var(--border-subtle, var(--border)); }
.bc-start-section-head { display: flex; align-items: center; gap: 8px; padding: 0 8px 4px; }
.bc-start-label {
  margin: 0;
  padding: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bc-start-section-head .bc-start-label { flex: 1; min-width: 0; }
.bc-start-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--border-subtle, var(--border));
  border-radius: var(--radius-s);
  cursor: pointer;
}
.bc-start-add:hover { color: var(--text); background: var(--bg-hover); }
.bc-start-row { gap: 10px; padding: 5px 8px; border-radius: var(--radius-s); }
.bc-start-row:disabled { opacity: 0.55; cursor: default; }
.bc-start-row .sb-row-info { min-width: 0; }
.bc-start-empty { padding: 4px 8px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }

/* Owned dino artwork keeps the existing avatar slots and profile dimensions. */
picture.bot-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
