/* hoube.ai theme for the Omnigent web UI: the quiet navy look.
   Cool blue-grey neutrals, one navy accent (light blue at night), Geist for
   text and Geist Mono for code. Surfaces are flat and split by 1px hairlines;
   only floating layers (menus, dialogs, tooltips, the composer) cast a shadow.
   Restyles Omnigent's default theme (no data-theme attribute) only, so anyone
   who picks another built-in theme in Settings still gets it.
   Loaded after Omnigent's own stylesheet; selectors match or beat its
   specificity so these values win. The palette is duplicated in
   hoube-dashboard/app/static/console.css and config/user_context_page.html. */

/* ── type (every theme) ─────────────────────────────────────────── */
html:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: "Geist Mono", "Geist Mono Variable", ui-monospace, monospace;
}

/* ── light ─────────────────────────────────────────────────────── */
:root:not(.dark):not([data-theme]) {
  --background: #F5F6F9;
  --foreground: #0E1325;
  --card: #FFFFFF;
  --card-solid: #FFFFFF;
  --card-foreground: #0E1325;
  --tray: #FFFFFF;
  --popover: #FFFFFF;
  --popover-foreground: #0E1325;
  --primary: #16244A;
  --primary-foreground: #FFFFFF;
  --link: #3A5E9C;
  --selection-background: rgba(58, 94, 156, .18);
  --selection-foreground: #0E1325;
  --secondary: #EEF0F5;
  --secondary-foreground: #0E1325;
  --muted: rgba(22, 36, 74, .05);
  --muted-foreground: #5A6380;
  --code-bg: rgba(22, 36, 74, .05);
  --accent: #E5E8F0;
  --accent-foreground: #0E1325;
  --border: #E1E4EC;
  --border-strong: #B5BCCD;
  --button-border: #E1E4EC;
  --input: #E1E4EC;
  --ring: #3A5E9C;
  --brand-accent: #3A5E9C;
  --sidebar: #EEF0F5;
  --sidebar-foreground: #0E1325;
  --sidebar-primary: #16244A;
  --sidebar-primary-foreground: #FFFFFF;
  --sidebar-accent: #E5E8F0;
  --sidebar-accent-foreground: #0E1325;
  --sidebar-border: #E1E4EC;
  --sidebar-ring: #3A5E9C;
  --sidebar-active: #E5E8F0;
  --sidebar-active-foreground: #0E1325;

  --foreground-tertiary: #646D8A;
  --border-weak: #ECEEF3;
  --button-icon-hover-color: #0E1325;
  --tag-pink: rgba(22, 36, 74, .05);
  --destructive: #A3423B;
  --destructive-foreground: #FFFFFF;
  --success: #3D6B52;
  --warning: #8F6420;
  --info: #3A5E9C;
  --session-active: #3A5E9C;
  --status-blue: #3A5E9C;
  --status-green: #3D6B52;
  --status-yellow: #8F6420;
  --status-red: #A3423B;
  --status-gray: #646D8A;
  --chart-1: #4972B5;
  --chart-2: #16244A;
  --chart-3: #C3CFE4;
  --chart-4: #253F7E;
  --chart-5: #848CA3;
  --radius: 10px;
  --radius-otto-button: 8px;
  --ui-shadow-neutral-rgb: 14 19 37;
  --ui-shadow-warm-rgb: 14 19 37;
  --onboarding-wizard-background: #F5F6F9;
  --onboarding-modal-border: #E1E4EC;
  --onboarding-modal-shadow: 0 24px 64px -24px rgba(0, 0, 0, .45);
  --composer-shadow: 0 16px 40px -24px rgba(14, 19, 37, .30);
  --composer-shadow-focus: 0 20px 48px -24px rgba(14, 19, 37, .42);

  /* hoube's own roles (design.md §3.1) for what Omnigent has no variable for */
  --hb-text-2: #4A5470;
  --hb-line-soft: #ECEEF3;
  --hb-line-hover: #CDD2DE;
  --hb-line-strong: #B5BCCD;
  --hb-composer: #FFFFFF;
  --hb-composer-chip: var(--secondary);
  --hb-composer-chip-hover: var(--accent);
  --hb-primary-hover: #1F3160;
  --hb-code-tint: rgba(22, 36, 74, .05);
  --hb-tip-bg: #0E1325;
  --hb-tip-text: #F5F6F9;
  --hb-shadow: 0 8px 24px -12px rgba(14, 19, 37, .18);
  --hb-shadow-pop: 0 20px 48px -24px rgba(0, 0, 0, .45);
  --hb-shadow-dialog: 0 24px 64px -24px rgba(0, 0, 0, .45);
  --hb-scrim: rgba(5, 7, 15, .55);
}

