/* =====================================================
   Alia AI Reporter — Premium Dark UI
   ===================================================== */

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

/* ---------- Design Tokens ---------- */
:root {
  --bg:           #080b12;
  --bg2:          #0d1117;
  --panel:        #111827;
  --panel2:       #161d2c;
  --border:       #1f2937;
  --border2:      #2d3748;
  --text:         #f0f4ff;
  --text2:        #9ca3af;
  --text3:        #6b7280;
  --accent:       #6366f1;
  --accent2:      #818cf8;
  --accent-glow:  rgba(99,102,241,0.25);
  --violet:       #8b5cf6;
  --cyan:         #06b6d4;
  --emerald:      #10b981;
  --rose:         #f43f5e;
  --amber:        #f59e0b;
  --error:        #f87171;
  --radius:       12px;
  --radius-lg:    16px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.6);
  --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* =====================================================
   AUTH SCREEN & SIGNUP SCREEN
   ===================================================== */

#authScreen, #signupScreen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,0.2) 0%, transparent 60%),
              var(--bg);
  overflow: hidden;
}

/* Animated background orbs */
.auth-bg-orbs { position: absolute; inset: 0; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: orbFloat 8s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: #6366f1; top: -10%; left: -10%; animation-delay: 0s; }
.orb-2 { width: 300px; height: 300px; background: #8b5cf6; bottom: 10%; right: -5%; animation-delay: 3s; }
.orb-3 { width: 200px; height: 200px; background: #06b6d4; bottom: 30%; left: 30%; animation-delay: 5s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(20px, -20px) scale(1.05); }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(99,102,241,0.1) inset;
  animation: fadeUp 0.5s ease both;
}

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

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.auth-card h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text2);
  font-size: 0.9rem;
  margin-bottom: 28px;
  line-height: 1.6;
}

.input-group {
  margin-bottom: 14px;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input-group input::placeholder { color: var(--text3); }

.input-group input:focus,
.input-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

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

.input-row .input-group { flex: 1; }

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text2);
}

.auth-link {
  color: var(--accent2);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
}

.auth-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  letter-spacing: 0.01em;
}

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

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--text); background: var(--accent-glow); }
.btn-ghost.small { width: auto; padding: 8px 16px; font-size: 0.85rem; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

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

.btn-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text3);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-close:hover { border-color: var(--rose); color: var(--rose); background: rgba(244,63,94,0.1); }

.btn-send {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-send:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99,102,241,0.5); }
.btn-send:active { transform: translateY(0); }

.error-msg { color: var(--error); font-size: 0.82rem; min-height: 1em; margin-top: 10px; }

/* =====================================================
   APP LAYOUT
   ===================================================== */

#appScreen { display: flex; flex-direction: column; height: 100vh; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 60px;
  background: rgba(13, 17, 23, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.conn-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--emerald);
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Layout */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
#sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  gap: 8px;
}

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

.sidebar-header h2 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.conn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  gap: 8px;
}

.conn-item-info {
  flex: 1;
  min-width: 0;
}

.conn-delete-btn {
  background: transparent;
  border: none;
  color: var(--text3);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conn-item:hover .conn-delete-btn {
  opacity: 0.6;
}

.conn-delete-btn:hover {
  opacity: 1 !important;
  color: #f87171;
  background: rgba(239,68,68,0.15);
}

.conn-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--violet));
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.conn-item:hover {
  border-color: var(--border2);
  background: rgba(255,255,255,0.03);
}

.conn-item:hover::before { opacity: 0.5; }

.conn-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(139,92,246,0.1) 100%);
  border-color: rgba(99,102,241,0.4);
}

.conn-item.active::before { opacity: 1; }

.conn-item-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conn-item small {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conn-item.active small { color: var(--accent2); }

.sidebar-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 0;
  color: var(--text3);
  font-size: 0.82rem;
  text-align: center;
}

