/* ═══════════════════════════════════════════════════════════════════════
   SAIKATI v2 — Glass Design System (HTML layout + glassmorphism)
   Fonts: Google Sans / Inter · Mono: JetBrains Mono
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────────────────────── */
:root {
  --teal: #0D9488;
  --teal-dark: #0F766E;
  --teal-light: #14B8A6;
  --teal-pale: #CCFBF1;
  --teal-glow: rgba(13, 148, 136, 0.08);
  --coral: #F97316;
  --coral-dark: #EA580C;

  --text-h: #1E293B;
  --text-body: #475569;
  --text-muted: #94A3B8;

  --bg: #F1F5F9;
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-chat: rgba(248, 250, 252, 0.6);
  --bg-input: #F8FAFC;
  --bg-surface: rgba(241, 245, 249, 0.75);
  --bg-msg-user: linear-gradient(135deg, #0D9488, #0F766E);
  --bg-msg-ai: rgba(255, 255, 255, 0.85);

  --border: rgba(226, 232, 240, 0.8);
  --border-light: rgba(241, 245, 249, 0.6);
  --border-glass: rgba(255, 255, 255, 0.45);
  --overlay: rgba(15, 23, 42, 0.25);

  --ok: #10B981;
  --warn: #F59E0B;
  --crit: #EF4444;
  --info: #3B82F6;

  --font-body: 'Google Sans', 'Product Sans', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 16px;
  --r-bubble: 18px;

  --shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.12);
  --glass-blur: blur(16px);

  --font-size-base: 16px;
  --sidebar-w: 250px;
}

[data-theme="dark"] {
  --bg: #0B1120;
  --bg-card: rgba(15, 23, 42, 0.85);
  --bg-chat: rgba(11, 17, 32, 0.6);
  --bg-input: #1E293B;
  --bg-surface: rgba(30, 41, 59, 0.75);
  --bg-msg-ai: rgba(30, 41, 59, 0.85);
  --border: rgba(51, 65, 85, 0.7);
  --border-light: rgba(30, 41, 59, 0.5);
  --border-glass: rgba(51, 65, 85, 0.4);
  --text-h: #F1F5F9;
  --text-body: #CBD5E1;
  --text-muted: #64748B;
  --overlay: rgba(0, 0, 0, 0.5);
}

/* ── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
}

html { font-size: var(--font-size-base); }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-body);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Animated Blobs (glass backdrop) ─────────────────────────────────── */
.blob-bg {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(80px);
}
.blob-a {
  width: 600px; height: 600px; top: -150px; left: -100px;
  background: rgba(13, 148, 136, 0.08);
  animation: blobDrift 18s ease-in-out infinite;
}
.blob-b {
  width: 500px; height: 500px; bottom: -100px; right: -80px;
  background: rgba(99, 102, 241, 0.06);
  animation: blobDriftB 22s ease-in-out infinite;
}
.blob-c {
  width: 350px; height: 350px; top: 40%; left: 45%;
  background: rgba(249, 115, 22, 0.04);
  animation: blobDriftC 14s ease-in-out infinite;
}
[data-theme="dark"] .blob-a { background: rgba(13, 148, 136, 0.12); }
[data-theme="dark"] .blob-b { background: rgba(99, 102, 241, 0.09); }
[data-theme="dark"] .blob-c { background: rgba(249, 115, 22, 0.07); }

/* ── Scrollbar (matches HTML) ───────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Animations ─────────────────────────────────────────────────────── */
@keyframes blobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(40px, -30px) scale(1.05); }
  66%       { transform: translate(-25px, 20px) scale(0.97); }
}
@keyframes blobDriftB {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  40%       { transform: translate(-50px, 30px) scale(1.08) rotate(5deg); }
  70%       { transform: translate(30px, -20px) scale(0.95) rotate(-3deg); }
}
@keyframes blobDriftC {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(20px, 40px) scale(1.03); }
}