/* ── night ─────────────────────────────────────────────────────── */
.dark:not([data-theme]) {
  --background: #05070F;
  --foreground: #EEF1F8;
  --card: #0A1024;
  --card-solid: #0A1024;
  --card-foreground: #EEF1F8;
  --tray: #0A1024;
  --popover: #0A1024;
  --popover-foreground: #EEF1F8;
  --primary: #8FB0E8;
  --primary-foreground: #05070F;
  --link: #8FB0E8;
  --selection-background: rgba(143, 176, 232, .28);
  --selection-foreground: #EEF1F8;
  --secondary: #121A33;
  --secondary-foreground: #EEF1F8;
  --muted: #121A33;
  --muted-foreground: #9AA3BA;
  --code-bg: #070B19;
  --accent: #121A33;
  --accent-foreground: #EEF1F8;
  --border: #1A2138;
  --border-strong: #323C5A;
  --button-border: #1A2138;
  --input: #1A2138;
  --ring: #8FB0E8;
  --brand-accent: #8FB0E8;
  --sidebar: #070B19;
  --sidebar-foreground: #EEF1F8;
  --sidebar-primary: #8FB0E8;
  --sidebar-primary-foreground: #05070F;
  --sidebar-accent: #121A33;
  --sidebar-accent-foreground: #EEF1F8;
  --sidebar-border: #1A2138;
  --sidebar-ring: #8FB0E8;
  --sidebar-active: #121A33;
  --sidebar-active-foreground: #EEF1F8;

  --foreground-tertiary: #8790A8;
  --border-weak: #11172B;
  --button-icon-hover-color: #EEF1F8;
  --tag-pink: rgba(143, 176, 232, .10);
  --destructive: #E08A82;
  --destructive-foreground: #05070F;
  --success: #8CC2A4;
  --warning: #D6AE6E;
  --info: #8FB0E8;
  --session-active: #8FB0E8;
  --status-blue: #8FB0E8;
  --status-green: #8CC2A4;
  --status-yellow: #D6AE6E;
  --status-red: #E08A82;
  --status-gray: #8790A8;
  --chart-1: #8FB0E8;
  --chart-2: #4972B5;
  --chart-3: #26386A;
  --chart-4: #C5D6F5;
  --chart-5: #5A6587;
  --tooltip-bg: #121A33;
  --ui-shadow-neutral-rgb: 0 0 0;
  --ui-shadow-warm-rgb: 0 0 0;
  --onboarding-wizard-background: #05070F;
  --onboarding-modal-border: #1A2138;
  --composer-shadow: 0 28px 56px -28px rgba(0, 0, 0, .7);
  --composer-shadow-focus: 0 32px 64px -28px rgba(0, 0, 0, .85);

  --hb-text-2: #BCC3D4;
  --hb-line-soft: rgba(238, 241, 248, .08);
  --hb-line-hover: rgba(238, 241, 248, .13);
  --hb-line-strong: rgba(238, 241, 248, .18);
  --hb-composer: rgba(18, 26, 51, .82);
  /* --chip is the panel's own Night fill, so the pills step up a tint */
  --hb-composer-chip: rgba(238, 241, 248, .06);
  --hb-composer-chip-hover: rgba(238, 241, 248, .11);
  --hb-primary-hover: #A5C0EE;
  --hb-code-tint: #070B19;
  --hb-tip-bg: #EEF1F8;
  --hb-tip-text: #05070F;
  --hb-shadow: 0 12px 32px -16px rgba(0, 0, 0, .6);
  --hb-shadow-pop: 0 20px 48px -24px rgba(0, 0, 0, .45);
  --hb-shadow-dialog: 0 24px 64px -24px rgba(0, 0, 0, .45);
  --hb-scrim: rgba(5, 7, 15, .55);
}

/* ── base ──────────────────────────────────────────────────────── */
html:not([data-theme]) body {
  -webkit-font-smoothing: antialiased;
}
html:not([data-theme]) .font-heading {
  font-weight: 600;
  letter-spacing: -.015em;
}
html:not([data-theme]) [data-testid="new-chat-landing"] h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.25;
  text-wrap: balance;
}
html:not([data-theme]) :focus-visible {
  outline-color: var(--ring);
}