/* ---------- Main ---------- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 40px;
  text-align: center;
}

.empty-icon { margin-bottom: 8px; }

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.empty-state p {
  color: var(--text2);
  font-size: 0.9rem;
  max-width: 360px;
  line-height: 1.7;
}

/* ---------- Chat ---------- */
#chatArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Message Bubbles */
.msg {
  max-width: 860px;
  width: 100%;
  animation: msgIn 0.3s ease both;
}

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

.msg.user {
  align-self: flex-end;
  max-width: 600px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  border-radius: 18px 18px 4px 18px;
  font-size: 0.92rem;
  font-weight: 500;
  color: white;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

.msg.assistant {
  align-self: flex-start;
  padding: 0;
  background: transparent;
  border: none;
}

.assistant-inner {
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: 4px 18px 18px 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.assistant-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.ai-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ai-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent);
}

.assistant-body { padding: 18px; }

/* Loading */
.msg.loading .assistant-inner { border-color: rgba(99,102,241,0.3); }
.thinking-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}
.thinking-dots span {
  width: 7px;
  height: 7px;
  background: var(--accent2);
  border-radius: 50%;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

.msg.error {
  align-self: flex-start;
  padding: 12px 18px;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: 4px 18px 18px 18px;
  color: var(--error);
  font-size: 0.88rem;
}

/* ---------- Report text ---------- */
.report-text { color: var(--text); font-size: 0.9rem; line-height: 1.7; }
.report-text p { margin: 0 0 10px; }
.report-text p:last-child { margin-bottom: 0; }
.report-text h2 { font-size: 1.1rem; font-weight: 600; margin: 16px 0 8px; letter-spacing: -0.02em; }
.report-text h3 { font-size: 0.98rem; font-weight: 600; margin: 12px 0 6px; color: var(--accent2); }
.report-text h4 { font-size: 0.88rem; font-weight: 600; margin: 10px 0 5px; color: var(--text2); }
.report-text strong { color: var(--text); font-weight: 600; }
.report-text code { font-family: 'JetBrains Mono', monospace; background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.2); padding: 2px 6px; border-radius: 5px; font-size: 0.82em; color: var(--accent2); }
.report-text ul { margin: 8px 0 10px 20px; }
.report-text li { margin-bottom: 5px; }

.report-text table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 0.85rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border2);
}
.report-text th {
  padding: 9px 14px;
  background: rgba(99,102,241,0.12);
  color: var(--accent2);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}
.report-text td { padding: 9px 14px; border-top: 1px solid var(--border); color: var(--text2); }
.report-text tr:hover td { background: rgba(255,255,255,0.02); color: var(--text); }

/* ---------- SQL Debug ---------- */
.sql-debug {
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.sql-debug-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
}

.sql-debug-toggle svg { transition: transform var(--transition); }
.sql-debug.open .sql-debug-toggle svg { transform: rotate(90deg); }

.sql-debug-body {
  display: none;
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text2);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.sql-debug.open .sql-debug-body { display: block; }

/* ---------- Chart ---------- */
.chart-section {
  margin-top: 18px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  overflow: hidden;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  flex-wrap: wrap;
  gap: 8px;
}

.chart-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-title-icon {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-type-btns {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.chart-type-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text3);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.chart-type-btn:hover { color: var(--text2); background: rgba(255,255,255,0.04); }
.chart-type-btn.active { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(99,102,241,0.4); }

.chart-download-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text3);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.chart-download-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.chart-canvas-wrapper {
  padding: 20px;
  position: relative;
  min-height: 280px;
}

.chart-canvas-wrapper canvas {
  max-height: 320px;
}

/* Stats row under chart */
.chart-stats {
  display: flex;
  gap: 1px;
  border-top: 1px solid var(--border);
  background: var(--border);
}

.chart-stat {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg2);
  text-align: center;
}

.chart-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.chart-stat-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 2px;
}

/* ---------- Prompt row ---------- */
.prompt-row {
  display: flex;
  gap: 10px;
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.prompt-input-wrapper {
  flex: 1;
  position: relative;
}

.prompt-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}

#promptInput {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition);
}

#promptInput::placeholder { color: var(--text3); }
#promptInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease both;
  max-height: 90vh;
  overflow-y: auto;
}

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

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

.modal-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
}

