/* ==========================================================================
   Semantic Search Engine UI — "Vector space" design system
   Visual language of an embedding space: deep ink canvas, a faint coordinate
   grid, glowing vector nodes and a teal → violet → magenta similarity
   gradient. Responsive, light/dark (auto + manual override), no build step.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --font-sans: "Inter", "Segoe UI Variable", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Inter Tight", "Inter", "Segoe UI Variable Display", ui-sans-serif,
    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* vector palette */
  --teal-400: #2ee6d0;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --violet-400: #a395ff;
  --violet-500: #7c6cff;
  --violet-600: #6150f0;
  --pink-400: #f09bf9;
  --pink-500: #e15fef;
  --blue-500: #3b82f6;

  --brand-400: var(--violet-400);
  --brand-500: var(--violet-500);
  --brand-600: var(--violet-600);
  --accent-500: var(--teal-500);

  --gradient-vector: linear-gradient(115deg, #14d3be 0%, #6f63ff 52%, #e15fef 100%);
  --gradient-brand: linear-gradient(135deg, #7c6cff 0%, #5b4cf0 50%, #3b5bdb 100%);
  --gradient-score: linear-gradient(90deg, #14d3be, #7c6cff 70%, #e15fef);

  /* light surfaces */
  --bg: #f4f6fb;
  --bg-elevated: rgb(255 255 255 / 86%);
  --bg-solid: #ffffff;
  --bg-subtle: rgb(244 246 252 / 80%);
  --bg-inset: #edf0f8;
  --border: rgb(30 41 82 / 10%);
  --border-strong: rgb(30 41 82 / 20%);
  --text: #0b1021;
  --text-muted: #525c78;
  --text-faint: #8690aa;
  --grid-line: rgb(30 41 82 / 6%);
  --glow-a: rgb(20 211 190 / 18%);
  --glow-b: rgb(124 108 255 / 18%);
  --node: rgb(30 41 82 / 22%);

  --shadow-sm: 0 1px 2px rgb(15 23 42 / 6%), 0 1px 3px rgb(15 23 42 / 4%);
  --shadow-md: 0 10px 30px -14px rgb(30 41 82 / 22%), 0 2px 6px -2px rgb(30 41 82 / 8%);
  --shadow-lg: 0 30px 60px -28px rgb(30 41 82 / 35%), 0 10px 24px -16px rgb(30 41 82 / 20%);
  --shadow-glow: 0 10px 30px -10px rgb(124 108 255 / 55%);

  --focus-ring: 0 0 0 3px rgb(124 108 255 / 32%);

  --success-fg: #0f6b47;
  --success-bg: #e5f8f0;
  --success-border: #22c58b;
  --error-fg: #9a1c35;
  --error-bg: #fdecef;
  --error-border: #f0446a;
  --warning-fg: #8a5200;
  --warning-bg: #fff5df;
  --warning-border: #f0a92a;
  --info-fg: #0b4f7a;
  --info-bg: #e6f4fe;
  --info-border: #38a3f0;

  --code-bg: #0a0e1c;
  --code-fg: #d5dcf2;
}

/* Dark tokens: explicit override and system preference in "auto" mode. */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060913;
  --bg-elevated: rgb(15 20 37 / 72%);
  --bg-solid: #0d1222;
  --bg-subtle: rgb(20 26 46 / 62%);
  --bg-inset: rgb(8 11 22 / 75%);
  --border: rgb(160 172 255 / 11%);
  --border-strong: rgb(160 172 255 / 22%);
  --text: #e8ebf7;
  --text-muted: #9aa3c2;
  --text-faint: #6c7594;
  --grid-line: rgb(160 172 255 / 5.5%);
  --glow-a: rgb(20 211 190 / 16%);
  --glow-b: rgb(124 108 255 / 22%);
  --node: rgb(180 190 255 / 30%);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 14px 34px -16px rgb(0 0 0 / 70%);
  --shadow-lg: 0 34px 70px -30px rgb(0 0 0 / 85%);
  --success-fg: #7ff0c2;
  --success-bg: rgb(16 120 82 / 20%);
  --error-fg: #ffa3b5;
  --error-bg: rgb(160 28 58 / 22%);
  --warning-fg: #ffd07a;
  --warning-bg: rgb(146 88 8 / 22%);
  --info-fg: #86c8ff;
  --info-bg: rgb(12 86 130 / 24%);
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    color-scheme: dark;
    --bg: #060913;
    --bg-elevated: rgb(15 20 37 / 72%);
    --bg-solid: #0d1222;
    --bg-subtle: rgb(20 26 46 / 62%);
    --bg-inset: rgb(8 11 22 / 75%);
    --border: rgb(160 172 255 / 11%);
    --border-strong: rgb(160 172 255 / 22%);
    --text: #e8ebf7;
    --text-muted: #9aa3c2;
    --text-faint: #6c7594;
    --grid-line: rgb(160 172 255 / 5.5%);
    --glow-a: rgb(20 211 190 / 16%);
    --glow-b: rgb(124 108 255 / 22%);
    --node: rgb(180 190 255 / 30%);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-md: 0 14px 34px -16px rgb(0 0 0 / 70%);
    --shadow-lg: 0 34px 70px -30px rgb(0 0 0 / 85%);
    --success-fg: #7ff0c2;
    --success-bg: rgb(16 120 82 / 20%);
    --error-fg: #ffa3b5;
    --error-bg: rgb(160 28 58 / 22%);
    --warning-fg: #ffd07a;
    --warning-bg: rgb(146 88 8 / 22%);
    --info-fg: #86c8ff;
    --info-bg: rgb(12 86 130 / 24%);
  }
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgb(124 108 255 / 30%);
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem);
}

h2 {
  font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.55rem);
}

h3 {
  font-size: 1.08rem;
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--brand-500);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}

a:hover {
  color: var(--brand-600);
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.1em 0.4em;
  border-radius: 6px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
}

svg {
  flex-shrink: 0;
}

.muted {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.nowrap {
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--brand-500);
  color: #fff;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-3);
  color: #fff;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.text-gradient {
  background: var(--gradient-vector);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --------------------------------------------------------------------------
   3. Backdrop: coordinate grid + soft embedding glows
   -------------------------------------------------------------------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.backdrop__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 85%);
}

.backdrop__glow {
  position: absolute;
  width: 46rem;
  height: 46rem;
  border-radius: 50%;
  filter: blur(80px);
}

.backdrop__glow--a {
  top: -22rem;
  left: -12rem;
  background: radial-gradient(circle, var(--glow-a), transparent 65%);
}

.backdrop__glow--b {
  top: -18rem;
  right: -16rem;
  background: radial-gradient(circle, var(--glow-b), transparent 65%);
}

/* --------------------------------------------------------------------------
   4. Top bar & navigation
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: var(--space-3) var(--space-4) 0;
}

.topbar__inner {
  max-width: 1680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0.55rem 0.6rem 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  flex-shrink: 0;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--text-muted);
  background: linear-gradient(var(--bg-solid), var(--bg-solid)) padding-box,
    var(--gradient-vector) border-box;
  border: 1.5px solid transparent;
}

.brand__mark svg {
  width: 28px;
  height: 28px;
}

.brand__node--a {
  fill: var(--violet-500);
}

.brand__node--b {
  fill: var(--teal-400);
  transform-origin: 15.5px 9.5px;
  animation: node-pulse 3.2s ease-in-out infinite;
}

.brand__node--c {
  fill: var(--pink-500);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand__name strong {
  font-weight: 800;
}

.brand__tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0 auto;
  padding: 0.25rem;
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  border: 1px solid var(--border);
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.9rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.89rem;
  font-weight: 550;
  white-space: nowrap;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.nav__icon {
  width: 17px;
  height: 17px;
  opacity: 0.8;
}

.nav__link:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.nav__link.is-active {
  color: var(--text);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}

.nav__link.is-active .nav__icon {
  color: var(--brand-500);
  opacity: 1;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.nav ~ .topbar__actions {
  margin-left: 0;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.lang-switch__item {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 100%;
  padding: 0 0.55rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.lang-switch__item:hover {
  color: var(--text);
  text-decoration: none;
}

.lang-switch__item.is-active {
  background: var(--gradient-vector);
  color: #fff;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.3s var(--ease);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: rotate(18deg);
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
  display: none;
}

[data-theme="auto"] .theme-toggle__icon--auto,
[data-theme="light"] .theme-toggle__icon--light,
[data-theme="dark"] .theme-toggle__icon--dark {
  display: block;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.75rem 0.2rem 0.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-size: 0.86rem;
  font-weight: 550;
}

.user-chip__avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-vector);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
}

.user-chip__name {
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   5. Layout
   -------------------------------------------------------------------------- */
.page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.page--wide {
  max-width: 1680px;
}

.page--narrow {
  max-width: 640px;
}

.page--auth {
  max-width: 1080px;
  justify-content: center;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding: var(--space-2) var(--space-1) 0;
}

.page-header h1 {
  margin-bottom: var(--space-1);
}

/* The subtitle may use the full width of the heading column: with nothing
   next to it a narrow measure only wraps one sentence into two lines */
.page-header .subtitle {
  max-width: none;
  margin: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.grid-2,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.grid-sidebar {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  scrollbar-width: thin;
}

/* Search page: parameters column on the left, question + results stacked on
   the right. The form is "transparent" for layout, so its sidebar and query
   console become grid items next to the results (which live outside the form,
   because the feedback form must not be nested in it). */
.search-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: var(--space-5);
  row-gap: var(--space-5);
  align-items: start;
}

.search-layout__form {
  display: contents;
}

.search-layout__side {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
}

.search-layout__query {
  grid-column: 2;
  grid-row: 1;
}

.search-layout__results {
  grid-column: 2;
  grid-row: 2;
  gap: var(--space-5);
}

.search-layout__results > .card {
  padding: var(--space-5);
}

.search-layout--results .query-console__question {
  min-height: 4.5rem;
}

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  min-width: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

.card--subtle {
  padding: var(--space-5);
  background: var(--bg-subtle);
  box-shadow: none;
  border-radius: var(--radius-md);
}

.card--panel {
  padding: var(--space-5);
  background: var(--bg-elevated);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.card__header h1,
.card__header h2 {
  margin-bottom: var(--space-1);
}

.card__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-500);
}

.card__eyebrow::before {
  content: "";
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-vector);
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 var(--space-3);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}

.section-title--rule {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border-strong);
}

.card__eyebrow + .section-title--rule,
.params-head + .section-title--rule {
  margin-top: var(--space-2);
  padding-top: 0;
  border-top: 0;
}

/* Sidebar head: eyebrow + "restore defaults" (shown once options are kept) */
.params-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.params-head .card__eyebrow {
  margin-bottom: 0;
}

.params-head__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.params-reset {
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.params-reset:hover,
.params-reset:focus-visible {
  color: var(--brand-500);
  text-decoration: underline;
}

.params-collapse-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.params-collapse-btn svg {
  width: 16px;
  height: 16px;
}

.params-collapse-btn:hover {
  color: var(--brand-500);
  border-color: var(--brand-500);
  background: rgb(124 108 255 / 10%);
}

/* Collapsed sidebar rail & toggle in collection banner */
.params-rail {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  width: 44px;
  padding: var(--space-3) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.params-rail:hover,
.params-rail:focus-visible {
  color: var(--brand-500);
  border-color: var(--brand-500);
  background: linear-gradient(180deg, rgb(20 211 190 / 8%), rgb(124 108 255 / 12%)), var(--bg-elevated);
  box-shadow: var(--shadow-md);
}

.params-rail__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--brand-500);
}

.params-rail__icon svg {
  width: 18px;
  height: 18px;
}

.params-rail__label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.coll-banner__params-btn {
  display: none;
}

.coll-banner__params-btn svg {
  width: 15px;
  height: 15px;
}

.search-layout.is-params-collapsed,
.search-layout--chat.is-params-collapsed {
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--space-3);
}

.search-layout.is-params-collapsed [data-params] {
  display: none;
}

.search-layout.is-params-collapsed .params-rail {
  display: flex;
}

.search-layout.is-params-collapsed .coll-banner__params-btn {
  display: inline-flex;
}

/* Search parameters: collapsible groups with a live one-line summary.
   Each group is its own bordered tile so Collection / Models / Filters read
   as separate blocks instead of one long column of controls. */
.params {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  padding-bottom: var(--space-4);
}

.params > .params-head {
  padding: 0 var(--space-1);
}

.pgroup {
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.pgroup[open] {
  border-color: rgb(124 108 255 / 32%);
  box-shadow: var(--shadow-sm), 0 0 0 3px rgb(124 108 255 / 5%);
}

.pgroup.is-active {
  border-color: rgb(124 108 255 / 45%);
}

.pgroup__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  cursor: pointer;
  list-style: none;
  background: linear-gradient(180deg, var(--bg-subtle), transparent), var(--bg-solid);
  transition: background 0.15s var(--ease);
}

.pgroup__head:hover {
  background: linear-gradient(135deg, rgb(20 211 190 / 5%), rgb(124 108 255 / 8%)), var(--bg-solid);
}

