/* OD-LAYOUT-PRIMITIVES v1 - structure only: display, flex/grid, overflow, wrapping, ratio, geometry.
   Put this @layer first; product CSS outside the layer wins ordinary layout rules.
   Native hidden and closed-dialog states take precedence over component display rules. */
@layer od-layout {
  [hidden]:not([hidden="until-found" i]) { display: none !important; }
  dialog:not([open]) { display: none !important; }

  :where(.od-stack,.od-row,.od-row-top,.od-cluster,.od-grid,.od-field,.od-stat,.od-cell,.od-tile) > :where(*) { min-width: 0; }

  /* containers */
  .od-stack   { display: flex; flex-direction: column; gap: var(--od-gap, 8px); }
  .od-row     { display: flex; align-items: center; gap: var(--od-gap, 8px); }
  .od-row-top { display: flex; align-items: flex-start; gap: var(--od-gap, 8px); }
  .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); }
  .od-fill    { flex: 1 1 0; min-width: 0; }
  .od-fixed   { flex: none; }
  .od-grid    { display: grid; gap: var(--od-gap, 12px); grid-template-columns: repeat(var(--od-cols, 3), minmax(0, 1fr)); }

  /* stacked information */
  .od-stat, .od-field, .od-cell { display: grid; gap: var(--od-gap, 2px); }
  :where(.od-stat,.od-field,.od-cell) > :where(*) { display: block; }
  .od-tile { display: grid; grid-template-rows: auto 1fr; }
  :where(.od-tile) > :where(*) { display: block; }

  .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); }
  .od-media-cover { object-fit: cover; }
  .od-icon { display: inline-block; inline-size: var(--od-icon-size, 1em); block-size: var(--od-icon-size, 1em); flex: none; }
  .od-truncate { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .od-clamp-2, .od-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .od-clamp-2 { -webkit-line-clamp: 2; }
  .od-clamp-3 { -webkit-line-clamp: 3; }
  .od-lines-2 { min-height: calc(2 * 1.4em); }
  .od-nowrap  { white-space: nowrap; }
  .od-keep    { word-break: keep-all; overflow-wrap: anywhere; }

  .od-screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
  .od-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
  .od-rail { display: flex; gap: var(--od-gap, 8px); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
             padding-inline: var(--od-rail-pad, 16px); scroll-padding-inline: var(--od-rail-pad, 16px); }
  .od-rail::-webkit-scrollbar { display: none; }
  :where(.od-rail) > :where(*) { flex: none; scroll-snap-align: start; }
  :where(.od-rail) > :where(:last-child) { margin-inline-end: var(--od-rail-pad, 16px); }

  .od-spacer { flex: none; visibility: hidden; pointer-events: none; }
  .od-touch  { min-width: 44px; min-height: 44px; }
}
:root [hidden]:where(:not([hidden="until-found" i])) { display: none; }
/* /OD-LAYOUT-PRIMITIVES v1 */

/* Product Design Tokens: Luxury Obsidian Dark (Taste-Skill Anti-Slop Calibrated) */
:root {
  --bg-core: #06090e;
  --bg-surface: #0b101b;
  --bg-card: rgba(16, 24, 40, 0.72);
  --bg-card-hover: rgba(24, 34, 56, 0.88);
  --bg-glass: rgba(11, 16, 27, 0.82);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-accent: rgba(99, 102, 241, 0.4);
  
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.25);
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Dual-layer card shadow with 1px top rim highlight */
  --shadow-card: 0 12px 32px -8px rgba(0, 0, 0, 0.7), inset 0 1px 0 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-card-elevated: 0 20px 48px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 0 rgba(255, 255, 255, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 32px -4px rgba(99, 102, 241, 0.3);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* Numeric alignment for live telemetry */
  font-variant-numeric: tabular-nums;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-core);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessible focus ring without visual pollution */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Reduced motion compliance (Taste Skill Section 6.B) */
@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;
  }
  .ambient-glow-1, .ambient-glow-2, .stepper-scan-line, .widget-ambient-ripple, .pulse-dot {
    animation: none !important;
  }
}

