@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2dd4a0;
  --primary-dim: rgba(45, 212, 160, 0.15);
  --accent: #facc15;
  --bg: #0f172a;
  --bg-2: #0a0f1a;
  --sidebar: #0b1224;
  --card: rgba(30, 41, 59, 0.6);
  --card-solid: #1e293b;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --border: rgba(45, 212, 160, 0.25);
  --border-soft: rgba(255, 255, 255, 0.06);
  --danger: #f87171;
  --info: #60a5fa;
  --warn: #fb923c;
  --success: #2dd4a0;
  --mono: 'JetBrains Mono', 'Consolas', monospace;
  --radius: 14px;
  --sidebar-w: 250px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: radial-gradient(ellipse at top, #1e293b 0%, var(--bg) 50%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  line-height: 1.55;
}

button { font-family: inherit; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ───── SIDEBAR ───── */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sb-top { padding: 0 1.4rem 1.2rem; border-bottom: 1px solid var(--border-soft); }

.sb-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-mark { font-size: 1.7rem; }

.brand-text span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.bot-selector {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 0.5rem;
}

.bot-active {
  background: var(--primary-dim);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.bot-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.bot-avatar.lg { width: 48px; height: 48px; font-size: 1.5rem; }

.bot-name-sm { font-weight: 600; font-size: 0.95rem; }
.bot-status-sm { font-size: 0.75rem; color: var(--text-dim); display: flex; align-items: center; gap: 0.3rem; }

.dot {
  width: 7px;
  height: 7px;
  background: var(--text-dim);
  border-radius: 50%;
}

.dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(45, 212, 160, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 160, 0.6); }
  50% { box-shadow: 0 0 0 5px rgba(45, 212, 160, 0); }
}

.sb-nav {
  flex: 1;
  padding: 0.5rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sb-link {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  position: relative;
  transition: all 0.15s;
}

.sb-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.sb-link.active { background: var(--primary-dim); color: var(--primary); }

.sb-icon { font-size: 1.15rem; flex-shrink: 0; }

.sb-pulse {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  margin-left: auto;
  animation: pulse 1.5s infinite;
}

.sb-count {
  background: var(--accent);
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  margin-left: auto;
}

.sb-bottom {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border-soft);
}

.back-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.2s;
}

.back-link:hover { background: var(--primary-dim); transform: translateX(-3px); }

/* ───── MAIN ───── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-menu {
  display: none;
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

.page-title { margin: 0; font-size: 1.3rem; flex: 1; }

.topbar-right { display: flex; gap: 0.6rem; }

.btn-test, .btn-deploy {
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  font-size: 0.85rem;
  padding: 0.6rem 1.1rem;
  transition: all 0.2s;
}

.btn-test {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn-test:hover { background: var(--primary); color: #0f172a; }

.btn-deploy {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #0f172a;
  box-shadow: 0 4px 15px rgba(45, 212, 160, 0.3);
}

.btn-deploy:hover { transform: translateY(-2px); }

/* ───── PAGE ───── */
.page { padding: 2rem; animation: fadeIn 0.3s ease; }

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

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.section-title { margin: 0 0 0.2rem; font-size: 1.5rem; }
.section-sub { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

/* ───── BUTTONS ───── */
.btn-primary, .btn-ghost {
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #22b387);
  color: #0f172a;
  padding: 0.7rem 1.4rem;
  box-shadow: 0 6px 20px rgba(45, 212, 160, 0.25);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(45, 212, 160, 0.4); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--border);
  padding: 0.55rem 1.1rem;
}

.btn-ghost:hover { background: var(--primary-dim); }