.pgroup[open] > .pgroup__head {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgb(20 211 190 / 5%), rgb(124 108 255 / 8%)), var(--bg-solid);
}

.pgroup__head::-webkit-details-marker {
  display: none;
}

.pgroup__head::after {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin: 0 0.35rem 0 auto;
  border-right: 2px solid var(--text-faint);
  border-bottom: 2px solid var(--text-faint);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s var(--ease);
}

.pgroup[open] > .pgroup__head::after {
  transform: rotate(-135deg) translateY(-2px);
}

.pgroup__head:hover .pgroup__title {
  color: var(--brand-500);
}

.pgroup__head:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

.pgroup__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgb(20 211 190 / 14%), rgb(124 108 255 / 18%));
  color: var(--brand-500);
  box-shadow: inset 0 0 0 1px rgb(124 108 255 / 18%);
}

.pgroup__icon svg {
  width: 18px;
  height: 18px;
}

.pgroup.is-active .pgroup__icon {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.pgroup__titles {
  display: grid;
  min-width: 0;
}

.pgroup__title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  transition: color 0.15s var(--ease);
}

.pgroup__summary {
  overflow: hidden;
  margin-top: 1px;
  font-size: 0.77rem;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pgroup__summary:empty {
  display: none;
}

.pgroup__body {
  padding: var(--space-3) var(--space-3) var(--space-4);
}

.pgroup__body > label:first-child {
  margin-top: 0;
}

/* sub-section caption inside a group, separated from what is above */
.pgroup__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-5) 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.pgroup__label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

/* option tiles: icon + title + description + toggle */
.opt-list {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
}

.opt-list:first-child {
  margin-top: 0;
}

/* a toggle list placed after plain fields gets its own divider */
.pgroup__body > :not(.opt-list, .pgroup__label) + .opt-list {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border-strong);
}

label.opt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.7rem;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

label.opt:not(:has(.opt__icon)) {
  grid-template-columns: minmax(0, 1fr) auto;
}

label.opt:hover {
  border-color: var(--brand-400);
  background: var(--bg-solid);
}

label.opt:has(input:checked) {
  border-color: rgb(124 108 255 / 45%);
  background: linear-gradient(135deg, rgb(20 211 190 / 6%), rgb(124 108 255 / 9%)), var(--bg-solid);
}

label.opt:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.opt__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
  color: var(--text-muted);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.opt__icon svg {
  width: 16px;
  height: 16px;
}

label.opt:has(input:checked) .opt__icon {
  background: rgb(124 108 255 / 16%);
  color: var(--brand-500);
}

.opt__text {
  display: grid;
  gap: 2px;
  padding-top: 1px;
}

.opt__title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.opt__desc {
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-muted);
}

label.opt input[type="checkbox"] {
  margin-top: 4px;
}

label.opt input[type="checkbox"]:not(:checked) {
  border-color: var(--text-faint);
}

.opt--primary .opt__icon {
  width: 34px;
  height: 34px;
}

label.opt--primary:has(input:checked) {
  border-color: transparent;
  background:
    linear-gradient(var(--bg-solid), var(--bg-solid)) padding-box,
    var(--gradient-vector) border-box;
  border: 1px solid transparent;
  box-shadow: 0 10px 24px -18px rgb(124 108 255 / 70%);
}

label.opt--primary:has(input:checked) .opt__icon {
  background: var(--gradient-vector);
  color: #fff;
}

/* options that only apply when the generative QA is on */
.opt-nest {
  position: relative;
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-3) var(--space-3) calc(var(--space-3) + 3px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}

.opt-nest label.opt {
  padding: 0.55rem 0.65rem;
  gap: 0.6rem;
  background: var(--bg-solid);
}

.opt-nest::before {
  content: "";
  position: absolute;
  top: var(--space-2);
  bottom: var(--space-2);
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--violet-500), rgb(124 108 255 / 15%));
}

.opt-nest > label:first-child {
  margin-top: 0;
}

.opt-sub {
  margin: var(--space-2) 0 0 2.4rem;
}

.opt-sub label {
  margin-top: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* number of results: − value + and quick presets */
.num-stepper {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-solid);
  overflow: hidden;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.num-stepper:focus-within {
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

.num-stepper input[type="number"] {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  appearance: textfield;
}

.num-stepper input[type="number"]::-webkit-inner-spin-button,
.num-stepper input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.num-stepper__btn {
  border: 0;
  background: var(--bg-inset);
  color: var(--text-muted);
  font: inherit;
  font-size: 1.15rem;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.num-stepper__btn:hover,
.num-stepper__btn:focus-visible {
  outline: none;
  background: rgb(124 108 255 / 14%);
  color: var(--brand-500);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: var(--space-2);
}

.presets__chip {
  min-width: 38px;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}

.presets__chip:hover,
.presets__chip:focus-visible {
  outline: none;
  border-color: var(--brand-400);
  color: var(--brand-500);
}

.presets__chip.is-active {
  border-color: transparent;
  background: var(--gradient-brand);
  color: #fff;
}

/* stacked sliders: name + value on top, the range, then a short hint */
.field-slider.field-slider--stack {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-4) 0;
}

.field-slider--stack > .field-slider__name {
  grid-column: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.field-slider--wide > .field-slider__name {
  font-family: var(--font-sans);
  font-size: 0.87rem;
  font-weight: 600;
}

.field-slider--stack > output {
  grid-column: 2;
}

.field-slider--stack > input[type="range"],
.field-slider--stack > .field-slider__desc {
  grid-column: 1 / -1;
}

.field-slider--stack > .field-slider__desc {
  margin-top: -2px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.field-slider output.is-changed {
  border-color: rgb(124 108 255 / 45%);
  background: rgb(124 108 255 / 12%);
  color: var(--brand-500);
}

.expander--tune summary {
  gap: 0.55rem;
}

.expander.expander--tune summary::before {
  order: 3;
  margin-left: auto;
}

.expander__icon {
  display: inline-grid;
  color: var(--brand-500);
}

.expander__icon svg {
  width: 16px;
  height: 16px;
}

.expander__changed {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0.05rem 0.45rem;
  border-radius: var(--radius-pill);
  background: rgb(124 108 255 / 14%);
  color: var(--brand-500);
  font-size: 0.7rem;
  font-weight: 600;
}

.expander--tune .opt-list {
  margin-top: var(--space-4);
}

/* multi-select filters shown as a searchable toggle list (app.js) */
.picker-native {
  display: none !important;
}

.picker {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-solid);
  overflow: hidden;
}

.picker.has-selection {
  border-color: rgb(124 108 255 / 45%);
}

.picker__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.picker__bar input[type="search"] {
  padding: 0.4rem 0.65rem;
  border-color: transparent;
  background: var(--bg-inset);
  font-size: 0.84rem;
}

.picker__clear {
  flex-shrink: 0;
  padding: 0.3rem 0.55rem;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--brand-500);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.picker__clear:hover,
.picker__clear:focus-visible {
  outline: none;
  background: rgb(124 108 255 / 12%);
}

.picker__list {
  display: grid;
  gap: 2px;
  max-height: 232px;
  padding: 0.3rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.picker__opt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-width: 0;
  padding: 0.42rem 0.55rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.picker__opt:hover,
.picker__opt:focus-visible {
  outline: none;
  background: var(--bg-inset);
}

.picker__opt[aria-pressed="true"] {
  background: rgb(124 108 255 / 12%);
  font-weight: 600;
}

.picker__check {
  position: relative;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-solid);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.picker__opt[aria-pressed="true"] .picker__check {
  border-color: transparent;
  background: var(--gradient-brand);
}

.picker__opt[aria-pressed="true"] .picker__check::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 4.5px;
  width: 4px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

.picker__label {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker__parent {
  color: var(--text-faint);
  font-weight: 400;
}

.picker__status {
  margin: 0;
  padding: 0.4rem 0.7rem;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.picker.has-selection .picker__status {
  color: var(--brand-500);
  font-weight: 600;
}

.section-heading {
  max-width: 640px;
  margin-bottom: var(--space-5);
}

/* --------------------------------------------------------------------------
   7. Badges, pills, status
   -------------------------------------------------------------------------- */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 550;
  white-space: nowrap;
}

.badge__value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}

.badge--brand {
  border-color: rgb(124 108 255 / 30%);
  background: rgb(124 108 255 / 10%);
  color: var(--brand-500);
}

.badge--brand .badge__value {
  color: inherit;
}

/* A number with the word it counts ("8 280 znaków", "60 stron").

   Two things go wrong with a centred row here: the mono digits and the
   interface text do not share their ascent, so centring the two boxes leaves
   the number floating above the word; and a badge shrunk by a long title
   stacks the word under the number.  One baseline, no shrinking and tabular
   digits make the pair read as a single value. */
.badge--stat {
  align-items: baseline;
  flex: none;
  gap: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.badge--stat .badge__value {
  font-size: 0.9rem;
  line-height: 1;
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 var(--space-5);
  padding: 0.35rem 0.9rem 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal-400);
  box-shadow: 0 0 0 0 rgb(46 230 208 / 60%);
  animation: status-ping 2.4s ease-out infinite;
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.btn-row--center {
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--bg-solid);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease),
    background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:hover {
  color: var(--text);
  border-color: var(--brand-400);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.7;
  cursor: progress;
  transform: none;
}

.btn-primary {
  position: relative;
  border-color: transparent;
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow), inset 0 1px 0 rgb(255 255 255 / 22%);
  isolation: isolate;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--gradient-vector);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.btn-primary:hover {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 14px 34px -10px rgb(124 108 255 / 70%), inset 0 1px 0 rgb(255 255 255 / 22%);
}

.btn-primary:hover::after {
  opacity: 1;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

/* conversational entry point: teal/violet outline glowing on hover */
.btn--chat {
  position: relative;
  border-color: transparent;
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    var(--gradient-vector) border-box;
  color: var(--text);
  box-shadow: 0 6px 18px -10px rgb(20 211 190 / 55%);
}

.btn--chat svg {
  color: #14d3be;
}

.btn--chat:hover {
  border-color: transparent;
  background: var(--gradient-vector);
  color: #fff;
  box-shadow: 0 14px 34px -10px rgb(20 211 190 / 65%);
}

.btn--chat:hover svg {
  color: #fff;
}

.btn--ghost:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.btn--sm {
  min-height: 34px;
  padding: 0.35rem 0.85rem;
  font-size: 0.84rem;
}

.btn--lg {
  min-height: 48px;
  padding: 0.7rem 1.6rem;
  font-size: 0.98rem;
}

.btn--block {
  width: 100%;
}

.btn--danger {
  background: #e11d48;
  border-color: #be123c;
  color: #fff;
}

.btn--danger:hover {
  background: #f43f5e;
  border-color: #e11d48;
  color: #fff;
  box-shadow: 0 10px 24px -8px rgb(225 29 72 / 60%);
}

.btn--danger-ghost {
  background: transparent;
  border-color: rgb(244 63 94 / 35%);
  color: #fb7185;
}

.btn--danger-ghost:hover {
  background: rgb(225 29 72 / 15%);
  border-color: #f43f5e;
  color: #fff;
}

.btn--xs {
  min-height: 28px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  border-radius: var(--radius-xs, 6px);
}

.inline-form {
  display: inline-block;
  margin: 0;
  padding: 0;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgb(255 255 255 / 40%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* --------------------------------------------------------------------------
   9. Forms
   -------------------------------------------------------------------------- */
label {
  display: block;
  margin: var(--space-4) 0 var(--space-2);
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text);
}

label:first-child,
.section-title + label {
  margin-top: 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  display: block;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-solid);
  color: var(--text);
  font: inherit;
  font-size: 0.93rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--brand-400);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

select:not([multiple]) {
  appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c6cff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 16px;
}

select option {
  background-color: var(--bg-solid);
  color: var(--text);
}

select[multiple] {
  padding: 0.35rem;
  min-height: 120px;
}

select[multiple] option {
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 2px;
}

select[multiple] option:checked {
  background: rgb(124 108 255 / 22%);
  color: var(--text);
}

input + .muted,
select + .muted,
textarea + .muted,
.dropzone + .muted {
  margin: var(--space-2) 0 0;
  font-size: 0.82rem;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: var(--space-3) 0;
}

.check-row label {
  margin: 0;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
}

input[type="checkbox"] {
  appearance: none;
  flex-shrink: 0;
  position: relative;
  width: 36px;
  height: 20px;
  margin: 1px 0 0;
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border-strong);
  transition: transform 0.2s var(--ease);
}

input[type="checkbox"]:checked {
  background: var(--gradient-brand);
  border-color: transparent;
}

input[type="checkbox"]:checked::after {
  transform: translateX(16px);
  background: #fff;
  box-shadow: none;
}

input[type="checkbox"]:focus-visible {
  box-shadow: var(--focus-ring);
}

/* sliders */
.field-slider {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(0, 2fr) 56px;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-3) 0;
}

.field-slider > span {
  font-family: var(--font-sans);
  font-size: 0.87rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}

.field-slider output {
  justify-self: end;
  min-width: 48px;
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: center;
  color: var(--text);
}

input[type="range"] {
  --range-progress: 50%;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0;
  border-radius: var(--radius-pill);
  background:
    linear-gradient(90deg, var(--teal-500), var(--violet-500)) 0 / var(--range-progress) 100% no-repeat,
    var(--bg-inset);
  box-shadow: inset 0 0 0 1px var(--border);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--violet-500);
  box-shadow: 0 2px 8px rgb(124 108 255 / 45%);
  transition: transform 0.15s var(--ease);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--violet-500);
  box-shadow: 0 2px 8px rgb(124 108 255 / 45%);
}

