/* ================================================================
   CHUBUT.IA — SISTEMA DE DISEÑO PREMIUM v2.0
   Legal SaaS · Provincia de Chubut
   Paleta: Azul Noche + Oro · Tipografía: Playfair + Inter
================================================================ */

/* ── 1. TOKENS Y VARIABLES ─────────────────────────────────────── */
:root {
  --navy-void:    #070B17;
  --navy-deep:    #0C1120;
  --navy-surface: #0F172A;
  --navy-hover:   #111827;
  --navy-border:  #1E2A3A;

  --gold-main:    #D4AF37;
  --gold-light:   #E8C97A;
  --gold-deep:    #C5A028;
  --gold-muted:   #A8882A;
  --gold-dark:    #7A6118;
  --gold-glow:    rgba(212,175,55,0.12);
  --gold-glow-md: rgba(212,175,55,0.20);
  --gold-border:  rgba(212,175,55,0.22);
  --gold-border-strong: rgba(212,175,55,0.50);

  --text-primary:   #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted:     #475569;
  --text-dim:       #334155;

  --red-soft:    rgba(239,68,68,0.12);
  --red-border:  rgba(239,68,68,0.22);
  --red-text:    #F87171;

  --sidebar-w:   272px;
  --input-h:     64px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;

  --transition: 0.20s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.45);
}

/* ── 2. RESET Y BASE ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--navy-void);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea { font-family: inherit; outline: none; }
a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold-main); }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(212,175,55,0.18);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,0.35); }

/* ── 3. LAYOUT PRINCIPAL ────────────────────────────────────────── */
#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── 4. SIDEBAR ─────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--navy-deep);
  border-right: 1px solid var(--gold-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition);
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 16px 0;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 100%;
  max-width: 160px;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter:
    drop-shadow(1px 1px 0 white)
    drop-shadow(-1px -1px 0 white)
    drop-shadow(1px -1px 0 white)
    drop-shadow(-1px 1px 0 white);
}

.sidebar-logo-fallback {
  text-align: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.04em;
  padding: 8px 0;
}

.sidebar-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-border-strong), transparent);
  margin: 16px 0 0;
}

.sidebar-inner {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── User Card ── */
.user-card {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--gold-border);
  border-top: 2px solid var(--gold-border-strong);
  background: linear-gradient(135deg, rgba(20,16,4,0.8), rgba(12,17,32,0.85));
}

.user-card__label {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.user-card__name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card__footer {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Plan Badges */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
}

.badge--pro {
  background: rgba(212,175,55,0.12);
  border: 1px solid rgba(212,175,55,0.40);
  color: var(--gold-main);
}

.badge--trial {
  background: rgba(148,163,184,0.07);
  border: 1px solid rgba(212,175,55,0.18);
  color: var(--gold-muted);
}

.badge--expired {
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  color: var(--red-text);
}

.badge--guest {
  background: rgba(71,85,105,0.15);
  border: 1px solid rgba(71,85,105,0.25);
  color: var(--text-secondary);
}

/* Guest Counter Card */
.guest-counter-card {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--gold-border);
  border-top: 2px solid rgba(212,175,55,0.40);
  background: linear-gradient(135deg, rgba(12,17,32,0.9), rgba(15,23,42,0.7));
}

.guest-counter-card__count {
  font-size: 0.80rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.guest-counter-card__count span {
  color: var(--gold-main);
  font-weight: 600;
  font-size: 0.90rem;
}

/* ── Plan Upgrade Box ── */
.plan-upgrade-box {
  border-radius: var(--radius-md);
  padding: 14px 14px;
  border: 1px solid rgba(212,175,55,0.28);
  border-top: 2px solid rgba(212,175,55,0.55);
  background: linear-gradient(135deg, rgba(20,16,4,0.65), rgba(12,17,32,0.75));
  text-align: center;
}

.plan-upgrade-box__label {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.plan-upgrade-box__price {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-main);
  line-height: 1.2;
}

.plan-upgrade-box__price sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--gold-dark);
  vertical-align: baseline;
}