/* ── shell: one flat fill per surface, no washes ───────────────── */
:root:not(.dark):not([data-theme]) .app-shell,
.dark:not([data-theme]) .app-shell {
  background: var(--background);
}
:root:not(.dark):not([data-theme]) .conversations-sidebar:not(.is-peek),
.dark:not([data-theme]) .conversations-sidebar:not(.is-peek) {
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: none;
}
html:not([data-theme]) .conversations-sidebar .sidebar-row[aria-current="page"],
html:not([data-theme]) .conversations-sidebar .sidebar-row.sidebar-active {
  font-weight: 500;
}

/* The header Share button: flat primary, no gloss. */
html:not([data-theme]) .share-button-glassy,
html:not([data-theme]) .share-button-glassy:hover {
  color: var(--primary-foreground);
  background: var(--primary);
  border: none;
  box-shadow: none;
}
html:not([data-theme]) .share-button-glassy:hover {
  opacity: .9;
}

/* ── composer (new chat and in chat) ───────────────────────────── */
html:not([data-theme]) .composer-reference-surface {
  background: var(--hb-composer);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--composer-shadow);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.dark:not([data-theme]) .composer-reference-surface,
.dark:not([data-theme]) .composer-workspace-surface {
  border-color: var(--hb-line-soft);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}
/* The workspace tray shares the panel, split from it by a soft hairline.
   (html:root beats Omnigent's :root:not(.dark) tray gradient.) */