code, pre, .badge-mono, .stat-value, .stepper-time, [data-mono], .telemetry-metric, .infra-metric-row {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Background Cyber Grid & Ambient Glows */
.ambient-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-glow-1 {
  position: absolute;
  top: -15%;
  left: 15%;
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0) 70%);
  filter: blur(80px);
}

.ambient-glow-2 {
  position: absolute;
  bottom: 5%;
  right: 10%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, rgba(6, 182, 212, 0) 70%);
  filter: blur(90px);
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 80%);
}

/* File Type Pill & Search Presets */
.file-type-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.search-preset-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: var(--transition);
}

.search-preset-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.search-preset-card.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.15);
}

/* App Shell Structure */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

/* Left Sidebar */
.sidebar {
  width: 280px;
  flex: none;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 20;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--primary-glow);
}

.brand-logo svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

.brand-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Nav Menu */
.nav-menu {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.nav-pill {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.nav-item.active .nav-pill {
  background: rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
}

/* Sidebar Footer & Specs */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

/* Prototype footer styles live here rather than inline so strict CSP applies. */
.user-profile-anchor {
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:12px;
  padding:8px;
  border-radius:var(--radius-md);
  background:rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.04);
  box-shadow:0 12px 32px -8px rgba(0,0,0,.7), inset 0 1px 0 0 rgba(255,255,255,.08), 0 0 0 1px rgba(255,255,255,.05);
}
.user-profile-avatar {
  width:30px;
  height:30px;
  border-radius:50%;
  background:linear-gradient(135deg,var(--primary),var(--cyan));
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  font-weight:700;
  color:#fff;
  flex-shrink:0;
}
.user-profile-info { flex:1; min-width:0; }
.user-profile-name { font-size:12px; font-weight:600; line-height:1.5; color:var(--text-main); }
.user-profile-meta { font-size:10px; line-height:1.5; color:var(--text-muted); }
.user-profile-name, .user-profile-meta { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-logout-btn { display:flex; align-items:center; justify-content:center; width:28px; height:28px; flex-shrink:0; padding:4px; color:var(--text-muted); border-radius:var(--radius-sm); }
.user-logout-btn:hover { background:rgba(255,255,255,.06); color:var(--text-main); }
.sidebar-footer .status-header { gap:8px; align-items:flex-start; }
.sidebar-footer .status-indicator { font-size:11px; line-height:1.5; min-width:0; }
.sidebar-footer .pulse-dot { flex-shrink:0; }
.status-ready-tag { font-size:10px; line-height:1.65; font-family:var(--font-mono); color:var(--text-secondary); white-space:nowrap; }
.status-ready-tag[data-state="reachable"] { color:var(--emerald); }
.status-ready-tag[data-state="unavailable"] { color:var(--amber); }
.status-header:has(.status-ready-tag[data-state="unavailable"]) .pulse-dot { background:var(--amber); box-shadow:none; animation:none; }
.service-details { margin-top:10px; padding-top:8px; border-top:1px solid var(--border-subtle); }
.service-details summary { cursor:pointer; font-size:11px; line-height:1.6; color:var(--text-secondary); }
.service-details summary:focus-visible, .user-logout-btn:focus-visible { outline:2px solid var(--primary); outline-offset:3px; }
.service-details .service-health-detail { margin:8px 0 0; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.composer-note { margin:0; max-width:960px; width:100%; font-size:11px; line-height:1.6; color:var(--text-muted); text-align:center; }
.composer-submit-actions { display:flex; align-items:center; gap:12px; }
.generation-notice:empty, .generation-controls:empty { display:none; }

.infra-status-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow:0 12px 32px -8px rgba(0,0,0,.7), inset 0 1px 0 0 rgba(255,255,255,.08), 0 0 0 1px rgba(255,255,255,.05);
}

.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.infra-metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 4px;
}

.infra-metric-val {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Main Workspace */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05) 0%, transparent 60%);
  overflow: hidden;
  position: relative;
}