/* upload dropzone */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 180px;
  padding: var(--space-5);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 50% 0%, rgb(124 108 255 / 9%), transparent 70%),
    var(--bg-solid);
  text-align: center;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone:hover,
.dropzone:focus-within,
.dropzone.is-dragover {
  border-color: var(--brand-500);
  background:
    radial-gradient(circle at 50% 0%, rgb(124 108 255 / 18%), transparent 70%),
    var(--bg-solid);
}

.dropzone.is-dragover {
  transform: scale(1.01);
}

.dropzone:focus-within {
  box-shadow: var(--focus-ring);
}

.dropzone.has-files {
  border-style: solid;
  border-color: var(--teal-500);
}

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.dropzone__icon svg {
  width: 24px;
  height: 24px;
}

.dropzone__title {
  font-weight: 600;
}

.dropzone__title u {
  color: var(--brand-500);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.dropzone__formats {
  display: flex;
  gap: 0.35rem;
}

.dropzone__formats i {
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-style: normal;
  color: var(--text-muted);
}

.file-summary {
  font-family: var(--font-mono);
}

.file-queue {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.file-queue__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0 0.15rem;
}

.file-queue__summary {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  font-size: 0.82rem;
}

.file-queue__clear {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease, background 0.15s ease;
}

.file-queue__clear:hover {
  color: var(--rose-500, #ef4444);
  background: rgb(239 68 68 / 10%);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-solid);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-item:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.file-item__info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.file-item__badge {
  flex-shrink: 0;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.file-item__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
}

.file-item__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.file-item__size {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.file-item__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.file-item__remove:hover {
  color: var(--rose-500, #ef4444);
  background: rgb(239 68 68 / 12%);
  transform: scale(1.1);
}

.file-item__remove svg {
  width: 14px;
  height: 14px;
}

/* chunking preview */
.chunk-preview {
  --overlap: 0.1;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-inset);
}

.chunk-preview__label,
.chunk-preview__legend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chunk-preview__label {
  font-weight: 600;
  color: var(--text);
}

.chunk-preview__track {
  display: flex;
  margin: var(--space-2) 0;
  height: 16px;
}

.chunk-preview__chunk {
  flex: 0 0 33.3%;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, rgb(20 184 166 / 65%), rgb(124 108 255 / 65%));
  border: 1px solid rgb(255 255 255 / 25%);
  mix-blend-mode: normal;
  transition: margin 0.2s var(--ease);
}

.chunk-preview__chunk + .chunk-preview__chunk {
  margin-left: calc(-33.3% * var(--overlap));
  background: linear-gradient(90deg, rgb(225 95 239 / 70%), rgb(124 108 255 / 55%) 30%, rgb(124 108 255 / 65%));
}

.chunk-preview__key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--teal-500), var(--violet-500));
}

.chunk-preview__key--overlap {
  margin-left: var(--space-2);
  background: var(--pink-500);
}

/* star rating */
.star-rating {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 0.25rem;
  margin: 0 0 var(--space-3);
  padding: 0;
  border: 0;
}

.star-rating input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.star-rating label {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  color: var(--border-strong);
  cursor: pointer;
  transition: color 0.15s var(--ease), transform 0.15s var(--ease);
}

.star-rating label:hover {
  transform: scale(1.12);
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
  color: #fbbf24;
  text-shadow: 0 0 18px rgb(251 191 36 / 45%);
}

.star-rating input:focus-visible + label {
  border-radius: 6px;
  box-shadow: var(--focus-ring);
}

/* --------------------------------------------------------------------------
   10. Stepper (pipeline progress)
   -------------------------------------------------------------------------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.stepper__item {
  display: flex;
  align-items: center;
}

.stepper__item + .stepper__item::before {
  content: "";
  width: 22px;
  height: 1.5px;
  margin: 0 0.15rem;
  background: var(--border-strong);
}

.stepper__item.is-done + .stepper__item::before,
.stepper__item.is-done + .stepper__item.is-current::before {
  background: var(--gradient-vector);
}

.stepper__item a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.85rem 0.3rem 0.3rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}

.stepper__item a:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.stepper__dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}

.stepper__copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.stepper__copy b {
  font-size: 0.84rem;
}

.stepper__copy small {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
}

.stepper__item.is-done .stepper__dot {
  border-color: transparent;
  background: rgb(20 184 166 / 16%);
  color: var(--teal-500);
}

.stepper__item.is-current a {
  color: var(--text);
  background: var(--bg-solid);
  box-shadow: inset 0 0 0 1px var(--border);
}

.stepper__item.is-current .stepper__dot {
  border-color: transparent;
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* --------------------------------------------------------------------------
   11. Home: hero, embedding-space visual, pipeline, features
   -------------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-7);
  padding: var(--space-6) 0 var(--space-5);
}

.hero__title {
  margin-bottom: var(--space-4);
  font-size: clamp(2.3rem, 1.4rem + 3.4vw, 4rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
  font-weight: 800;
}

.lead {
  max-width: 54ch;
  font-size: 1.06rem;
  color: var(--text-muted);
}

.command-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 520px;
  margin-top: var(--space-5);
  padding: 0.5rem 0.55rem 0.5rem 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(var(--bg-solid), var(--bg-solid)) padding-box,
    var(--gradient-vector) border-box;
  border: 1.5px solid transparent;
  box-shadow: var(--shadow-lg), 0 0 0 6px rgb(124 108 255 / 7%);
  color: var(--text-faint);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.command-bar:hover {
  color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 0 8px rgb(124 108 255 / 12%);
}

.command-bar__icon {
  width: 20px;
  height: 20px;
  color: var(--brand-500);
}

.command-bar__placeholder {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 1rem;
}

.command-bar__placeholder::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--brand-500);
  animation: caret 1.1s steps(1) infinite;
}

.command-bar__kbd {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  border-radius: var(--radius-xs);
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 700;
}

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
}

.hero__chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.chip-dot--teal {
  background: var(--teal-400);
}

.chip-dot--violet {
  background: var(--violet-500);
}

.chip-dot--pink {
  background: var(--pink-500);
}

.chip-dot--blue {
  background: var(--brand-500);
}

.hero__visual {
  position: relative;
}

.hero__visual::before {
  content: "";
  position: absolute;
  inset: 8% 6%;
  z-index: -1;
  border-radius: 50%;
  background: var(--gradient-vector);
  filter: blur(70px);
  opacity: 0.28;
}

.vector-space {
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: float 8s ease-in-out infinite;
}

.vector-space__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--space-2) var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.vector-space__title {
  color: var(--text);
  font-weight: 600;
}

.vector-space__meta {
  color: var(--text-faint);
}

.vector-space__plot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 25px 25px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 25px 25px,
    var(--bg-inset);
}

.vs-axis path {
  stroke: var(--border-strong);
  stroke-width: 1;
}

.vs-cloud circle {
  fill: var(--node);
}

.vs-ring {
  stroke: rgb(124 108 255 / 45%);
  stroke-width: 1;
  stroke-dasharray: 3 5;
  fill: rgb(124 108 255 / 5%);
  transform-origin: 205px 150px;
  animation: spin 40s linear infinite;
}

.vs-ring--outer {
  stroke: rgb(20 184 166 / 35%);
  fill: none;
  animation-direction: reverse;
  animation-duration: 60s;
}

.vs-links path,
.auth__constellation .vs-links {
  stroke: var(--violet-400);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  animation: dash 1.6s linear infinite;
}

.vs-hits circle {
  fill: var(--teal-400);
  stroke: var(--bg-solid);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 6px rgb(46 230 208 / 70%));
}

.vs-query {
  fill: var(--violet-500);
  stroke: #fff;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 10px rgb(124 108 255 / 90%));
}

.vs-query-pulse {
  fill: rgb(124 108 255 / 35%);
  transform-origin: 205px 150px;
  animation: ripple 2.6s ease-out infinite;
}

.vs-labels text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-muted);
}

.vector-space__hits {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.vector-space__hits li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-solid);
}

.vector-space__hits li:nth-child(2) {
  opacity: 0.85;
}

.vector-space__hits li:nth-child(3) {
  opacity: 0.7;
}

.vs-rank {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-500);
}

.vs-doc {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.vs-doc b {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vs-doc small {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

.vs-score {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}

.vs-score__bar {
  display: block;
  width: 64px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  overflow: hidden;
  position: relative;
}

.vs-score__bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--gradient-score);
}

.vs-score__bar--92::after {
  width: 92%;
}

.vs-score__bar--88::after {
  width: 88%;
}

.vs-score__bar--81::after {
  width: 81%;
}

.pipeline {
  margin-top: var(--space-6);
}

.pipeline__track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: stage;
}

.pipeline__track::before {
  content: "";
  position: absolute;
  top: 46px;
  left: 8%;
  right: 8%;
  height: 2px;
  background: var(--gradient-vector);
  opacity: 0.45;
  z-index: -1;
}

.pipeline__stage {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm);
  counter-increment: stage;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.pipeline__stage:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.pipeline__stage b {
  font-family: var(--font-display);
  font-size: 1.02rem;
}

.pipeline__stage b::before {
  content: "0" counter(stage) " ";
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-right: 0.3rem;
}

.pipeline__stage small {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.pipeline__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: var(--space-2);
  border-radius: 14px;
  color: #fff;
}

.pipeline__icon svg {
  width: 22px;
  height: 22px;
}

.pipeline__icon--teal {
  background: linear-gradient(135deg, #2ee6d0, #0d9488);
  box-shadow: 0 10px 24px -10px rgb(20 184 166 / 70%);
}

.pipeline__icon--blue {
  background: linear-gradient(135deg, #60a5fa, #3b5bdb);
  box-shadow: 0 10px 24px -10px rgb(59 130 246 / 70%);
}

.pipeline__icon--violet {
  background: linear-gradient(135deg, #a395ff, #6150f0);
  box-shadow: 0 10px 24px -10px rgb(124 108 255 / 70%);
}

.pipeline__icon--pink {
  background: linear-gradient(135deg, #f09bf9, #c026d3);
  box-shadow: 0 10px 24px -10px rgb(225 95 239 / 70%);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

.feature {
  --feature-accent: var(--brand-500);
  --feature-glow: rgb(124 108 255 / 16%);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 100% 0%, var(--feature-glow), transparent 58%),
    var(--bg-solid);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.feature--teal {
  --feature-accent: var(--teal-500);
  --feature-glow: rgb(20 184 166 / 15%);
}

.feature--blue {
  --feature-accent: var(--blue-500);
  --feature-glow: rgb(59 130 246 / 15%);
}

.feature--violet {
  --feature-accent: var(--violet-500);
  --feature-glow: rgb(124 108 255 / 16%);
}

.feature--pink {
  --feature-accent: var(--pink-500);
  --feature-glow: rgb(225 95 239 / 15%);
}

.feature::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--gradient-vector);
  opacity: 0.7;
  transform: scaleX(0.35);
  transform-origin: left;
  transition: transform 0.35s var(--ease), opacity 0.25s var(--ease);
}

.feature:hover {
  color: var(--text);
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.feature:hover::before {
  opacity: 1;
  transform: scaleX(1);
}

.feature__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.feature__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease);
}

.feature:hover .feature__icon {
  transform: scale(1.06);
}

.feature__icon svg {
  width: 21px;
  height: 21px;
}

.feature__icon--teal {
  background: linear-gradient(135deg, #2ee6d0, #0d9488);
  box-shadow: 0 10px 24px -10px rgb(20 184 166 / 70%);
}

.feature__icon--blue {
  background: linear-gradient(135deg, #60a5fa, #3b5bdb);
  box-shadow: 0 10px 24px -10px rgb(59 130 246 / 70%);
}

.feature__icon--violet {
  background: linear-gradient(135deg, #a395ff, #6150f0);
  box-shadow: 0 10px 24px -10px rgb(124 108 255 / 70%);
}

.feature__icon--pink {
  background: linear-gradient(135deg, #f09bf9, #c026d3);
  box-shadow: 0 10px 24px -10px rgb(225 95 239 / 70%);
}

.feature__step {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.feature h3 {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
  letter-spacing: -0.015em;
}

.feature p {
  flex: 1;
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.feature__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.feature:hover .feature__link {
  border-color: var(--feature-accent);
  background: var(--feature-glow);
  color: var(--feature-accent);
}

.feature__link span {
  display: inline-block;
  transition: transform 0.2s var(--ease);
}

.feature:hover .feature__link span {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   12. Auth
   -------------------------------------------------------------------------- */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: stretch;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth__showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-7) var(--space-6);
  color: #e8ebf7;
  background:
    radial-gradient(circle at 15% 15%, rgb(20 211 190 / 30%), transparent 45%),
    radial-gradient(circle at 90% 80%, rgb(225 95 239 / 28%), transparent 45%),
    linear-gradient(160deg, #0d1230, #070a18);
  overflow: hidden;
}

