/* ========================================
   LIONELL AI CHAT — style.css
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #16161f;
  --surface: #1c1c28;
  --surface2: #23232f;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #f0f0f5;
  --text2: #9898b0;
  --text3: #5a5a72;
  --accent: #7c6aff;
  --accent2: #a78bfa;
  --gold: #f0b428;
  --sidebar-w: 280px;

  /* Model colors */
  --claude: #d97706;
  --gpt: #10a37f;
  --gemini: #4285f4;
  --llama: #7c3aed;
  --mistral: #f97316;
  --grok: #1d9bf0;
  --perplexity: #20b2aa;
  --deepseek: #06b6d4;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ---- Ambient background ---- */
.bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}
.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #7c6aff 0%, transparent 70%);
  top: -150px; left: -100px;
  animation: driftA 18s ease-in-out infinite alternate;
}
.orb2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #d97706 0%, transparent 70%);
  bottom: -100px; right: -50px;
  animation: driftB 22s ease-in-out infinite alternate;
}
.orb3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #4285f4 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  animation: driftC 15s ease-in-out infinite alternate;
}
.noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
}
@keyframes driftA { to { transform: translate(60px, 40px) scale(1.1); } }
@keyframes driftB { to { transform: translate(-40px, -60px) scale(1.15); } }
@keyframes driftC { to { transform: translate(-50%, -60%) scale(0.9); } }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  height: 100dvh;
  background: rgba(16, 16, 24, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  background: linear-gradient(135deg, #fff, var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Buttons ---- */
.btn-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

/* ---- Section labels ---- */
.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  padding: 14px 16px 8px;
}

/* ---- Model Grid ---- */
.model-section {
  border-bottom: 1px solid var(--border);
}
.model-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 12px 14px;
}
.model-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-size: 0.8rem;
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.model-chip:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}
.model-chip.active {
  background: rgba(124, 106, 255, 0.12);
  border-color: rgba(124, 106, 255, 0.35);
  color: var(--text);
}

