/* AITB change (Icons & Branding): Insightable theme add-on (external design), linked by client/vite.config.ts.
   Adapted: logo paths point to ../logo*.svg, selector also matches assets/insightable/logo.svg (AuthLayout). */
/* The website wordmark has a separate red dot. The deployment theme supplies
   its ink, spacing surfaces and control colors in the user's active mode. */
img[src="assets/logo.svg"],
img[src="assets/insightable/logo.svg"] {
  content: url("../logo.svg");
}

.dark img[src="assets/logo.svg"],
.dark img[src="assets/insightable/logo.svg"] {
  content: url("../logo-dark.svg");
}

/* The model/chat icon is an outline bubble: swap to a light outline in dark mode. */
.dark img[src$="assets/insightable/model-icon.svg"] {
  content: url("../model-icon-dark.svg");
}

/* The bubble is too fine for the "Chats" list, the answer avatars (the message icon sits in an `.icon-md` box, as do the model selector's spec icons) and the model selector's trigger and menu rows: show only the red dot there (declared after the dark rule so it wins in both modes). */
[data-testid="convo-item"] img[src$="assets/insightable/model-icon.svg"],
[data-testid="model-selector-button"] img[src$="assets/insightable/model-icon.svg"],
[role^="menuitem"] img[src$="assets/insightable/model-icon.svg"],
[role="option"] img[src$="assets/insightable/model-icon.svg"],
.icon-md > img[src$="assets/insightable/model-icon.svg"] {
  content: url("../model-dot.svg");
}

/* The Presets menu hard-codes assets/asksam.svg for its rows: show a "saved settings" (sliders with a red knob) icon instead. */
[data-testid^="preset-item-"] img[src$="assets/asksam.svg"] {
  content: url("../preset-icon.svg");
}

.dark [data-testid^="preset-item-"] img[src$="assets/asksam.svg"] {
  content: url("../preset-icon-dark.svg");
}

/* A named agent wraps its heading separately. The temporary-chat heading
   carries the hat icon. Keep both of those native identity treatments. */