.auth__showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 5%) 1px, transparent 1px);
  background-size: 32px 32px;
}

.auth__showcase > * {
  position: relative;
}

.auth__showcase .eyebrow-pill {
  align-self: flex-start;
  background: rgb(255 255 255 / 6%);
  border-color: rgb(255 255 255 / 14%);
  color: #c9cfe8;
}

.auth__showcase h2 {
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.5rem);
  letter-spacing: -0.035em;
}

.auth__showcase p {
  color: #aab2d2;
  max-width: 42ch;
}

.auth__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-5);
  padding: 0;
  list-style: none;
}

.auth__facts li {
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(255 255 255 / 10%);
  background: rgb(255 255 255 / 4%);
}

.auth__facts b {
  font-size: 0.88rem;
}

.auth__facts small {
  font-size: 0.72rem;
  color: #8f98bb;
}

.auth__constellation {
  width: 100%;
  max-width: 360px;
  height: auto;
}

.auth__node {
  fill: var(--violet-400);
  filter: drop-shadow(0 0 6px rgb(163 149 255 / 80%));
}

.auth__node--b {
  fill: var(--teal-400);
  filter: drop-shadow(0 0 6px rgb(46 230 208 / 80%));
}

.auth__node--c {
  fill: var(--pink-400);
  filter: drop-shadow(0 0 8px rgb(240 155 249 / 80%));
}

.card--auth {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-7) var(--space-6);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.card--auth .subtitle {
  margin-bottom: var(--space-5);
}

.card--auth .btn--block {
  margin-top: var(--space-2);
}

/* --------------------------------------------------------------------------
   13. Collections
   -------------------------------------------------------------------------- */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* filter above the cards, same box as the filter of the document list */
.collection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.collection-toolbar__count {
  font-size: 0.8rem;
  white-space: nowrap;
}

.collection-toolbar__count:empty {
  display: none;
}

.collection-nomatch {
  margin: 0;
  padding: var(--space-4) 0;
  text-align: center;
}

/* A job still running for the collection: a quiet bar under the card */
.collection__indexing {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
}

.collection__indexing-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--brand-500);
  white-space: nowrap;
}

.collection__indexing-bar {
  position: relative;
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
}

.collection__indexing-bar > span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 35%;
  border-radius: inherit;
  background: var(--gradient-vector);
  animation: indeterminate 1.4s var(--ease) infinite;
}

/* Arrows under the cards: a page of COLLECTIONS_PER_PAGE at a time (app.js) */
.collection-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.collection-pager__label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  min-width: 9ch;
  text-align: center;
  white-space: nowrap;
}

.collection {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

/* brand accent along the top edge, like the knowledge-base switcher icon */
.collection::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--gradient-brand);
  opacity: 0.55;
  transition: opacity 0.2s var(--ease);
}

.collection:hover::before {
  opacity: 1;
}

.collection:hover {
  transform: translateY(-2px);
  border-color: rgb(124 108 255 / 40%);
  box-shadow: var(--shadow-md);
}

.collection__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.collection__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgb(20 184 166 / 18%), rgb(124 108 255 / 20%));
  color: var(--brand-500);
}

.collection__icon svg {
  width: 21px;
  height: 21px;
}

.collection__title {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

/* the full display name fits in two lines instead of being cut after one */
.collection__title h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 0;
  overflow: hidden;
  font-size: 1.02rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.collection__title .mono {
  margin-top: 0.2rem;
  color: var(--text-faint);
  font-size: 0.74rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection__desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  flex: 1;
  margin: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.89rem;
  line-height: 1.5;
}

.collection__foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0 calc(-1 * var(--space-5)) calc(-1 * var(--space-4));
  padding: var(--space-3) var(--space-5) var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.collection__date {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-faint);
}

.collection__date svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* row 1: documents + add content; row 2: search + chat */
.collection__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.collection__actions .btn {
  justify-content: center;
  gap: 0.4rem;
  min-width: 0;
  padding-inline: 0.5rem;
  white-space: nowrap;
}

.collection__actions .btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.collection__actions .btn--ghost {
  background: var(--bg-solid);
}

.collection__delete {
  align-self: flex-start;
  opacity: 0.55;
  transition: opacity 0.15s var(--ease);
}

.collection:hover .collection__delete,
.collection__delete:focus-within {
  opacity: 1;
}

/* key/value summary */
.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0;
  margin: 0 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-solid);
}

.kv dt,
.kv dd {
  margin: 0;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}

.kv dt {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
}

.kv dd {
  word-break: break-word;
}

.kv dt:last-of-type,
.kv dd:last-of-type {
  border-bottom: 0;
}

/* --------------------------------------------------------------------------
   14. Search: query console, examples, results
   -------------------------------------------------------------------------- */
.query-console {
  position: relative;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    linear-gradient(135deg, rgb(20 211 190 / 55%), rgb(124 108 255 / 55%), rgb(225 95 239 / 45%)) border-box;
  border: 1px solid transparent;
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.query-console__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.query-console__head .section-title {
  margin: 0;
}

.query-console__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.query-console__icon svg {
  width: 18px;
  height: 18px;
}

/* Which collection the question goes to (name, description, size) */
.coll-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgb(124 108 255 / 35%);
  border-left: 4px solid var(--brand-500);
  border-radius: var(--radius-md);
  background:
    linear-gradient(90deg, rgb(124 108 255 / 12%), rgb(20 211 190 / 6%) 70%, transparent),
    var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.coll-banner__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgb(124 108 255 / 14%);
  color: var(--brand-500);
}

.coll-banner__icon svg {
  width: 20px;
  height: 20px;
}

.coll-banner__body {
  flex: 1 1 auto;
  min-width: 0;
}

.coll-banner__eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-500);
}

.coll-banner__name {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  margin: 0;
}

.coll-banner__name strong {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.coll-banner__id {
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.coll-banner__desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
}

.coll-banner__desc.is-muted {
  color: var(--text-muted);
  font-style: italic;
}

.coll-banner__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.coll-banner__fact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.coll-banner__fact svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.8;
}

.coll-banner__models {
  flex-wrap: wrap;
  min-width: 0;
  overflow-wrap: anywhere;
  gap: 0.6rem;
}

.coll-banner__models svg {
  color: var(--brand-500);
  opacity: 1;
}

.coll-banner__model-embedder,
.coll-banner__model-reranker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.coll-banner__empty {
  display: none;
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.coll-banner__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  align-self: center;
}

/* No collection chosen yet: a muted prompt instead of the details */
.coll-banner.is-empty {
  border-color: var(--border);
  border-left-color: var(--text-muted);
  background: var(--bg-subtle);
}

.coll-banner.is-empty .coll-banner__icon {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.coll-banner.is-empty .coll-banner__eyebrow {
  color: var(--text-muted);
}

.coll-banner.is-empty .coll-banner__filled,
.coll-banner.is-empty [data-banner-manage] {
  display: none;
}

.coll-banner.is-empty .coll-banner__empty {
  display: block;
}

/* With results on the page the console is compact: one-line description */
.search-layout--results .coll-banner {
  margin-bottom: var(--space-4);
}

.search-layout--results .coll-banner__desc {
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

@media (max-width: 640px) {
  .coll-banner {
    flex-wrap: wrap;
  }

  .coll-banner__actions {
    width: 100%;
    justify-content: flex-start;
    padding-left: calc(40px + var(--space-3));
  }
}

.query-console__question {
  min-height: 130px;
  padding: 0.9rem 1rem;
  font-size: 1.08rem;
  border-radius: var(--radius-md);
}

.query-console__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.query-console__hint {
  margin-top: var(--space-4);
  font-size: 0.8rem;
}

.examples {
  padding: 0 var(--space-2);
}

.examples .section-title {
  color: var(--text-muted);
}

.examples ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.example-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.example-chip::before {
  content: "↗";
  color: var(--brand-500);
  font-size: 0.8em;
}

.example-chip:hover {
  color: var(--text);
  border-color: var(--brand-400);
  background: rgb(124 108 255 / 8%);
}

/* Search history of the selected collection (partials/search_history.html) */
.history__box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.history__summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-lg);
}

.history__summary::-webkit-details-marker {
  display: none;
}

.history__summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: var(--space-2);
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s var(--ease);
}

.history__box[open] > .history__summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

.history__summary:hover .history__title {
  color: var(--brand-500);
}

.history__summary:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

.history__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgb(124 108 255 / 12%);
  color: var(--brand-500);
}

.history__icon svg {
  width: 17px;
  height: 17px;
}

.history__title {
  font-weight: 650;
  transition: color 0.15s var(--ease);
}

.history__collection {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history__body {
  padding: 0 var(--space-5) var(--space-4);
}

.history__note {
  margin: 0;
  font-size: 0.88rem;
}

.history__note[hidden] {
  display: none;
}

.history__filter {
  margin-bottom: var(--space-3);
  padding: 0.45rem 0.8rem;
  font-size: 0.88rem;
}

.history__list {
  display: grid;
  gap: var(--space-2);
  max-height: 340px;
  margin: 0;
  padding: 0 0.25rem 0 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}

.history__list > li[hidden] {
  display: none;
}

.history__entry {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}

.history__item {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 0.35rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
}

.history__item:hover,
.history__item:focus-visible {
  border-color: var(--brand-400);
  border-left-color: var(--brand-500);
  background: rgb(124 108 255 / 8%);
  transform: translateX(2px);
}

.history__item.is-current {
  border-color: rgb(124 108 255 / 45%);
  border-left-color: var(--brand-500);
  background: rgb(124 108 255 / 10%);
}

.history__query {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.93rem;
  font-weight: 550;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.history__date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

.history__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.history__tag {
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.history__tag--answer {
  color: var(--brand-500);
  border-color: rgb(124 108 255 / 35%);
}

.history__tag--rating {
  color: #d39b16;
  border-color: rgb(211 155 22 / 35%);
}

.history__tag--current {
  color: #fff;
  border-color: transparent;
  background: var(--gradient-brand);
}

.results {
  scroll-margin-top: 96px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.25rem;
  margin-bottom: var(--space-4);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-inset);
}

.tabs__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 0;
  text-align: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.tabs__btn:hover {
  color: var(--text);
}

.tabs__btn.is-active {
  color: var(--text);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}

.tabs__count {
  min-width: 22px;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-align: center;
}

.tabs__btn.is-active .tabs__count {
  border-color: transparent;
  background: var(--gradient-brand);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
  animation: fade-up 0.3s var(--ease);
}

/* tables */
.table-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-solid);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-solid);
  box-shadow: inset 0 -1px 0 var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 0.12s var(--ease);
}

.data-table tbody tr:hover {
  background: rgb(124 108 255 / 5%);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .is-num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  white-space: nowrap;
}

.data-table th.is-score {
  min-width: 170px;
}

.score {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: flex-end;
  width: 100%;
}

.score__bar {
  --score: 0%;
  position: relative;
  flex: 1;
  max-width: 96px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}

.score__bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--score);
  border-radius: inherit;
  background: var(--gradient-score);
  background-size: 96px 100%;
}

.score__value {
  font-family: var(--font-mono);
  font-weight: 600;
}

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
}

.clamp:hover {
  background: rgb(124 108 255 / 6%);
}

.clamp.is-open {
  display: block;
  -webkit-line-clamp: unset;
}

/* results toolbar: document filter + view switch */
[hidden] {
  display: none !important;
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.results-toolbar__summary {
  margin: 0;
}

.results-toolbar__summary b {
  color: var(--text);
  font-weight: 600;
}

.doc-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
}

.doc-filter__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 280px;
  padding: 0.35rem 0.5rem 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.doc-filter__chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.doc-filter__chip.is-active {
  color: var(--text);
  border-color: rgb(124 108 255 / 55%);
  background: rgb(124 108 255 / 12%);
}

.doc-filter__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-filter__count {
  flex-shrink: 0;
  min-width: 20px;
  padding: 0 0.35rem;
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-align: center;
}

.segmented {
  display: inline-flex;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}

.segmented__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.segmented__btn svg {
  width: 15px;
  height: 15px;
}

.segmented__btn.is-active {
  color: var(--text);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}

/* hits: one card per retrieved passage */
.hits {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hit {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5) var(--space-4) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-solid);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  animation: fade-up 0.35s var(--ease) both;
}

.hit:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.hit--top::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient-vector);
}

.hit__rank {
  display: flex;
  justify-content: center;
}

.hit__rank-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
}

.hit--top .hit__rank-num {
  border-color: transparent;
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.hit__body {
  min-width: 0;
}

.hit__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-3);
}

.hit__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgb(20 211 190 / 12%);
  color: var(--teal-500);
}

.hit__icon svg {
  width: 19px;
  height: 19px;
}

.hit__title {
  min-width: 0;
}

.hit__title > b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
  font-weight: 650;
}

.hit__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.hit__meta b {
  color: var(--text-muted);
  font-weight: 600;
}

