/* ==========================================================================
   Intelligent Knowledge Hub - Calming Light Mode Design System
   Engineered for high readability, stress reduction, and clear visual hierarchy
   for Customer Service & Enterprise Knowledge Retrieval.
   ========================================================================== */

:root {
  /* Surface & Background Palette (Soft mist & porcelain tones) */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-input: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-elevated: #f8fafc;
  
  /* Borders & Dividers */
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-hover: #cbd5e1;
  --border-focus: #0284c7;
  --border-accent: rgba(2, 132, 199, 0.25);
  
  /* Typography Hierarchy (High legibility, serene contrast) */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  /* Calming Accent Palette (Cool Azure, Sage, Lavender, Soft Warmth) */
  --accent-blue: #0284c7;
  --accent-blue-hover: #0369a1;
  --accent-blue-subtle: #f0f9ff;
  --accent-blue-border: #bae6fd;
  
  --accent-emerald: #059669;
  --accent-emerald-subtle: #ecfdf5;
  --accent-emerald-border: #a7f3d0;
  
  --accent-indigo: #4f46e5;
  --accent-purple: #6366f1;
  --accent-purple-subtle: #f5f3ff;
  --accent-purple-border: #ddd6fe;

  --accent-amber: #d97706;
  --accent-amber-subtle: #fffbeb;
  --accent-amber-border: #fde68a;

  --accent-rose: #e11d48;
  --accent-rose-subtle: #fff1f2;
  --accent-rose-border: #fecdd3;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows (Soft, diffused, zero harshness) */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-focus: 0 0 0 3px rgba(2, 132, 199, 0.18);

  /* Border Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.55;
  background-image: 
    radial-gradient(at 0% 0%, rgba(224, 242, 254, 0.5) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(238, 242, 255, 0.4) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(240, 253, 250, 0.4) 0px, transparent 50%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Top Navigation Bar
   -------------------------------------------------------------------------- */
.top-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brand-icon {
  background: linear-gradient(135deg, #0284c7, #4f46e5);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.badge-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--accent-blue-subtle);
  color: var(--accent-blue);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-blue-border);
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: #ffffff;
  box-shadow: var(--shadow-xs);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-ready {
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
  border-color: var(--accent-emerald-border);
}
.status-ready .status-dot {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  animation: pulse-dot 2.5s infinite;
}

.status-loading {
  background: var(--accent-amber-subtle);
  color: var(--accent-amber);
  border-color: var(--accent-amber-border);
}
.status-loading .status-dot {
  background: #f59e0b;
  animation: pulse-dot 1.8s infinite;
}

.status-error {
  background: var(--accent-rose-subtle);
  color: var(--accent-rose);
  border-color: var(--accent-rose-border);
}
.status-error .status-dot {
  background: #ef4444;
}

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

.credential-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.nav-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
  text-decoration: none;
}

.nav-btn-icon:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue-border);
  background: var(--accent-blue-subtle);
}

/* --------------------------------------------------------------------------
   Main Workspace Layout (Zero-Horizontal Scroll)
   -------------------------------------------------------------------------- */
.app-main {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.75rem;
  overflow-x: hidden;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}

/* --------------------------------------------------------------------------
   Cards & Surfaces
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  max-width: 100%;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-title-group h2, .card-title-group h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Chat Container & Message Stream
   -------------------------------------------------------------------------- */
.chat-card {
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chat-avatar-header {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

.chat-header-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.model-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-indigo);
  background: var(--accent-purple-subtle);
  border: 1px solid var(--accent-purple-border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.model-badge strong {
  color: #3730a3;
}

.sparkle {
  color: var(--accent-amber);
}

.btn-clear-chat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear-chat:hover {
  background: var(--accent-blue-subtle);
  border-color: var(--accent-blue-border);
  color: var(--accent-blue-hover);
}

/* Chat Stream History */
.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 320px;
  max-height: 520px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.35rem 1rem 0;
  scroll-behavior: smooth;
  width: 100%;
}

/* Message Rows & Animation */
.message-row {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease-out, transform 0.35s ease-out;
}

@starting-style {
  .message-row {
    opacity: 0;
    transform: translateY(14px);
  }
}

.message-row.user-row {
  justify-content: flex-end;
}

.message-row.assistant-row {
  justify-content: flex-start;
}

.message-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  margin-top: 2px;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.2);
}

.user-bubble {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff !important;
  border-radius: 16px 16px 4px 16px;
  padding: 0.85rem 1.15rem;
  max-width: 82%;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.18);
  font-size: 0.9375rem;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: break-word;
}

