/* ═══════════════════════════════════════════════════════════════════════════
   Tandem Excel Copilot — Premium Design System
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Transitions */
  --transition: .22s cubic-bezier(.4,0,.2,1);
  --transition-fast: .12s cubic-bezier(.4,0,.2,1);
  --transition-spring: .4s cubic-bezier(.34,1.56,.64,1);
  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  /* Fonts */
  --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.12);
  --shadow-md: 0 4px 12px rgba(0,0,0,.15);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.2);
  --shadow-xl: 0 16px 50px rgba(0,0,0,.3);
  /* Sidebar */
  --sidebar-width: 280px;
}

/* ── Dark Theme (default) ──────────────────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg-primary: #1a1917;
  --bg-secondary: #232220;
  --bg-tertiary: #2c2b28;
  --bg-hover: #35342f;
  --bg-active: #3e3d38;
  --bg-input: #282724;
  --bg-message-user: #3a3520;
  --bg-message-ai: #232220;
  --bg-card: #252422;
  --border: #3a3936;
  --border-light: #2e2d2a;
  --border-focus: #d4a843;
  --text-primary: #f0ede6;
  --text-secondary: #a8a49a;
  --text-tertiary: #7a766e;
  --text-inverse: #1a1917;
  --accent: #d4a843;
  --accent-hover: #e0ba5a;
  --accent-muted: rgba(212,168,67,.15);
  --accent-glow: rgba(212,168,67,.25);
  --success: #4ade80;
  --success-muted: rgba(74,222,128,.12);
  --error: #f87171;
  --error-muted: rgba(248,113,113,.12);
  --warning: #fbbf24;
  --warning-muted: rgba(251,191,36,.12);
  --info: #60a5fa;
  --info-muted: rgba(96,165,250,.12);
  --overlay-bg: rgba(10,10,8,.75);
  --scrollbar-thumb: #3a3936;
  --scrollbar-thumb-hover: #4a4944;
  color-scheme: dark;
}

/* ── Light Theme ───────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #f5f3f0;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eae7e2;
  --bg-hover: #e0ddd7;
  --bg-active: #d5d2cc;
  --bg-input: #ffffff;
  --bg-message-user: #fdf6e3;
  --bg-message-ai: #ffffff;
  --bg-card: #ffffff;
  --border: #d9d5ce;
  --border-light: #e5e2dc;
  --border-focus: #c4950e;
  --text-primary: #2c2a26;
  --text-secondary: #6b6760;
  --text-tertiary: #9a968f;
  --text-inverse: #f5f3f0;
  --accent: #c4950e;
  --accent-hover: #a87e08;
  --accent-muted: rgba(196,149,14,.1);
  --accent-glow: rgba(196,149,14,.2);
  --success: #22c55e;
  --success-muted: rgba(34,197,94,.1);
  --error: #ef4444;
  --error-muted: rgba(239,68,68,.1);
  --warning: #f59e0b;
  --warning-muted: rgba(245,158,11,.1);
  --info: #3b82f6;
  --info-muted: rgba(59,130,246,.1);
  --overlay-bg: rgba(60,58,52,.6);
  --scrollbar-thumb: #c9c5be;
  --scrollbar-thumb-hover: #b3afa8;
  color-scheme: light;
}

/* ── Typography ────────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100dvh;
  transition: background var(--transition), color var(--transition);
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.3;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
  transition: background var(--transition);
}
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* ── Utility ───────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — Chat App
   ═══════════════════════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition);
  z-index: 30;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-new-chat {
  width: 100%;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}
.btn-new-chat:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-new-chat:active { transform: translateY(0); }

/* Sidebar list */
.sidebar-chats {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.chat-item::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  transition: height var(--transition);
}

.chat-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateX(3px);
}
.chat-item:hover::before { height: 60%; }

.chat-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 500;
}
.chat-item.active::before { height: 60%; }