.hit__folder {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hit__lang {
  padding: 0 0.4rem;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.hit.is-highlighted {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 2px rgb(124 108 255 / 26%);
}

.hit__doc-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text);
}

.hit__doc-step-pos {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hit__doc-step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--brand-500);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.hit__doc-step-btn:hover {
  background: rgb(124 108 255 / 15%);
  color: var(--brand-400);
}

.hit__score {
  display: grid;
  justify-items: end;
  gap: 0.3rem;
  min-width: 128px;
}

.hit__score-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
}

.hit__score-bar {
  width: 128px;
  max-width: none;
  flex: none;
  height: 6px;
}

.hit__score-bar::after {
  background-size: 128px 100%;
}

.hit__score small {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.hit__text {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.65;
}

.hit__passage {
  margin: 0;
  overflow-wrap: anywhere;
}

/* long passages are cut to ~5 lines with a fade until "show full passage" */
.hit__passage.is-clamped {
  max-height: 8.3em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 62%, transparent);
  mask-image: linear-gradient(#000 62%, transparent);
}

.hit__text.is-open .hit__passage.is-clamped {
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}

/* each text is rendered twice: Markdown (default) and plain (.is-plain) */
.hit__raw {
  white-space: pre-line;
}

.hits:not(.is-plain) .hit__raw,
.hits.is-plain .hit__md {
  display: none;
}

.markdown--passage {
  font-size: inherit;
  line-height: inherit;
}

.markdown--passage p {
  margin: 0 0 0.6em;
}

.markdown--passage > :last-child {
  margin-bottom: 0;
}

.markdown--passage h3,
.markdown--passage h4,
.markdown--passage h5,
.markdown--passage h6 {
  margin: 0.8em 0 0.35em;
  font-size: 0.98rem;
  line-height: 1.4;
}

.markdown--passage > h3:first-child,
.markdown--passage > h4:first-child,
.markdown--passage > h5:first-child,
.markdown--passage > h6:first-child {
  margin-top: 0;
}

.markdown--passage ul,
.markdown--passage ol {
  margin: 0 0 0.6em;
}

.markdown--passage blockquote {
  margin: 0.4em 0 0.6em;
  padding: 0.3rem 0.8rem;
  background: var(--bg-solid);
}

.markdown--passage pre,
.markdown--passage table {
  margin: 0.4em 0 0.6em;
  font-size: 0.85rem;
}

.markdown--passage hr {
  margin: 0.8em 0;
  border: 0;
  border-top: 1px dashed var(--border-strong);
}

/* left / right context: neighbouring chunks, dimmed and cut to ~3 lines
   (the left one shows its end, the right one its beginning) */
.hit__ctx {
  position: relative;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.hit__ctx--left {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px dashed var(--border-strong);
}

.hit__ctx--right {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border-strong);
}

.hit__ctx-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hit__ctx--left .hit__ctx-label::before {
  content: "↑";
}

.hit__ctx--right .hit__ctx-label::before {
  content: "↓";
}

.hit__ctx-body {
  display: flex;
  flex-direction: column;
  max-height: 4.9em;
  overflow: hidden;
}

.hit__ctx--left .hit__ctx-body {
  justify-content: flex-end;
  -webkit-mask-image: linear-gradient(transparent, #000 55%);
  mask-image: linear-gradient(transparent, #000 55%);
}

.hit__ctx--right .hit__ctx-body {
  -webkit-mask-image: linear-gradient(#000 45%, transparent);
  mask-image: linear-gradient(#000 45%, transparent);
}

.hit__ctx-body > * {
  flex-shrink: 0;
}

.hit__text.is-open .hit__ctx-body {
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}

/* with context around it the passage itself gets an accent rule */
.hits:not(.no-context) .hit__text:has(.hit__ctx) .hit__passage {
  margin-left: calc(-1 * var(--space-4) + 2px);
  padding-left: calc(var(--space-4) - 5px);
  border-left: 3px solid var(--brand-500);
}

.hits.no-context .hit__ctx,
.hits.no-context [data-ctx-only] {
  display: none;
}

/* toolbar switches: Markdown / context */
.hits-switches {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: auto;
}

.hits-switches + .segmented {
  margin-left: 0;
}

.switch-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.4rem 0.75rem 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.switch-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-chip::before {
  content: "";
  width: 26px;
  height: 15px;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at 7.5px 50%, var(--bg-solid) 5px, transparent 5.5px), var(--border-strong);
  transition: background 0.2s var(--ease);
}

.switch-chip:has(input:checked) {
  color: var(--text);
  border-color: rgb(124 108 255 / 40%);
}

.switch-chip:has(input:checked)::before {
  background: radial-gradient(circle at 18.5px 50%, #fff 5px, transparent 5.5px), var(--gradient-score);
}

.switch-chip:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.hit__mark {
  padding: 0 0.12em;
  border-radius: 3px;
  background: rgb(20 211 190 / 22%);
  color: inherit;
  box-shadow: inset 0 -1px 0 rgb(20 211 190 / 60%);
}

.hit__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin-top: var(--space-2);
}

.hit__foot:empty {
  display: none;
}

.hit__action,
.hit__extra > summary {
  padding: 0.25rem 0.55rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-500);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

[data-theme="dark"] .hit__action,
[data-theme="dark"] .hit__extra > summary {
  color: var(--brand-400);
}

.hit__action:hover,
.hit__extra > summary:hover {
  background: rgb(124 108 255 / 10%);
}

.hit__action:disabled {
  color: var(--teal-500);
  cursor: default;
}

.hit__extra {
  margin-left: auto;
}

.hit__extra[open] {
  flex-basis: 100%;
  margin-left: 0;
}

.hit__extra > summary {
  display: inline-block;
  list-style: none;
}

.hit__extra > summary::-webkit-details-marker {
  display: none;
}

.hit__extra > summary::before {
  content: "▸ ";
}

.hit__extra[open] > summary::before {
  content: "▾ ";
}

.hit__extra dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-2) var(--space-4);
  margin: var(--space-2) 0 0;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
}

.hit__extra dt {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hit__extra dd {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

/* document ranking (search statistics) */
.doc-board {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc-board__row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5) var(--space-4) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-solid);
  min-width: 0;
}

.doc-board__row.is-best {
  border-color: rgb(124 108 255 / 40%);
  background:
    radial-gradient(circle at 0% 0%, rgb(124 108 255 / 9%), transparent 55%),
    var(--bg-solid);
}

.doc-board__rank {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 700;
}

.doc-board__row.is-best .doc-board__rank {
  border-color: transparent;
  background: var(--gradient-brand);
  color: #fff;
}

.doc-board__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
  min-width: 0;
}

.doc-board__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}

.doc-board__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.doc-board__score {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

.doc-board__score small {
  margin-left: 0.5rem;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 500;
}

.doc-board__bar {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 8px;
}

.doc-board__bar::after {
  background-size: 100% 100%;
}

.doc-board__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
  max-width: 100%;
}

.doc-board__facts li {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-faint);
  font-size: 0.75rem;
  box-sizing: border-box;
}

.doc-board__facts span {
  flex-shrink: 0;
}

.doc-board__facts b {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .hit {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .hit__rank {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
  }

  .hit__rank-num {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 0.78rem;
  }

  .hit__head {
    grid-template-columns: auto minmax(0, 1fr);
    padding-right: 36px;
  }

  .hit__score {
    grid-column: 1 / -1;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    justify-items: start;
    min-width: 0;
  }

  .hit__score-bar {
    width: 100%;
  }

  .segmented {
    margin-left: 0;
  }

  .doc-board__head {
    flex-direction: column;
    gap: 0.2rem;
  }

  .doc-board__name {
    max-width: 100%;
  }
}

/* generative answer */
.answer {
  position: relative;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 0% 0%, rgb(124 108 255 / 10%), transparent 50%),
    radial-gradient(circle at 100% 100%, rgb(20 211 190 / 8%), transparent 50%),
    var(--bg-solid);
  border: 1px solid rgb(124 108 255 / 30%);
}

.answer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-vector);
}

.answer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.answer__header .section-title {
  margin: 0;
}

.answer__spark {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--gradient-vector);
  color: #fff;
  font-size: 0.85rem;
}

/* Answer card: shown above the results; while the model is still writing,
   it holds a skeleton that is replaced by the answer (see app.js). */
.answer-card .card__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.answer-card .answer__spark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: 0.75rem;
}

.answer-card--pending {
  position: relative;
  overflow: hidden;
  border-color: rgb(124 108 255 / 35%);
}

.answer-card--pending::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--gradient-vector);
  background-size: 200% 100%;
  animation: answer-flow 1.6s linear infinite;
}

.answer-card--pending .answer__spark {
  animation: node-pulse 1.8s var(--ease) infinite;
}

.answer-card__hint {
  margin: 0 0 var(--space-4);
}

.badge--live {
  gap: 0.45rem;
  color: var(--text);
  border-color: rgb(124 108 255 / 40%);
}

.badge--live .spinner {
  width: 12px;
  height: 12px;
  border-color: rgb(124 108 255 / 30%);
  border-top-color: var(--brand-500);
}

.answer-skeleton {
  display: grid;
  gap: 0.7rem;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px dashed rgb(124 108 255 / 35%);
  background: var(--bg-inset);
}

.answer-skeleton span {
  display: block;
  height: 0.8rem;
  border-radius: 999px;
  background: linear-gradient(90deg,
      rgb(124 108 255 / 10%) 0%,
      rgb(124 108 255 / 28%) 40%,
      rgb(20 211 190 / 18%) 60%,
      rgb(124 108 255 / 10%) 100%);
  background-size: 300% 100%;
  animation: answer-shimmer 1.8s ease-in-out infinite;
}

.answer-skeleton span:nth-child(2) {
  width: 92%;
  animation-delay: 0.15s;
}

.answer-skeleton span:nth-child(3) {
  width: 97%;
  animation-delay: 0.3s;
}

.answer-skeleton span:nth-child(4) {
  width: 58%;
  animation-delay: 0.45s;
}

.answer-card .alert {
  margin: 0;
}

.answer-card.is-arrived {
  animation: fade-up 0.45s var(--ease) both;
}

.feedback-slot:empty {
  display: none;
}

@keyframes answer-shimmer {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: 0 0;
  }
}

@keyframes answer-flow {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.markdown {
  font-size: 0.98rem;
  line-height: 1.7;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: var(--space-5) 0 var(--space-2);
}

.markdown ul,
.markdown ol {
  padding-left: 1.4rem;
}

.markdown li + li {
  margin-top: 0.25rem;
}

.markdown li::marker {
  color: var(--brand-500);
}

.markdown blockquote {
  margin: var(--space-4) 0;
  padding: 0.4rem 1rem;
  border-left: 3px solid var(--brand-500);
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.markdown pre {
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--code-fg);
  overflow-x: auto;
}

.markdown pre code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}

.markdown table {
  width: 100%;
  margin: var(--space-4) 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.markdown th,
.markdown td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
}

.markdown th {
  background: var(--bg-subtle);
}

.cell-left {
  text-align: left;
}

.cell-center {
  text-align: center;
}

.cell-right {
  text-align: right;
}

/* expander + JSON */
.expander {
  margin-top: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  overflow: hidden;
}

.expander summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  color: var(--text-muted);
}

.expander summary::-webkit-details-marker {
  display: none;
}

.expander summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s var(--ease);
}

.expander[open] summary::before {
  transform: rotate(45deg);
}

.expander summary:hover {
  color: var(--text);
}

.expander-body {
  padding: 0 0.9rem 0.9rem;
}

.json {
  margin: var(--space-2) 0 0;
  padding: var(--space-4);
  max-height: 420px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
}

.json code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}

/* --------------------------------------------------------------------------
   15. Feedback: alerts, empty states, progress
   -------------------------------------------------------------------------- */
.alert {
  position: relative;
  display: flex;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: 0.85rem 1rem 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 0.92rem;
}

.alert::before {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
}

.alert__content {
  min-width: 0;
  flex: 1;
}

.alert-success {
  color: var(--success-fg);
  background: var(--success-bg);
  border-color: rgb(34 197 139 / 40%);
}

.alert-success::before {
  content: "✓";
  background: var(--success-border);
}

.alert-error {
  color: var(--error-fg);
  background: var(--error-bg);
  border-color: rgb(240 68 106 / 40%);
}

.alert-error::before {
  content: "!";
  background: var(--error-border);
}

.alert-warning {
  color: var(--warning-fg);
  background: var(--warning-bg);
  border-color: rgb(240 169 42 / 45%);
}

.alert-warning::before {
  content: "!";
  background: var(--warning-border);
}

.alert .json {
  color: var(--code-fg);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-7) var(--space-4);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  max-width: 46ch;
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: var(--space-2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgb(20 184 166 / 18%), rgb(124 108 255 / 22%));
  color: var(--brand-500);
}

.empty-state__icon svg {
  width: 28px;
  height: 28px;
}

.progress {
  position: relative;
  height: 6px;
  margin-top: var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  overflow: hidden;
}

.progress__bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: inherit;
  background: var(--gradient-vector);
}

.progress--indeterminate .progress__bar {
  animation: indeterminate 1.4s var(--ease) infinite;
}