html:root:not([data-theme]) .composer-workspace-surface {
  margin-inline: 0;
  background: var(--hb-composer);
  border-color: var(--border);
  border-radius: 20px 20px 0 0;
  transition: border-color .18s ease;
}
html:not([data-theme]) :is(.chat-composer-form, [data-testid="new-chat-landing-composer-surface"]):hover :is(.composer-reference-surface, .composer-workspace-surface) {
  border-color: var(--hb-line-hover);
}
html:not([data-theme]) :is(.chat-composer-form, [data-testid="new-chat-landing-composer-surface"]):focus-within :is(.composer-reference-surface, .composer-workspace-surface) {
  border-color: var(--hb-line-strong);
}
html:not([data-theme]) :is(.chat-composer-form, [data-testid="new-chat-landing-composer-surface"]):is(:hover, :focus-within) .composer-reference-surface {
  box-shadow: var(--composer-shadow-focus);
}
html:not([data-theme]) :is(.chat-composer-form, [data-testid="new-chat-landing-composer-surface"]):has(.composer-workspace-surface) .composer-reference-surface {
  border-top-color: var(--hb-line-soft);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
html:not([data-theme]) .composer-input-text textarea,
html:not([data-theme]) textarea.composer-input-text {
  font-size: 16px;
  line-height: 1.55;
}

/* Every control in the composer is a 32px pill on the chip fill. */
html:not([data-theme]) :is(
  [data-testid="composer-attach"], [data-testid="new-chat-landing-attach"],
  [data-testid="composer-host-select"], [data-testid="new-chat-landing-host-chip"],
  [data-testid="new-chat-landing-permission-chip"],
  [data-testid="composer-config-gear"], [data-testid="new-chat-landing-agent-select"],
  :is([data-testid="composer-action-row"], [data-testid="new-chat-landing-actions"]) button[aria-label="Voice dictation"]
) {
  min-height: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 999px;
  background: var(--hb-composer-chip);
  color: var(--secondary-foreground);
  transition: background-color .15s ease, color .15s ease;
}
html:not([data-theme]) :is([data-testid="composer-attach"], [data-testid="new-chat-landing-attach"], [data-testid="composer-action-row"] button[aria-label="Voice dictation"], [data-testid="new-chat-landing-actions"] button[aria-label="Voice dictation"]) {
  width: 32px;
}
html:not([data-theme]) :is(
  [data-testid="composer-attach"], [data-testid="new-chat-landing-attach"],
  [data-testid="composer-host-select"], [data-testid="new-chat-landing-host-chip"],
  [data-testid="new-chat-landing-permission-chip"],
  [data-testid="composer-config-gear"], [data-testid="new-chat-landing-agent-select"],
  :is([data-testid="composer-action-row"], [data-testid="new-chat-landing-actions"]) button[aria-label="Voice dictation"]
):is(:hover, [data-state="open"], [aria-expanded="true"]) {
  background: var(--hb-composer-chip-hover);
  color: var(--foreground);
}
html:not([data-theme]) :is([data-testid="composer-action-row"], [data-testid="new-chat-landing-actions"]) :is([data-testid="composer-host-select"], [data-testid="new-chat-landing-host-chip"]) {
  padding: 0 8px 0 6px;
  width: auto;
}
/* Let the right-hand group give way on phones so the picker label truncates
   instead of pushing send out of the panel (stock Omnigent overflows here). */
html:not([data-theme]) :is([data-testid="new-chat-landing-right-controls"], [data-testid="composer-action-row"] > div:last-child) {
  flex-shrink: 1;
  min-width: 0;
}
html:not([data-theme]) :is([data-testid="composer-config-gear"], [data-testid="new-chat-landing-agent-select"]) {
  min-width: 0;
}
html:not([data-theme]) [data-testid="composer-config-gear"] *,
html:not([data-theme]) [data-testid="new-chat-landing-agent-select"] * {
  color: inherit;
}

/* Send: a small round navy button, never a slab. Interrupt turns it red. */
html:not([data-theme]) :is([data-testid="new-chat-landing-submit"], [data-testid="composer-action-row"] button[type="submit"]) {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border-color: transparent;
  background: var(--primary);
  color: var(--primary-foreground);
  opacity: 1;
  transition: background-color .15s ease;
}
html:not([data-theme]) :is([data-testid="new-chat-landing-submit"], [data-testid="composer-action-row"] button[type="submit"]):hover {
  background: var(--hb-primary-hover);
  opacity: 1;
}
html:not([data-theme]) :is([data-testid="new-chat-landing-submit"], [data-testid="composer-action-row"] button[type="submit"]):disabled {
  background: var(--hb-composer-chip);
  color: var(--foreground-tertiary);
}
html:not([data-theme]) [data-testid="composer-action-row"] button[aria-label="Interrupt"],
html:not([data-theme]) [data-testid="composer-action-row"] button[aria-label="Interrupt"]:hover {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
@media (max-width: 767px) {
  html:not([data-theme]) :is([data-testid="new-chat-landing-submit"], [data-testid="composer-action-row"] button[type="submit"]) {
    width: 36px;
    height: 36px;
  }
}

/* ── messages ──────────────────────────────────────────────────── */
/* The person's message: a soft chip fill, no ring. The assistant's text sits
   on the page with no bubble (Omnigent's default). */
html:not([data-theme]) [data-testid="message-bubble"].is-user [class*="group-[.is-user]:bg-muted"] {
  background: var(--secondary);
  border-radius: 12px;
  box-shadow: none;
}

/* Code and table blocks: one hairline frame, a 36px header, the body on a
   faint tint. Omnigent's second, inner box is flattened away. */
html:not([data-theme]) :is([data-streamdown="code-block"], [data-streamdown="table-wrapper"]) {
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
html:not([data-theme]) [data-streamdown="code-block-header"] {
  height: 36px;
  padding: 0 12px 0 13px;
  border-bottom: 1px solid var(--hb-line-soft);
  font: 500 12px/1 var(--font-mono);
}
html:not([data-theme]) [data-streamdown="code-block"] > .sticky {
  height: 36px;
  margin-top: -36px;
  padding-right: 4px;
}
html:not([data-theme]) [data-streamdown="code-block-actions"] {
  gap: 2px;
  padding: 0;
  background: transparent;
  border: 0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html:not([data-theme]) [data-streamdown="code-block-body"] {
  padding: 14px 16px;
  background: var(--hb-code-tint);
  border: 0;
  border-radius: 0;
  font: 400 12.5px/1.6 var(--font-mono);
}
html:not([data-theme]) [data-streamdown="table-wrapper"] > :first-child {
  min-height: 36px;
  padding: 0 4px;
  border-bottom: 1px solid var(--hb-line-soft);
}
/* Omnigent's own wrap and copy buttons float over the header: seat them in
   the 36px row, beside streamdown's download button. */
html:not([data-theme]) .chat-code-block > div:not([data-streamdown]) {
  top: 0;
  right: 35px;
  margin-right: 0;
  gap: 2px;
}
html:not([data-theme]) :is([data-streamdown="code-block"], [data-streamdown="table-wrapper"], .chat-code-block > div:not([data-streamdown])) button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  transition: background-color .15s ease, color .15s ease;
}
html:not([data-theme]) :is([data-streamdown="code-block"], [data-streamdown="table-wrapper"], .chat-code-block > div:not([data-streamdown])) button:hover {
  background: var(--accent);
}
html:not([data-theme]) [data-streamdown="table-wrapper"] > :last-child {
  background: transparent;
  border: 0;
  border-radius: 0;
}
html:not([data-theme]) [data-streamdown="table-wrapper"] :is(table, thead, tbody, tr) {
  border-color: var(--hb-line-soft);
}
html:not([data-theme]) [data-streamdown="table-header"] {
  background: transparent;
  border-bottom: 1px solid var(--border);
}
html:not([data-theme]) [data-streamdown="table-wrapper"] th {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
}
html:not([data-theme]) [data-streamdown="table-wrapper"] :is(th, td) {
  font-variant-numeric: tabular-nums;
}

/* ── floating layers ───────────────────────────────────────────── */
html:not([data-theme]) :is([data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-sub-content"], [data-slot="context-menu-content"], [data-slot="select-content"], [data-slot="popover-content"]) {
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--hb-shadow-pop);
}
html:not([data-theme]) .shadow-menu {
  --tw-shadow: var(--hb-shadow-pop);
}
html:not([data-theme]) [data-slot="dropdown-menu-item"] {
  border-radius: 8px;
}
html:not([data-theme]) [data-slot="dialog-content"] {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--hb-shadow-dialog);
}
html:not([data-theme]) .shadow-dialog {
  --tw-shadow: var(--hb-shadow-dialog);
}
html:not([data-theme]) [data-slot="dialog-overlay"] {
  background: var(--hb-scrim);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html:not([data-theme]) [data-slot="tooltip-content"] {
  background: var(--hb-tip-bg);
  color: var(--hb-tip-text);
  border-radius: 6px;
  box-shadow: var(--hb-shadow);
}

/* ── hoube's consent dialog (apply_theme.py CONTEXT_SCRIPT) ─────
   hoube's own element, so it is styled under every theme, from the
   variables each Omnigent theme defines. */
.hb-consent {
  position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(5, 7, 15, .55); animation: hb-fade .16s ease-out;
}
.hb-consent-card {
  width: 100%; max-width: 480px; padding: 24px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--card-solid); color: var(--card-foreground); box-shadow: 0 24px 64px -24px rgba(0, 0, 0, .45);
  font: 400 14px/1.55 var(--font-sans); animation: hb-rise .16s ease-out;
}
.hb-consent-card h2 { margin: 0 0 8px; font: 600 18px/1.3 var(--font-sans); letter-spacing: -.01em; }
.hb-consent-card p { margin: 0 0 20px; color: var(--hb-text-2, var(--muted-foreground)); }
.hb-consent-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hb-consent-actions a { margin-left: auto; color: var(--link, var(--primary)); font-size: 13px; }
.hb-consent-actions a:hover { color: var(--foreground); }
.hb-consent-btn {
  min-height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  background: var(--card-solid); color: var(--foreground); font: 500 13px/1 var(--font-sans);
  transition: background-color .15s ease, opacity .15s ease;
}
.hb-consent-btn:hover { background: var(--accent); }
.hb-consent-btn.primary { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
.hb-consent-btn.primary:hover { opacity: .9; }
.hb-consent-btn:disabled { opacity: .5; cursor: not-allowed; }
.hb-consent :focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@keyframes hb-fade { from { opacity: 0; } }
@keyframes hb-rise { from { opacity: 0; transform: translateY(6px) scale(.99); } }

/* ── hoube's account menu (apply_theme.py CONTEXT_SCRIPT) ───────
   The sidebar foot, like Mission Control's: who you are, and a menu that
   opens upward over it. Styled under every theme, like the consent dialog. */
.hb-account { position: relative; flex-shrink: 0; padding: 8px; border-top: 1px solid var(--sidebar-border, var(--border)); }
.hb-account-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--sidebar-foreground, var(--foreground)); font: 400 13px/1.2 var(--font-sans); text-align: left; cursor: pointer;
  transition: background-color .12s ease;
}
.hb-account-btn:hover, .hb-account-btn[aria-expanded="true"] { background: var(--sidebar-accent, var(--accent)); }
.hb-account-btn > .hb-icon { flex-shrink: 0; margin-left: auto; color: var(--muted-foreground); }
.hb-avatar {
  display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: var(--primary-foreground); font: 600 13px/1 var(--font-sans);
}
.hb-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hb-who-name { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.hb-who-role { font-size: 11px; color: var(--hb-text-2, var(--muted-foreground)); }
.hb-menu {
  position: absolute; left: 8px; right: 8px; bottom: calc(100% - 4px); z-index: 20; display: flex; flex-direction: column; gap: 2px; padding: 6px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--popover); color: var(--popover-foreground);
  box-shadow: var(--hb-shadow-pop, 0 20px 48px -24px rgba(0, 0, 0, .45)); animation: hb-rise .14s ease-out;
}
.hb-menu[hidden] { display: none; }
.hb-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: inherit; font: 400 13px/1 var(--font-sans); text-align: left; text-decoration: none; cursor: pointer;
}
.hb-menu-item:hover { background: var(--accent); color: var(--accent-foreground); }
.hb-menu-item .hb-icon { flex-shrink: 0; color: var(--muted-foreground); }
.hb-menu-item:hover .hb-icon { color: var(--hb-text-2, var(--accent-foreground)); }
.hb-menu-item .hb-icon:last-child:not(:first-child) { margin-left: auto; }
.hb-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; padding: 0 4px 0 8px; font: 400 13px/1 var(--font-sans); }
.hb-menu-sep { height: 1px; margin: 3px 4px; background: var(--border); }
.hb-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--muted); }
.hb-seg button {
  display: inline-grid; place-items: center; min-height: 28px; padding: 0 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted-foreground); cursor: pointer; transition: color .12s ease;
}
.hb-seg button:hover { color: var(--foreground); }
.hb-seg button[aria-checked="true"] { background: var(--popover); color: var(--foreground); box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }
.hb-account :focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
/* Settings lives in the menu, so Omnigent's own gears go while it is there. */
body:has(.hb-account) :is([data-testid="settings-button"], [data-testid="sidebar-settings-float"]) { display: none; }
@media (max-width: 767px) {
  .hb-menu-item { min-height: 44px; }
  .hb-seg button { min-width: 40px; min-height: 36px; }
}