/* Top Navigation Bar */
.topbar {
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  z-index: 10;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.topbar-breadcrumb .breadcrumb-item {
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-breadcrumb .breadcrumb-sep {
  color: var(--text-dim);
  font-size: 12px;
  user-select: none;
}

.topbar-breadcrumb .breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-badge-chain {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.spec-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-badge svg {
  width: 13px;
  height: 13px;
  color: var(--cyan);
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Interactive Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-medium);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 0 16px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.5);
}

.btn-accent {
  background: linear-gradient(135deg, var(--cyan) 0%, #0284c7 100%);
  color: #fff;
  box-shadow: 0 0 16px var(--cyan-glow);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.5);
}

.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.lang-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-light);
}

/* View Container */
.view-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* Chat Main View - Responsive & Centered */
.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 64px);
  width: 100%;
}

.messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center; /* Ensures centered layout on stretched wide viewports */
  gap: 24px;
  width: 100%;
}

/* Welcome Hero Card */
.welcome-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.welcome-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.welcome-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.welcome-desc {
  color: var(--text-secondary);
  font-size: 13px;
  max-width: 780px;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Prompt Capsules */
.prompt-chips-label {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.prompt-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.prompt-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  max-width: 100%;
  white-space: normal;
  line-height: 1.45;
}

.prompt-chip:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--text-main);
  transform: translateY(-1px);
}

.prompt-chip svg {
  width: 14px;
  height: 14px;
  color: var(--cyan);
  flex: none;
}

/* Chat Message Bubbles - Centered Column Constraint */
.chat-msg {
  display: flex;
  gap: 16px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.chat-msg.user {
  margin: 0 auto;
  justify-content: flex-end;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.chat-msg.bot .chat-avatar {
  background: linear-gradient(135deg, var(--primary) 0%, #312e81 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px var(--primary-glow);
}

.chat-msg.user .chat-avatar {
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.chat-bubble-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.chat-msg.user .chat-bubble-body {
  flex: 0 1 auto;
  max-width: 80%;
}

.user-bubble-box {
  background: linear-gradient(135deg, #1e1b4b 0%, #1e293b 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg) var(--radius-lg) 2px var(--radius-lg);
  padding: 14px 18px;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
}

.bot-bubble-box {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* RAG Stepper / Chain-of-Thought (The Technical Proof) */
.rag-pipeline-container {
  background: rgba(6, 9, 14, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.rag-pipeline-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.rag-pipeline-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.rag-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  font-weight: 600;
}

.radar-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(6, 182, 212, 0.3);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.rag-status-meta {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.rag-steps-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.rag-step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 12px;
  position: relative;
}

.step-icon-wrap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 11px;
  font-family: var(--font-mono);
}

.step-icon-wrap.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--cyan);
  color: var(--cyan);
}

.step-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-main);
  font-weight: 600;
}

.step-time-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.step-desc {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

/* Answer Content & Citations */
.answer-prose {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-main);
}

.answer-prose p {
  margin-bottom: 12px;
}

.answer-prose ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.answer-prose li {
  margin-bottom: 8px;
}

.answer-prose code {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #38bdf8;
}

/* Inline Citation Badge */
.citation-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  margin: 0 3px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-sm);
  color: var(--primary-light);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  vertical-align: baseline;
  transition: var(--transition);
  text-decoration: none;
}

.citation-tag:hover {
  background: rgba(99, 102, 241, 0.35);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Popover for Citation Hover */
.citation-popover {
  /* A hidden absolute tooltip at its static position extended document height.
     Keep the overlay in viewport coordinates, even before its first use. */
  position: fixed;
  top: 0;
  left: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 25px var(--primary-glow);
  z-index: 100;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(20px);
}

.citation-popover.visible {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.popover-doc-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-relevance {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald);
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.popover-snippet {
  min-height: 0;
  max-height: 240px;
  overflow-y: auto;
  flex: 0 1 auto;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--primary);
  word-break: break-all;
}

.popover-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Chat Input Bar - Centered Constraint */
.chat-input-area {
  padding: 16px 32px 24px;
  background: linear-gradient(180deg, transparent 0%, var(--bg-core) 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 10px;
}

.input-box-wrapper {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 24px -4px rgba(0,0,0,0.5);
  transition: var(--transition);
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.input-box-wrapper:focus-within {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.2);
}

.chat-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 24px;
  max-height: 120px;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.input-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-toggles {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.toggle-chip.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--cyan);
}

.keyboard-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.key-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 10px;
}