/* Indexing progress (queue of the engine): a determinate bar when the number
   of documents is known, an indeterminate one while the job is still being
   prepared. Rendered by partials/indexing_status.html, refreshed by app.js. */
.indexing-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: var(--space-4) var(--space-4) var(--space-4) calc(var(--space-4) + 4px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* the accent stripe on the left tells the state at a glance */
.indexing-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--border-strong);
}

.indexing-panel.is-running {
  border-color: rgb(124 108 255 / 35%);
}

.indexing-panel.is-running::before {
  background: var(--gradient-vector);
}

.indexing-panel--completed::before {
  background: var(--success-fg);
}

.indexing-panel--partial::before,
.indexing-panel--failed::before {
  background: var(--error-fg);
}

.indexing-panel > * {
  margin: 0;
}

.indexing-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.indexing-panel__head-main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.indexing-panel__head-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

/* "Close automatically when finished": a small switch next to the close button */
.indexing-autoclose {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.indexing-autoclose:hover,
.indexing-autoclose:has(input:checked) {
  color: var(--text);
}

.indexing-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-solid);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.indexing-panel__close:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.indexing-panel__close:focus-visible,
.indexing-tab:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Switcher of the indexing processes: a row of tabs below the header */
.indexing-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px dashed var(--border);
}

.indexing-switcher__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.indexing-switcher__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}

.indexing-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  min-width: 0;
  padding: 0.35rem 0.4rem 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.indexing-tab:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-solid);
}

.indexing-tab.is-active {
  border-color: rgb(124 108 255 / 55%);
  background: rgb(124 108 255 / 10%);
  color: var(--text);
  box-shadow: 0 0 0 3px rgb(124 108 255 / 12%);
}

.indexing-tab__name {
  min-width: 0;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.indexing-tab__id {
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.indexing-tab.is-active .indexing-tab__id {
  color: var(--brand-600);
}

.indexing-tab__badge {
  min-width: 3.2em;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-solid);
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.indexing-panel__coll-link {
  font-size: 0.82rem;
}

.indexing-panel__coll-link a {
  font-weight: 600;
  color: var(--brand-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.indexing-panel__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.indexing-badge {
  padding: 0.15em 0.65em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-solid);
  white-space: nowrap;
}

.indexing-badge--queued,
.indexing-badge--preparing {
  color: var(--info-fg);
  border-color: rgb(59 130 246 / 35%);
  background: rgb(59 130 246 / 10%);
}

.indexing-badge--indexing {
  color: var(--brand-600);
  border-color: rgb(124 108 255 / 40%);
  background: rgb(124 108 255 / 12%);
}

.indexing-badge--completed {
  color: var(--success-fg);
  border-color: rgb(34 197 139 / 40%);
  background: var(--success-bg);
}

.indexing-badge--partial,
.indexing-badge--failed {
  color: var(--error-fg);
  border-color: rgb(240 68 106 / 40%);
  background: var(--error-bg);
}

/* "Indexed documents: N of M" on the left, the share in big digits on the right */
.indexing-panel__summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: calc(-1 * var(--space-1));
}

.indexing-panel__percent {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--brand-600);
}

.indexing-panel--completed .indexing-panel__percent {
  color: var(--success-fg);
}

.indexing-panel--partial .indexing-panel__percent,
.indexing-panel--failed .indexing-panel__percent {
  color: var(--error-fg);
}

.indexing-progress {
  position: relative;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}

.indexing-progress__bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-radius: inherit;
  background: var(--gradient-vector);
  transition: width 0.4s var(--ease);
}

.indexing-progress.is-indeterminate .indexing-progress__bar {
  width: 35%;
  animation: indeterminate 1.4s var(--ease) infinite;
}

.indexing-panel__count {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.indexing-panel__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.indexing-panel__stats:not(:has(li:not(.hidden))) {
  display: none;
}

.indexing-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.indexing-stat::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--info-fg);
}

.indexing-stat--failed {
  color: var(--error-fg);
  border-color: rgb(240 68 106 / 35%);
  background: var(--error-bg);
}

.indexing-stat--failed::before {
  background: var(--error-fg);
}

.indexing-stat--skipped::before {
  background: var(--text-faint);
}

/* The document being indexed right now */
.indexing-panel__current {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
}

.indexing-panel__current::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 0.15em;
  border: 2px solid rgb(124 108 255 / 25%);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.indexing-panel__meta,
.indexing-panel__note,
.indexing-panel__hint {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.indexing-panel__note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.indexing-panel__note::before {
  content: "i";
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-weight: 700;
  font-style: italic;
  color: var(--text-muted);
}

.indexing-panel__hint {
  padding-top: var(--space-2);
  border-top: 1px dashed var(--border);
  color: var(--text-faint);
}

@media (prefers-reduced-motion: reduce) {
  .indexing-panel__current::before {
    animation: none;
  }
}

.indexing-panel__meta-title {
  font-weight: 600;
  color: var(--error-fg);
}

.indexing-panel__hint--error {
  color: var(--error-fg);
}

/* --------------------------------------------------------------------------
   16. Footer
   -------------------------------------------------------------------------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-5) var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-faint);
}

.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-weight: 600;
}

.footer a {
  color: var(--text-muted);
}

.footer a:hover {
  color: var(--brand-500);
}

/* --------------------------------------------------------------------------
   17. Motion
   -------------------------------------------------------------------------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes status-ping {
  0% {
    box-shadow: 0 0 0 0 rgb(46 230 208 / 55%);
  }
  70%,
  100% {
    box-shadow: 0 0 0 8px rgb(46 230 208 / 0%);
  }
}

@keyframes node-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  100% {
    transform: scale(4.5);
    opacity: 0;
  }
}

@keyframes dash {
  to {
    stroke-dashoffset: -16;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes indeterminate {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   18. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .brand__tag {
    display: none;
  }

  .user-chip__name {
    display: none;
  }

  .user-chip {
    padding-right: 0.2rem;
  }
}

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .hero__visual {
    max-width: 560px;
  }

  .pipeline__track,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pipeline__track::before {
    display: none;
  }

  .grid-sidebar {
    grid-template-columns: 1fr;
  }

  .grid-sidebar > .sidebar {
    position: static;
    max-height: none;
    order: 2;
  }

  .search-layout,
  .search-layout.is-params-collapsed,
  .search-layout--chat.is-params-collapsed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .search-layout.is-params-collapsed .params-rail {
    display: none;
  }

  .search-layout__side,
  .search-layout__query,
  .search-layout__results {
    grid-column: 1;
    grid-row: auto;
  }

  .search-layout__query {
    order: 1;
  }

  .search-layout__side {
    position: static;
    max-height: none;
    order: 2;
  }

  .search-layout__results {
    order: 3;
  }

  .auth {
    grid-template-columns: 1fr;
  }

  .auth__showcase {
    padding: var(--space-6) var(--space-5);
  }
}

@media (max-width: 900px) {
  .topbar__inner {
    flex-wrap: wrap;
    border-radius: var(--radius-lg);
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    order: 3;
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0;
    border-radius: var(--radius-md);
  }

  .nav.is-open {
    display: flex;
  }

  .nav__link {
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
  }

  .topbar__actions,
  .nav ~ .topbar__actions {
    margin-left: 0;
  }

  .page-header {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14.5px;
  }

  .page {
    padding: var(--space-5) var(--space-3) var(--space-6);
  }

  .card,
  .query-console,
  .answer {
    padding: var(--space-4);
  }

  .grid-2,
  .form-grid,
  .feature-grid,
  .pipeline__track,
  .auth__facts {
    grid-template-columns: 1fr;
  }

  .stepper {
    width: 100%;
    justify-content: space-between;
  }

  .stepper__copy small {
    display: none;
  }

  .stepper__item + .stepper__item::before {
    width: 10px;
  }

  .stepper__item a {
    padding-right: 0.55rem;
  }

  .field-slider {
    grid-template-columns: 1fr 56px;
  }

  .field-slider > span {
    grid-column: 1 / -1;
  }

  .vector-space__hits li:nth-child(3) {
    display: none;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .kv dt {
    border-bottom: 0;
    padding-bottom: 0.2rem;
  }

  .card--auth {
    padding: var(--space-5) var(--space-4);
  }

  .brand__text {
    display: none;
  }
}

@media (max-width: 420px) {
  .stepper__copy {
    display: none;
  }

  .stepper {
    width: auto;
  }
}

/* --------------------------------------------------------------------------
   18.5 Collection Management
   -------------------------------------------------------------------------- */
.manage-card {
  margin-bottom: 0;
}

.manage-form label {
  margin-top: var(--space-3);
}

.form-row--split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 var(--space-3);
}

.doc-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.doc-search-box {
  flex: 1;
  min-width: 180px;
}

.doc-search-box input {
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
}

.doc-selection-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
}

.doc-selection-actions .btn {
  border-radius: var(--radius-pill);
}

.doc-selection-actions .btn--ghost:not(:disabled) {
  background: var(--bg-solid);
}

.doc-table-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-solid);
  max-height: 420px;
  overflow-y: auto;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.doc-table th,
.doc-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.doc-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  background: var(--bg-subtle);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--border-strong);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.doc-table td {
  transition: background 0.12s var(--ease);
}

.doc-table tr:last-child td {
  border-bottom: 0;
}

.doc-table tbody tr:hover td {
  background: var(--bg-subtle);
}

.doc-name-text {
  font-weight: 500;
}

.doc-th--check,
.doc-td--check {
  width: 40px;
  text-align: center;
}

/* Row selection uses square check boxes: the pill switch is reserved for
   the "in search" state so the two controls cannot be confused. */
.doc-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  vertical-align: middle;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-solid);
}

.doc-table input[type="checkbox"]::after {
  top: 50%;
  left: 50%;
  width: 9px;
  height: 5px;
  border-radius: 0;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  background: none;
  box-shadow: none;
  transform: translate(-50%, -65%) rotate(-45deg) scale(0);
  transition: transform 0.15s var(--ease);
}

.doc-table input[type="checkbox"]:hover {
  border-color: var(--brand-500);
}

.doc-table input[type="checkbox"]:checked,
.doc-table input[type="checkbox"]:indeterminate {
  background: var(--gradient-brand);
  border-color: transparent;
}

.doc-table input[type="checkbox"]:checked::after {
  background: none;
  box-shadow: none;
  transform: translate(-50%, -65%) rotate(-45deg) scale(1);
}

.doc-table input[type="checkbox"]:indeterminate::after {
  width: 10px;
  height: 2px;
  border: 0;
  border-radius: 1px;
  background: #fff;
  transform: translate(-50%, -50%) scale(1);
}

.doc-th--action,
.doc-td--action {
  width: 170px;
  text-align: right;
}

.doc-td--name {
  word-break: break-all;
}

.doc-path-badge {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 0.1em 0.45em;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  border-radius: 4px;
  background: var(--bg-inset);
  color: var(--text-faint);
  border: 1px solid var(--border);
}

/* "In search" switch of a document (use_in_search) */
.doc-th--action {
  white-space: nowrap;
}

.doc-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.doc-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  cursor: pointer;
}

.doc-switch:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.doc-switch__track {
  position: relative;
  display: block;
  width: 36px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background 0.2s var(--ease);
}

.doc-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 30%);
  transition: transform 0.2s var(--ease);
}

.doc-switch[aria-checked="true"] .doc-switch__track {
  background: var(--gradient-vector);
}

.doc-switch[aria-checked="true"] .doc-switch__thumb {
  transform: translateX(16px);
}

.doc-switch.is-busy {
  cursor: progress;
  opacity: 0.6;
}

.doc-row.is-disabled .doc-name-text {
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.doc-row.is-disabled .doc-path-badge {
  opacity: 0.6;
}

.doc-state-badge {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 0.1em 0.5em;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  color: #b45309;
  background: rgb(245 158 11 / 14%);
  border: 1px solid rgb(245 158 11 / 30%);
  white-space: nowrap;
}

[data-theme="dark"] .doc-state-badge:not(.doc-index-badge) {
  color: #fbbf24;
}

/* Status of a document of an indexing request (pending / indexing / indexed /
   failed / skipped): a pill with a status dot; "indexed" is shown only for
   the documents of the job of the panel. */
.doc-index-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.15em 0.6em 0.15em 0.5em;
  vertical-align: 0.1em;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.doc-index-badge::before {
  content: "";
  flex: none;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: currentColor;
}

.doc-index-badge--pending {
  color: var(--text-muted);
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
}

.doc-index-badge--pending::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px currentColor;
}

.doc-index-badge--indexing {
  color: var(--brand-600);
  background: rgb(124 108 255 / 12%);
  border: 1px solid rgb(124 108 255 / 35%);
}

/* a small spinner instead of the dot while the document is being indexed */
.doc-index-badge--indexing::before {
  width: 0.75em;
  height: 0.75em;
  background: transparent;
  border: 1.5px solid rgb(124 108 255 / 30%);
  border-top-color: currentColor;
  animation: spin 0.9s linear infinite;
}

.doc-index-badge--indexed {
  color: var(--success-fg);
  background: var(--success-bg);
  border: 1px solid rgb(34 197 139 / 40%);
}

