:root {
  --bg-dark: #050811;
  --sidebar-bg: rgba(9, 13, 25, 0.98);
  --card-bg: rgba(13, 18, 32, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-active: rgba(56, 189, 248, 0.4);
  --cyan-neon: #38bdf8;
  --gold-primary: #eab308;
  --gold-gradient: linear-gradient(135deg, #fef08a 0%, #eab308 50%, #a16207 100%);
  --gold-glow: rgba(234, 179, 8, 0.2);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  position: relative;
}

#ambientCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.ambient-glow {
  position: fixed;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 580px;
  height: 580px;
  background: radial-gradient(circle, rgba(29, 78, 216, 0.22) 0%, rgba(234, 179, 8, 0.05) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(70px);
}

.app-container {
  display: flex;
  width: 100%;
  height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 2;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease, transform 0.3s ease;
  z-index: 100;
  backdrop-filter: blur(16px);
  flex-shrink: 0;
}

.sidebar.collapsed {
  margin-left: -280px;
}

.sidebar-header {
  padding: 14px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
}

.btn-new-chat {
  flex: 1;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--cyan-neon);
  padding: 9px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-chat:hover {
  background: rgba(56, 189, 248, 0.2);
}

.btn-close-sidebar {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 14px 16px 6px 16px;
  font-weight: 700;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-list::-webkit-scrollbar { width: 3px; }
.chat-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }

.chat-item {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: normal;
  overflow-wrap: anywhere;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.chat-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--cyan-neon);
}

.chat-list-empty {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  padding: 20px;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--card-border);
}

.btn-drive-connect {
  width: 100%;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: var(--gold-primary);
  padding: 9px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-drive-connect:hover {
  background: rgba(234, 179, 8, 0.2);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.top-navbar {
  width: 100%;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-toggle-sidebar, .btn-back {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s;
  gap: 6px;
}

.btn-toggle-sidebar:hover, .btn-back:hover {
  color: #fff;
  border-color: var(--cyan-neon);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo-mini {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.nav-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--cyan-neon);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 8px;
  border-radius: 999px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.chat-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
}

.messages-viewport::-webkit-scrollbar { width: 4px; }
.messages-viewport::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }

.welcome-container {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 480px;
  padding: 10px 0;
  animation: fadeIn 0.4s ease;
}

.logo-wrapper {
  position: relative;
  width: 75px;
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.logo-backlight {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.6) 0%, rgba(29, 78, 216, 0.35) 45%, rgba(0, 210, 255, 0.15) 65%, transparent 80%);
  filter: blur(18px);
  border-radius: 50%;
}

.store-logo {
  position: relative;
  z-index: 2;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.welcome-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
}

.welcome-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 0 10px;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.suggestion-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  color: #cbd5e1;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.suggestion-card:hover {
  border-color: var(--cyan-neon);
  transform: translateY(-2px);
  color: #ffffff;
}

.message-row {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: messageSlide 0.25s ease-out;
}

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

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

.message-row.assistant { align-self: flex-start; }

.avatar-bubble {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  font-size: 14px;
  flex-shrink: 0;
}

.avatar-bubble.assistant-avatar {
  border-color: rgba(234, 179, 8, 0.4);
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(13, 18, 32, 0.9));
  font-size: 12px;
  color: var(--gold-primary);
  border-radius: 8px;
}

.avatar-bubble.user-avatar {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  user-select: text;
}

.message-row.assistant .message-bubble {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: #f1f5f9;
  border-top-left-radius: 4px;
  backdrop-filter: blur(12px);
}

.message-row.user .message-bubble {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.4) 0%, rgba(13, 18, 32, 0.9) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #ffffff;
  border-top-right-radius: 4px;
}

.message-bubble strong { color: #ffffff; font-weight: 700; }
.message-bubble p { margin-bottom: 6px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin: 6px 0 6px 18px; }
.message-bubble li { margin-bottom: 3px; }

.thinking-container {
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

.thinking-dots {
  display: inline-block;
  width: 18px;
  text-align: left;
}

.input-container {
  padding: 10px 16px 16px;
  width: 100%;
  max-width: 850px;
  margin: 0 auto;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 8, 17, 0.95) 40%);
  z-index: 10;
}

.input-box-wrapper {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 5px 10px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-box-wrapper:focus-within {
  border-color: var(--card-border-active);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 189, 248, 0.15);
}

.chat-textarea {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  max-height: min(35dvh, 220px);
  min-height: 22px;
  padding: 5px 0;
  overflow-y: hidden;
  overflow-wrap: anywhere;
}