.plan-upgrade-box__desc {
  font-size: 0.72rem;
  color: var(--gold-dark);
  margin-top: 4px;
}

/* ── Sidebar Buttons ── */
.btn-primary {
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--gold-light);
  background: linear-gradient(135deg, #1A2F6A, #1D4ED8, #1A2F6A);
  border: 1px solid var(--gold-border-strong);
  box-shadow: 0 1px 8px rgba(212,175,55,0.12), inset 0 1px 0 rgba(212,175,55,0.10);
  text-shadow: 0 1px 3px rgba(0,0,0,0.35);
  transition: all var(--transition);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1E3A8A, #2563EB, #1E3A8A);
  box-shadow: 0 2px 16px rgba(212,175,55,0.25), inset 0 1px 0 rgba(212,175,55,0.16);
  border-color: var(--gold-main);
}

.btn-primary--gold {
  background: linear-gradient(135deg, rgba(212,175,55,0.12), rgba(212,175,55,0.06));
  border: 1px solid var(--gold-border-strong);
  color: var(--gold-light);
  text-shadow: none;
  box-shadow: none;
}

.btn-primary--gold:hover {
  background: linear-gradient(135deg, rgba(212,175,55,0.22), rgba(212,175,55,0.14));
  box-shadow: 0 2px 16px rgba(212,175,55,0.20);
}

.btn-ghost {
  width: 100%;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.80rem;
  font-weight: 400;
  color: var(--text-secondary);
  border: 1px solid rgba(148,163,184,0.10);
  transition: all var(--transition);
  text-align: left;
}

.btn-ghost:hover {
  color: var(--gold-light);
  background: var(--gold-glow);
  border-color: var(--gold-border);
}

/* ── Chat History List ── */
.sidebar-section-label {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-weight: 500;
  padding: 4px 4px 2px;
}

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.chat-history-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-history-item__btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all var(--transition);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chat-history-item__btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
  border-color: var(--navy-border);
}

.chat-history-item__btn.active {
  color: var(--gold-light);
  background: var(--gold-glow);
  border-color: var(--gold-border);
}

.chat-history-item__btn .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.chat-history-item__btn.active .dot {
  background: var(--gold-main);
}

.chat-history-item__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-history-item__del {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 0.80rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  opacity: 0;
}

.chat-history-item:hover .chat-history-item__del {
  opacity: 1;
}

.chat-history-item__del:hover {
  color: var(--red-text);
  background: var(--red-soft);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 10px 12px 14px;
  flex-shrink: 0;
  border-top: 1px solid rgba(212,175,55,0.10);
}

.sidebar-terms-toggle {
  font-size: 0.72rem;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  transition: color var(--transition);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.sidebar-terms-toggle:hover { color: var(--gold-dark); }

.sidebar-terms-content {
  font-size: 0.73rem;
  color: var(--text-dim);
  line-height: 1.65;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 2px;
}

.sidebar-terms-content.open {
  max-height: 300px;
  padding-top: 6px;
}

.sidebar-terms-content strong {
  color: var(--gold-muted);
  font-weight: 500;
}

.disclaimer {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
  font-style: italic;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(212,175,55,0.10);
}

.support-link {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 6px;
}

.support-link a {
  color: var(--gold-main);
  font-weight: 500;
}

/* ── 5. CHAT MAIN ───────────────────────────────────────────────── */
#chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background: var(--navy-void);
  background-image: radial-gradient(
    ellipse 80% 50% at 50% -5%,
    rgba(212,175,55,0.055) 0%,
    transparent 70%
  );
}

/* ── 6. SCROLL CONTAINER ────────────────────────────────────────── */
#scroll-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── 7. WELCOME HERO ────────────────────────────────────────────── */
#welcome-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px 24px;
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 140px);
}