.chat-item-icon {
  font-size: 16px;
  flex-shrink: 0;
  opacity: .7;
}

.chat-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-delete {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  flex-shrink: 0;
}
.chat-item:hover .chat-item-delete { opacity: 1; }
.chat-item-delete:hover { color: var(--error); background: var(--error-muted); }

/* Sidebar empty */
.sidebar-empty {
  padding: 32px 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.sidebar-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  animation: sidebarFloat 3s ease-in-out infinite;
}

@keyframes sidebarFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Sidebar footer - removed */

/* ── Main Area ─────────────────────────────────────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* ── Header ────────────────────────────────────────────────────────────── */
.main-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 56px;
}

.btn-sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Model selector */
.model-selector {
  position: relative;
}

.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all var(--transition);
  white-space: nowrap;
}
.model-selector-btn:hover { border-color: var(--accent); background: var(--bg-hover); }

.model-selector-arrow {
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform var(--transition);
}

.model-selector.open .model-selector-arrow { transform: rotate(180deg); }

.model-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all var(--transition);
  overflow: hidden;
}

.model-selector.open .model-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.model-option {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-light);
}
.model-option:last-child { border-bottom: none; }
.model-option:hover { background: var(--bg-hover); }
.model-option.selected { background: var(--accent-muted); }

.model-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.model-option-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.model-option-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.model-option .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full, 50px);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.badge-high { background: var(--error-muted); color: var(--error); }
.badge-mid { background: var(--warning-muted); color: var(--warning); }
.badge-low { background: var(--success-muted); color: var(--success); }
.badge-free { background: var(--info-muted); color: var(--info); }

/* Prompt enhancement animation */
.bubble-text {
  display: inline;
  transition: filter 0.4s ease, opacity 0.4s ease;
}

.enhance-blur-out {
  filter: blur(6px);
  opacity: 0.3;
}

.enhance-blur-in {
  animation: enhanceReveal 0.6s ease-out;
}

@keyframes enhanceReveal {
  0%   { filter: blur(6px); opacity: 0.3; }
  100% { filter: blur(0); opacity: 1; }
}

.enhance-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 6px;
  opacity: 0;
  animation: enhanceLabelIn 0.5s ease-out 0.2s forwards;
}

@keyframes enhanceLabelIn {
  0%   { opacity: 0; transform: translateY(4px); }
  100% { opacity: 0.7; transform: translateY(0); }
}

/* Balance chip */
.balance-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Header spacer */
.header-spacer { flex: 1; }

/* Theme toggle */
.btn-theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: rotate(20deg);
}

/* Language toggle */
.lang-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.lang-btn {
  background: none;
  border: none;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition);
  font-family: var(--font-sans);
}
.lang-btn.active {
  background: var(--accent);
  color: var(--text-inverse);
}
.lang-btn:hover:not(.active) { color: var(--text-primary); }

/* WhatsApp header button */
.btn-whatsapp-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #25d366;
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-whatsapp-header:hover {
  background: #1da851;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}
.btn-whatsapp-header svg { flex-shrink: 0; }

/* User menu */
.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--transition);
  white-space: nowrap;
}
.user-menu-btn:hover { border-color: var(--accent); }

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all var(--transition);
  overflow: hidden;
}

.user-menu.open .user-menu-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}
.user-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.user-menu-item.danger:hover { background: var(--error-muted); color: var(--error); }

.user-menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MESSAGES AREA
   ═══════════════════════════════════════════════════════════════════════════ */

.messages-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  scroll-behavior: smooth;
}

.messages-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Welcome Screen ────────────────────────────────────────────────────── */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 32px;
  animation: welcomeFadeIn .7s ease-out;
}

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

.welcome-logo {
  font-size: 56px;
  margin-bottom: 12px;
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-5px) rotate(1deg); }
  75% { transform: translateY(3px) rotate(-1deg); }
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.welcome-subtitle {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), #e8c96e, #f0a050, #e8c96e, var(--accent));
  background-size: 400% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  animation: subtitleShimmer 4s ease-in-out infinite;
}