.user-bubble .bubble-header {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.9) !important;
  margin-bottom: 0.25rem;
}

.user-bubble .bubble-header span {
  color: rgba(255, 255, 255, 0.9) !important;
}

.user-bubble .bubble-body,
.user-bubble .bubble-body p,
.user-bubble .bubble-body span,
.user-bubble .bubble-body strong {
  color: #ffffff !important;
}

.assistant-bubble {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px 18px 18px 18px;
  padding: 1.15rem 1.25rem;
  max-width: 92%;
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: break-word;
}

.assistant-bubble .bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--bg-subtle);
}

.bubble-author {
  font-weight: 700;
  font-size: 0.78125rem;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bubble-time {
  color: var(--text-subtle);
  font-size: 0.6875rem;
}

.bubble-body {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-primary);
}

.bubble-body h1,
.bubble-body h2,
.bubble-body h3,
.bubble-body h4,
.bubble-body .chat-heading {
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.bubble-body h1:first-child,
.bubble-body h2:first-child,
.bubble-body h3:first-child,
.bubble-body h4:first-child,
.bubble-body .chat-heading:first-child {
  margin-top: 0;
}

.bubble-body h3,
.bubble-body h3.chat-heading {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.bubble-body h4,
.bubble-body h4.chat-heading {
  font-size: 0.975rem;
}

.bubble-body hr.chat-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0.75rem 0;
}

.bubble-body p {
  margin-bottom: 0.65rem;
}

.bubble-body p:last-child {
  margin-bottom: 0;
}

.bubble-body ul, .bubble-body ol {
  margin-left: 1.25rem;
  margin-bottom: 0.65rem;
}

.bubble-body li {
  margin-bottom: 0.3rem;
}

.bubble-body strong {
  color: #0f172a;
  font-weight: 700;
}

.bubble-body blockquote {
  border-left: 3px solid var(--accent-blue);
  background: var(--accent-blue-subtle);
  padding: 0.5rem 0.75rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0.6rem 0;
  font-style: italic;
  color: var(--text-secondary);
}

.bubble-body code {
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent-blue-hover);
}

/* Typing Indicator Bubble */
.typing-row {
  align-items: center;
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 4px 18px 18px 18px;
  padding: 0.85rem 1.15rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: #0284c7;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Collapsible Citations & Context Passages within Message */
.message-citations, .message-context {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

.message-citations summary, .message-context summary {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
  transition: color 0.2s ease;
}

.message-citations summary:hover, .message-context summary:hover {
  color: var(--accent-blue);
}

.message-citations[open] summary, .message-context[open] summary {
  margin-bottom: 0.5rem;
  color: var(--accent-blue);
}

.message-citations-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.citation-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-subtle);
  border: 1px solid #cbd5e1;
  color: var(--accent-blue-hover);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
}

.citation-chunk-id {
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.message-context-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.passage-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
}

.passage-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  color: var(--accent-blue-hover);
  font-weight: 600;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.passage-content {
  color: var(--text-secondary);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Per-Message Footer Bar (Telemetry & Feedback) */
.message-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border-subtle);
}