@keyframes pulse2 {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes typing {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}

@keyframes loadingProgress {
  0% { width: 0%; }
  30% { width: 40%; }
  70% { width: 75%; }
  95% { width: 92%; }
  100% { width: 92%; }
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--teal-dark);
  box-shadow: 0 4px 15px rgba(13, 148, 136, 0.3);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-body);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface);
  border-color: var(--teal);
  color: var(--teal);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn-icon:hover { background: var(--bg-surface); color: var(--teal); }
.btn-icon.active { color: var(--teal); background: var(--teal-glow); }

.btn-stop {
  background: var(--crit);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}
.btn-stop:hover { background: #dc2626; }

/* ── Landing Page ───────────────────────────────────────────────────── */
.landing {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-glass);
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: -0.5px;
}
.logo-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-top: -4px;
}

.nav-actions { display: flex; align-items: center; gap: 12px; }

.lang-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 12px;
  cursor: pointer;
  outline: none;
}
.lang-select:focus { border-color: var(--teal); }

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 60px;
  gap: 32px;
  animation: fadeUp 0.5s ease both;
}

.avatar-orb-wrap { position: relative; width: 120px; height: 120px; }
.avatar-orb {
  width: 120px; height: 120px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 40px var(--teal-glow);
  position: relative; z-index: 2;
}
.avatar-orb-inner {
  width: 88px; height: 88px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
}
.avatar-orb-ring {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid rgba(13, 148, 136, 0.2);
}
.avatar-orb-ring::after {
  content: ''; position: absolute; top: -4px; left: 50%;
  transform: translateX(-50%); width: 8px; height: 8px;
  background: var(--teal-light); border-radius: 50%;
  box-shadow: 0 0 8px var(--teal-light);
}

.hero-title {
  font-size: clamp(3.5rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--teal);
}
.hero-tagline { font-size: 1.3rem; color: var(--text-body); max-width: 420px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal-glow); border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: 100px; padding: 6px 14px; font-size: 0.8rem;
  color: var(--teal-dark); font-weight: 500;
}
[data-theme="dark"] .hero-badge { color: var(--teal-light); }

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-cta {
  padding: 14px 32px; font-size: 1rem; font-weight: 600;
  border-radius: var(--r-lg);
  box-shadow: 0 4px 20px rgba(13, 148, 136, 0.3);
}
.btn-cta:hover:not(:disabled) {
  box-shadow: 0 8px 30px rgba(13, 148, 136, 0.45);
  transform: translateY(-2px);
}

.trust-pills { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.trust-pill {
  background: var(--bg-card); border: 1px solid var(--border-glass);
  border-radius: 100px; padding: 7px 16px; font-size: 13px;
  color: var(--text-muted); font-weight: 500;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 6px;
}

.landing-footer {
  text-align: center; padding: 24px; font-size: 0.8rem;
  color: var(--text-muted); border-top: 1px solid var(--border);
}

/* ── Chat Layout ────────────────────────────────────────────────────── */
.chat-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
  position: fixed;
  left: 0;
  top: 0;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo-wrap { display: flex; flex-direction: column; flex: 1; }
.sidebar-logo-name {
  font-size: 1.1rem; font-weight: 700;
  color: var(--teal);
}
.sidebar-logo-sub {
  font-size: 0.7rem; color: var(--text-muted);
}

.sidebar-new-chat { margin: 12px 16px; }
.btn-new-chat {
  width: 100%; justify-content: center;
  border-radius: 10px; padding: 10px; font-size: 13px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff; border: none; cursor: pointer;
  font-family: var(--font-body); font-weight: 600;
  transition: all 0.15s; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15);
}
.btn-new-chat:hover {
  box-shadow: 0 4px 15px rgba(13, 148, 136, 0.3);
  transform: translateY(-1px);
}

.sidebar-section-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 16px 8px;
}

.sidebar-chats { flex: 1; overflow-y: auto; padding: 8px; }