.modal-footer .btn-primary { margin: 0; }

.hint-text {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--text3);
  line-height: 1.5;
  margin-top: 4px;
  margin-bottom: 8px;
}

/* ---------- Profile Modal ---------- */
.profile-header-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
  text-transform: uppercase;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.profile-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--emerald);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border2);
  margin: 18px 0 16px;
}

.form-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.success-msg {
  color: var(--emerald);
  font-size: 0.82rem;
  min-height: 1em;
  margin-top: 8px;
}

/* ---------- ML Insights Cards ---------- */
.ml-card {
  margin-top: 16px;
  padding: 16px;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius);
  animation: fadeUp 0.3s ease both;
}

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

.ml-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent2);
  background: rgba(99,102,241,0.12);
  padding: 4px 10px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}

.ml-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.ml-metric-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.ml-metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.ml-metric-value.positive { color: var(--emerald); }
.ml-metric-value.negative { color: var(--rose); }
.ml-metric-value.neutral { color: var(--amber); }

.ml-metric-label {
  font-size: 0.72rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ml-progress-bg {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin-top: 6px;
  overflow: hidden;
}

.ml-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--emerald));
  border-radius: 99px;
}

.ml-future-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.ml-future-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.ml-future-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.ml-future-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
}

.ml-future-label { font-size: 0.72rem; color: var(--text3); margin-bottom: 2px; }
.ml-future-value { font-size: 0.95rem; font-weight: 700; color: var(--accent2); }

/* ML Clustering Grid */
.ml-clusters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.ml-cluster-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px;
}

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

.ml-cluster-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.ml-cluster-pct { font-size: 0.72rem; font-weight: 700; color: white; padding: 2px 7px; border-radius: 99px; }

.ml-cluster-stats { font-size: 0.78rem; color: var(--text2); display: flex; flex-direction: column; gap: 3px; }

/* =====================================================
   LIGHT MODE THEME
   ===================================================== */

body.light-mode {
  --bg:           #f1f5f9;
  --bg2:          #ffffff;
  --panel:        #ffffff;
  --panel2:       #f8fafc;
  --border:       #e2e8f0;
  --border2:      #cbd5e1;
  --text:         #0f172a;
  --text2:        #475569;
  --text3:        #94a3b8;
  --accent:       #6366f1;
  --accent2:      #4f46e5;
  --accent-glow:  rgba(99,102,241,0.12);
  --violet:       #7c3aed;
  --cyan:         #0891b2;
  --emerald:      #059669;
  --rose:         #e11d48;
  --amber:        #d97706;
  --error:        #ef4444;
  --shadow:       0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.14);
}

body.light-mode header {
  background: rgba(255,255,255,0.95);
}

body.light-mode #sidebar {
  background: #f8fafc;
}

body.light-mode .auth-card {
  background: rgba(255,255,255,0.92);
}

body.light-mode .assistant-inner {
  background: #ffffff;
}

body.light-mode #promptInput {
  background: #f8fafc;
}

body.light-mode .prompt-row {
  background: #f8fafc;
}

body.light-mode .chart-section {
  background: #ffffff;
}

body.light-mode .sql-debug {
  background: rgba(0,0,0,0.04);
}

body.light-mode .report-text code {
  background: rgba(99,102,241,0.07);
}

/* Theme toggle button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.theme-toggle-btn .icon-sun { display: none; }
.theme-toggle-btn .icon-moon { display: block; }
body.light-mode .theme-toggle-btn .icon-sun { display: block; }
body.light-mode .theme-toggle-btn .icon-moon { display: none; }

/* =====================================================
   TAB BAR (Multi-tab)
   ===================================================== */

#tabBar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
#tabBar::-webkit-scrollbar { display: none; }

.tab-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px 9px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  color: var(--text3);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  position: relative;
  top: 1px;
}

.tab-item:hover { color: var(--text2); background: rgba(255,255,255,0.04); }

.tab-item.active {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}

body.light-mode .tab-item.active {
  background: #f1f5f9;
}