.chat-textarea::placeholder { color: #64748b; }

.btn-mic {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-mic:hover {
  color: var(--cyan-neon);
  background: rgba(56, 189, 248, 0.1);
}

.btn-mic.listening {
  color: #ef4444;
  animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.btn-mic svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-send {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 9px;
  border: none;
  background: var(--gold-gradient);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 0 10px var(--gold-glow);
  flex-shrink: 0;
}

.btn-send:hover { transform: scale(1.05); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.btn-send svg {
  width: 14px;
  height: 14px;
  stroke: #000;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.disclaimer-text {
  text-align: center;
  font-size: 9.5px;
  color: #64748b;
  margin-top: 6px;
}

/* Responsividade Mobile Aperfeiçoada */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    height: 100%;
    margin-left: 0;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .top-navbar { padding: 8px 12px; }
  .messages-viewport { padding: 14px 12px; gap: 14px; }
  .message-row { max-width: 94%; gap: 8px; }
  .message-bubble { padding: 9px 12px; font-size: 13.5px; }
  .suggestions-grid { grid-template-columns: 1fr; }
  .welcome-title { font-size: 20px; }
  .welcome-desc { font-size: 13px; }
  .chat-textarea { max-height: min(32dvh, 180px); }
}
/* ============================================================
   RESPOSTAS ORGANIZADAS: texto, código, fórmulas e tabelas
   ============================================================ */
.message-bubble { min-width: 0; max-width: 100%; }
.message-bubble.user-text { white-space: pre-wrap; }

.message-bubble h1, .message-bubble h2, .message-bubble h3, .message-bubble h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #ffffff;
  line-height: 1.3;
  margin: 12px 0 6px;
}
.message-bubble h1 { font-size: 17px; }
.message-bubble h2 { font-size: 16px; }
.message-bubble h3 { font-size: 15px; }
.message-bubble h4 { font-size: 14px; }
.message-bubble h1:first-child, .message-bubble h2:first-child,
.message-bubble h3:first-child, .message-bubble h4:first-child { margin-top: 0; }

.message-bubble a { color: var(--cyan-neon); text-decoration: underline; }
.message-bubble hr { border: none; border-top: 1px solid var(--card-border); margin: 10px 0; }
.message-bubble blockquote {
  border-left: 3px solid var(--gold-primary);
  padding: 2px 0 2px 12px;
  margin: 8px 0;
  color: #cbd5e1;
}

/* código dentro da frase */
.message-bubble :not(pre) > code {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: #fde68a;
}

/* bloco de código */
.code-block {
  margin: 10px 0;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
  background: #0d1117;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--card-border);
  font-size: 11px;
  text-transform: lowercase;
  color: var(--text-muted);
}
.code-copy {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--cyan-neon);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.code-copy:hover { background: rgba(56, 189, 248, 0.22); }
.code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre;
  word-break: normal;
}
.code-block pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  background: transparent;
  color: #e6edf3;
  padding: 0;
  border: none;
  white-space: pre;
}
.code-block pre code.hljs { padding: 0; background: transparent; }

