/* -> SIDEBAR <- */

.sidebar-logo {
  padding: 1.15rem;
  display: flex;
  justify-content: center; /* Centers horizontally */
  align-items: center; /* Centers vertically */
}

.sidebar-logo-img {
  display: flex;
  justify-content: center; /* Centers horizontally */
  align-items: center; /* Centers vertically */
}

.content {
  display: flex;
  flex-direction: column;
  max-width: 100%; /* Statt 99vw */
  width: 100%; /* Statt 99vw */
  padding: 0.75rem; /* Reduziert für mehr Platz */
}

.content > .container-fluid {
  display: flex;
  flex-direction: column;
}

/* Chat opts back into the viewport-locked, inner-scroll layout. */
body.app-fixed .content {
  flex: 1;
  min-height: 0; /* Kritisch! */
  overflow: hidden;
}

body.app-fixed .content > .container-fluid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media only screen and (max-height: 900px) {
  .content {
    padding: 0.5rem;
  }
}

@media only screen and (max-height: 768px) {
  .content {
    padding: 0.25rem;
  }
}

/* Footer and Nav */

/* Transitions während Drag deaktivieren */
#sidebar.dragging {
  transition: none !important;
}

@media only screen and (max-width: 1200px) {
  #sidebar {
    max-width: 264px;
    min-width: 264px;
    height: 100vh;
    background-color: var(--sidebar);
    opacity: 0.9;
    color: var(--sidebar-text);
    transition:
      margin-left 0.35s ease-in-out,
      transform 0.35s ease-in-out;
    position: fixed;
    z-index: 1000;
    left: 0;
  }

  #sidebar.first-look {
    margin-left: -264px;
  }

  #sidebar.collapsed {
    margin-left: -264px;
  }

  /* Wichtig: Während des Drags keine Transition */
  #sidebar.dragging {
    transition: none !important;
  }
}

@media only screen and (min-width: 1200px) {
  .content {
    width: auto;
  }

  /* Body-scroll mode: the sidebar sticks in view while the page body scrolls.
     In the locked chat layout (body.app-fixed) nothing scrolls at body level,
     so sticky behaves identically to static — no override needed. */
  #sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
  }

  #sidebar.first-look {
    margin-left: 0;
  }

  /* Sidebar Toggle */
  #sidebar.collapsed {
    margin-left: -264px;
  }
}

#sidebar {
  max-width: 264px;
  min-width: 264px;
  height: 100vh;
  background-color: var(--sidebar);
  color: var(--sidebar-text);
  transition: all 0.35s ease-in-out;
  overflow-y: auto; /* Sidebar selbst scrollbar */
}

html[data-bs-theme="dark"] #sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.4);
}

.sidebar-nav {
  padding-left: 0;
  margin-top: 15px;
  height: calc(95vh - 265px);
  /* Native internal scroll for long lists (chat history, execution history,
     category links). Replaces the removed PerfectScrollbar. */
  overflow-y: auto;
  position: relative;
}

a.sidebar-link {
  padding: 0.625rem 1rem;
  color: var(--sidebar-text);
  position: relative;
  display: block;
  font-size: var(--font-size-sm);
}

/* -> ERRORS <- */

.deleted {
  color: red;
  text-decoration: line-through;
}

/* Style the error message chat bubble */
.chat-message.assistant.error-message {
  background-color: #ffe6e6; /* Light red background */
  border-left: 4px solid #ff4d4d; /* Red border on the left */
}

/* Style the error message text */
.error-text {
  color: #b30000; /* Dark red text color */
}

/* Optionally style the timestamp/info */
.chat-message.assistant.error-message .message-info {
  color: #b30000; /* <Dark> red text color for assistant name and timestamp */
}

/* -> TABS (HEADER) <- */