.tab-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text3);
  cursor: pointer;
  padding: 0;
  font-size: 0;
  transition: all var(--transition);
  flex-shrink: 0;
}
.tab-close-btn:hover { background: rgba(244,63,94,0.15); color: var(--rose); }

.tab-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px dashed var(--border2);
  border-radius: 6px;
  color: var(--text3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all var(--transition);
  flex-shrink: 0;
  margin-left: 4px;
}
.tab-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* =====================================================
   SIDEBAR TABS (Databases / History / Favorites)
   ===================================================== */

.sidebar-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-tab-btn {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text3);
  font-size: 0.68rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  transition: all var(--transition);
}
.sidebar-tab-btn:hover { color: var(--text2); }
.sidebar-tab-btn.active { background: var(--accent); color: white; }

/* History / Favorites items */
.history-item, .fav-item {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.history-item:hover, .fav-item:hover { background: rgba(99,102,241,0.07); border-color: rgba(99,102,241,0.3); }

.history-item-prompt, .fav-item-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta, .fav-item-meta {
  font-size: 0.72rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fav-delete-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  border-radius: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}
.fav-delete-btn:hover { color: var(--rose); }

.sidebar-section-empty {
  padding: 20px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text3);
}

/* =====================================================
   TABLE EXPLORER (Schema Viewer)
   ===================================================== */

#tableExplorerPanel {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  overflow: hidden;
  transition: width var(--transition);
}

#tableExplorerPanel.collapsed {
  width: 0;
  border-left: none;
}

.explorer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.explorer-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.explorer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.explorer-loading {
  padding: 20px 10px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text3);
}

.explorer-table-item {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
  border: 1px solid var(--border);
}

.explorer-table-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  transition: background var(--transition);
  user-select: none;
}
.explorer-table-header:hover { background: rgba(99,102,241,0.1); }

.explorer-table-header svg { transition: transform var(--transition); flex-shrink: 0; }
.explorer-table-item.open .explorer-table-header svg { transform: rotate(90deg); }

.explorer-table-preview-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--accent2);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  flex-shrink: 0;
}
.explorer-table-header:hover .explorer-table-preview-btn { opacity: 1; }
.explorer-table-preview-btn:hover { background: rgba(99,102,241,0.15); }

.explorer-columns {
  display: none;
  padding: 4px 8px 6px;
  background: rgba(0,0,0,0.1);
}
.explorer-table-item.open .explorer-columns { display: block; }

.explorer-col-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 2px;
  font-size: 0.72rem;
  color: var(--text2);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.explorer-col-row:last-child { border-bottom: none; }

.explorer-col-name { font-weight: 500; }
.explorer-col-type { color: var(--text3); font-size: 0.68rem; margin-left: auto; font-family: 'JetBrains Mono', monospace; }

/* Explorer toggle button in toolbar */
.explorer-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text3);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.explorer-toggle-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.explorer-toggle-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* =====================================================
   MESSAGE ACTION BUTTONS (Save / Share / Export)
   ===================================================== */

.msg-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
  flex-wrap: wrap;
}

.msg-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--text3);
  font-size: 0.73rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.msg-action-btn:hover { border-color: var(--border2); color: var(--text2); background: rgba(255,255,255,0.04); }
.msg-action-btn.fav { }
.msg-action-btn.fav.saved { border-color: var(--amber); color: var(--amber); background: rgba(245,158,11,0.08); }
.msg-action-btn.share:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(6,182,212,0.08); }
.msg-action-btn.export-csv:hover { border-color: var(--emerald); color: var(--emerald); background: rgba(16,185,129,0.08); }
.msg-action-btn.export-xlsx:hover { border-color: var(--emerald); color: var(--emerald); background: rgba(16,185,129,0.08); }

/* =====================================================
   CHART AI REASON BADGE
   ===================================================== */

.chart-ai-reason {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(6,182,212,0.06);
  border-bottom: 1px solid rgba(6,182,212,0.15);
  font-size: 0.75rem;
  color: var(--cyan);
  font-style: italic;
}

/* =====================================================
   TOAST NOTIFICATION
   ===================================================== */