.recent-chat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  cursor: pointer; transition: all 0.15s;
  font-size: 13px; color: var(--text-muted);
  text-decoration: none; border: 0; background: transparent;
  width: 100%; text-align: left;
}
.recent-chat-item:hover { background: var(--bg-surface); }
.recent-chat-item.active {
  background: var(--teal-glow);
  color: var(--teal);
  font-weight: 600;
}

.recent-chat-icon { font-size: 0.85rem; opacity: 0.6; flex-shrink: 0; }
.recent-chat-text { flex: 1; min-width: 0; }
.recent-chat-title {
  font-size: 13px; color: var(--text-body); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent-chat-time { font-size: 11px; color: var(--text-muted); }

.sidebar-empty {
  text-align: center; padding: 32px 16px;
  color: var(--text-muted); font-size: 13px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-footer .lang-select { flex: 1; font-size: 12px; padding: 6px 10px; }

/* ── Main Chat Area ─────────────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

/* ── Chat Header ────────────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
  z-index: 10;
}

.chat-header-avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(13, 148, 136, 0.15);
}

.chat-header-info { flex: 1; }
.chat-header-name {
  font-weight: 700; font-size: 14px;
  color: var(--text-h); line-height: 1.2;
}
.online-indicator {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted); font-weight: 500;
}
.online-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  animation: pulse2 2s infinite;
}

.chat-header-actions { display: flex; align-items: center; gap: 4px; }

/* ── Status Bar / Loading Bar ───────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-glass);
  animation: fadeUp 0.2s ease-out;
}

.status-bar-stages {
  display: flex; align-items: center; gap: 6px; flex: 1;
}

.status-stage {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 500;
  transition: all 0.3s;
  color: var(--text-muted);
}
.status-stage.active {
  background: var(--teal-glow);
  color: var(--teal);
  animation: statusPulse 1.5s ease-in-out infinite;
}
.status-stage.done { color: var(--ok); }
.status-stage-sep { color: var(--text-muted); font-size: 10px; }

.status-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Messages Area ──────────────────────────────────────────────────── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-chat);
  scroll-behavior: smooth;
}

/* Empty state */
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px; text-align: center; gap: 16px;
  animation: fadeUp 0.3s ease;
}
.empty-orb {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15);
}
.empty-title {
  font-size: 16px; font-weight: 700; color: var(--text-h);
}
.empty-sub {
  font-size: 12px; color: var(--text-muted); max-width: 300px;
}

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 440px;
}
.quick-prompt-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.quick-prompt-card:hover {
  border-color: #CBD5E1;
  color: var(--text-h);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.quick-prompt-title {
  font-weight: 600; font-size: 13px;
  color: var(--text-h); margin-bottom: 2px;
}
.quick-prompt-sub { font-size: 11px; color: var(--text-muted); }

/* ── Chat Bubbles — match HTML exactly ──────────────────────────────── */
.message-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeUp 0.3s ease-out;
  max-width: 100%;
}

.message-wrap.user { align-items: flex-end; }
.message-wrap.assistant { align-items: flex-start; }

.message-bubble {
  width: fit-content;
  word-break: break-word;
}

/* User bubble — teal gradient, right-aligned */
.message-wrap.user .message-bubble {
  max-width: 70%;
  background: linear-gradient(135deg, #0D9488, #0F766E);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  padding: 14px 18px;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15);
  font-size: 14.5px;
  line-height: 1.65;
}

/* Assistant bubble — glass surface */
.message-wrap.assistant .message-bubble {
  max-width: 78%;
  background: var(--bg-msg-ai);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  color: var(--text-h);
  border-radius: 18px 18px 18px 4px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}

/* Typing dots */
.typing-dots {
  display: flex; align-items: center; gap: 5px; padding: 4px 0;
}
.typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal); display: inline-block;
  animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Markdown content — matches HTML .md-body exactly ───────────────── */