/* ───── WELCOME BANNER ───── */
.welcome-banner {
  background: linear-gradient(135deg, rgba(45, 212, 160, 0.1), rgba(250, 204, 21, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
}

.wb-text { flex: 1; }
.wb-text h2 { margin: 0 0 0.3rem; font-size: 1.5rem; }
.wb-text p { margin: 0; color: var(--text-dim); }

.wb-avatar {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  flex-shrink: 0;
  box-shadow: 0 10px 30px rgba(45, 212, 160, 0.3);
}

/* ───── KPI ───── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.kpi-card:hover { transform: translateY(-2px); border-color: var(--border); }

.kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.2rem;
}

.kpi-value .unit { font-size: 1rem; color: var(--text-dim); margin-left: 0.2rem; font-weight: 600; }

.kpi-label { color: var(--text-dim); font-size: 0.82rem; }
.kpi-trend { font-size: 0.72rem; margin-top: 0.2rem; color: var(--text-faint); }
.kpi-trend.up { color: var(--success); }

/* ───── QUICK ACTIONS ───── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.qa-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
}

.qa-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 15px 30px rgba(45, 212, 160, 0.15);
}

.qa-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.qa-card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; color: var(--text); }
.qa-card p { margin: 0; color: var(--text-dim); font-size: 0.85rem; }

/* ───── KB SEARCH & LIST ───── */
.kb-search {
  margin-bottom: 1rem;
}

.kb-search input,
.filters input,
.filters select {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  border-radius: 10px;
  color: var(--text);
  padding: 0.7rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
}

.kb-search input:focus { outline: none; border-color: var(--primary); }

.kb-list {
  display: grid;
  gap: 0.8rem;
}

.kb-entry {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.2rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.kb-entry:hover { border-color: var(--border); }

.kb-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}

.kb-q {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  flex: 1;
}

.kb-q .icon { color: var(--primary); margin-right: 0.4rem; }

.kb-cat-badge {
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.kb-a {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0.5rem 0;
  padding-left: 1.4rem;
  border-left: 2px solid var(--primary);
  line-height: 1.5;
}

.kb-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
}

.kb-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.kb-tag {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.kb-actions { display: flex; gap: 0.3rem; }

.icon-btn-sm {
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.icon-btn-sm:hover { background: rgba(45, 212, 160, 0.1); color: var(--primary); }
.icon-btn-sm.danger:hover { background: rgba(248, 113, 113, 0.1); color: var(--danger); }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

.empty-emoji { font-size: 3rem; margin-bottom: 0.8rem; opacity: 0.6; }

/* ───── DESIGNER ───── */
.designer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1100px) { .designer-grid { grid-template-columns: 1fr; } }

.design-form {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.8rem;
  backdrop-filter: blur(10px);
}

.form-row { margin-bottom: 1.2rem; }
.form-row.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }

.form-row label {
  display: block;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  padding: 0.7rem 0.9rem;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

/* Tone options */
.tone-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.6rem;
}

.tone-option input { display: none; }

.tone-card {
  display: block;
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.7rem;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.tone-option input:checked + .tone-card {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
}

/* Color swatches */
.color-options { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--primary); }

/* Toggle */
.toggle-list { display: flex; flex-direction: column; gap: 0.6rem; }

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  cursor: pointer;
}

.toggle-row span:first-child {
  flex: 1;
  font-size: 0.9rem;
}

.toggle-row span:first-child small { color: var(--text-faint); font-size: 0.78rem; }

.toggle-row input { display: none; }

.toggle {
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-row input:checked ~ .toggle {
  background: var(--primary);
}

.toggle-row input:checked ~ .toggle::after {
  transform: translateX(20px);
}

/* Preview */
.design-preview {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.preview-label {
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 1rem;
  font-weight: 700;
  text-align: center;
}

.chat-window-mini {
  background: var(--bg-2);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.chat-header-mini {
  background: var(--primary);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #0f172a;
}

.chat-header-mini .bot-avatar {
  background: rgba(255, 255, 255, 0.3);
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
}

.cw-name { font-weight: 700; font-size: 0.95rem; }
.cw-status { font-size: 0.72rem; opacity: 0.7; display: flex; align-items: center; gap: 0.3rem; }

.chat-body-mini {
  padding: 1rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.msg { display: flex; gap: 0.5rem; align-items: flex-end; }
.msg.user { justify-content: flex-end; }

.msg-avatar {
  width: 26px;
  height: 26px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.msg-bubble {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  font-size: 0.85rem;
  max-width: 75%;
}

.user-bubble {
  background: var(--primary);
  color: #0f172a;
  border-radius: 14px;
  border-bottom-right-radius: 4px;
}

.chat-input-mini {
  border-top: 1px solid var(--border-soft);
  padding: 0.7rem;
  display: flex;
  gap: 0.5rem;
}

.chat-input-mini input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

.chat-input-mini button {
  background: var(--primary);
  color: #0f172a;
  border: none;
  border-radius: 999px;
  padding: 0 1rem;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ───── LIVE CHAT ───── */
.live-chat-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .live-chat-wrap { grid-template-columns: 1fr; } }

.chat-window {
  background: var(--card-solid);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 600px;
}

.chat-header {
  background: var(--primary);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #0f172a;
}

.chat-header .bot-avatar { background: rgba(255, 255, 255, 0.25); }
.ch-name { font-weight: 700; }
.ch-status { font-size: 0.78rem; opacity: 0.8; display: flex; align-items: center; gap: 0.4rem; }

.ch-clear {
  margin-left: auto;
  background: rgba(0, 0, 0, 0.15);
  border: none;
  color: #0f172a;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.ch-clear:hover { background: rgba(0, 0, 0, 0.3); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.chat-msg {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  animation: msgIn 0.3s ease;
}

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

.chat-msg.user { justify-content: flex-end; }
.chat-msg .msg-avatar { width: 30px; height: 30px; font-size: 0.9rem; background: var(--primary); }

.chat-bubble {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  font-size: 0.92rem;
  max-width: 70%;
  line-height: 1.5;
}

.chat-msg.user .chat-bubble {
  background: var(--primary);
  color: #0f172a;
  border-radius: 14px;
  border-bottom-right-radius: 4px;
}

.chat-time { font-size: 0.7rem; color: var(--text-faint); margin-top: 0.3rem; }

.typing-indicator {
  display: flex;
  gap: 0.3rem;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  width: fit-content;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}

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

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.quick-replies {
  padding: 0.5rem 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quick-reply {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.2s;
}

.quick-reply:hover { background: var(--primary); color: #0f172a; }

.chat-input {
  border-top: 1px solid var(--border-soft);
  padding: 0.9rem;
  display: flex;
  gap: 0.5rem;
}

.chat-input input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}

.chat-input input:focus { outline: none; border-color: var(--primary); background: rgba(255, 255, 255, 0.08); }

.chat-input button {
  background: var(--primary);
  color: #0f172a;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input button:hover { background: var(--accent); transform: scale(1.05); }

.chat-info-panel {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-info-panel h3 { margin: 0; font-size: 1rem; }
.chat-info-panel h4 { margin: 0 0 0.5rem; font-size: 0.88rem; color: var(--text); }
.chat-info-panel p { margin: 0; color: var(--text-dim); font-size: 0.85rem; }

.bot-thoughts {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 0.9rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  max-height: 280px;
  overflow-y: auto;
}

.bot-thought {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.bot-thought:last-child { border-bottom: none; }
.bot-thought.empty { font-style: italic; color: var(--text-faint); text-align: center; padding: 1.5rem 0; }
.bot-thought .step { color: var(--primary); font-weight: 600; }
.bot-thought .score { color: var(--accent); }
.bot-thought .matched { color: var(--success); }
.bot-thought .miss { color: var(--danger); }

.suggestion-list { display: flex; flex-direction: column; gap: 0.4rem; }

.suggestion-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  text-align: left;
  transition: all 0.2s;
}

.suggestion-btn:hover { background: var(--primary-dim); border-color: var(--border); }

/* ───── CONVERSATIONS ───── */
.conv-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.conv-item {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.2rem;
  backdrop-filter: blur(10px);
}

.conv-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.conv-id { font-family: var(--mono); color: var(--primary); font-weight: 700; font-size: 0.88rem; }
.conv-meta { font-size: 0.8rem; color: var(--text-dim); }
.conv-snippet { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 0.5rem; font-style: italic; }
.conv-stats { display: flex; gap: 0.5rem; font-size: 0.75rem; color: var(--text-faint); }

.conv-tag {
  background: rgba(45, 212, 160, 0.1);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* ───── DATA TABLE ───── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  backdrop-filter: blur(10px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.data-table thead { background: rgba(0, 0, 0, 0.3); }
.data-table th { text-align: left; padding: 0.9rem 1.1rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); font-weight: 600; }
.data-table td { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border-soft); font-size: 0.92rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(45, 212, 160, 0.03); }

/* ───── REPORTS GRID ───── */
.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1000px) { .reports-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.panel h3 { margin: 0 0 0.5rem; font-size: 1rem; }

.chart-wrap { position: relative; height: 280px; margin-top: 1rem; }

/* ───── EMBED ───── */
.embed-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.emb-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

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

.emb-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.embed-code-wrap {
  background: #000;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  margin-bottom: 1.5rem;
}

.embed-code-wrap pre {
  margin: 0;
  overflow-x: auto;
  color: var(--primary);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

.copy-btn {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
}

.copy-btn:hover { background: var(--primary); color: #0f172a; }

.embed-instructions {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  margin-bottom: 1.5rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

.embed-instructions h4 { color: var(--text); margin: 0 0 0.5rem; }
.embed-instructions ol { margin: 0; padding-left: 1.4rem; }
.embed-instructions li { margin-bottom: 0.4rem; }

.embed-options {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.embed-options h3 { margin: 0 0 1rem; font-size: 1.05rem; }

.opt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) { .opt-grid { grid-template-columns: 1fr; } }

.opt-row label { display: block; color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.3rem; }

.opt-row select {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.9rem;
  font-family: inherit;
  font-size: 0.9rem;
}

/* ───── TEMPLATE PICKER ───── */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.template-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.template-card:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
  transform: translateY(-3px);
}

.template-emoji { font-size: 2.5rem; margin-bottom: 0.5rem; }
.template-card h4 { margin: 0 0 0.3rem; color: var(--text); }
.template-card p { margin: 0; color: var(--text-dim); font-size: 0.82rem; }

/* ───── MODAL ───── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal[hidden] { display: none; }

.modal-content {
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  position: relative;
  animation: slideUp 0.3s ease;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-content.modal-lg { max-width: 640px; }

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

.modal-content h2 { margin: 0 0 1.2rem; color: var(--primary); }

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.2s;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.form-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
  margin-top: 1.3rem;
}

/* ───── TOAST ───── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card-solid);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 0.9rem 1.4rem;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  animation: toastIn 0.3s ease;
  font-weight: 500;
}

.toast[hidden] { display: none; }

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

/* ───── RESPONSIVE ───── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -280px;
    width: 260px;
    z-index: 200;
    transition: left 0.3s;
  }
  .sidebar.mobile-open { left: 0; box-shadow: 10px 0 30px rgba(0,0,0,0.4); }
  .mobile-menu { display: block; }
}

@media (max-width: 600px) {
  .page { padding: 1.2rem; }
  .topbar { padding: 0.8rem 1.2rem; }
  .form-row.split { grid-template-columns: 1fr; }
  .tone-options { grid-template-columns: 1fr; }
  .welcome-banner { flex-direction: column; text-align: center; }
  .wb-avatar { width: 70px; height: 70px; font-size: 2rem; }
  .chat-window { height: 500px; }
  .toast { left: 1rem; right: 1rem; }
}