/* Streaming Blinking Cursor */
.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background-color: var(--cyan);
  vertical-align: middle;
  margin-left: 4px;
  animation: cursor-blink 0.8s infinite;
}

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

/* Secondary Views: Knowledge Base & Settings - Scaled with Panel Inner */
.view-panel {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.panel-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.panel-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Knowledge Base Toolbar & Search */
.kb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.kb-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  flex: 1;
  min-width: 260px;
  max-width: 420px;
}

.kb-search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
  outline: none;
}

.kb-search-box input::placeholder {
  color: var(--text-muted);
}

.kb-search-box svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.kb-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kb-scope-summary {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

.kb-meta-separator {
  color: var(--text-muted);
  font-size: 12px;
}

.compact-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.compact-dropzone:hover {
  background: rgba(99, 102, 241, 0.05);
  border-color: var(--primary);
}

.doc-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  outline: none;
}

.doc-checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.doc-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 1.5px;
  left: 4.5px;
  width: 3.5px;
  height: 7px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.doc-checkbox:focus-visible {
  outline: 2px solid var(--cyan);
}

/* Document Table */
.docs-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  width: 100%;
}

.docs-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.docs-table th {
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.docs-table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.docs-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.doc-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-main);
}

.doc-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  flex: none;
}

.doc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-family: var(--font-mono);
}

.status-ready {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-processing {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  background: rgba(99, 102, 241, 0.02);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.upload-dropzone:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: var(--primary);
}

/* Floating Launcher Widget & Teaser (The Client-Side Preview) */
.widget-teaser-callout {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 499;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f8fafc;
  cursor: pointer;
  max-width: 320px;
  animation: teaser-pop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.25s ease;
}

.widget-teaser-callout:hover {
  transform: translateY(-2px);
  border-color: #06b6d4;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(6, 182, 212, 0.35);
}

.widget-teaser-callout.dismissed {
  display: none !important;
}

.widget-teaser-callout.is-dragging {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.9) !important;
  transition: opacity 0.15s ease, transform 0.15s ease !important;
}

@keyframes teaser-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.teaser-pulse-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  flex-shrink: 0;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.teaser-text-wrap {
  flex: 1;
  line-height: 1.35;
}

.teaser-text-wrap strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.teaser-text-wrap span {
  font-size: 11px;
  color: #94a3b8;
}

.teaser-dismiss-btn {
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.teaser-dismiss-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.floating-widget-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 50%, var(--cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.25);
  z-index: 500;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.floating-widget-bubble svg,
.floating-widget-bubble span {
  pointer-events: none;
}

.floating-widget-bubble::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(6, 182, 212, 0.4));
  z-index: -1;
  opacity: 0.7;
  animation: widget-ambient-ripple 2.5s infinite;
  pointer-events: none;
}

@keyframes widget-ambient-ripple {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 0.25; }
  100% { transform: scale(1.3); opacity: 0; }
}

.floating-widget-bubble:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 40px rgba(99, 102, 241, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.floating-widget-bubble:active,
.floating-widget-bubble.is-dragging {
  cursor: grabbing !important;
}

.floating-widget-bubble.is-dragging {
  transition: none !important;
  transform: scale(1.12) !important;
  box-shadow: 0 20px 48px rgba(99, 102, 241, 0.75), 0 0 0 2px rgba(255, 255, 255, 0.45) !important;
}

.floating-widget-bubble.is-snapping {
  transition: left 0.42s cubic-bezier(0.18, 0.89, 0.32, 1.25), top 0.42s cubic-bezier(0.18, 0.89, 0.32, 1.25), transform 0.25s ease, box-shadow 0.25s ease !important;
}

.floating-widget-bubble svg.icon-chat {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
}

.floating-widget-bubble svg.icon-close {
  display: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
}

.floating-widget-bubble.active svg.icon-chat {
  display: none;
}

.floating-widget-bubble.active svg.icon-close {
  display: block;
  transform: rotate(90deg);
}

.widget-unread-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border: 2.5px solid #06090e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  transition: opacity 0.2s;
}