/* ── sign-in form (apply_theme.py LOGIN_FORM_HOUBE) ──────────────
   The password and Sign in arrive once a username is typed; "or" sits on a
   hairline between the form and Single sign-on. Under every theme. */
.hb-reveal { animation: hb-rise .18s ease-out; }
/* Anchored, not centred: what appears grows downward and the username field stays under the cursor. */
.min-h-screen:has(#login-username) { align-items: flex-start; padding-top: calc(var(--omnigent-safe-top, 0px) + max(48px, 50vh - 130px)) !important; } /* over the page's inline safe-area padding */
.hb-or { display: flex; align-items: center; gap: 12px; color: var(--muted-foreground); font: 400 13px/1 var(--font-sans); }
.hb-or::before, .hb-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ── Mission Control window (apply_theme.py CONTEXT_SCRIPT) ──────
   A window over the chat with Mission Control framed inside; .is-full takes
   the whole screen. Styled under every theme, like the consent dialog. */
.hb-mcw {
  position: fixed; inset: 0; z-index: 2147482000; display: flex; align-items: center; justify-content: center; padding: 32px;
  background: var(--hb-scrim, rgba(5, 7, 15, .55)); animation: hb-fade .16s ease-out;
}
.hb-mcw[hidden] { display: none; }
.hb-mcw-win {
  display: flex; flex-direction: column; width: min(1280px, 100%); height: min(860px, 100%); overflow: hidden;
  border: 1px solid var(--border); border-radius: 14px; background: var(--background); color: var(--foreground);
  box-shadow: var(--hb-shadow-dialog, 0 24px 64px -24px rgba(0, 0, 0, .45)); animation: hb-rise .16s ease-out;
}
.hb-mcw.is-full { padding: 0; }
.hb-mcw.is-full .hb-mcw-win { width: 100%; height: 100%; border: 0; border-radius: 0; }
.hb-mcw-bar {
  display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; height: 44px; padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--border); background: var(--card-solid, var(--card)); user-select: none;
}
.hb-mcw-title { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font: 600 14px/1 var(--font-sans); letter-spacing: -.005em; }
.hb-mcw-title .hb-icon { flex-shrink: 0; color: var(--muted-foreground); }
.hb-mcw-actions { display: flex; gap: 2px; }
.hb-mcw-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted-foreground); cursor: pointer; transition: background-color .12s ease, color .12s ease;
}
.hb-mcw-btn:hover { background: var(--accent); color: var(--accent-foreground); }
.hb-mcw-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.hb-mcw-body { position: relative; flex: 1; min-height: 0; background: var(--background); }
.hb-mcw-body iframe { display: block; width: 100%; height: 100%; border: 0; }
.hb-mcw-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted-foreground); font: 400 13px/1 var(--font-sans); pointer-events: none;
}
.hb-mcw-loading[hidden] { display: none; }
.hb-spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--muted-foreground); border-radius: 50%; animation: hb-spin .8s linear infinite; }
@keyframes hb-spin { to { transform: rotate(360deg); } }
@media (max-width: 767px) {
  .hb-mcw { padding: 0; }
  .hb-mcw-win { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .hb-mcw-size { display: none; }
  .hb-mcw-btn { width: 44px; height: 44px; }
}

/* ── chain of thought chart (apply_theme.py THOUGHTS_SCRIPT) ─────
   Mission Control's window holding a pannable canvas: a dot grid, one column
   of step cards per turn joined by hairline connectors, zoom controls and a
   legend floating at the foot, and the chosen step in full on the right.
   One hue per kind of step, shown as the card's badge and its left rule. */
.hb-cotw {
  --cot-prompt: #3A5E9C; --cot-think: #7357C2; --cot-tool: #4A5470; --cot-web: #1F7A8C;
  --cot-answer: #1F8A5B; --cot-route: #A0660F; --cot-error: #C2412D; --cot-compact: #6B7280;
}
.dark .hb-cotw {
  --cot-prompt: #8FB0E8; --cot-think: #B7A2F2; --cot-tool: #A9B2C8; --cot-web: #6CC6D6;
  --cot-answer: #66CC9E; --cot-route: #E3B062; --cot-error: #F08A78; --cot-compact: #9AA3BA;
}
.hb-cotw .kind-prompt { --k: var(--cot-prompt); }
.hb-cotw .kind-think { --k: var(--cot-think); }
.hb-cotw .kind-tool { --k: var(--cot-tool); }
.hb-cotw .kind-web { --k: var(--cot-web); }
.hb-cotw .kind-answer { --k: var(--cot-answer); }
.hb-cotw .kind-route { --k: var(--cot-route); }
.hb-cotw .kind-error { --k: var(--cot-error); }
.hb-cotw .kind-compact { --k: var(--cot-compact); }
.hb-cot-body { display: flex; overflow: hidden; font-family: var(--font-sans); }
.hb-cot-stage {
  position: relative; flex: 1; min-width: 0; overflow: hidden; cursor: grab; touch-action: none; outline: none;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--muted-foreground) 32%, transparent) 1px, transparent 1.2px);
}
.hb-cot-stage.is-dragging { cursor: grabbing; }
.hb-cot-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }
.hb-cot-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.hb-cot-edges { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.hb-cot-edge { fill: none; stroke: var(--border-strong, var(--border)); stroke-width: 1.5; }
.hb-cot-edge.is-link { stroke-dasharray: 4 5; }
.hb-cot-turn { position: absolute; display: flex; align-items: baseline; gap: 8px; height: 26px; white-space: nowrap; overflow: hidden; }
.hb-cot-turn-n { font: 600 13px/1 var(--font-sans); color: var(--foreground); }
.hb-cot-turn-meta { overflow: hidden; text-overflow: ellipsis; font: 400 12px/1 var(--font-sans); color: var(--muted-foreground); }
.hb-cot-node {
  position: absolute; display: flex; flex-direction: column; gap: 5px; padding: 10px 12px 10px 14px; overflow: hidden; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card-solid, var(--card)); color: var(--foreground);
  box-shadow: inset 3px 0 0 var(--k); transition: border-color .12s ease, box-shadow .12s ease;
}
.hb-cot-node:hover { border-color: var(--border-strong, var(--border)); }
.hb-cot-node:focus-visible, .hb-cot-node.is-selected { outline: 2px solid var(--ring); outline-offset: 1px; }
.hb-cot-node-text {
  display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  font: 400 12.5px/1.4 var(--font-sans); color: var(--foreground);
}
.hb-cot-node.is-quiet .hb-cot-node-text { font-style: italic; color: var(--muted-foreground); }
.hb-cot-node.is-failed { border-color: color-mix(in srgb, var(--cot-error) 55%, var(--border)); }
.hb-cot-node-top { display: flex; align-items: center; gap: 7px; min-width: 0; font: 500 11.5px/1 var(--font-sans); color: var(--muted-foreground); }
.hb-cot-node-kind { color: var(--k); }
.hb-cot-node-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.hb-cot-badge {
  display: inline-grid; flex-shrink: 0; place-items: center; width: 20px; height: 20px; border-radius: 6px;
  background: color-mix(in srgb, var(--k) 15%, transparent); color: var(--k);
}
.hb-cot-node-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 13px/1.25 var(--font-sans); }
.hb-cot-node-line { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 400 12px/1.3 var(--font-sans); color: var(--muted-foreground); }
.hb-cot-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; }
.hb-cot-dot.is-running { background: var(--cot-route); animation: hb-pulse 1.2s ease-in-out infinite; }
.hb-cot-dot.is-failed { background: var(--cot-error); }
@keyframes hb-pulse { 50% { opacity: .35; } }
.hb-cot-status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px;
  text-align: center; color: var(--muted-foreground); font: 400 13px/1.4 var(--font-sans); background: var(--background);
}
.hb-cot-status[hidden] { display: none; }
.hb-cot-status.is-note { inset: 12px auto auto 50%; transform: translateX(-50%); padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card-solid, var(--card)); }
.hb-cot-retry { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card-solid, var(--card)); color: var(--foreground); font: 500 13px/1 var(--font-sans); cursor: pointer; }
.hb-cot-tools, .hb-cot-legend {
  position: absolute; bottom: 14px; display: flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card-solid, var(--card));
  box-shadow: var(--hb-shadow-menu, 0 8px 24px -12px rgba(0, 0, 0, .3));
}
.hb-cot-tools { left: 14px; }
.hb-cot-zoom { min-width: 44px; text-align: center; font: 500 12px/1 var(--font-sans); font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.hb-cot-legend { left: 50%; transform: translateX(-50%); gap: 14px; padding: 8px 12px; font: 400 12px/1 var(--font-sans); color: var(--muted-foreground); pointer-events: none; }
.hb-cot-body:has(.hb-cot-panel:not([hidden])) .hb-cot-legend { left: calc(50% - 190px); }
.hb-cot-legend-i { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.hb-cot-swatch { width: 8px; height: 8px; border-radius: 2px; background: var(--k); }
.hb-cot-panel {
  position: relative; display: flex; flex-direction: column; flex-shrink: 0; width: 380px; overflow-y: auto; padding: 0 16px 20px;
  border-left: 1px solid var(--border); background: var(--card-solid, var(--card)); color: var(--foreground);
}
.hb-cot-panel[hidden] { display: none; }
.hb-cot-panel-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 8px 0; margin-right: -10px; background: inherit; }
.hb-cot-panel-kind { display: flex; align-items: center; gap: 8px; font: 500 12px/1 var(--font-sans); color: var(--k); }
.hb-cot-panel-title { margin: 4px 0 6px; font: 600 15px/1.35 var(--font-sans); overflow-wrap: anywhere; }
.hb-cot-panel-meta { margin: 0 0 6px; font: 400 12px/1.45 var(--font-sans); color: var(--muted-foreground); overflow-wrap: anywhere; }
.hb-cot-sec { margin-top: 14px; }
.hb-cot-sec h4 { margin: 0 0 6px; font: 600 11px/1 var(--font-sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); }
.hb-cot-pre {
  margin: 0; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--border); border-radius: 8px;
  background: var(--code-bg, var(--muted)); font: 400 12px/1.55 var(--font-mono); user-select: text;
}
@media (max-width: 767px) {
  .hb-cot-legend { display: none; }
  .hb-cot-panel { position: absolute; inset: auto 0 0 0; width: auto; max-height: 60%; border-left: 0; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-consent, .hb-consent-card, .hb-menu, .hb-mcw, .hb-mcw-win, .hb-reveal { animation: none; }
  .hb-cot-dot.is-running { animation: none; }
  .hb-spinner { animation-duration: 2.4s; }
  html:not([data-theme]) :is(.composer-reference-surface, .composer-workspace-surface, .composer-reference-surface button, [data-streamdown] button) {
    transition: none;
  }
}