/* fórmulas */
.message-bubble .katex { font-size: 1.05em; }
.message-bubble .katex-display {
  margin: 10px 0;
  padding: 8px 4px;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

/* tabelas */
.table-wrap { overflow-x: auto; margin: 8px 0; }
.message-bubble table { border-collapse: collapse; font-size: 13px; min-width: 60%; }
.message-bubble th, .message-bubble td {
  border: 1px solid var(--card-border);
  padding: 6px 10px;
  text-align: left;
}
.message-bubble th { background: rgba(255, 255, 255, 0.06); color: #fff; }

/* ============================================================
   INDICADOR "PENSANDO..." COM TEXTOS ANIMADOS
   ============================================================ */
.thinking-label {
  display: inline-block;
  background: linear-gradient(90deg, #94a3b8 0%, #ffffff 50%, #94a3b8 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: thinkingShimmer 2s linear infinite;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.thinking-label.swap-out {
  opacity: 0;
  transform: translateY(-6px);
}

.thinking-label.swap-in {
  animation: thinkingShimmer 2s linear infinite, thinkingLabelIn 0.3s ease-out;
}

@keyframes thinkingShimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

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

.thinking-dots {
  color: var(--text-muted);
}

/* avatar pulsando enquanto a IA trabalha */
.avatar-bubble.working {
  animation: avatarPulse 1.6s ease-in-out infinite;
}

@keyframes avatarPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.0); }
  50% { box-shadow: 0 0 12px 2px rgba(234, 179, 8, 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  .thinking-label, .thinking-label.swap-in, .avatar-bubble.working {
    animation: none;
  }
  .thinking-label {
    -webkit-text-fill-color: var(--text-muted);
    color: var(--text-muted);
    background: none;
  }
}

/* ============================================================
   LOGIN COM GOOGLE, LINKS LEGAIS E AVISOS
   ============================================================ */
.drive-note {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.btn-drive-connect:disabled {
  opacity: 0.6;
  cursor: wait;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  margin-top: 10px;
  font-size: 11px;
  color: #64748b;
}

.legal-links a, .disclaimer-links a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-links a:hover, .disclaimer-links a:hover { color: #ffffff; }

.disclaimer-links { white-space: nowrap; }

.chat-item { line-height: 1.35; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translate(-50%, 12px);
  background: rgba(13, 18, 32, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1000;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============================================================
   ENVIO DE IMAGENS
   ============================================================ */
.btn-attach {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-attach:hover {
  color: var(--cyan-neon);
  background: rgba(56, 189, 248, 0.1);
}

.btn-attach svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.attach-preview[hidden] { display: none; }

.attach-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: var(--card-bg);
  animation: messageSlide 0.2s ease-out;
}

.attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9px;
  display: block;
}

.attach-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: #0d1220;
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-remove:hover { background: #ef4444; }

.msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.msg-image {
  max-width: min(100%, 240px);
  max-height: 220px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--card-border);
  display: block;
}

.img-chip {
  display: inline-block;
  font-size: 12px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 6px;
}

/* ============================================================
   CONTA NO CANTO SUPERIOR (login e foto do Google)
   ============================================================ */
.nav-left { flex: 1; }

.account-area {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  position: relative;
}

.btn-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn-login:hover:not(:disabled) {
  border-color: var(--cyan-neon);
  background: rgba(56, 189, 248, 0.1);
}

.btn-login:disabled { opacity: 0.6; cursor: wait; }
.btn-login[hidden], .btn-avatar[hidden], .account-menu[hidden] { display: none; }

.g-icon { width: 16px; height: 16px; flex-shrink: 0; }

.btn-avatar {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(234, 179, 8, 0.55);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.btn-avatar:hover, .btn-avatar[aria-expanded="true"] {
  border-color: var(--gold-primary);
  box-shadow: 0 0 12px var(--gold-glow);
}

.btn-avatar img, .account-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-menu {
  position: absolute;
  top: 46px;
  right: 0;
  width: 250px;
  background: rgba(13, 18, 32, 0.98);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  z-index: 200;
  animation: messageSlide 0.18s ease-out;
}

.account-menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-menu-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  font-size: 18px;
  font-weight: 700;
}

.account-menu-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.account-menu-info strong { font-size: 14px; color: #ffffff; overflow-wrap: anywhere; line-height: 1.3; }
.account-menu-info span { font-size: 11.5px; color: #4ade80; }

.account-menu-hint {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
}

.account-menu-logout {
  width: 100%;
  margin-top: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 8px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.account-menu-logout:hover { background: rgba(239, 68, 68, 0.2); }

/* texto da barra lateral: bem pequeno */
.drive-note {
  font-size: 10px;
  line-height: 1.3;
  color: #64748b;
  margin-bottom: 8px;
  text-align: center;
}

@media (max-width: 480px) {
  .login-text { display: inline; font-size: 12px; }
  .btn-login { padding: 6px 12px 6px 8px; gap: 6px; }
  .account-menu { width: min(250px, 80vw); }
}

/* ============================================================
   CRIAR IMAGENS
   ============================================================ */
.btn-draw {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-draw:hover { color: var(--gold-primary); background: rgba(234, 179, 8, 0.1); }

.btn-draw.active {
  color: #000000;
  background: var(--gold-gradient);
  box-shadow: 0 0 10px var(--gold-glow);
}

.btn-draw svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-box-wrapper.draw-mode {
  border-color: rgba(234, 179, 8, 0.55);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(234, 179, 8, 0.18);
}

.gen-image-wrap { margin: 2px 0 8px; }

.gen-image {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
}

.gen-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.gen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--cyan-neon);
  border-radius: 8px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.gen-btn:hover { background: rgba(56, 189, 248, 0.22); }
.gen-note { font-size: 11.5px; color: var(--text-muted); }
.gen-prompt { font-size: 12px; color: var(--text-muted); margin-top: 6px; overflow-wrap: anywhere; }

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

/* ============================================================
   CAMPO DE MENSAGEM: ícones alinhados e centralizados
   ============================================================ */
.input-box-wrapper {
  align-items: flex-end;
  gap: 4px;
  padding: 5px 8px 5px 8px;
}

.btn-attach, .btn-draw, .btn-mic {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-attach svg, .btn-draw svg, .btn-mic svg {
  width: 18px;
  height: 18px;
  display: block;
}

.chat-textarea {
  line-height: 22px;
  min-height: 34px;
  padding: 6px 6px;
}

/* ============================================================
   MICROFONE: ondas sonoras animadas
   ============================================================ */
.sound-bars, .mic-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.sound-bars { height: 26px; }
.mic-bars { display: none; height: 20px; gap: 2px; }

.sound-bars i, .mic-bars i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(180deg, #38bdf8, #a78bfa);
  transform-origin: center;
  animation: soundBar var(--d, 1s) ease-in-out infinite;
  animation-delay: var(--dl, 0s);
  --min: 0.22;
  --max: 0.6;
}

.sound-bars i:nth-child(1), .mic-bars i:nth-child(1) { --d: 0.9s; --dl: -0.1s; }
.sound-bars i:nth-child(2), .mic-bars i:nth-child(2) { --d: 1.1s; --dl: -0.5s; }
.sound-bars i:nth-child(3), .mic-bars i:nth-child(3) { --d: 0.8s; --dl: -0.3s; }
.sound-bars i:nth-child(4), .mic-bars i:nth-child(4) { --d: 1.2s; --dl: -0.7s; }
.sound-bars i:nth-child(5) { --d: 0.95s; --dl: -0.2s; }
.sound-bars i:nth-child(6) { --d: 1.05s; --dl: -0.6s; }
.sound-bars i:nth-child(7) { --d: 0.85s; --dl: -0.4s; }

.sound-bars.hearing i, .mic-bars.hearing i { --max: 1; --min: 0.35; animation-duration: 0.45s; }

@keyframes soundBar {
  0%, 100% { transform: scaleY(var(--min)); }
  50% { transform: scaleY(var(--max)); }
}

.btn-mic.listening {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  animation: none;
}

.btn-mic.listening svg { display: none; }
.btn-mic.listening .mic-bars { display: flex; }
.btn-mic.listening .mic-bars i { background: linear-gradient(180deg, #f87171, #fb923c); }

.listening-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 7px 8px 7px 14px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.07);
  animation: messageSlide 0.2s ease-out;
}

.listening-bar[hidden] { display: none; }

.listening-text {
  flex: 1;
  font-size: 13px;
  color: #e2e8f0;
}

.listening-stop {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 9px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.listening-stop:hover { background: rgba(239, 68, 68, 0.25); }

@media (prefers-reduced-motion: reduce) {
  .sound-bars i, .mic-bars i { animation: none; transform: scaleY(0.6); }
}

/* ============================================================
   ARQUIVOS ANEXADOS
   ============================================================ */
.attach-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 40px;
  padding: 0 34px 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: var(--card-bg);
  font-size: 12.5px;
  color: #e2e8f0;
  animation: messageSlide 0.2s ease-out;
}

.attach-file.loading {
  padding-right: 12px;
  color: var(--text-muted);
  border-style: dashed;
}

.attach-file-icon { font-size: 17px; flex-shrink: 0; }

.attach-file-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.attach-file-info {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.attach-remove-inline {
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

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

.file-chip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #e2e8f0;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  padding: 3px 11px;
}

/* ============================================================
   MENU DA CONTA NO CELULAR: abre logo abaixo do cabeçalho, sem cobrir a logo
   (o efeito de vidro do cabeçalho prendia o menu dentro dele; no celular ele é sólido)
   ============================================================ */
@media (max-width: 768px) {
  .top-navbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(5, 8, 17, 0.97);
  }
  .account-menu {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 62px);
    right: 12px;
    left: auto;
    width: min(270px, calc(100vw - 24px));
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
  }
}

/* ============================================================
   SAUDAÇÃO: "Olá, <nome>!" em uma linha e a pergunta abaixo (responsiva)
   ============================================================ */
.welcome-title {
  text-wrap: balance;
  line-height: 1.25;
}

.welcome-title .wt-hello {
  display: block;
}

.welcome-title .wt-ask {
  display: block;
  margin-top: 0.25em;
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-size: 0.66em;
  font-weight: 600;
  color: #cbd5e1;
}

@media (max-width: 480px) {
  .welcome-title { font-size: 22px; }
  .welcome-title .wt-ask { font-size: 0.7em; }
}

/* ============================================================
   LOGO DO CABEÇALHO: um pouco maior
   ============================================================ */
.nav-logo-mini {
  height: 44px;
}

@media (max-width: 768px) {
  .nav-logo-mini { height: 40px; }
}