.tabs {
  background: var(--background);
  display: flex;
  flex-direction: row;
  gap: 0;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.tabs a {
  text-decoration: none; /* Remove underline from links */
}

.tab,
.tab-selected {
  border-radius: var(--var-sds-size-radius-100, 4px)
    var(--var-sds-size-radius-100, 4px) 0 0;
  padding: var(--var-sds-size-space-100, 4px)
    var(--var-sds-size-space-300, 12px);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: background-color 0.3s;
  /* Non-active tabs reserve the underline space but keep it invisible, so only
     the active tab shows an underline and the layout does not shift. */
  border-bottom: 2px solid transparent;
}

.tab-selected {
  border-bottom: 2px solid var(--text);
}

.tab-text,
.tab-selected-text {
  font-size: var(--font-size-xl);
  color: var(--bs-navbar-color);
}

.tab-selected-text {
  color: var(--text);
  font-weight: var(--font-weight-semibold);
}

.tab:hover,
.tab-selected:hover,
.tab:focus-visible,
.tab-selected:focus-visible {
  color: var(--bs-navbar-color-hover); /* Change background on hover */
  cursor: pointer; /* Change cursor to pointer on hover */
}

.tab:hover .tab-text,
.tab-selected:hover .tab-selected-text,
.tab:focus-visible .tab-text,
.tab-selected:focus-visible .tab-selected-text {
  color: var(--bs-navbar-color-hover); /* Change text color on hover */
}

/* -> DOKU (DOKUMENT PAGE) <- */

.table-container {
  height: 95%; /* Set the height to 80% of the viewport height */
  /*overflow: hidden; !* Prevent overflow if the table content exceeds the height *!*/
}

#document-table {
  height: 100%; /* Make the table take full height of its container */
}

.tabulator-tableholder,
.tabulator-footer,
.tabulator-row {
  background-color: var(--background) !important;
}

.tabulator .tabulator-footer .tabulator-paginator {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.tabulator .tabulator-footer .tabulator-pages {
  display: inline-flex;
  gap: 0.25rem;
}

.tabulator .tabulator-header .tabulator-col {
  background-color: var(--background);
}

html[data-bs-theme="dark"] .tabulator .tabulator-header .tabulator-col :hover {
  background-color: color-mix(in srgb, var(--background), white 10%);
}

.tabulator .tabulator-header .tabulator-col :hover {
  background-color: color-mix(in srgb, var(--background), black 10%);
}

html[data-bs-theme="dark"] .tabulator-row.tabulator-selected {
  background-color: #9abcea !important;
}

.tabulator-row.tabulator-selected {
  background-color: #9abcea !important;
}

/*-> NAVBAR <-*/
.navbar {
  flex-shrink: 0;
}

.rag-checkbox {
  margin-inline: 1rem;
}

/* -> SONSTIGES <- */

html[data-bs-theme="dark"] .btn-primary {
  background-color: var(--button) !important;
  border: var(--button);
}

.footer {
  font-size: var(--font-size-sm);
}

html[data-bs-theme="light"] .bi-moon-fill {
  display: none;
}

html[data-bs-theme="dark"] .bi-sun-fill {
  display: none;
}

html[data-bs-theme="dark"] input:-webkit-autofill {
  background-color: transparent !important;
  box-shadow: 0 0 0 1000px var(--background) inset !important;
}

html[data-bs-theme="dark"] .form-check-input {
  background-color: #5e5e5e; /* Grau für ungecheckt */
  border-color: #5e5e5e;
}

html[data-bs-theme="dark"] .form-check-input:checked {
  background-color: var(--button);
  border-color: var(--button);
}

.form-check.form-switch {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding-left: 0;
  min-height: 0;
}

.form-check.form-switch .form-check-input {
  float: none;
  margin: 0;
  flex-shrink: 0;
}

.form-check.form-switch .form-check-label {
  margin: 0;
}

.btn-light {
  background-color: transparent !important;
  border: none !important;
  color: var(--button);
}

.btn-light[disabled] {
  color: var(--button-disabled);
}

.btn-light:hover {
  color: var(--button-hover);
}

/* Icon-only delete buttons (e.g. role/user/folder management) mark the
   trash icon itself with .text-danger, whose !important color otherwise
   masks the .btn-light:hover color change above. Override it explicitly
   with Bootstrap's own btn-danger hover shade so hover is visible. */
.btn-light:hover .text-danger {
  color: #bb2d3b !important;
}

.text-display {
  white-space: pre-wrap;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 10px;
}

.scrollbar {
  position: relative;
  min-height: 0;
}

/* Only the locked chat layout needs #main to fill its flex parent;
   in body-scroll mode it must grow with its content. */
body.app-fixed .scrollbar {
  height: 100%; /* Wichtig für Flexbox-Kinder */
}

@media (min-width: 768px) {
  .modal-dialog.prompts {
    max-width: 700px; /* Standard für größere Bildschirme */
  }
}

/* Shared modal chrome for delete-, edit- and add-confirmation dialogs (see
   templates/_delete_modal.html) - all get a blue title bar (.cgs-modal),
   with the body/footer on the normal (light/dark-theme) background. The
   delete confirm button stays btn-danger (red) regardless. */
.cgs-modal .modal-header {
  background: var(--sidebar);
  color: var(--sidebar-text);
}

/* Some callers pass a message with "\n\n" to separate two lines (e.g. a schedule
   description below the main question) - preserve that as an actual line break. */
#genericDeleteConfirmMessage {
  white-space: pre-line;
}