@keyframes subtitleShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.welcome-description {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 500px;
  line-height: 1.7;
  margin-bottom: 32px;
}

/* Suggestion cards */
.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 640px;
  width: 100%;
  margin-bottom: 16px;
}

.suggestion-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  animation: cardStagger .5s ease-out both;
  position: relative;
  overflow: hidden;
}

.suggestion-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-muted), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.suggestion-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.suggestion-card:hover::after { opacity: 1; }
.suggestion-card:active { transform: translateY(0); }

.suggestion-card:nth-child(1) { animation-delay: .05s; }
.suggestion-card:nth-child(2) { animation-delay: .1s; }
.suggestion-card:nth-child(3) { animation-delay: .15s; }
.suggestion-card:nth-child(4) { animation-delay: .2s; }
.suggestion-card:nth-child(5) { animation-delay: .25s; }
.suggestion-card:nth-child(6) { animation-delay: .3s; }

@keyframes cardStagger {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.suggestion-icon {
  font-size: 22px;
  position: relative;
  z-index: 1;
}

.suggestion-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.btn-shuffle-suggestions {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  font-family: var(--font-sans);
}
.btn-shuffle-suggestions:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Message bubbles ───────────────────────────────────────────────────── */
.message {
  display: flex;
  gap: 12px;
  animation: messageFadeIn .3s ease-out;
  max-width: 100%;
}

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

.message.user-message {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.user-message .message-avatar { background: var(--accent-muted); }

.message-content {
  max-width: 85%;
  min-width: 0;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word;
  position: relative;
}

.user-message .message-bubble {
  background: var(--bg-message-user);
  border: 1px solid var(--border);
  border-top-right-radius: var(--radius-xs);
}

.ai-message .message-bubble {
  background: var(--bg-message-ai);
  border: 1px solid var(--border-light);
  border-top-left-radius: var(--radius-xs);
}

/* Message content typography */
.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble strong { font-weight: 600; color: var(--text-primary); }
.message-bubble em { font-style: italic; }
.message-bubble ul, .message-bubble ol { padding-left: 20px; margin-bottom: 8px; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 13px;
}
.message-bubble pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.message-bubble pre code {
  background: none;
  padding: 0;
}

/* Copy button on AI messages */
.btn-copy-message {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-tertiary);
  opacity: 0;
  transition: all var(--transition);
}
.ai-message .message-bubble:hover .btn-copy-message,
.user-message .message-bubble:hover .btn-copy-message {
  opacity: 1;
}
.btn-copy-message:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-muted);
}
.btn-copy-message.copied {
  color: var(--success);
  border-color: var(--success);
}

/* ── File chips ────────────────────────────────────────────────────────── */
.message-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 200px;
  transition: all var(--transition);
  animation: chipPop .3s var(--transition-spring);
}

@keyframes chipPop {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: scale(1); }
}

.file-chip-thumb {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.file-chip-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-remove {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  transition: color var(--transition);
  flex-shrink: 0;
  line-height: 1;
}
.file-chip-remove:hover { color: var(--error); }

/* ── Download card ─────────────────────────────────────────────────────── */
.download-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  transition: all var(--transition);
  animation: downloadPop .4s cubic-bezier(.34,1.56,.64,1);
}

@keyframes downloadPop {
  from { opacity: 0; transform: scale(.95); }
  to { opacity: 1; transform: scale(1); }
}

.download-card:hover {
  border-color: var(--success);
  box-shadow: 0 0 20px rgba(74,222,128,.1);
}

.download-icon {
  font-size: 32px;
  flex-shrink: 0;
}

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