.md-content {
  font-size: 14.5px;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.md-content p { margin-bottom: 8px; }
.md-content p:last-child { margin-bottom: 0; }
.md-content strong { font-weight: 600; color: #0F172A; }
[data-theme="dark"] .md-content strong { color: #F1F5F9; }
.md-content em { color: var(--text-body); }

.md-content code {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--teal);
}

.md-content pre {
  background: #1E293B;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
}
.md-content pre code {
  background: transparent;
  border: none;
  color: #E2E8F0;
  padding: 0;
  font-size: 12px;
  line-height: 1.6;
}

.md-content ul, .md-content ol {
  margin: 8px 0;
  padding-left: 20px;
}
.md-content li { margin-bottom: 4px; font-size: 14px; }

.md-content blockquote {
  border-left: 3px solid var(--teal);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-muted);
  font-style: italic;
}

.md-content h1, .md-content h2, .md-content h3 {
  font-weight: 700; color: #0F172A; margin: 12px 0 6px;
}
[data-theme="dark"] .md-content h1,
[data-theme="dark"] .md-content h2,
[data-theme="dark"] .md-content h3 { color: #F1F5F9; }

.md-content h1 { font-size: 18px; }
.md-content h2 { font-size: 16px; }
.md-content h3 { font-size: 14.5px; }

.md-content a { color: var(--teal); text-decoration: underline; }

.md-content table {
  width: 100%; border-collapse: collapse;
  margin: 8px 0; font-size: 13px;
}
.md-content th, .md-content td {
  border: 1px solid var(--border);
  padding: 6px 10px; text-align: left;
}
.md-content th { background: var(--bg-chat); font-weight: 600; }

.md-content hr {
  border: none; border-top: 1px solid var(--border); margin: 12px 0;
}

/* ── Message actions ────────────────────────────────────────────────── */
.message-actions {
  display: flex; align-items: center; gap: 4px;
  opacity: 0; transition: opacity 0.2s; padding: 0 4px;
}
.message-wrap:hover .message-actions { opacity: 1; }

.msg-action-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 11px; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s;
  font-family: var(--font-body);
}
.msg-action-btn:hover {
  background: var(--teal-glow);
  border-color: rgba(13, 148, 136, 0.2);
  color: var(--teal);
}

.message-meta {
  font-size: 10px; color: var(--text-muted);
  padding: 0 4px;
  display: flex; align-items: center; gap: 6px;
}
.message-wrap.user .message-meta { justify-content: flex-end; }

/* ── RAG citations ─────────────────────────────────────────────────── */
.citation-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 0 4px; margin-top: 6px;
}
.citation-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; padding-top: 3px;
}
.citation-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.citation-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px; color: var(--teal);
  cursor: pointer; transition: all 0.15s;
  max-width: 260px;
}
.citation-chip:hover {
  background: var(--teal-glow);
  border-color: rgba(13, 148, 136, 0.3);
}
.citation-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.citation-score {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
}
.citation-popover {
  margin: 8px 20px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.citation-popover-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.citation-popover-title {
  font-size: 12px; font-weight: 600; color: var(--text);
}
.citation-popover-body {
  font-size: 12px; color: var(--text-muted); line-height: 1.5;
  max-height: 120px; overflow-y: auto;
}
.citation-popover-score {
  font-size: 10px; color: var(--teal); margin-top: 6px; font-weight: 600;
}

/* ── Input Area — matches HTML flat design ──────────────────────────── */
.input-area {
  padding: 14px 20px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.input-box {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.input-textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text-h);
  font-size: 14.5px;
  resize: none;
  min-height: 48px;
  max-height: 140px;
  outline: none;
  transition: border 0.15s;
  font-family: var(--font-body);
  line-height: 1.5;
}
.input-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.08);
}
.input-textarea::placeholder { color: var(--text-muted); }

.input-actions {
  display: flex; align-items: flex-end; gap: 4px; flex-shrink: 0;
}

.btn-mic {
  width: 40px; height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px;
  flex-shrink: 0; transition: all 0.15s;
}
.btn-mic:hover { border-color: var(--teal); color: var(--teal); background: rgba(13, 148, 136, 0.04); }