#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  animation: toastIn 0.3s ease both;
  pointer-events: auto;
  min-width: 220px;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--emerald); }
.toast.error   { border-left: 3px solid var(--rose); }
.toast.info    { border-left: 3px solid var(--cyan); }

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

/* =====================================================
   SHARE MODAL
   ===================================================== */

.share-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  margin: 8px 0;
}

.share-link-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text2);
  min-width: 0;
}

.share-copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--accent);
  border: none;
  border-radius: 7px;
  color: white;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.share-copy-btn:hover { opacity: 0.85; }

/* =====================================================
   VOICE MIC BUTTON
   ===================================================== */

.btn-mic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-mic:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.btn-mic.listening {
  border-color: var(--rose);
  color: var(--rose);
  background: rgba(244,63,94,0.12);
  animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(244,63,94,0.4); }
  70% { box-shadow: 0 0 0 8px rgba(244,63,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(244,63,94,0); }
}

/* =====================================================
   DASHBOARD GRID & WIDGETS
   ===================================================== */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.dashboard-widget-card {
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

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

.dashboard-widget-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.dashboard-widget-unpin {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 0.75rem;
  transition: color var(--transition);
}
.dashboard-widget-unpin:hover { color: var(--rose); }

/* =====================================================
   ALERTS BUTTON & BADGE
   ===================================================== */

.alerts-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text2);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.alerts-btn:hover { border-color: var(--amber); color: var(--amber); background: rgba(245,158,11,0.08); }

.alerts-badge {
  background: var(--rose);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 2px;
}

.alert-item-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.alert-item-card.triggered { border-left: 4px solid var(--rose); background: rgba(244,63,94,0.06); }
.alert-item-title { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.alert-item-sub { font-size: 0.75rem; color: var(--text3); }

/* =====================================================
   SQL EDITOR & AI EXPLAIN
   ===================================================== */

.sql-editor-wrapper {
  margin-top: 10px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
}

.sql-editor-textarea {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text);
  resize: vertical;
  min-height: 70px;
  box-sizing: border-box;
}

.sql-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

.sql-editor-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text2);
  font-size: 0.73rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.sql-editor-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.sql-editor-btn.run { background: var(--accent); border-color: var(--accent); color: white; }
.sql-editor-btn.run:hover { opacity: 0.9; }

/* =====================================================
   API KEY MANAGER STYLES
   ===================================================== */

.api-key-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.api-key-label { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.api-key-prefix { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text3); }

.msg-action-btn.export-pdf:hover { border-color: var(--violet); color: var(--violet); background: rgba(139,92,246,0.08); }
.msg-action-btn.pin-dash:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* =====================================================
   AI PROMPT ENHANCER & SUGGESTED QUESTION CHIPS
   ===================================================== */

.btn-enhance {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  height: 42px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--violet);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-enhance:hover {
  border-color: var(--violet);
  background: rgba(139,92,246,0.12);
  box-shadow: 0 2px 12px rgba(139,92,246,0.25);
}

.suggested-chips-row {
  padding: 12px 32px 0;
  background: var(--bg);
}

.suggested-chips-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.suggested-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggested-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  background: var(--panel2);
  border: 1px solid var(--border2);
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.suggested-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

/* Followup Question Chips in Message Cards */
.followup-chips-container {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(99,102,241,0.04);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.followup-chips-title {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.followup-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.followup-chip {
  padding: 5px 11px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
}
.followup-chip:hover {
  border-color: var(--accent2);
  color: var(--text);
  background: rgba(99,102,241,0.12);
}

/* =====================================================
   3D ALIA AI REPORTER LOGO ASSET
   ===================================================== */

.brand-logo-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 9px;
  box-shadow: 0 2px 10px rgba(99,102,241,0.25);
  flex-shrink: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}
.brand-logo-img:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(139,92,246,0.45);
}

.auth-logo-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(99,102,241,0.35), 0 0 0 1px rgba(255,255,255,0.1);
  margin-bottom: 6px;
  transition: transform var(--transition);
}
.auth-logo-img:hover {
  transform: scale(1.05);
}