.promptDescription {
  color: darkgray;
  font-size: var(--font-size-rel-xs) !important;
  font-weight: var(--font-weight-normal) !important;
}

.transparent-input {
  background-color: transparent;
  border: none;
  outline: none;
  width: 100%;
  font-size: inherit;
}

/* Select2 Dark Mode Styling */
html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--single,
html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--multiple {
  background-color: var(--bs-dark);
  border-color: var(--button);
  color: #fff;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection__rendered {
  color: #fff;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection__placeholder {
  color: #aaa;
}

html[data-bs-theme="dark"] .select2-container--default .select2-search__field {
  background-color: #222;
  color: #fff;
  border: 1px solid #444;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-results__option {
  background-color: #222;
  color: #fff;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-results__option--highlighted {
  background-color: #444;
  color: #fff;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--multiple
  .select2-selection__choice {
  background-color: #444 !important;
  color: #fff !important;
  border-color: #666 !important;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--multiple {
  background-color: #2a2a2a !important;
  border-color: var(--button) !important;
  color: #fff !important;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--multiple
  .select2-selection__choice {
  background-color: #444 !important;
  color: #fff !important;
  border: 1px solid #666 !important;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--multiple
  .select2-search__field {
  background-color: #2a2a2a !important;
  color: #fff !important;
  border: none !important;
}

html[data-bs-theme="dark"]
  .select2-container--default
  .select2-selection--multiple
  .select2-selection__choice {
  background-color: #444 !important;
  color: #fff !important;
  border: 1px solid #666 !important;
}

.zoom {
  transition:
    transform var(--transition-hover),
    box-shadow var(--transition-hover),
    background-color var(--transition-hover);
}

.zoom:hover,
.zoom:focus-visible {
  transform: scale(1.02);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  background-color: #f0f8ff;
  color: #333;
}

html[data-bs-theme="dark"] .zoom:hover,
html[data-bs-theme="dark"] .zoom:focus-visible {
  background-color: #343a40;
  color: white;
}

.zoom-heavy {
  transition:
    transform var(--transition-hover),
    box-shadow var(--transition-hover),
    background-color var(--transition-hover);
}

.zoom-heavy:hover,
.zoom-heavy:focus-visible {
  transform: scale(1.3);
}

.padding-top {
  padding-top: calc(var(--bs-gutter-x) * 0.5);
}

html[data-bs-theme="dark"] {
  --bs-box-shadow-lg: 0 1rem 3rem rgba(255, 255, 255, 0.175);
  --bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --bs-box-shadow-md: 0 0.25rem 0.75rem rgba(255, 255, 255, 0.175);
}

html[data-bs-theme="light"] {
  --bs-box-shadow-md: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.175);
}

.shadow-md {
  box-shadow: var(--bs-box-shadow-md) !important;
}

.rotate-180 {
  transform: rotate(180deg);
  transition: transform 0.2s;
}

.bi-chevron-down {
  transition: transform 0.3s;
}

.copy-btn-block {
  position: absolute;
  top: 8px;
  z-index: 10;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.copy-btn-block:hover,
.copy-btn-block:focus-visible {
  background: var(--chat-hover-button);
  opacity: 1;
}

.copy-btn-block.assistant {
  right: 8px;
}

pre {
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: var(--user-message);
  padding: 1rem;
  margin-top: 1em;
  margin-bottom: 1em;
}

/* Optional: Innenabstand Code */
pre code {
  background: inherit;
  border-radius: inherit;
  padding: 0;
}

:root {
  --bs-code-color: #1976d2;
}

html[data-bs-theme="dark"] {
  --bs-code-color: #90caf9;
}

@keyframes blink {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.blinking-dots::after {
  content: ". . .";
  display: inline-block;
  animation: blink 1.2s infinite;
}

.typing-indicator-dots {
  min-height: 1.4rem;
  display: flex;
  align-items: center;
}

.chat-main {
  position: relative;
}


/* ── Unified sidebar list items ──────────────────────────────────────────────────
   One look across every sidebar: Chat history, Use-case executions, Automation
   schedules, Documents folders and Admin nav. Flat rows, a divider only *between*
   items, a shared hover, and (where applicable) a coloured left accent when selected. */
.chat-history-item,
.usecase-history-card,
.schedule-history-card,
.sidebar-chat-item {
  background: var(--sidebar);
  color: var(--sidebar-text);
  cursor: pointer;
}

/* :focus-within, not :focus-visible - the focusable element is the .sidebar-link
   anchor nested inside these list items, not the item itself. */
.chat-history-item:hover,
.usecase-history-card:hover,
.schedule-history-card:hover,
.sidebar-chat-item:hover,
.chat-history-item:focus-within,
.usecase-history-card:focus-within,
.schedule-history-card:focus-within,
.sidebar-chat-item:focus-within {
  background: var(--sidebar-hover);
}

.usecase-history-card-timestamp {
  font-size: var(--font-size-rel-sm);
}

/* Selected/active item accent — one rule for every sidebar (Chat and Documents mark the link
   .active; Use-case executions and Automation schedules mark the card .selected). */
.sidebar-link.active,
.usecase-history-card.selected,
.schedule-history-card.selected {
  background-color: rgba(13, 110, 253, 0.1);
  border-left: 3px solid #0d6efd;
}

/* Card layout: a flexible title/meta column on the left, the kebab (⋮) menu pinned right.
   The link carries Bootstrap's d-flex + justify-content-between; this just tunes the parts. */
.usecase-history-card > .sidebar-link,
.schedule-history-card > .sidebar-link {
  gap: 0.5rem;
}

.usecase-history-span,
.schedule-history-span {
  min-width: 0;      /* allow the column to shrink so the kebab is never pushed off */
  flex: 1 1 auto;
}

/* ── Reusable sidebar per-item kebab (⋮) actions menu ─────────────────────────────
   Shared across all sidebar lists. The toggle reveals on hover/selection; the menu
   itself is portalled to <body> (see sidebar.js) and positioned fixed, so it never
   gets clipped by the sidebar's overflow and looks the same for 1, 2 or many items. */
.sidebar-kebab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.sidebar-kebab-toggle {
  visibility: hidden;
  background: none;
  border: 0;
  color: #6c757d;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

/* The toggle sits on the dark sidebar, so hover/active use the sidebar's (light) text
   colour — not --text, which is black in light mode. */
.sidebar-kebab-toggle:hover,
.sidebar-kebab-toggle:focus-visible,
.sidebar-kebab-toggle.show {
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-item:hover .sidebar-kebab-toggle,
.sidebar-item.selected .sidebar-kebab-toggle,
.sidebar-link.active .sidebar-kebab-toggle,
.sidebar-item:focus-within .sidebar-kebab-toggle,
.sidebar-kebab-toggle.show {
  visibility: visible;
}

.sidebar-kebab-menu {
  position: fixed;
  z-index: 1080;
  min-width: 168px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--background);
  border: 1px solid rgba(127, 127, 127, 0.3);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  display: none;
}

.sidebar-kebab-menu.show {
  display: block;
}

.sidebar-kebab-menu li {
  margin: 0;
}

.sidebar-kebab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.sidebar-kebab-item:hover,
.sidebar-kebab-item:focus-visible {
  /* The menu sits on the page background (portalled to <body>), not the dark sidebar, so use a
     theme-adaptive tint of the text colour rather than --sidebar-hover (which is dark). */
  background: color-mix(in srgb, var(--text) 12%, transparent);
}

.sidebar-kebab-item.primary {
  color: var(--button);
}

.sidebar-kebab-item.primary:hover,
.sidebar-kebab-item.primary:focus-visible {
  color: var(--button-hover);
}

.sidebar-kebab-item.danger {
  color: var(--bs-danger);
}

.sidebar-kebab-item.danger:hover,
.sidebar-kebab-item.danger:focus-visible {
  /* Bootstrap's own btn-danger hover shade */
  color: #bb2d3b;
}

/* Editable title styling */
.usecase-history-span > span[contenteditable="true"] {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
  border-radius: 3px;
  padding: 2px 4px;
  background-color: rgba(13, 110, 253, 0.05);
}

/* === Star Rating === */

/* Single star glyph — unfilled */
.star {
  color: var(--bs-secondary-color, #6c757d);
  transition: color 0.2s;
}

/* Filled state (display or input) */
.star.star-selected {
  color: #e8a400;
}

html[data-bs-theme="dark"] .star.star-selected {
  color: #ffcd39;
}

/* Container for displaying a star rating (read-only) */
.stars {
  letter-spacing: 1px;
}

/* Interactive variant — adds cursor, larger size, row-reverse for LTR-fill hover preview */
.stars-input {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 5px;
  font-size: var(--font-size-3xl);
  cursor: pointer;
}

.stars-input .star {
  cursor: pointer;
}

.stars-input .star:hover,
.stars-input .star:hover ~ .star {
  color: #e8a400;
  text-shadow: 0 0 5px #e8a400, 0 0 10px #c88f00;
}

html[data-bs-theme="dark"] .stars-input .star:hover,
html[data-bs-theme="dark"] .stars-input .star:hover ~ .star {
  color: #ffcd39;
  text-shadow: 0 0 5px #ffcd39, 0 0 10px #ffc107;
}

.star-rating {
  content: "★★★★★";
  width: fit-content;
  color: transparent;
  font-size: var(--font-size-2xl);
  position: relative;
  padding: 0;
  margin-bottom: 10px;
}

.star-empty-ratings {
  padding: 0;
  display: block;
  z-index: 0;
  color: #808080;
}

.star-fill-ratings {
  color: #e8a400;
  padding: 0;
  position: absolute;
  z-index: 1;
  display: block;
  top: 0;
  left: 0;
  overflow: hidden;
}

html[data-bs-theme="dark"] .star-fill-ratings {
  color: #ffcd39;
}

/* Container für den Tooltip */
.rating-tooltip {
  width: fit-content;
  padding: 10px 15px; /* Innenabstand für schöne Größe */
  border-radius: 8px; /* Runde Ecken für modernes Design */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); /* Kleiner Schatten */
  font-size: var(--font-size-sm);
  z-index: 1000; /* Tooltip immer oben */
  transform: scale(1); /* Standardgröße */
  transition:
    transform 0.2s ease,
    opacity 0.2s ease; /* Übergang für die Animation */
}

/* Pulsierende Animation */
.rating-tooltip.pulsing {
  animation: pulse 1.5s infinite; /* Animation: 1,5 Sekunden, wiederholt */
}

/* Pulse-Keyframes */
@keyframes pulse {
  0% {
    transform: scale(1); /* Startgröße */
  }
  50% {
    transform: scale(1.05); /* Leicht größer */
  }
  100% {
    transform: scale(1); /* Zurück zur Originalgröße */
  }
}

.cgs-footer {
  position: fixed;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.bi-bold {
  -webkit-text-stroke: 0.6px currentColor; /* “Umriss” adds visual weight */
}

.tooltip {
  opacity: 1 !important;
}

.tooltip-inner {
  background-color: var(--tooltip-bg) !important;
  color: var(--text) !important;
  font-size: var(--font-size-sm) !important;
  max-width: 300px !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

html[data-bs-theme="dark"] .usecase-toggle-visibility-btn {
  --bs-btn-color: #f3f3f3;
  --bs-btn-border-color: #f3f3f3;
  --bs-btn-hover-color: #14569b;
  --bs-btn-hover-bg: #f3f3f3;
}

html[data-bs-theme="light"] .usecase-toggle-visibility-btn {
  --bs-btn-color: #000;
  --bs-btn-border-color: #000;
  --bs-btn-hover-color: #14569b;
  --bs-btn-hover-bg: #f3f3f3;
}

/* Globale Scrollbar-Styles */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-track {
  background: transparent;
}

.cgs-card {
  box-shadow: 0 4px 10px rgb(0 0 0 / 10%);
}

html[data-bs-theme="dark"] .cgs-card {
  background-color: #2a2f34;
  box-shadow: 0 4px 10px rgb(255 255 255 / 10%);
}

.cgs-collapse {
  border: none;
  background: var(--background);
  transition: background-color var(--transition-hover), color var(--transition-hover);
}

/* Same theme-adaptive tint used by .sidebar-kebab-item:hover - this button has no
   colour variant of its own to fall back on, so it needs an explicit hover/focus fill. */
.cgs-collapse:hover,
.cgs-collapse:focus-visible {
  background: color-mix(in srgb, var(--text) 10%, var(--background));
  color: var(--text);
}

/* Sticky top nav for body-scroll pages so the tab bar stays reachable while the
   page scrolls. Scoped to nav.navbar so the nested div.navbar-collapse.navbar
   isn't pinned. */
nav.navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: var(--background);
}

/* ---- Chat exception: viewport-locked layout (body.app-fixed) ----
   The chat message list scrolls internally and the input footer stays pinned. */
body.app-fixed {
  height: 100vh;
  overflow: hidden;
}

body.app-fixed .wrapper {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

body.app-fixed .main {
  height: 100vh;
  overflow: hidden;
}

body.app-fixed nav.navbar {
  position: static;
}

/* Automation Log Detail Content Boxes */
.automation-content-box {
  position: relative;
  background: var(--background);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.75rem;
  padding-right: 2.5rem; /* Make room for copy button */
  border-radius: 4px;
  margin-top: 0.5rem;
  max-height: 500px;
  overflow-y: auto;
}

html[data-bs-theme="dark"] .automation-content-box {
  background: #282a2d;
  border-color: rgba(255, 255, 255, 0.1);
}

/* Markdown formatting inside automation-content-box */
.automation-content-box h1,
.automation-content-box h2,
.automation-content-box h3,
.automation-content-box h4,
.automation-content-box h5,
.automation-content-box h6 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.automation-content-box p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.automation-content-box ul,
.automation-content-box ol {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.automation-content-box li {
  margin-bottom: 0.25rem;
}

.automation-content-box code {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: var(--font-family-mono);
  font-size: var(--font-size-rel-sm);
}

html[data-bs-theme="dark"] .automation-content-box code {
  background: #1e1e1e;
}

.automation-content-box pre {
  background: rgba(0, 0, 0, 0.05);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

html[data-bs-theme="dark"] .automation-content-box pre {
  background: #1e1e1e;
}

.automation-content-box pre code {
  background: transparent;
  padding: 0;
}

.automation-content-box blockquote {
  border-left: 3px solid rgba(0, 0, 0, 0.3);
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 0.75rem;
  color: var(--text);
  opacity: 0.8;
}

html[data-bs-theme="dark"] .automation-content-box blockquote {
  border-left-color: #555;
  color: #b0b0b0;
  opacity: 1;
}

/* Markdown & HTML-preview tables (chat answers, use case & automation results):
   wide markdown tables scroll instead of overflowing (via .md-table-wrapper);
   HTML previews already scroll via their own container overflow-x. Both get
   readable cell borders/padding. LLM-supplied inline styles still win. (#597) */
.md-table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.md-table-wrapper > table,
.html-preview table {
  border-collapse: collapse;
}

.md-table-wrapper th,
.md-table-wrapper td,
.html-preview th,
.html-preview td {
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 0.5rem;
  text-align: left;
}

/* Dark-theme overrides apply only to markdown tables; the HTML preview box is
   always rendered on a white background, so it keeps the light cell styling. */
html[data-bs-theme="dark"] .md-table-wrapper th,
html[data-bs-theme="dark"] .md-table-wrapper td {
  border-color: #444;
}

.md-table-wrapper th,
.html-preview th {
  background: rgba(0, 0, 0, 0.05);
  font-weight: var(--font-weight-bold);
}

html[data-bs-theme="dark"] .md-table-wrapper th {
  background: #333;
}

/* Automation result tables fill the box width (preserves prior behaviour). */
.automation-content-box .md-table-wrapper > table {
  width: 100%;
}

.automation-content-box a {
  color: #58a6ff;
  text-decoration: none;
}

.automation-content-box a:hover {
  text-decoration: underline;
}

.automation-code-box {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.75rem;
  border-radius: 4px;
  max-height: 300px;
  overflow-y: auto;
}

html[data-bs-theme="dark"] .automation-code-box {
  background: #282a2d;
}

.automation-error-box {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fff5f5;
  border-left: 4px solid #e53e3e;
  border-radius: 4px;
}

html[data-bs-theme="dark"] .automation-error-box {
  background: #282a2d;
  border-left-color: #553030;
}

.automation-error-pre {
  background: #fee;
  padding: 0.5rem;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
}

html[data-bs-theme="dark"] .automation-error-pre {
  background: #553030;
}

.lightblue {
  color: #90caf9;
}

/* Applied to every use case field description so authored line breaks are
   preserved by default, without requiring a per-field styleClass.
   (Replaces the former `.usecase-description` styleClass, whose `margin-top:
   -30px` only compensated for a leading blank line that no longer occurs.) */
.usecase-field-description {
  white-space: pre-line;
}

/* Hide feedback and next-steps while the LLM is still streaming */
#llm-result-box.streaming-locked .rating-section,
#llm-result-box.streaming-locked > .my-4 {
  display: none;
}