.floating-widget-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 390px;
  height: 550px;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(99, 102, 241, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1), height 0.3s cubic-bezier(0.16, 1, 0.3, 1), left 0.35s cubic-bezier(0.16, 1, 0.3, 1), right 0.35s cubic-bezier(0.16, 1, 0.3, 1), top 0.35s cubic-bezier(0.16, 1, 0.3, 1), bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-widget-window.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.floating-widget-window.is-wide {
  width: min(680px, calc(100vw - 48px));
  height: min(640px, calc(100vh - 120px));
}

.widget-header {
  padding: 12px 16px;
  background: linear-gradient(90deg, #1e1b4b 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.widget-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.widget-logo-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.widget-title-meta {
  display: flex;
  flex-direction: column;
}

.widget-title-meta strong {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.widget-title-meta span {
  font-size: 11px;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 4px;
}

.widget-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.widget-tool-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.widget-tool-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.widget-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.widget-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.widget-prompt-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 5px 10px;
  font-size: 11.5px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.widget-prompt-pill:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

.widget-trace-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}

.widget-input-bar {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #06090e;
  flex-shrink: 0;
}

.widget-input-row {
  display: flex;
  gap: 8px;
}

.widget-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.widget-input:focus {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.widget-footnote {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
}

/* Toast System */
.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: #0f172a;
  border: 1px solid var(--emerald);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 15px rgba(16, 185, 129, 0.3);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive Breakpoints & Anti-Deformation Rules */
@media (max-width: 1280px) {
  /* stats-grid-row removed */
}

@media (max-width: 980px) {
  .topbar-badge-chain {
    display: none;
  }
  .topbar-breadcrumb .breadcrumb-item,
  .topbar-breadcrumb .breadcrumb-sep {
    display: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -280px;
  }
  .sidebar.mobile-open {
    left: 0;
  }
  /* stats-grid-row removed */
  .messages-scroll, .chat-input-area, .view-panel {
    padding-left: 16px;
    padding-right: 16px;
  }
  .floating-widget-window {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 84px;
    height: 480px;
  }
  .floating-widget-window.is-wide {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 84px;
    height: calc(100vh - 100px);
  }
  .widget-teaser-callout {
    right: 16px;
    bottom: 84px;
    max-width: calc(100vw - 32px);
  }
}
  
/* Sidebar Recent History Section */
.nav-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 4px;
}

.nav-section-title-row .nav-section-title {
  padding: 0;
}

.nav-history-add-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-history-add-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.chat-history-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
  padding: 0 4px;
}

.chat-history-container::-webkit-scrollbar {
  width: 4px;
}

.chat-history-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.history-group-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px 4px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.history-item.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.3);
  color: #fff;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.12);
}

.history-item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.history-item.active .history-item-icon {
  color: var(--primary-light);
}

.history-item-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.history-item-actions {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}

.history-item:hover .history-item-actions {
  display: flex;
}

.history-action-btn {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.history-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.history-action-btn.btn-del:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
}

/* Upload Document Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #0b101b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.8), 0 0 32px rgba(99, 102, 241, 0.12);
  transform: scale(0.96) translateY(10px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
}

.modal-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.modal-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-dropzone {
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.modal-dropzone:hover,
.modal-dropzone.dragover {
  background: rgba(99, 102, 241, 0.06);
  border-color: var(--primary);
  box-shadow: inset 0 0 24px rgba(99, 102, 241, 0.08);
}

.drop-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  transition: transform 0.2s ease;
}

.modal-dropzone:hover .drop-icon-circle,
.modal-dropzone.dragover .drop-icon-circle {
  transform: translateY(-2px) scale(1.05);
}

.dropzone-headline {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dropzone-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
}

.dropzone-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.modal-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.modal-section-title {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal-staged-count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.staged-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px;
}

.staged-files-list::-webkit-scrollbar {
  width: 4px;
}

.staged-files-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.staged-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.staged-file-item:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
}

.staged-file-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  flex-shrink: 0;
}

.staged-file-info {
  flex: 1;
  min-width: 0;
}

.staged-file-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.staged-file-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.staged-file-bar-container {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 5px;
  display: none;
}

.staged-file-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.staged-file-del {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.staged-file-del:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.upload-options-card {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.opt-label:hover {
  color: var(--text-primary);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-footer-tip {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}



/* ===================================================================
   Folio Harbor Application & Test Compatibility Extensions
   =================================================================== */