.attach-btn {
  width: 40px; height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px;
  flex-shrink: 0; transition: all 0.15s;
}
.attach-btn:hover { border-color: var(--teal); color: var(--teal); background: rgba(13, 148, 136, 0.04); }
.btn-mic.recording {
  background: rgba(239, 68, 68, 0.08);
  color: var(--crit); border-color: var(--crit);
  animation: statusPulse 1s ease-in-out infinite;
}

.btn-send {
  width: 48px; height: 48px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  background: linear-gradient(135deg, #0D9488, #0F766E);
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}
.btn-send:hover:not(:disabled) {
  box-shadow: 0 4px 15px rgba(13, 148, 136, 0.3);
  transform: translateY(-1px);
}
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-disclaimer {
  text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 8px;
}

.stop-streaming-row {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 8px;
}

/* ── Settings Panel ─────────────────────────────────────────────────── */
.settings-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.settings-panel {
  position: fixed; top: 0; right: 0;
  width: 320px; height: 100vh;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-glass);
  z-index: 201;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  overflow-y: auto;
}

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-title {
  font-weight: 700; font-size: 16px; color: var(--text-h);
}

.settings-body {
  flex: 1; padding: 20px;
  display: flex; flex-direction: column; gap: 24px;
}
.settings-section {
  display: flex; flex-direction: column; gap: 12px;
}
.settings-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.settings-row-label {
  font-size: 14px; color: var(--text-body); font-weight: 500;
}

/* Toggle */
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 100px; cursor: pointer; transition: background 0.25s;
}
.toggle-track::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.toggle input:checked + .toggle-track { background: var(--teal); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

/* Segmented control */
.seg-control {
  display: flex; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 3px; gap: 2px;
}
.seg-btn {
  flex: 1; padding: 5px 10px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-muted);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all 0.2s; font-family: var(--font-body);
}
.seg-btn.active {
  background: var(--teal); color: #fff;
  box-shadow: 0 1px 6px rgba(13, 148, 136, 0.3);
}

/* Health indicators */
.health-row { display: flex; align-items: center; gap: 8px; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.health-dot.ok { background: var(--ok); }
.health-dot.warn { background: var(--warn); }
.health-dot.crit { background: var(--crit); animation: statusPulse 1s ease-in-out infinite; }
.health-dot.unknown { background: var(--text-muted); }
.health-label { font-size: 13px; color: var(--text-body); flex: 1; }
.health-status { font-size: 12px; color: var(--text-muted); }

.settings-version {
  text-align: center; font-size: 12px; color: var(--text-muted); padding: 12px 0;
}

.settings-select {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-body);
  font-family: var(--font-body); font-size: 13px;
  padding: 7px 12px; cursor: pointer; outline: none; width: 100%;
}
.settings-select:focus { border-color: var(--teal); }

/* ── Error banner ───────────────────────────────────────────────────── */
.error-banner {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--crit);
  margin: 0 20px 8px;
  animation: fadeUp 0.2s ease-out;
}

/* ── File badge ─────────────────────────────────────────────────────── */
.file-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(13, 148, 136, 0.06);
  border: 1px solid rgba(13, 148, 136, 0.2);
  border-radius: 20px; padding: 4px 10px;
  font-size: 11px; color: var(--teal);
}
[data-theme="dark"] .file-badge { color: var(--teal-light); }

.file-badge-close {
  cursor: pointer; opacity: 0.6; transition: opacity 0.15s;
  background: none; border: none; color: inherit;
  font-size: 0.9rem; line-height: 1; padding: 0;
}
.file-badge-close:hover { opacity: 1; }

/* ── Mobile sidebar ─────────────────────────────────────────────────── */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: var(--overlay); z-index: 39;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 80;
    transform: translateX(calc(-1 * var(--sidebar-w)));
    width: var(--sidebar-w) !important;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; animation: fadeIn 0.2s ease; }
  .quick-prompts { grid-template-columns: 1fr; }
  .landing-nav { padding: 16px 20px; }
  .hero { padding: 60px 20px 40px; }
}