.hero-aurora {
  position: absolute;
  top: -30%;
  left: -15%;
  width: 130%;
  height: 160%;
  background: radial-gradient(
    ellipse 55% 35% at 50% 25%,
    rgba(212,175,55,0.06) 0%,
    transparent 70%
  );
  animation: aurora-drift 14s ease-in-out infinite;
  pointer-events: none;
}

.hero-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gold-main);
  font-weight: 500;
  margin-bottom: 18px;
  position: relative;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  position: relative;
}

.hero-divider {
  width: 64px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-main), transparent);
  margin: 0 auto 14px;
  border-radius: 1px;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 36px;
  position: relative;
}

/* ── Suggestions Grid ── */
.suggestions-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 620px;
  width: 100%;
}

.suggestion-btn {
  padding: 14px 16px;
  text-align: left;
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  background: var(--navy-deep);
  color: var(--text-secondary);
  font-size: 0.83rem;
  line-height: 1.5;
  transition: all var(--transition);
  box-shadow: inset 0 1px 0 rgba(212,175,55,0.04);
}

.suggestion-btn:hover {
  border-color: var(--gold-main);
  background: var(--gold-glow);
  color: var(--gold-light);
  box-shadow: 0 4px 16px rgba(212,175,55,0.10), inset 0 1px 0 rgba(212,175,55,0.10);
  transform: translateY(-1px);
}

/* ── 8. MESSAGES ────────────────────────────────────────────────── */
#messages-container {
  display: flex;
  flex-direction: column;
  padding: 28px 0 16px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  align-self: center;
  gap: 0;
  flex: 1;
}

.message {
  animation: msg-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  padding: 0 20px;
  margin-bottom: 4px;
}

/* ── AI Message ── */
.message--ai {
  align-self: flex-start;
  width: 100%;
}

.message--ai .message-bubble {
  background: var(--navy-deep);
  border: 1px solid rgba(212,175,55,0.12);
  border-left: 3px solid var(--gold-border-strong);
  border-radius: 2px 16px 16px 16px;
  padding: 20px 22px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.30), 0 0 0 1px rgba(212,175,55,0.03);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(212,175,55,0.06));
  border: 1px solid var(--gold-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-muted);
  letter-spacing: 0.02em;
}

.message-avatar--loading {
  animation: gold-pulse 1.8s ease-in-out infinite;
}

.message-content {
  flex: 1;
  min-width: 0;
  color: #CBD5E1;
  font-size: 0.915rem;
  line-height: 1.80;
}

/* Markdown rendering inside AI messages */
.message-content p { margin-bottom: 0.75em; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { color: var(--text-primary); font-weight: 600; }
.message-content em { font-style: italic; }
.message-content ul, .message-content ol {
  padding-left: 1.4em;
  margin: 0.5em 0 0.75em;
}
.message-content li { margin-bottom: 0.3em; }
.message-content a {
  color: var(--gold-light);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(232,201,122,0.35);
  transition: color var(--transition);
}
.message-content a:hover { color: var(--gold-main); }
.message-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.82em;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 3px;
}
.message-content blockquote {
  border-left: 3px solid var(--gold-border);
  padding-left: 14px;
  margin: 0.8em 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ── User Message ── */
.message--user {
  align-self: flex-end;
  max-width: 82%;
  margin-left: auto;
}

.message--user .message-bubble {
  background: linear-gradient(135deg, #172554, #1E3A8A);
  border: 1px solid var(--gold-border);
  border-right: 3px solid var(--gold-border-strong);
  border-radius: 16px 2px 16px 16px;
  padding: 14px 18px;
  box-shadow: 0 4px 20px rgba(30,58,138,0.35), 0 0 0 1px rgba(212,175,55,0.04);
  color: #DBEAFE;
  font-size: 0.915rem;
  line-height: 1.65;
}

/* ── File Attachment Chip ── */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(212,175,55,0.07);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--gold-muted);
  margin-bottom: 8px;
}