#app {
  width: 100%;
  height: 100%;
  display: flex;
}

/* Login Page (Luxury Obsidian) */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.login-header {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
}
.brand img {
  width: 24px;
  height: 24px;
}
.login-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card-elevated);
  backdrop-filter: blur(16px);
}
.login-form h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}
.login-form p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.login-kicker {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--primary-light);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.login-note {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 16px;
  text-align: center;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.field input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}
.error {
  color: var(--rose);
  font-size: 12px;
  margin-bottom: 12px;
  min-height: 16px;
}
.login-page footer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Chat & Composer Test Compatibility Aliases */
.answer-body {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-main);
}
.answer-body p {
  margin-bottom: 10px;
}
.answer-body p:last-child {
  margin-bottom: 0;
}
.answer-body strong {
  color: #fff;
  font-weight: 600;
}
.answer-body ul, .answer-body ol {
  margin: 10px 0 12px 20px;
  padding-left: 0;
}
.answer-body li {
  margin-bottom: 6px;
  line-height: 1.6;
}
.answer-body code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--cyan);
}
.answer-body pre {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 10px 0;
  font-family: var(--font-mono);
  font-size: 12px;
}
.answer-body h3 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 14px 0 6px;
  color: #fff;
}

.user-bubble {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(99, 102, 241, 0.12) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 12px 16px;
  border-radius: 14px 14px 4px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-main);
  box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.5);
}

.pending {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  margin-top: 8px;
}
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  animation: pulse-glow 1.5s infinite;
}

.stream-warning {
  font-size: 11.5px;
  color: var(--amber);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.branch-banner {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 11.5px;
  color: var(--primary-light);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.generation-notice {
  font-size: 11px;
  color: var(--cyan);
  padding: 4px 0;
  font-family: var(--font-mono);
}
.generation-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* History Row & Pin Styling */
.history-row {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}
.history-item-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.history-item-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}
.history-item-btn.selected {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
  color: #fff;
}
.history-item-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.history-item-btn:hover .history-item-icon,
.history-item-btn.selected .history-item-icon {
  color: var(--primary-light);
}
.history-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-status {
  font-size: 10px;
  color: var(--cyan);
  font-family: var(--font-mono);
  margin-left: 4px;
}
.history-status.is-generating {
  animation: pulse-glow 1s infinite;
}
.pin-indicator, .pin-badge {
  color: var(--primary-light);
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  opacity: 0.8;
}
.history-actions {
  display: none;
  align-items: center;
  gap: 4px;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.history-row:hover .history-actions {
  display: flex;
}
.history-action-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.history-action-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  color: #fff;
}
.history-action-btn.is-pinned,
.history-action-btn.active {
  color: var(--primary-light);
  border-color: rgba(99, 102, 241, 0.4);
}

/* Search input in sidebar */
.history-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  margin: 6px 0 8px;
}
.history-search {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 11.5px;
  width: 100%;
}
.history-search::placeholder {
  color: var(--text-muted);
}