.model-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.claude-dot   { background: var(--claude); box-shadow: 0 0 6px var(--claude); }
.gpt-dot      { background: var(--gpt); box-shadow: 0 0 6px var(--gpt); }
.gemini-dot   { background: var(--gemini); box-shadow: 0 0 6px var(--gemini); }
.llama-dot    { background: var(--llama); box-shadow: 0 0 6px var(--llama); }
.mistral-dot  { background: var(--mistral); box-shadow: 0 0 6px var(--mistral); }
.grok-dot     { background: var(--grok); box-shadow: 0 0 6px var(--grok); }
.perplexity-dot { background: var(--perplexity); box-shadow: 0 0 6px var(--perplexity); }
.deepseek-dot { background: var(--deepseek); box-shadow: 0 0 6px var(--deepseek); }
.kimi-dot { background: #8B5CF6; box-shadow: 0 0 6px #8B5CF6; }

/* ---- History ---- */
.history-section {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.history-section::-webkit-scrollbar { width: 4px; }
.history-section::-webkit-scrollbar-track { background: transparent; }
.history-section::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.history-list { padding: 0 10px 10px; }
.empty-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  color: var(--text3);
  font-size: 0.78rem;
  text-align: center;
}

.history-item {
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.history-item:hover {
  background: var(--surface);
  border-color: var(--border);
}
.history-item.active {
  background: rgba(124, 106, 255, 0.1);
  border-color: rgba(124, 106, 255, 0.25);
}
.history-item-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.history-item-text {
  font-size: 0.8rem;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.history-item-del {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}
.history-item:hover .history-item-del { opacity: 1; }
.history-item-del:hover { color: #ff5f5f; }

/* ---- Sidebar Footer ---- */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  font-size: 0.78rem;
  text-decoration: none;
  transition: color 0.2s;
  padding: 8px 10px;
  border-radius: 8px;
}
.back-link:hover { color: var(--text2); background: var(--surface); }

/* ---- Main Area ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,15,0.6);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}
.current-model {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}
.model-provider {
  color: var(--text3);
  font-size: 0.78rem;
  font-weight: 400;
}
.topbar-actions { display: flex; gap: 8px; }
.mobile-menu-btn { display: none; }

/* ---- Chat Area ---- */
.chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  scroll-behavior: smooth;
}
.chat-area::-webkit-scrollbar { width: 5px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ---- Welcome Screen ---- */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 40px 24px;
  text-align: center;
}
.welcome-logo {
  position: relative;
  width: 90px; height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}
.logo-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid;
  animation: spin linear infinite;
}
.ring1 {
  width: 90px; height: 90px;
  border-color: rgba(124,106,255,0.3);
  animation-duration: 12s;
}
.ring2 {
  width: 68px; height: 68px;
  border-color: rgba(167,139,250,0.4);
  animation-duration: 8s;
  animation-direction: reverse;
}
.ring3 {
  width: 46px; height: 46px;
  border-color: rgba(124,106,255,0.6);
  animation-duration: 5s;
}
@keyframes spin { to { transform: rotate(360deg); } }
.logo-center {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  position: relative;
  z-index: 1;
}

.welcome-title {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.welcome-sub {
  color: var(--text2);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 36px;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 700px;
  width: 100%;
}
.suggestion-card {
  padding: 16px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.suggestion-card:hover {
  background: rgba(124,106,255,0.08);
  border-color: rgba(124,106,255,0.3);
  transform: translateY(-2px);
}
.sug-icon { font-size: 1.3rem; }
.suggestion-card p {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.4;
}

/* ---- Messages ---- */
.messages-container {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.message {
  display: flex;
  gap: 12px;
  animation: msgIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  font-weight: 700;
  align-self: flex-start;
  margin-top: 2px;
}
.msg-avatar.ai-avatar {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: white;
}
.msg-avatar.user-avatar {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border2);
}

.msg-content {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.message.user .msg-content { align-items: flex-end; }

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text3);
}
.msg-model-badge {
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.7;
  word-break: break-word;
  font-family: 'Inter', 'DM Sans', sans-serif;
}
.message.ai .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px;
  color: var(--text);
}
.message.user .msg-bubble {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: white;
  border-radius: 16px 4px 16px 16px;
}

/* Message content formatting */
.msg-bubble p { margin-bottom: 8px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { padding-left: 20px; margin-bottom: 8px; }
.msg-bubble li { margin-bottom: 4px; }
.msg-bubble code {
  background: rgba(0,0,0,0.35);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.875rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: #e2c882;
  border: 1px solid rgba(255,255,255,0.07);
}

/* Code block wrapper (para el botón de copiar) */
.code-block-wrapper {
  position: relative;
  margin: 10px 0;
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border2);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 6px 12px;
}
.code-lang-label {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--text3);
  text-transform: lowercase;
  letter-spacing: 0.03em;
}
.copy-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text3);
  font-size: 0.72rem;
  font-family: 'Inter', 'DM Sans', sans-serif;
  padding: 3px 9px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.copy-code-btn:hover {
  background: var(--surface2);
  color: var(--text2);
  border-color: var(--border2);
}
.copy-code-btn.copied {
  color: #4ade80;
  border-color: rgba(74,222,128,0.35);
}