.download-filename {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.btn-download {
  padding: 8px 18px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-download:hover {
  background: #22c55e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74,222,128,.3);
}
.btn-download:active { transform: translateY(0); }

/* ── Progress bar ──────────────────────────────────────────────────────── */
.progress-bar-wrapper {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-full);
  transition: width .4s ease-out;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  animation: progressShimmer 1.5s infinite;
}

@keyframes progressShimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ── Queue pulsing progress bar ─────────────────────────────────────── */
.progress-bar-fill.queued {
  width: 100% !important;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: queuePulse 2s ease-in-out infinite;
}

.progress-bar-fill.queued::after {
  display: none;
}

@keyframes queuePulse {
  0%, 100% { background-position: 0% 50%; opacity: .55; }
  50% { background-position: 100% 50%; opacity: 1; }
}

.progress-text {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ── Typing indicator ──────────────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typingBounce .6s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }

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

/* ═══════════════════════════════════════════════════════════════════════════
   INPUT AREA
   ═══════════════════════════════════════════════════════════════════════════ */

.input-area {
  padding: 12px 20px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-container {
  max-width: 780px;
  margin: 0 auto;
}

.input-files-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

/* Active glow during generation / streaming */
.input-row.is-active {
  border-color: transparent;
  background-image: linear-gradient(var(--bg-input), var(--bg-input)),
                    linear-gradient(90deg, var(--accent), #e8c96e, #f0a050, #e8c96e, var(--accent));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  background-size: 100% 100%, 400% 100%;
  box-shadow: 0 0 18px 2px rgba(232, 201, 110, 0.25), 0 0 6px 1px rgba(240, 160, 80, 0.15);
  animation: inputActiveGlow 3s ease-in-out infinite;
}

@keyframes inputActiveGlow {
  0%   { background-position: 0 0, 0% 50%; box-shadow: 0 0 18px 2px rgba(232, 201, 110, 0.25), 0 0 6px 1px rgba(240, 160, 80, 0.15); }
  50%  { background-position: 0 0, 100% 50%; box-shadow: 0 0 22px 4px rgba(240, 160, 80, 0.3), 0 0 8px 2px rgba(232, 201, 110, 0.2); }
  100% { background-position: 0 0, 0% 50%; box-shadow: 0 0 18px 2px rgba(232, 201, 110, 0.25), 0 0 6px 1px rgba(240, 160, 80, 0.15); }
}

.btn-attach {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  transition: all var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-attach:hover { color: var(--accent); transform: scale(1.1); }

#message-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  resize: none;
  min-height: 24px;
  max-height: 200px;
  line-height: 1.5;
  padding: 4px 0;
}

#message-input::placeholder {
  color: var(--text-tertiary);
}

.btn-send,
.btn-stop {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-send {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn-send:hover { background: var(--accent-hover); transform: scale(1.05); }
.btn-send:disabled { opacity: .4; cursor: default; transform: none; }

.btn-stop {
  background: var(--error);
  color: #fff;
  display: none;
}
.btn-stop:hover { background: #ef4444; }

.input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* Hidden file input */
#file-input { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   FULL-PAGE DROP OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--overlay-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.drop-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: dropPulse 2s ease-in-out infinite;
}

@keyframes dropPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.drop-overlay-icon {
  font-size: 64px;
  filter: drop-shadow(0 4px 20px rgba(212,168,67,.4));
}

.drop-overlay-text {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.drop-overlay-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.drop-overlay-border {
  position: absolute;
  inset: 20px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-xl);
  opacity: .5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ONBOARDING OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}

.onboarding-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.onboarding-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px 36px;
  max-width: 520px;
  width: calc(100% - 40px);
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: onboardingPop .5s cubic-bezier(.34,1.56,.64,1);
}

@keyframes onboardingPop {
  from { opacity: 0; transform: scale(.85) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.onboarding-logo {
  font-size: 56px;
  margin-bottom: 16px;
}

.onboarding-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.3;
}

.onboarding-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 28px;
  white-space: pre-line;
}

.onboarding-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.onboarding-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.onboarding-faq-link {
  display: block;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition);
  background: none;
  border: none;
  font-family: var(--font-sans);
}
.onboarding-faq-link:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text-primary);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(40px);
  transition: all .35s cubic-bezier(.4,0,.2,1);
  max-width: 360px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  position: relative;
}

.toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--error); }
.toast.toast-info { border-left: 3px solid var(--info); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-text { flex: 1; }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 0 var(--radius-md);
  transition: width linear;
}

.toast.toast-success .toast-progress { background: var(--success); }
.toast.toast-error .toast-progress { background: var(--error); }
.toast.toast-info .toast-progress { background: var(--info); }
.toast.toast-warning .toast-progress { background: var(--warning); }

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  overflow: auto;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: loginFadeIn .5s ease-out;
}

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

.login-logo {
  text-align: center;
  font-size: 48px;
  margin-bottom: 8px;
}

.login-title {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* ── Login tabs ── */
.login-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.login-tab.active {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.login-tab:not(.active):hover {
  color: var(--text-primary);
}

.login-tab-content {
  display: none;
}
.login-tab-content.active {
  display: block;
  animation: loginFadeIn .3s ease-out;
}

/* ── Password toggle ── */
.input-password-wrap {
  position: relative;
}
.input-password-wrap input {
  width: 100%;
  padding-right: 42px;
}
.btn-toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}
.btn-toggle-password:hover {
  color: var(--text-primary);
}
.btn-toggle-password svg {
  display: block;
}

/* ── Login success ── */
.login-success {
  display: none;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #4ade80;
  margin-bottom: 16px;
}
.login-success.visible { display: block; }

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

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

.form-group select {
  cursor: pointer;
}

.login-error {
  display: none;
  background: var(--error-muted);
  border: 1px solid rgba(248,113,113,.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--error);
  margin-bottom: 16px;
}
.login-error.visible { display: block; }

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-login:hover { background: var(--accent-hover); }
.btn-login:disabled { opacity: .6; cursor: default; }

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FAQ PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.faq-page {
  min-height: 100dvh;
  background: var(--bg-primary);
  overflow-y: auto;
}

.faq-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.faq-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.faq-back:hover { color: var(--accent); border-color: var(--accent); }

.faq-header-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
}

.faq-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.faq-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.faq-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition);
  animation: faqCardIn .5s ease-out both;
}

.faq-item:nth-child(1) { animation-delay: .05s; }
.faq-item:nth-child(2) { animation-delay: .1s; }
.faq-item:nth-child(3) { animation-delay: .15s; }
.faq-item:nth-child(4) { animation-delay: .2s; }
.faq-item:nth-child(5) { animation-delay: .25s; }
.faq-item:nth-child(6) { animation-delay: .3s; }
.faq-item:nth-child(7) { animation-delay: .35s; }
.faq-item:nth-child(8) { animation-delay: .4s; }

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

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: background var(--transition);
  user-select: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}
.faq-question:hover { background: var(--bg-hover); }