.flex:has(> .relative .avatar-stroke):not(:has(.lucide-hat-glasses)) > .split-parent {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.flex:has(> .relative .avatar-stroke):not(:has(.lucide-hat-glasses)) > .split-parent::after {
  content: "";
  display: inline-block;
  width: 0.36em;
  height: 0.36em;
  vertical-align: 0.15em;
  margin-inline-start: 0.13em;
  border-radius: 50%;
  background: rgb(var(--surface-submit));
}

.relative:has(> .avatar-stroke):has(~ .split-parent):not(:has(.lucide-hat-glasses)) {
  display: none;
}

[data-testid="new-chat-button"] {
  background: rgb(var(--surface-inverted));
  border-radius: var(--theme-control-radius);
}

[data-testid="new-chat-button"] svg {
  color: rgb(var(--text-inverted));
}

[data-testid="new-chat-button"]:hover {
  background: rgb(var(--surface-inverted-hover));
}

/* AITB: New Chat is a plain bold plus in the rail's ink color, without the red disc. The plus is a
   Phosphor "plus-bold" glyph fed through the icon stylesheet's mask variable; the rail hover/focus
   tint from 30-agent-editor.css still applies. The mobile fab keeps its ghost button and page colors. */
:root aside [data-testid="new-chat-button"] {
  background: transparent;
  border-radius: var(--theme-control-radius);
}

:root aside [data-testid="new-chat-button"] svg {
  color: rgb(var(--ia-rail-ink, var(--text-primary)));
}

:root [data-testid="new-chat-button"] svg,
:root [data-testid="nav-new-chat-fab"] svg {
  --insightable-glyph: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http://www.w3.org/2000/svg%22%20viewBox%3D%220%200%20256%20256%22%20fill%3D%22currentColor%22%3E%3Cpath%20d%3D%22M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z%22/%3E%3C/svg%3E");
}

[data-testid^="nav-panel-"][aria-pressed="true"] svg {
  color: rgb(var(--accent-primary));
}

/* AITB: the Presets button next to the model selector shows sliders with a red knob (same motif as the Presets
   menu rows) instead of the books glyph; the knob is a solid mask area painted red by a radial layer. */
:root [data-testid="presets-button"] svg {
  background-image: radial-gradient(circle closest-side at 65.6% 50%, #e4002b 0 30%, transparent 31%);
  --insightable-glyph: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http://www.w3.org/2000/svg%22%20viewBox%3D%220%200%20256%20256%22%20stroke%3D%22%23000%22%20stroke-width%3D%2216%22%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22M36%2068H216M36%20128H216M36%20188H216%22/%3E%3Cg%20stroke%3D%22none%22%20fill%3D%22%23000%22%3E%3Ccircle%20cx%3D%2288%22%20cy%3D%2268%22%20r%3D%2224%22/%3E%3Ccircle%20cx%3D%22108%22%20cy%3D%22188%22%20r%3D%2224%22/%3E%3Ccircle%20cx%3D%22168%22%20cy%3D%22128%22%20r%3D%2226%22/%3E%3C/g%3E%3C/svg%3E");
}

/* AITB: the agent/model fallback icon (lucide feather, shown for agents without an avatar) becomes a solid bot in the
   red of model-dot.svg: a filled robot glyph (after Phosphor robot-fill, with larger eyes/mouth and a longer antenna)
   as mask, painted red; eyes and mouth are evenodd cut-outs. The New Chat button/fab keep their own plus glyph. */
:root svg.lucide-feather:not(:is([data-testid="new-chat-button"], [data-testid="nav-new-chat-fab"]) svg) {
  --insightable-glyph: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http://www.w3.org/2000/svg%22%20viewBox%3D%220%200%20256%20256%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22M56,60H200a32,32,0,0,1,32,32V200a32,32,0,0,1-32,32H56a32,32,0,0,1-32-32V92A32,32,0,0,1,56,60ZM66,116a18,18,0,1,0,36,0a18,18,0,1,0-36,0ZM154,116a18,18,0,1,0,36,0a18,18,0,1,0-36,0ZM82,160H102V200H82a20,20,0,0,1,0-40ZM112,160H144V200H112ZM154,160H174a20,20,0,0,1,0,40H154Z%22/%3E%3Cpath%20d%3D%22M120,61V18a8,8,0,0,1,16,0V61Z%22/%3E%3C/svg%3E");
  background-color: #e4002b;
}

/* AITB: modern marketplace icon (three outlined rounded tiles and the little red robot of the agent icon top right) for
   the rail button, the welcome screen link and the model selector's marketplace row, replacing storefront / grid.
   The mask carries the tiles plus the robot (same path as the svg.lucide-feather rule above, scaled 0.4 into the
   top-right slot); a red layer limited to the top-right quarter (where only the robot sits) paints it red. */
:root [data-testid="nav-agents-marketplace-button"] svg,
:root a[href="/agents"] svg.lucide-layout-grid,
:root [data-testid="model-selector-marketplace-item"] svg {
  background-image: linear-gradient(#e4002b, #e4002b);
  background-position: right top;
  background-repeat: no-repeat;
  background-size: 50% 50%;
  --insightable-glyph: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http://www.w3.org/2000/svg%22%20viewBox%3D%220%200%20256%20256%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%2220%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%2238%22%20y%3D%2238%22%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2216%22/%3E%3Cg%20transform%3D%22translate(134.8%2017.6)%20scale(0.4)%22%20fill%3D%22%23000%22%20stroke%3D%22none%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20d%3D%22M56,60H200a32,32,0,0,1,32,32V200a32,32,0,0,1-32,32H56a32,32,0,0,1-32-32V92A32,32,0,0,1,56,60ZM66,116a18,18,0,1,0,36,0a18,18,0,1,0-36,0ZM154,116a18,18,0,1,0,36,0a18,18,0,1,0-36,0ZM82,160H102V200H82a20,20,0,0,1,0-40ZM112,160H144V200H112ZM154,160H174a20,20,0,0,1,0,40H154Z%22/%3E%3Cpath%20d%3D%22M120,61V18a8,8,0,0,1,16,0V61Z%22/%3E%3C/g%3E%3Crect%20x%3D%2238%22%20y%3D%22154%22%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2216%22/%3E%3Crect%20x%3D%22154%22%20y%3D%22154%22%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2216%22/%3E%3C/svg%3E");
}
