/* Screen stylesheets can scope their rules to #oraxBotWorkspace[data-bot-workspace]. */
/* ORAXBOT is the same app: the workspace fills the sidebar and main columns
   under the one header, next to the rail and the side panel. The code sidebar
   stays mounted behind it, so returning to ORAXCODE lands where it was. */
[data-bot-workspace] {
  z-index: 3;
  display: grid;
  grid-column: 2 / 4;
  grid-row: 2;
  grid-template-columns: var(--bot-sidebar-w, 18rem) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
}

[data-bot-workspace][hidden] { display: none; }

/* The rail keeps the code sidebar's own container: same width, background,
   padding and row classes (sb-header, sb-section, sb-row). */
[data-bot-workspace] .bot-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-sidebar);
  border-inline-end: 1px solid var(--border-subtle);
}

[data-bot-workspace] .bot-sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 12px;
  overflow-y: auto;
}

[data-bot-workspace] .bot-sidebar .sb-row {
  overflow: hidden;
}

[data-bot-workspace] .bot-sidebar .sb-row-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-bot-workspace] .bot-sidebar .sb-row[disabled] {
  color: var(--text-muted);
  cursor: default;
}

[data-bot-workspace] .bot-sidebar .sb-row[disabled]:hover {
  background: transparent;
}

[data-bot-workspace] .bot-sidebar .sb-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-inline: var(--space-2);
}

[data-bot-workspace] .bot-sidebar .sb-section-head .sb-label {
  padding-inline: var(--space-1);
}

[data-bot-workspace] .bot-history {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-inline: var(--space-2);
}

[data-bot-workspace] .bot-history-heading,
[data-bot-workspace] .bot-history-message {
  color: var(--text-muted);
  font-size: var(--text-small);
  overflow-wrap: anywhere;
}

[data-bot-workspace] .bot-history-message { margin: 6px 0; padding-inline: var(--space-3); }

[data-bot-workspace] .bot-history-seeall[hidden] { display: none; }

[data-bot-workspace] .bot-history-seeall {
  min-height: 0;
  padding: 2px 8px;
  color: var(--text-muted);
  font-size: var(--text-small);
  background: transparent;
  border: 0;
  border-radius: var(--radius-s);
  cursor: pointer;
}

[data-bot-workspace] .bot-history-seeall:hover { color: var(--text); background: var(--bg-hover); }

[data-bot-workspace] .bot-history .sb-row {
  flex: 0 0 auto;
}

[data-bot-workspace] .bot-history-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-bot-workspace] .bot-search { padding: 4px var(--space-3) 2px; }
[data-bot-workspace] .bot-search[hidden] { display: none; }

[data-bot-workspace] .bot-search-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 30px;
  padding: 4px 8px;
  color: var(--text);
  font: inherit;
  font-size: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}

[data-bot-workspace] .bot-search-input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

/* One colour per bot, from the app's own accents, shared by the list, the chat
   header and the history. A light accent tint on the element surface keeps the
   initial readable on the theme's own text colour in every light and dark
   preset, so no second palette is introduced. */
[data-bot-workspace] [data-bot-accent] {
  --bot-accent: var(--accent);
  --bot-accent-soft: color-mix(in srgb, var(--bot-accent) 16%, var(--bg-element));
  --bot-accent-ink: var(--text);
  --bot-accent-line: color-mix(in srgb, var(--bot-accent) 55%, var(--border));
}

[data-bot-workspace] [data-bot-accent="info"] { --bot-accent: var(--info); }
[data-bot-workspace] [data-bot-accent="success"] { --bot-accent: var(--success); }
[data-bot-workspace] [data-bot-accent="danger"] { --bot-accent: var(--error); }
[data-bot-workspace] [data-bot-accent="teal"] { --bot-accent: color-mix(in srgb, var(--info) 50%, var(--success)); }
[data-bot-workspace] [data-bot-accent="olive"] { --bot-accent: color-mix(in srgb, var(--success) 55%, var(--diff-del)); }
[data-bot-workspace] [data-bot-accent="rose"] { --bot-accent: color-mix(in srgb, var(--diff-del) 72%, var(--info)); }

[data-bot-workspace] .bot-history-dot {
  flex: 0 0 auto;
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--bot-accent, var(--accent));
}

/* The bot tab follows the chosen view: CLI view keeps the terminal type and
   one-pixel rules the rest of the app uses there. */
[data-bot-workspace]:is(:root[data-view="cli"] *) {
  font-family: var(--mono);
}

[data-bot-workspace]:is(:root[data-view="cli"] *) .bot-sidebar {
  background: var(--bg);
  border-inline-end: 1px solid var(--border);
}

[data-bot-workspace] .bot-area {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

/* The screens carry the app's own padding; the old inner chips bar that
   repeated the header is gone. */
[data-bot-workspace] .bot-screen { display: grid; min-height: 0; overflow: auto; }
[data-bot-workspace] .bot-screen-content { min-width: 0; min-height: 0; }

[data-bot-workspace] .bot-placeholder {
  align-self: center;
  padding: 24px;
  text-align: center;
  overflow-wrap: anywhere;
}

[data-bot-workspace] .bot-placeholder h1 { margin: 0; font-size: var(--text-h1); }
[data-bot-workspace] .bot-placeholder p { margin: 8px 0 16px; color: var(--text-muted); }

[data-bot-workspace] .bot-notices {
  position: absolute;
  inset: auto 12px 20px;
  width: fit-content;
  max-width: min(36rem, calc(100% - 24px));
  margin-inline: auto;
  padding: 9px 12px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-s);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  pointer-events: none;
}

[data-bot-workspace] .bot-notices:empty {
  padding: 0;
  border: 0;
}

@media (max-width: 900px) {
  [data-bot-workspace] {
    grid-column: 1 / -1;
    grid-template-columns: minmax(104px, 30%) minmax(0, 1fr);
  }
}