.doc-index-badge--indexed::before {
  content: "✓";
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  font-weight: 800;
  line-height: 1;
}

.doc-index-badge--failed {
  color: var(--error-fg);
  background: var(--error-bg);
  border: 1px solid rgb(240 68 106 / 35%);
}

.doc-index-badge--skipped {
  color: var(--warning-fg);
  background: var(--warning-bg);
  border: 1px solid rgb(240 169 42 / 35%);
}

@media (prefers-reduced-motion: reduce) {
  .doc-index-badge--indexing::before {
    animation: none;
  }
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .doc-state-badge:not(.doc-index-badge) {
    color: #fbbf24;
  }
}

.badge--muted {
  color: var(--text-muted);
  background: var(--bg-inset);
  border: 1px solid var(--border);
}

.doc-visibility-hint {
  margin: var(--space-3) 0 0;
  font-size: 0.8rem;
}

.doc-visibility-status {
  margin: var(--space-1) 0 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  color: var(--teal-600);
}

.doc-visibility-status.is-error {
  color: #e11d48;
}

@media (max-width: 640px) {
  .doc-th--action,
  .doc-td--action {
    width: auto;
  }

  /* the preview link keeps its icon and aria-label only */
  .doc-preview-btn__label {
    display: none;
  }

  .doc-th--action {
    white-space: normal;
    font-size: 0.72rem;
  }

  .doc-table th,
  .doc-table td {
    padding: 0.5rem 0.5rem;
  }

  .doc-state-badge {
    margin: 0.25rem 0 0;
    white-space: normal;
    word-break: normal;
    border-radius: var(--radius-xs);
  }

  .doc-selection-actions {
    min-width: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .doc-switch__track,
  .doc-switch__thumb {
    transition: none;
  }
}

.card--danger-zone {
  border-color: rgb(244 63 94 / 35%);
  background: linear-gradient(180deg, rgb(225 29 72 / 4%), transparent);
}

.danger-eyebrow {
  color: #fb7185 !important;
}

/* --------------------------------------------------------------------------
   18.5.1 Preview of a whole document (documents tab -> window of its own)
   -------------------------------------------------------------------------- */

/* The label of the link fits next to the icon; on a narrow screen the row
   keeps just the eye and its accessible name. */
.doc-preview-btn__label {
  margin-inline-start: 0.3rem;
}

/* A file name is one word and the header has no room for every one of them. */
.doc-preview__title {
  overflow-wrap: anywhere;
}

/* The text of the document, with the line breaks of the source, in a block
   which scrolls on its own (the whitespace of the layout is already gone, see
   `preview_text` in `server.py`).

   `overflow-wrap: anywhere` and not `break-word`: `anywhere` also shrinks the
   *intrinsic* width of the text, so a block of it can never be wider than the
   page.  A link, a hash or a base64 picture is one word which no one can
   break, and a document indexed from a PDF still has lines a hundred
   characters wide; with `break-word` the text asked for its full width and
   stretched the whole window sideways. */
.doc-preview__text {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  padding: var(--space-4) var(--space-5);
  max-height: 60vh;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* A grid sizes its column to the widest of its items, so the pages of the
   document need the same room to shrink as the text in them. */
.doc-preview__pages {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.doc-preview__page {
  min-width: 0;
}

.doc-preview__page-number {
  margin: 0 0 var(--space-2);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.doc-preview__notice {
  margin: 0 0 var(--space-3);
  font-size: 0.82rem;
  color: var(--warning-fg);
}

/* --------------------------------------------------------------------------
   18.6 Knowledge base: shared header, tabs and collection switcher
   -------------------------------------------------------------------------- */
.kb-header {
  margin-bottom: var(--space-4);
}

/* Tabs + collection switcher + search link: one bar, fixed position */
.kb-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-inset);
}

.kb-bar .kb-tabs {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.kb-switch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1 1 280px;
  min-width: 0;
  max-width: 520px;
  margin-left: auto;
  padding: 0.3rem 0.4rem 0.3rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm);
}

.kb-switch:focus-within {
  border-color: var(--brand-500);
}

.kb-switch__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--gradient-brand);
}

.kb-switch__icon svg {
  width: 18px;
  height: 18px;
}

.kb-switch__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.kb-switch__label {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  line-height: 1.2;
}

.kb-switch select {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0.05rem 1.8rem 0.05rem 0;
  border: 0;
  box-shadow: none;
  background-color: var(--bg-solid);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-overflow: ellipsis;
  cursor: pointer;
}

.kb-switch select:focus {
  outline: none;
  box-shadow: none;
}

.kb-bar__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.kb-tabs + .kb-bar__actions {
  margin-left: auto;
}

.kb-bar__search,
.kb-bar__chat {
  flex-shrink: 0;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.kb-bar__search {
  color: var(--brand-500);
}

.kb-bar__chat {
  color: var(--accent-teal);
}

.kb-bar__search:hover,
.kb-bar__chat:hover {
  background: var(--bg-subtle);
}

.kb-tabs + .kb-bar__search {
  margin-left: auto;
}

.kb-tabs {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin: var(--space-4) 0 var(--space-5);
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  width: fit-content;
  max-width: 100%;
}

.kb-tabs__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.kb-tabs__link:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.kb-tabs__link.is-active {
  color: var(--text);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}

.kb-tabs__icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.kb-tabs__link.is-active .kb-tabs__icon {
  color: var(--brand-500);
}

.kb-tabs__count {
  min-width: 1.6em;
  padding: 0.05em 0.5em;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.kb-tabs__link.is-active .kb-tabs__count {
  background: var(--gradient-brand);
  color: #fff;
}

.tabs--methods {
  grid-template-columns: repeat(2, minmax(0, 220px));
  width: fit-content;
  max-width: 100%;
}

.btn--icon {
  gap: 0;
  padding-inline: 0.55rem;
}

.btn--icon svg {
  width: 16px;
  height: 16px;
}

.btn--xs.btn--icon svg {
  width: 15px;
  height: 15px;
}

.manage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: var(--space-5);
  align-items: start;
}

.manage-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  position: sticky;
  top: 96px;
}

.manage-side__title {
  margin: 0 0 var(--space-2);
  font-size: 1.05rem;
}

.manage-side .manage-card {
  margin: 0;
}

.doc-table-wrap {
  max-height: 560px;
}

/* selected rows are highlighted in the brand colour (red is kept for errors) */
.doc-table tbody tr.doc-row.is-selected td {
  background: rgb(124 108 255 / 9%);
}

.doc-row.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--violet-500);
}

.doc-selection-count {
  padding: 0 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-500);
  white-space: nowrap;
}

.doc-selection-count:empty {
  display: none;
}

.doc-empty-filter {
  margin: 0;
  padding: var(--space-4);
  text-align: center;
}

@media (max-width: 1024px) {
  .manage-layout {
    grid-template-columns: 1fr;
  }

  .manage-side {
    position: static;
  }
}

@media (max-width: 720px) {
  .kb-tabs {
    width: 100%;
    border-radius: var(--radius-md);
  }

  .kb-tabs__link {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0.5rem 0.6rem;
  }

  .kb-bar__actions {
    flex-basis: 100%;
    justify-content: center;
  }

  .kb-bar__search,
  .kb-bar__chat {
    flex: 1 1 auto;
    text-align: center;
  }

  .kb-switch {
    flex-basis: 100%;
    max-width: none;
    margin-left: 0;
  }
}

/* --------------------------------------------------------------------------
   18.7 Deletion feedback: result alert and confirmation dialog
   -------------------------------------------------------------------------- */
.alert-deleted {
  align-items: flex-start;
  padding: 0.95rem 2.8rem 0.95rem 1rem;
  color: var(--text);
  background:
    linear-gradient(90deg, rgb(225 29 72 / 12%), rgb(225 29 72 / 3%) 60%, transparent),
    var(--bg-elevated);
  border-color: rgb(244 63 94 / 38%);
  box-shadow: var(--shadow-sm);
  animation: alert-in 0.35s var(--ease) both;
}

.alert-deleted::before {
  content: none;
}

.alert-deleted__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f43f5e, #be123c);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgb(225 29 72 / 70%);
}

.alert-deleted__icon svg {
  width: 18px;
  height: 18px;
}

.alert-deleted__title {
  margin: 0.2rem 0 0;
  font-weight: 700;
}

.alert-deleted__items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
}