.file-chip__icon { font-size: 0.9em; }
.file-chip__name { font-weight: 500; color: var(--text-secondary); }

/* ── Typing Indicator ── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-muted);
  animation: typing-dot 1.4s ease-in-out infinite;
}

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

/* ── Export Bar ── */
#export-bar {
  max-width: 820px;
  width: 100%;
  margin: 6px auto 0;
  padding: 0 20px;
  align-self: center;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--gold-muted);
  background: transparent;
  transition: all var(--transition);
}

.btn-export:hover {
  border-color: var(--gold-main);
  color: var(--gold-light);
  background: var(--gold-glow);
  box-shadow: 0 2px 12px rgba(212,175,55,0.10);
}

/* ── Access / Upgrade Wall ── */
#access-wall {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  align-self: center;
}

.upgrade-wall {
  text-align: center;
  padding: 22px 24px;
  border: 1px solid rgba(212,175,55,0.22);
  border-top: 2px solid rgba(212,175,55,0.50);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(20,16,4,0.55), rgba(12,17,32,0.65));
  box-shadow: 0 4px 20px rgba(0,0,0,0.28);
}

.upgrade-wall--expired {
  border-color: var(--red-border);
  border-top-color: rgba(239,68,68,0.40);
  background: rgba(127,29,29,0.06);
}

.upgrade-wall h3 {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gold-main);
  margin-bottom: 6px;
}

.upgrade-wall--expired h3 { color: var(--red-text); }
.upgrade-wall p { font-size: 0.80rem; color: var(--text-secondary); }

/* ── 9. INPUT AREA ──────────────────────────────────────────────── */
#input-area {
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(212,175,55,0.08);
  flex-shrink: 0;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  align-self: center;
}

/* File Preview Card */
.file-preview-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(212,175,55,0.06);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  animation: msg-in 0.22s ease both;
}

.file-preview-card__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.file-preview-card__info {
  flex: 1;
  min-width: 0;
}

.file-preview-card__name {
  font-size: 0.80rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-preview-card__meta {
  font-size: 0.70rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.file-preview-card__remove {
  font-size: 1rem;
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.file-preview-card__remove:hover {
  color: var(--red-text);
  background: var(--red-soft);
}

/* Input Row */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--navy-deep);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 8px 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-row:focus-within {
  border-color: var(--gold-main);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.08), 0 0 20px rgba(212,175,55,0.05);
}

.input-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
}

.input-icon-btn:hover {
  color: var(--gold-muted);
  background: rgba(212,175,55,0.07);
}

.input-icon-btn svg { width: 18px; height: 18px; }

.input-icon-btn--recording {
  color: var(--red-text) !important;
  background: var(--red-soft) !important;
  animation: recording-pulse 1.2s ease-in-out infinite;
}

#chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.91rem;
  line-height: 1.55;
  resize: none;
  padding: 6px 4px;
  min-height: 34px;
  max-height: 180px;
  caret-color: var(--gold-main);
  overflow-y: auto;
}

#chat-textarea::placeholder { color: var(--text-dim); }

.btn-send {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  color: var(--gold-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  background: rgba(212,175,55,0.20);
  border-color: var(--gold-main);
  color: var(--gold-light);
  box-shadow: 0 2px 10px rgba(212,175,55,0.15);
}

.btn-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-send svg { width: 16px; height: 16px; }

.input-hint {
  font-size: 0.67rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 7px;
  letter-spacing: 0.01em;
}

/* ── 10. AUTH MODAL ─────────────────────────────────────────────── */
#auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,11,23,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: overlay-in 0.22s ease both;
}

.auth-modal {
  background: var(--navy-deep);
  border: 1px solid var(--gold-border);
  border-top: 2px solid var(--gold-border-strong);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(212,175,55,0.06);
  animation: modal-in 0.28s cubic-bezier(0.22,1,0.36,1) both;
}