/* Modal Dialog & Preview Dialog Extensions */
dialog {
  background: transparent;
  border: none;
  color: var(--text-main);
  max-width: 100vw;
  max-height: 100vh;
}
dialog::backdrop {
  background: rgba(6, 9, 14, 0.85);
  backdrop-filter: blur(8px);
}
.preview-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0;
  width: 90vw;
  max-width: 1100px;
  height: 85vh;
  box-shadow: var(--shadow-card-elevated);
  color: var(--text-main);
  overflow: hidden;
  margin: auto;
}
.preview-dialog-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}
.preview-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-doc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}
.preview-meta-page {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}
.preview-meta-size {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.preview-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.doc-preview-body {
  width: 100%;
  height: calc(100% - 53px);
  background: #06090e;
}
.doc-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}
.doc-preview-img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
}
.doc-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.preview-unavailable {
  padding: 40px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

/* Batch Upload Details */
.batch-results {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 12px;
}
.batch-results summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-light);
}
.batch-results ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  max-height: 160px;
  overflow-y: auto;
}
.batch-results li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Quiet buttons & helpers */
.quiet {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.quiet:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.text-button {
  background: transparent;
  border: none;
  color: var(--primary-light);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: inherit;
}
.empty-note {
  padding: 24px;
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
}
.status-emphasis {
  color: var(--emerald);
  font-weight: 600;
}
.status-pending {
  color: var(--amber);
}

/* Citations in markdown */
.cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 4px;
  padding: 0 5px;
  margin: 0 2px;
  cursor: pointer;
  text-decoration: none;
  vertical-align: baseline;
  transition: var(--transition);
}
.cite:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px var(--primary-glow);
}
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.source-chip:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
  color: #fff;
}
.answer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.answer-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.answer-mode {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--cyan);
}
.source-excerpt {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin: 12px 0;
  line-height: 1.6;
}
.eyebrow {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--primary-light);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dialog-head h2 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.dialog-info {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 10px 0;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Verified runtime data, scoped upload controls and keyboard-accessible retrieval limit. */
#chip-topk { cursor:pointer; }
.service-health-detail { font-size:10px; color:var(--text-secondary); white-space:pre-line; line-height:1.6; margin:8px 0; }
.search-excerpt { font-size:11px; color:var(--text-secondary); white-space:normal; max-width:520px; margin-top:6px; }
#kb-search-status { font-size:11px; color:var(--text-secondary); }
#file-input-multi,#folder-input { display:none; }
.staged-file-bar-container { display:none; }
.kb-toolbar,.kb-filter-group { flex-wrap:wrap; }
.retrieval-settings-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:20px; }
.retrieval-settings-grid > .stat-card { display:flex; flex-direction:column; align-self:start; gap:16px; padding:24px; border-radius:var(--radius-md); background:var(--bg-card); box-shadow:0 12px 32px -8px rgba(0,0,0,.7), inset 0 1px 0 0 rgba(255,255,255,.08), 0 0 0 1px rgba(255,255,255,.05); }
.retrieval-card .btn-secondary { background:var(--bg-surface); color:var(--text-secondary); border:1px solid var(--border-subtle); }
.retrieval-card .btn-secondary:hover { color:var(--text-main); border-color:var(--primary); }
.retrieval-card button:disabled { opacity:.45; cursor:not-allowed; }
.retrieval-card { gap:16px; min-width:0; }
.retrieval-card h3 { margin:0; font-size:15px; font-weight:600; }
.retrieval-help { color:var(--text-secondary); font-size:12px; line-height:1.65; }
.retrieval-card form { display:flex; flex-direction:column; gap:12px; }
.retrieval-card label { font-size:12px; color:var(--text-secondary); }
.retrieval-field-row { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
.retrieval-card input, .retrieval-card textarea { background:var(--bg-core); border:1px solid var(--border-subtle); border-radius:var(--radius-sm); padding:10px 12px; color:var(--text-main); font:inherit; }
.retrieval-card input { width:110px; font-variant-numeric:tabular-nums; }
.retrieval-card textarea { width:100%; box-sizing:border-box; resize:vertical; }
.retrieval-card input:focus-visible, .retrieval-card textarea:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.retrieval-card button { align-self:flex-start; }
.retrieval-status { font-size:12px; color:var(--text-secondary); line-height:1.6; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.retrieval-test-section { display:flex; flex-direction:column; gap:12px; padding-top:20px; border-top:1px solid var(--border-subtle); }
.retrieval-result { padding:14px 0; border-top:1px solid var(--border-subtle); font-size:12px; overflow-wrap:anywhere; }
.retrieval-result strong { display:block; color:var(--text-main); }
.retrieval-score { display:block; margin:8px 0; color:var(--cyan); font-family:var(--font-mono); font-variant-numeric:tabular-nums; }
.retrieval-result p { white-space:pre-wrap; line-height:1.7; color:var(--text-secondary); max-height:180px; overflow-y:auto; }
@media (max-width:900px) { .retrieval-settings-grid { grid-template-columns:minmax(0,1fr); } }