.msg-bubble pre {
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--border2);
  border-top: none;
  padding: 14px 16px;
  border-radius: 0 0 8px 8px;
  overflow-x: auto;
  margin: 0;
}
.msg-bubble pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: #e8e8f0;
  border: none;
  line-height: 1.6;
}
.msg-bubble strong { color: #fff; font-weight: 600; }

/* Headings uniformizados — todos pequeños, consistentes con el resto del texto */
.msg-bubble h1,
.msg-bubble h2,
.msg-bubble h3,
.msg-bubble h4,
.msg-bubble h5,
.msg-bubble h6 {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-size: 0.9375rem;       /* mismo tamaño que el texto normal */
  font-weight: 700;            /* solo negrita los distingue */
  line-height: 1.6;
  margin-top: 12px;
  margin-bottom: 4px;
  color: var(--text);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 16px;
}
.typing-dot {
  width: 7px; height: 7px;
  background: var(--text3);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ---- Input Area ---- */
.input-area {
  padding: 16px 20px 20px;
  background: rgba(10,10,15,0.7);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.input-wrapper {
  max-width: 820px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  transition: border-color 0.2s;
}
.input-wrapper:focus-within {
  border-color: rgba(124,106,255,0.5);
  box-shadow: 0 0 0 3px rgba(124,106,255,0.08);
}
#chatInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.9375rem;
  font-family: 'Inter', 'DM Sans', sans-serif;
  resize: none;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
  padding: 4px 0;
}
#chatInput::placeholder { color: var(--text3); }
#chatInput::-webkit-scrollbar { width: 4px; }
#chatInput::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.char-count {
  font-size: 0.68rem;
  color: var(--text3);
}
.send-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.send-btn:disabled {
  background: var(--surface2);
  color: var(--text3);
  cursor: not-allowed;
}
.send-btn:not(:disabled):hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(124,106,255,0.4);
}

.input-note {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text3);
  margin-top: 10px;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}
.input-note a { color: var(--accent2); text-decoration: none; }
.input-note a:hover { text-decoration: underline; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s;
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-desc { font-size: 0.83rem; color: var(--text2); line-height: 1.5; }
.api-group { display: flex; flex-direction: column; gap: 5px; }
.api-group label { font-size: 0.78rem; font-weight: 600; color: var(--text2); }
.api-group input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: 'Inter', 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.api-group input:focus { border-color: rgba(124,106,255,0.5); }
.modal-note {
  background: rgba(124,106,255,0.08);
  border: 1px solid rgba(124,106,255,0.2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.5;
}
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}
.btn-primary {
  padding: 9px 20px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Inter', 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,106,255,0.4); }
.btn-secondary {
  padding: 9px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text2);
  font-size: 0.88rem;
  font-family: 'Inter', 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--surface2); color: var(--text); }

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9;
}

/* ---- Toast Notification ---- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.83rem;
  color: var(--text);
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 20;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .mobile-menu-btn { display: flex; }
  .suggestion-grid { grid-template-columns: 1fr 1fr; }
  .main { width: 100%; }
  .messages-container { padding: 14px; }
  .input-area { padding: 12px 14px 16px; }
}
@media (max-width: 480px) {
  .suggestion-grid { grid-template-columns: 1fr; max-width: 340px; }
  .welcome-title { font-size: 1.6rem; }
  .msg-content { max-width: 88%; }
}

/* ---- Message Action Buttons (Copy & Speak) ---- */
.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text3);
  font-size: 0.72rem;
  font-family: 'Inter', 'DM Sans', sans-serif;
}
.msg-action-btn:hover {
  background: var(--surface2);
  color: var(--text2);
  border-color: var(--border2);
}
.msg-action-btn svg {
  flex-shrink: 0;
}

/* ---- Attach Button ---- */
.attach-btn {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 1px;
}
.attach-btn:hover {
  background: var(--surface2);
  color: var(--accent2);
  border-color: rgba(124,106,255,0.4);
}

/* ---- Attachments Preview Bar ---- */
.attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 820px;
  margin: 8px auto 0;
  padding: 0 2px;
}
.attachment-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 5px 10px 5px 8px;
  font-size: 0.78rem;
  color: var(--text2);
  max-width: 260px;
  animation: msgIn 0.2s ease;
}
.att-icon { font-size: 0.9rem; flex-shrink: 0; }
.att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
  color: var(--text);
  font-weight: 500;
}
.att-size { color: var(--text3); font-size: 0.7rem; flex-shrink: 0; }
.att-remove {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.att-remove:hover { color: #ff5f5f; }

/* ---- Ocultar botón de Configuración (re-activar cambiando display:none a display:flex) ---- */
#settingsBtn { display: none; }