.modal-logo {
  text-align: center;
  margin-bottom: 20px;
}

.modal-logo img {
  max-width: 120px;
  margin: 0 auto;
  filter: drop-shadow(1px 1px 0 white) drop-shadow(-1px -1px 0 white);
}

.modal-logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 4px;
}

.modal-divider {
  width: 50px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-main), transparent);
  margin: 0 auto 20px;
  border-radius: 1px;
}

.btn-close-modal {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 1.1rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

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

/* Modal Tabs */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--gold-border);
  margin-bottom: 22px;
  gap: 0;
}

.modal-tab {
  flex: 1;
  padding: 9px 16px;
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}

.modal-tab:hover { color: var(--gold-light); }

.modal-tab.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold-main);
}

/* Form Inputs */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 500;
  color: var(--gold-muted);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  background: rgba(12,17,32,0.8);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  border-color: var(--gold-main);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.09);
}

.form-input::placeholder { color: var(--text-dim); }

.form-error {
  font-size: 0.74rem;
  color: var(--red-text);
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
}

.form-success {
  font-size: 0.74rem;
  color: #34D399;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(52,211,153,0.07);
  border: 1px solid rgba(52,211,153,0.20);
  border-radius: var(--radius-sm);
}

.form-link {
  font-size: 0.78rem;
  color: var(--gold-dark);
  text-align: right;
  display: block;
  margin-top: 4px;
  cursor: pointer;
  transition: color var(--transition);
  background: none;
  border: none;
  width: 100%;
  text-align: right;
}

.form-link:hover { color: var(--gold-muted); }

/* ── 11. TOASTS ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 400;
  min-width: 240px;
  max-width: 340px;
  animation: toast-in 0.28s cubic-bezier(0.22,1,0.36,1) both;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 9px;
  backdrop-filter: blur(10px);
}

.toast--success {
  background: rgba(12,17,32,0.95);
  border: 1px solid rgba(52,211,153,0.28);
  color: #34D399;
}

.toast--error {
  background: rgba(12,17,32,0.95);
  border: 1px solid var(--red-border);
  color: var(--red-text);
}

.toast--info {
  background: rgba(12,17,32,0.95);
  border: 1px solid var(--gold-border);
  color: var(--gold-muted);
}

.toast-removing {
  animation: toast-out 0.20s ease forwards;
}

/* ── 12. UTILITY CLASSES ────────────────────────────────────────── */
.hidden { display: none !important; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--gold-border), transparent); margin: 8px 0; }

/* Mobile hamburger */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--navy-deep);
  border: 1px solid var(--gold-border);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7,11,23,0.65);
  z-index: 99;
}

/* ── 13. ANIMATIONS ─────────────────────────────────────────────── */
@keyframes aurora-drift {
  0%, 100% { transform: translateX(-8%) scale(1); opacity: 1; }
  50% { transform: translateX(8%) scale(1.06); opacity: 0.8; }
}

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

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}

@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.2; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

@keyframes gold-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,175,55,0); }
  50% { box-shadow: 0 0 0 7px rgba(212,175,55,0.13); }
}

@keyframes recording-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50% { box-shadow: 0 0 0 5px rgba(239,68,68,0.18); }
}

/* ── 14. RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }

  #sidebar-toggle { display: flex; }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  #sidebar.open { transform: translateX(0); }

  .sidebar-backdrop { display: block; }
  .sidebar-backdrop.hidden { display: none !important; }

  #chat-main { padding-top: 0; }

  .suggestions-grid { grid-template-columns: 1fr; }

  .hero-title { font-size: 1.75rem; }

  #messages-container { padding: 16px 0 12px; }

  .message--user { max-width: 90%; }

  .auth-modal { padding: 24px 18px; border-radius: var(--radius-lg); }

  #toast-container { bottom: 16px; right: 12px; left: 12px; }

  .toast { min-width: unset; max-width: 100%; }
}

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