.message-micro-metrics {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.message-feedback-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-thumb-small {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-thumb-small:hover {
  background: #ffffff;
  border-color: var(--border-hover);
}

.btn-thumb-small.active-like {
  background: var(--accent-emerald-subtle);
  border-color: var(--accent-emerald-border);
  color: var(--accent-emerald);
}

.btn-thumb-small.active-dislike {
  background: var(--accent-rose-subtle);
  border-color: var(--accent-rose-border);
  color: var(--accent-rose);
}

/* Inline Message DPO Correction Drawer */
.message-dpo-drawer {
  background: var(--bg-subtle);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-top: 0.75rem;
  animation: fadeIn 0.2s ease;
}

.message-dpo-drawer.hidden {
  display: none;
}

.drawer-header h4 {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.drawer-header p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.feedback-reasons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.reason-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.reason-chip:hover {
  border-color: var(--border-focus);
}

.reason-chip input {
  accent-color: var(--accent-blue);
}

.correction-field {
  margin-bottom: 0.6rem;
}

.correction-field label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.correction-field textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
}

.correction-field textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-accent {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #0284c7, #4f46e5);
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  transition: all 0.2s ease;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #0369a1, #4338ca);
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.35);
}

.feedback-saved-notice {
  font-size: 0.75rem;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* --------------------------------------------------------------------------
   Sample Prompt Chips
   -------------------------------------------------------------------------- */
.sample-prompts-container {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.sample-title {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.sample-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sample-chip {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.sample-chip:hover {
  background: var(--accent-blue-subtle);
  border-color: var(--accent-blue-border);
  color: var(--accent-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.1);
}

/* --------------------------------------------------------------------------
   Prompt Input Composer Form
   -------------------------------------------------------------------------- */
.prompt-composer-form {
  margin-top: 0.85rem;
}

.search-input-wrapper {
  position: relative;
  background: var(--bg-input);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: all 0.2s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
  background: #ffffff;
}

.search-icon {
  position: absolute;
  top: 1.05rem;
  left: 0.95rem;
  color: var(--text-subtle);
}

.query-form textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  padding-left: 2rem;
  resize: vertical;
  outline: none;
  min-height: 52px;
}

.query-form textarea::placeholder {
  color: var(--text-subtle);
}

.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.top-k-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.top-k-selector select {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.top-k-selector select:focus {
  border-color: var(--border-focus);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
  transform: translateY(-1px);
}

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

/* --------------------------------------------------------------------------
   Sidebar & AI Observability
   -------------------------------------------------------------------------- */
.observability-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.live-pill {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-emerald);
  background: var(--accent-emerald-subtle);
  border: 1px solid var(--accent-emerald-border);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.metric-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.metric-box.highlight {
  border-color: var(--accent-blue-border);
  background: var(--accent-blue-subtle);
}

.metric-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.cost-callout {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.cost-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.cost-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-emerald);
  font-size: 0.9375rem;
}

.cost-bar-container {
  height: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.cost-bar {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #0284c7);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.cost-footnote {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.cost-footnote code {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   LLMOps Flywheel Section
   -------------------------------------------------------------------------- */
.icon-btn-small {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.icon-btn-small:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.flywheel-stats {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.flywheel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
}

.stat-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.stat-icon {
  font-size: 1.1rem;
}

.stat-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.stat-badge {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.stat-badge.golden { 
  background: var(--accent-amber-subtle); 
  color: #92400e; 
  border: 1px solid var(--accent-amber-border); 
}
.stat-badge.dpo { 
  background: var(--accent-purple-subtle); 
  color: #5b21b6; 
  border: 1px solid var(--accent-purple-border); 
}
.stat-badge.total { 
  background: var(--accent-blue-subtle); 
  color: var(--accent-blue-hover); 
  border: 1px solid var(--accent-blue-border); 
}
.stat-badge.rate { 
  background: var(--accent-emerald-subtle); 
  color: #065f46; 
  border: 1px solid var(--accent-emerald-border); 
}

/* --------------------------------------------------------------------------
   KPIs & Certification Section
   -------------------------------------------------------------------------- */
.kpi-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-header-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-val.positive { color: var(--accent-emerald); font-weight: 700; }
.kpi-val.highlight { color: var(--accent-indigo); font-weight: 700; }

.kpi-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.kpi-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

.kpi-fill.green { background: #10b981; }
.kpi-fill.blue { background: #0284c7; }
.kpi-fill.purple { background: #6366f1; }

.certification-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cert-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.25rem 2rem;
  background: #ffffff;
  font-size: 0.8125rem;
  color: var(--text-muted);
  box-shadow: 0 -1px 2px rgba(15, 23, 42, 0.02);
}

.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent-blue);
}

/* --------------------------------------------------------------------------
   Utility & Animation
   -------------------------------------------------------------------------- */
.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Responsive Viewports & Zero-Horizontal Scroll Protection
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .top-navbar {
    padding: 0.85rem 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .nav-meta {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-main {
    padding: 1rem 1rem;
  }
}

@media (max-width: 768px) {
  .top-navbar {
    padding: 0.75rem 0.85rem;
  }

  .brand-title span {
    font-size: 0.9375rem;
  }

  .brand-subtitle {
    display: none;
  }

  .chat-stream {
    max-height: 440px;
    min-height: 280px;
  }

  .user-bubble {
    max-width: 90%;
  }

  .assistant-bubble {
    max-width: 96%;
    padding: 0.85rem 1rem;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .input-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .app-main {
    padding: 0.75rem 0.5rem;
  }

  .card {
    padding: 0.85rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .sample-chips {
    gap: 0.35rem;
  }

  .sample-chip {
    font-size: 0.6875rem;
    padding: 0.35rem 0.65rem;
  }
}