.faq-chevron {
  font-size: 12px;
  color: var(--text-tertiary);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.faq-item.open .faq-chevron { transform: rotate(180deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}

.faq-answer-inner {
  padding: 0 20px 16px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.faq-item.open .faq-answer {
  max-height: 500px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONFETTI CANVAS
   ═══════════════════════════════════════════════════════════════════════════ */

#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 29;
  opacity: 0;
  transition: opacity var(--transition);
}
.sidebar-overlay.visible {
  opacity: 1;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    z-index: 30;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .btn-sidebar-toggle { display: flex; }

  .main-header { padding: 10px 14px; gap: 8px; }
  .balance-chip { display: none; }
  .btn-whatsapp-header span { display: none; }
  .btn-whatsapp-header { padding: 6px 8px; }

  .messages-container { padding: 0 14px; }
  .input-area { padding: 10px 14px 14px; }

  .suggestions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .welcome-title { font-size: 28px; }
  .welcome-subtitle { font-size: 20px; }
  .welcome-logo { font-size: 44px; }

  .onboarding-card { padding: 36px 24px 28px; }
  .onboarding-title { font-size: 22px; }

  .faq-content { padding: 24px 16px 48px; }
  .faq-title { font-size: 26px; }
}

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

  .model-selector-btn span.model-full-name { display: none; }
  .model-selector-btn span.model-short-name { display: inline; }

  .lang-toggle { display: none; }

  .login-card { padding: 32px 24px 24px; }

  .welcome-screen { padding: 32px 16px 20px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   NEW: SVG Logo, Inline Lang, Problem Btn, Balance, Chat Groups
   ═══════════════════════════════════════════════════════════════════════════ */

/* SVG Logo */
.app-logo-svg {
  color: var(--accent);
  flex-shrink: 0;
}
.onboarding-logo .app-logo-svg { width: 48px; height: 48px; }
.login-logo .app-logo-svg { width: 48px; height: 48px; }

/* Inline language toggle (inside user menu) */
.user-menu-lang {
  cursor: default;
}
.lang-toggle-inline {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-left: auto;
}
.lang-btn-inline {
  background: none;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition);
  font-family: var(--font-sans);
}
.lang-btn-inline.active {
  background: var(--accent);
  color: var(--text-inverse);
}
.lang-btn-inline:hover:not(.active) { color: var(--text-primary); }

/* Balance with spent */
.balance-spent {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-left: 2px;
}

/* WhatsApp problem button */
.btn-problem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  margin-top: 8px;
}
.btn-problem:hover { background: #1fb855; transform: translateY(-1px); }
.btn-problem svg { width: 16px; height: 16px; fill: currentColor; }

/* Chat group tree view (show all chats) */
.show-all-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-light);
  width: 100%;
  font-family: var(--font-sans);
  transition: all var(--transition);
}
.show-all-toggle:hover { color: var(--accent); background: var(--bg-hover); }

.chat-group-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px 4px;
}

.chat-group-items {}

/* Onboarding: secondary FAQ button */
.onboarding-faq-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
}
.onboarding-faq-link:hover { border-color: var(--accent); color: var(--accent); }

/* Onboarding lang switch */
.onboarding-lang-switch {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 16px;
}
.onboarding-lang-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition);
}
.onboarding-lang-btn.active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .welcome-logo,
  .sidebar-empty-icon,
  .drop-overlay-content,
  .typing-dot,
  .progress-bar-fill::after {
    animation: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONFIRM DIALOG (замена confirm())
   ═══════════════════════════════════════════════════════════════════════════ */

.confirm-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.confirm-overlay.visible {
  opacity: 1; pointer-events: auto;
}

.confirm-dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 28px 32px 24px;
  min-width: 320px; max-width: 420px;
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
  transform: scale(.92);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.confirm-overlay.visible .confirm-dialog {
  transform: scale(1);
}

.confirm-text {
  font-size: 15px; line-height: 1.5;
  color: var(--color-text);
  margin: 0 0 22px;
  text-align: center;
}

.confirm-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}

.btn-confirm-cancel,
.btn-confirm-ok {
  padding: 9px 22px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  border: none; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-confirm-cancel:active,
.btn-confirm-ok:active { transform: scale(.96); }

.btn-confirm-cancel {
  background: var(--color-surface-alt, var(--color-border));
  color: var(--color-text-secondary);
}
.btn-confirm-cancel:hover {
  background: var(--color-border);
}

.btn-confirm-ok {
  background: #e74c3c; color: #fff;
}
.btn-confirm-ok:hover {
  background: #c0392b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
  .sidebar, .input-area, .main-header, .toast-container,
  .drop-overlay, .onboarding-overlay { display: none !important; }
  .main-area { width: 100%; }
  body { overflow: visible; height: auto; }
}