.alert-deleted__items li {
  max-width: 100%;
  padding: 0.15em 0.6em;
  border: 1px solid rgb(244 63 94 / 30%);
  border-radius: var(--radius-pill);
  background: var(--bg-solid);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-decoration: line-through;
  text-decoration-color: rgb(244 63 94 / 55%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-deleted__items .alert-deleted__more {
  text-decoration: none;
  font-family: inherit;
}

.alert-deleted__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin: 0.55rem 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.alert-deleted__stat {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.alert-deleted__stat + .alert-deleted__stat::before {
  content: "·";
  margin-right: 0.75rem;
  color: var(--text-faint);
}

.alert__close {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.alert__close:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

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

.confirm-dialog {
  width: min(460px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid rgb(244 63 94 / 35%);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgb(0 0 0 / 4%);
}

.confirm-dialog[open] {
  animation: dialog-in 0.2s var(--ease) both;
}

.confirm-dialog::backdrop {
  background: rgb(7 10 20 / 55%);
  backdrop-filter: blur(4px);
}

.confirm-dialog__body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-4);
  margin: 0;
  padding: var(--space-5);
}

.confirm-dialog__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgb(225 29 72 / 14%);
  color: #f43f5e;
}

.confirm-dialog__icon svg {
  width: 22px;
  height: 22px;
}

.confirm-dialog__title {
  margin: 0.15rem 0 0.4rem;
  font-size: 1.1rem;
}

.confirm-dialog__message {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.confirm-dialog__items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 180px;
  margin: var(--space-3) 0 0;
  padding: 0.5rem 0.65rem;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.confirm-dialog__items li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confirm-dialog__items li::before {
  content: "−";
  margin-right: 0.5rem;
  color: #f43f5e;
}

.confirm-dialog__items .confirm-dialog__more {
  font-family: inherit;
  color: var(--text-faint);
}

.confirm-dialog__items .confirm-dialog__more::before {
  content: none;
}

.confirm-dialog__phrase {
  margin-top: var(--space-3);
}

.confirm-dialog__phrase label {
  margin: 0 0 var(--space-2);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.confirm-dialog__phrase input {
  font-family: var(--font-mono);
}

.confirm-dialog__warning {
  margin: var(--space-3) 0 0;
  color: #f43f5e;
  font-size: 0.8rem;
  font-weight: 600;
}

.confirm-dialog__actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.confirm-dialog__actions .btn--danger:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .alert-deleted,
  .confirm-dialog[open] {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   18.6 Chunking: collection cards, new collection form, indexing options
   -------------------------------------------------------------------------- */
/* Collection card: date, counters and chunking, one line under another */
.collection__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

/* Counters of GET collections: all the documents, the active ones aside */
.collection__docs {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.collection__docs svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--brand-500);
}

.collection__doc-active {
  color: var(--text-faint);
}

.collection__doc-active::before {
  content: "·";
  margin-right: 0.4rem;
}

.collection__chunking {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.collection__chunking svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--brand-500);
}

.collection__chunking.is-undeclared {
  color: var(--text-faint);
  font-style: italic;
}

.collection__chunking.is-undeclared svg {
  color: var(--text-faint);
}

/* Models of GET collections: embedder and reranker */
.collection__models {
  display: inline-flex;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.collection__model-embedder,
.collection__model-reranker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.collection__models svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--brand-500);
}

/* "strict": the collection refuses other chunking than its own */
.badge--strict {
  padding: 0.05rem 0.5rem;
  border-color: rgb(240 169 42 / 55%);
  background: var(--warning-bg);
  color: var(--warning-fg);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.kv dd .badge--strict {
  margin-left: 0.5rem;
}

/* New collection: the chunking card spans both form columns */
.chunking-card {
  grid-column: 1 / -1;
}

.chunking-card__lead {
  margin: calc(-1 * var(--space-2)) 0 var(--space-3);
}

.chunking-card.has-error {
  border-color: rgb(240 68 106 / 45%);
}

.chunking-card .form-row--split {
  gap: 0 var(--space-5);
}

.model-info {
  min-height: 1.2em;
  font-family: var(--font-mono);
  font-size: 0.76rem !important;
}

.model-info:empty {
  display: none;
}

/* Inline notes under a field: validation error / soft warning */
.field-msg {
  margin: var(--space-2) 0 0;
  padding: 0.4rem 0.65rem;
  border-left: 3px solid;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.field-msg[hidden] {
  display: none;
}

.field-msg--error {
  border-color: var(--error-border);
  background: var(--error-bg);
  color: var(--error-fg);
}

.field-msg--warn {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-fg);
}

input.is-invalid,
input.is-invalid:focus {
  border-color: var(--error-border);
  box-shadow: 0 0 0 3px rgb(240 68 106 / 18%);
}

/* A switch with a title and a description (strict chunking) */
.check-row--boxed {
  align-items: flex-start;
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.check-row--boxed input[type="checkbox"] {
  margin-top: 3px;
}

.check-row--boxed label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.check-row__title {
  font-weight: 600;
}

.check-row__desc {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* Indexing: collection settings vs. custom values */
.chunk-mode {
  margin: 0 0 var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.chunk-mode__legend {
  padding: 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chunk-mode.is-strict {
  border-color: rgb(240 169 42 / 45%);
}

.chunk-mode__opt {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0 0 var(--space-2);
  padding: 0.5rem 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.chunk-mode__opt:hover {
  background: var(--bg-subtle);
}

.chunk-mode__opt:has(input:checked) {
  border-color: rgb(124 108 255 / 45%);
  background: rgb(124 108 255 / 8%);
}

.chunk-mode__opt input[type="radio"] {
  appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-solid);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.chunk-mode__opt input[type="radio"]:checked {
  border-color: var(--brand-500);
  box-shadow: inset 0 0 0 4px var(--bg-solid);
  background: var(--brand-500);
}

.chunk-mode__opt input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.chunk-mode__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.chunk-mode__title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.chunk-mode__desc {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.chunk-mode__note {
  margin: var(--space-2) 0 var(--space-2);
}

/* Sliders of the collection settings: visible, but not editable */
.chunk-fields {
  transition: opacity 0.2s var(--ease);
}

.chunk-fields.is-locked {
  opacity: 0.55;
}

.chunk-fields.is-locked input[type="range"] {
  cursor: not-allowed;
}

.field-slider.is-invalid > span,
.field-slider.is-invalid output {
  color: var(--error-fg);
}

.field-slider.is-invalid output {
  border-color: var(--error-border);
  background: var(--error-bg);
}

.field-slider.is-invalid input[type="range"] {
  box-shadow: inset 0 0 0 1px var(--error-border), 0 0 0 3px rgb(240 68 106 / 18%);
}

/* --------------------------------------------------------------------------
   20. Conversational Search (Chat)
   -------------------------------------------------------------------------- */
/* Two-column area under the collection banner: conversation list on the
   left, the chat itself on the right. */
.search-layout--chat:not(.is-params-collapsed) {
  grid-template-columns: minmax(270px, 310px) minmax(0, 1fr);
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: stretch;
}

.chat-layout__history {
  min-width: 0;
}

.chat-layout__main {
  min-width: 0;
  min-height: 0;
}

.chat-layout .history {
  height: 100%;
}

/* <details> is not a reliable flex container, so the height budget is put
   on the body/list themselves: the box can never grow past the chat card. */
.chat-layout .history__box {
  box-sizing: border-box;
  height: 100%;
  max-height: calc(100vh - 280px);
  min-height: 560px;
  overflow: hidden;
}

.chat-layout .history__box:not([open]) {
  height: auto;
  min-height: 0;
}

.chat-layout .history__summary {
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
}

.chat-layout .history__collection {
  display: none;
}

.chat-layout .history__body {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  /* summary row (~60px) is subtracted from the box budget */
  max-height: calc(100vh - 340px);
  min-height: 0;
  padding: 0 var(--space-4) var(--space-4);
  overflow: hidden;
}

.chat-layout .history__filter,
.chat-layout .chat-history__actions {
  flex-shrink: 0;
}

.chat-layout .history__list {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.chat-layout .history__list::-webkit-scrollbar,
.chat-feed::-webkit-scrollbar {
  width: 6px;
}

.chat-layout .history__list::-webkit-scrollbar-track,
.chat-feed::-webkit-scrollbar-track {
  background: transparent;
}

.chat-layout .history__list::-webkit-scrollbar-thumb,
.chat-feed::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}

.chat-layout .history__list::-webkit-scrollbar-thumb:hover,
.chat-feed::-webkit-scrollbar-thumb:hover {
  background: var(--brand-500);
}

.chat-layout .history__entry {
  position: relative;
  align-items: flex-start;
}

.chat-layout .history__item {
  padding: 0.55rem 2.25rem 0.55rem 0.75rem;
}

.chat-layout .history__query {
  font-size: 0.88rem;
}

.chat-layout .history__delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.chat-layout .history__entry:hover .history__delete,
.chat-layout .history__entry:focus-within .history__delete {
  opacity: 1;
}

.chat-layout .chat-card {
  height: 100%;
  max-height: calc(100vh - 280px);
  min-height: 560px;
}

.chat-layout .chat-feed {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.chat-layout .chat-input-bar {
  flex-shrink: 0;
}

@media (max-width: 1180px) {
  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-layout .history__box,
  .chat-layout .history__body,
  .chat-layout .chat-card {
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .chat-layout .history__list {
    max-height: 240px;
  }

  .chat-layout .history__collection {
    display: block;
  }

  .chat-layout .history__delete {
    opacity: 1;
  }

  .chat-layout .chat-feed {
    min-height: 420px;
    max-height: 60vh;
  }
}

.chat-history__actions {
  margin-bottom: var(--space-3);
}

.chat-history__btn-new {
  width: 100%;
  justify-content: center;
}

.is-hidden {
  display: none !important;
}

.chat-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}

.chat-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.chat-card__title-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.chat-card__status-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--teal-400);
  box-shadow: 0 0 8px var(--teal-400);
}

.chat-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 400px;
  max-height: 620px;
  padding: var(--space-5);
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  background: var(--bg-solid);
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-7) var(--space-4);
  margin: auto;
  max-width: 560px;
}

.chat-empty.is-hidden {
  display: none !important;
}

.chat-empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgb(20 211 190 / 16%), rgb(124 108 255 / 20%));
  border: 1px solid var(--border);
  color: var(--brand-500);
}

.chat-empty__icon svg {
  width: 28px;
  height: 28px;
}

.chat-empty__title {
  margin: 0 0 var(--space-2);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.chat-empty__text {
  margin: 0 0 var(--space-4);
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.chat-empty__samples {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.chat-empty__samples-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.chat-empty__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.chat-empty__chip {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.chat-empty__chip:hover {
  border-color: var(--brand-500);
  background: rgb(124 108 255 / 10%);
  color: var(--brand-400);
  transform: translateY(-1px);
}

.chat-msg {
  display: flex;
  gap: var(--space-3);
  max-width: 100%;
  animation: fadeIn 0.25s var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 78%;
}

.chat-msg--assistant {
  align-self: stretch;
  width: 100%;
}

.chat-msg__avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
}

.chat-msg--user .chat-msg__avatar {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 2px 8px rgb(124 108 255 / 25%);
}

.chat-msg--assistant .chat-msg__avatar {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--teal-400);
}

.chat-msg--assistant .chat-msg__avatar svg {
  width: 18px;
  height: 18px;
}

.chat-msg__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}

.chat-msg--user .chat-msg__content {
  flex: 0 1 auto;
  align-items: flex-end;
}

.chat-msg__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.78rem;
}

.chat-msg--user .chat-msg__header {
  justify-content: flex-end;
}

.chat-msg__author {
  font-weight: 600;
  color: var(--text-muted);
}

.chat-msg__time {
  color: var(--text-faint);
}

.chat-msg__body {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.94rem;
  line-height: 1.62;
  word-break: break-word;
}

.chat-msg__body > :first-child {
  margin-top: 0;
}

.chat-msg__body > :last-child {
  margin-bottom: 0;
}

.chat-msg__body p {
  margin: 0 0 0.65em;
}

.chat-msg__body p:last-child {
  margin-bottom: 0;
}

.chat-msg__body ul,
.chat-msg__body ol {
  margin: 0.4em 0 0.75em;
  padding-left: 1.35rem;
}

.chat-msg__body li + li {
  margin-top: 0.35rem;
}

.chat-msg__body li > ul,
.chat-msg__body li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.chat-msg--user .chat-msg__body {
  background: var(--gradient-brand);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 18px -8px rgb(124 108 255 / 45%);
}

.chat-msg--user .chat-msg__body a {
  color: #fff;
  text-decoration: underline;
}

.chat-msg--assistant .chat-msg__body {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg--waiting.is-hidden {
  display: none !important;
}

.chat-waiting-box {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  width: fit-content;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-500);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.chat-msg__sources {
  margin-top: var(--space-1);
}

.chat-sources-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  overflow: hidden;
  font-size: 0.82rem;
}

.chat-sources-accordion__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}

.chat-sources-accordion__summary::-webkit-details-marker {
  display: none;
}

.chat-sources-accordion__summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-right: 1.8px solid var(--text-muted);
  border-bottom: 1.8px solid var(--text-muted);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.2s var(--ease);
}

.chat-sources-accordion[open] > .chat-sources-accordion__summary::after {
  transform: rotate(-135deg) translateY(-1px);
}

.chat-sources-icon {
  width: 15px;
  height: 15px;
  color: var(--teal-400);
  flex-shrink: 0;
}

.chat-sources-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border-top: 1px solid var(--border);
  background: var(--bg-solid);
}

.chat-source-item {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.chat-source-item.is-highlighted {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 2px rgb(124 108 255 / 22%);
}

.chat-source-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.82rem;
}

.chat-source-item__badge {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--brand-500);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.chat-source-item__name {
  color: var(--text);
  word-break: break-all;
}

.chat-source-item__page {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.chat-source-item__count {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgb(124 108 255 / 12%);
  color: var(--brand-400);
  font-size: 0.72rem;
  font-weight: 600;
}

.chat-source-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.chat-source-nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.chat-source-nav__btn:hover {
  border-color: var(--brand-500);
  background: rgb(124 108 255 / 15%);
  color: var(--brand-400);
}

.chat-source-nav__pos {
  min-width: 2.5rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.chat-source-nav__all {
  margin-left: 0.2rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.chat-source-nav__all:hover {
  border-color: var(--brand-500);
  color: var(--text);
}

.chat-source-item__preview-link {
  margin-left: auto;
  color: var(--brand-500);
  text-decoration: none;
  font-weight: 600;
}

.chat-source-item--multi .chat-source-item__preview-link {
  margin-left: 0.25rem;
}

.chat-source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: var(--space-2);
  padding-bottom: 0.15rem;
}

.chat-source-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.chat-source-chip:hover {
  border-color: var(--brand-400);
  color: var(--text);
}

.chat-source-chip.is-active {
  border-color: var(--brand-500);
  background: rgb(124 108 255 / 18%);
  color: var(--text);
}

.chat-source-chunks {
  margin-top: var(--space-1);
}

.chat-source-chunk {
  display: none;
}

.chat-source-chunk.is-active {
  display: block;
}

.chat-source-item.is-expanded-all .chat-source-chunks {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.chat-source-item.is-expanded-all .chat-source-chunk {
  display: block;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
}

.chat-source-item.is-expanded-all .chat-source-chunk.is-active {
  border-color: var(--brand-500);
}

.chat-source-chunk__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

.chat-source-chunk__num {
  font-weight: 700;
  color: var(--brand-400);
}

.chat-source-chunk__tag {
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.chat-source-chunk__score {
  margin-left: auto;
  color: var(--teal-400);
  font-weight: 600;
}

.chat-source-chunk__ctx {
  opacity: 0.72;
}

.chat-source-item__quote {
  margin: var(--space-1) 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  font-style: italic;
}

.fn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin: 0 2px;
  border: 1px solid rgb(124 108 255 / 55%);
  border-radius: 9px;
  background: rgb(124 108 255 / 14%);
  color: var(--brand-400);
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: baseline;
  transform: translateY(-1px);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.fn-badge:hover {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  transform: translateY(-1px) scale(1.08);
}

.chat-msg__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.chat-rate-btn.is-active[data-rate-btn="1"] {
  border-color: var(--teal-500);
  background: rgb(20 211 190 / 15%);
  color: var(--teal-400);
}

.chat-rate-btn.is-active[data-rate-btn="0"] {
  border-color: var(--error-border);
  background: rgb(240 68 106 / 15%);
  color: var(--error-border);
}

.chat-input-bar {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.chat-input-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.45rem 0.55rem 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.chat-input-box:focus-within {
  border-color: var(--brand-500);
  box-shadow: var(--focus-ring);
}

.chat-input-box__textarea {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  max-height: 180px;
  padding: 6px 4px;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text);
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.45;
  resize: none;
  outline: none;
}

.chat-input-box__textarea:hover,
.chat-input-box__textarea:focus,
.chat-input-box__textarea:focus-visible {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.chat-input-box__textarea::placeholder {
  color: var(--text-faint);
}

.chat-input-box__actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  align-self: flex-end;
}

.chat-input-box__send {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.chat-input-box__send svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.chat-input-box__send.is-sending svg {
  display: none;
}

.chat-input-bar__hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: 0.74rem;
  color: var(--text-faint);
}

@media (max-width: 768px) {
  .chat-msg,
  .chat-msg--user {
    max-width: 96%;
  }
  .chat-input-bar__hint {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --------------------------------------------------------------------------
   19. Print
   -------------------------------------------------------------------------- */
@media print {
  .backdrop,
  .topbar,
  .footer,
  .stepper,
  .sidebar,
  .btn,
  .tabs {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card,
  .query-console,
  .answer {
    box-shadow: none;
    border-color: #ccc;
    background: #fff;
  }

  .tab-panel {
    display: block;
  }
}
