/* Athena · GEX — preto e roxo, bordas arredondadas, conversa centralizada. */

:root {
  --bg: #07040D;
  --bg-2: #0C0716;
  --surface: #120B1F;
  --surface-2: #1A1030;
  --surface-3: #241640;
  --border: rgba(215, 139, 255, 0.10);
  --border-strong: rgba(215, 139, 255, 0.22);
  --text: #F3EEFB;
  --text-2: #B9AED0;
  --text-3: #8A7FA3;
  --purple: #8B35FF;
  --purple-2: #A84DFF;
  --lilac: #D78BFF;
  --danger: #FF6B8B;
  --ok: #4ADE9C;
  --warn: #FFC56B;
  --grad: linear-gradient(135deg, #8B35FF 0%, #A84DFF 50%, #D78BFF 100%);
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border);
  --glow: 0 0 0 1px rgba(168, 77, 255, 0.35), 0 10px 40px -10px rgba(139, 53, 255, 0.55);
  --sidebar-w: 288px;
  --thread-w: 780px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(139, 53, 255, 0.14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(215, 139, 255, 0.07), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
a { color: var(--lilac); }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(168, 77, 255, 0.45); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; text-align: center; }

/* Ícones em traço */
.icon-btn svg, .btn svg, .card__icon svg, .quick__icon svg, .send svg, .user svg, .conv__menu svg, .msg__tools svg,
.menu button svg, .attachment button svg, .msg__file svg {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Mascote ---------- */
.athena { position: relative; display: inline-block; width: var(--athena-size); height: var(--athena-size); flex: none; }
/* Versão 3D: o canvas é 1,5x o mascote (o brilho vaza) e entra em fade sobre o SVG, que some. */
.athena--3d > svg { display: none; }
.athena-3d { position: absolute; left: -25%; top: -25%; width: 150%; height: 150%; pointer-events: none; animation: athena-3d-in .3s ease both; }
@keyframes athena-3d-in { from { opacity: 0; } to { opacity: 1; } }
/* Espaço reservado antes do JS montar o mascote: evita o texto "pular" na tela de carregamento. */
[data-mascot] { display: inline-block; width: calc(var(--slot, 88) * 1px); height: calc(var(--slot, 88) * 1px); }
.athena svg { width: 100%; height: 100%; overflow: visible; }
.athena-halo, .athena-blink, .athena-happy, .athena-rim { transform-box: fill-box; transform-origin: center; }
/* Onde os anéis passam sobre o corpo, as cores se somam (vidro sobre vidro) em vez de cobrir. */
.athena-blend { mix-blend-mode: screen; }

/* Só o brilho se move: o halo respira e uma luz roxa contorna o corpo. Anéis e partículas ficam fixos. */
.athena-halo { animation: athena-halo 3.8s ease-in-out infinite; }
.athena-rim { animation: athena-rim 3.8s ease-in-out infinite; }
.athena-aura { transform-origin: 61px 60px; animation: athena-aura 9s linear infinite; }
/* Anéis sobem e descem em fases opostas; o corpo fica fixo no meio. */
.athena-float--a { animation: athena-float 4.2s ease-in-out infinite; }
.athena-float--b { animation: athena-float 4.2s ease-in-out -2.1s infinite; }
.athena-look { animation: athena-look 8s ease-in-out infinite; }
.athena-blink { animation: athena-blink 5.2s ease-in-out infinite; }
.athena-track { transition: transform .07s linear; }
/* Sem transform aqui: animar escala junto com o filtro de brilho fazia o ^^ aparecer pixelado. */
.athena-happy { opacity: 0; transition: opacity .12s; }
.athena-blink { transition: opacity .1s; }

.athena.is-tracking .athena-look { animation: none; }
.athena.is-happy .athena-blink { opacity: 0; }
.athena.is-happy .athena-happy { opacity: 1; }

/* Versão parada: histórico do chat e marca. Olhos abertos, brilho fixo. */
.athena--still .athena-halo, .athena--still .athena-rim, .athena--still .athena-aura,
.athena--still .athena-look, .athena--still .athena-blink, .athena--still .athena-float { animation: none; }
.athena--still .athena-aura { opacity: .7; }

@keyframes athena-halo { 0%, 100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes athena-rim { 0%, 100% { opacity: .35; } 50% { opacity: .85; } }
@keyframes athena-float { 0%, 100% { transform: translateY(-3.2px); } 50% { transform: translateY(3.2px); } }
@keyframes athena-aura { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes athena-look {
  0%, 14% { transform: translateX(0); }
  20%, 34% { transform: translateX(-3.5px); }
  40%, 56% { transform: translateX(0); }
  62%, 78% { transform: translateX(3.5px); }
  84%, 100% { transform: translateX(0); }
}
@keyframes athena-blink { 0%, 44%, 50%, 100% { transform: scaleY(1); } 47% { transform: scaleY(0.12); } }

.is-thinking .athena-halo, .is-thinking .athena-rim { animation-duration: 1.6s; }
.is-thinking .athena-aura { animation-duration: 3s; }
.is-thinking .athena-look { animation: athena-think 2.4s ease-in-out infinite; }
@keyframes athena-think { 0%, 100% { transform: translate(-2px, -2px); } 50% { transform: translate(2px, -2px); } }

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

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--grad); color: #fff; box-shadow: var(--glow); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(215, 139, 255, .5), 0 14px 44px -10px rgba(139, 53, 255, .75); }
.btn--primary:active { transform: translateY(0); }
.btn--primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn--ghost { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.btn--ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn--danger { background: rgba(255, 107, 139, .14); border-color: rgba(255, 107, 139, .35); color: #FFB3C3; }
.btn--lg { height: 50px; padding: 0 26px; font-size: 15px; border-radius: 14px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 10px; border: 0; background: transparent; color: var(--text-3);
  transition: background .15s, color .15s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
/* Microfone ouvindo: roxo, com um anel que pulsa. */
.icon-btn[aria-pressed="true"] { background: rgba(139, 53, 255, .18); color: var(--lilac); animation: mic-pulse 1.6s ease-out infinite; }
@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(168, 77, 255, .55); }
  70% { box-shadow: 0 0 0 9px rgba(168, 77, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 77, 255, 0); }
}
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- Telas ---------- */
.screen { position: fixed; inset: 0; overflow-y: auto; }
/* Centraliza com margin:auto (e não com place-items): quando o conteúdo é mais alto que a tela,
   o topo continua alcançável pela rolagem em vez de ficar cortado. */
.screen--center { display: flex; flex-direction: column; align-items: center; padding: 32px 16px; }
.screen--center > * { margin: auto 0; }
.loading { display: grid; justify-items: center; gap: 12px; color: var(--text-3); }

.welcome { width: min(760px, 100%); display: grid; gap: 30px; animation: rise .6s ease both; }

/* ---------- Login: tela única, centralizada ---------- */
.login, .screen--welcome { background: #000; }
.welcome { position: relative; z-index: 1; }
.login__card { position: relative; z-index: 1; width: min(400px, 100%); display: grid; justify-items: center; text-align: center; animation: rise .6s ease both; }

/* Fundo aurora (adaptado do componente do 21st.dev, sem React/Tailwind). */
.aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.aurora__pulse {
  position: absolute; inset: 0; opacity: .5;
  background:
    radial-gradient(circle, rgba(168, 85, 247, .2) 0%, transparent 80%),
    radial-gradient(circle, rgba(79, 70, 229, .2) 0%, transparent 80%);
  animation: aurora-pulse 10s ease-in-out infinite;
}
.aurora__blobs { position: absolute; inset: 0; mix-blend-mode: screen; animation: aurora-in 1s ease-in-out both; }
.aurora__blob { position: absolute; border-radius: 50%; filter: blur(64px); will-change: transform; }
.aurora__blob--1 { top: -25%; left: -25%; width: 50%; height: 50%; background: #9333EA; opacity: .4; animation: aurora-blob-1 30s ease-in-out infinite alternate; }
.aurora__blob--2 { bottom: -25%; right: -25%; width: 50%; height: 50%; background: #C026D3; opacity: .4; animation: aurora-blob-2 40s ease-in-out infinite alternate; }
.aurora__blob--3 { top: 33%; left: 33%; width: 33%; height: 33%; background: #4338CA; opacity: .3; animation: aurora-blob-3 50s ease-in-out infinite alternate; }
.aurora__stars { position: absolute; inset: 0; }
.aurora__star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: 0; animation: aurora-star var(--dur) ease-in-out var(--delay) infinite; }
@keyframes aurora-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes aurora-pulse { 0%, 100% { opacity: .5; transform: scale(1); } 50% { opacity: .7; transform: scale(1.05); } }
@keyframes aurora-blob-1 { 0% { transform: translate(-50px, -20px) scale(1); } 50% { transform: translate(50px, 20px) scale(1.2); } 100% { transform: translate(-50px, -20px) scale(1); } }
@keyframes aurora-blob-2 { 0% { transform: translate(50px, 20px) scale(1); } 50% { transform: translate(-50px, -20px) scale(1.3); } 100% { transform: translate(50px, 20px) scale(1); } }
@keyframes aurora-blob-3 { 0% { transform: translate(20px, -30px) rotate(0deg); } 50% { transform: translate(-20px, 30px) rotate(360deg); } 100% { transform: translate(20px, -30px) rotate(0deg); } }
@keyframes aurora-star { 0%, 100% { opacity: 0; } 50% { opacity: var(--peak); } }
.login__card .athena { margin-bottom: 4px; }
.login h1 { margin: 0; font-size: 32px; letter-spacing: -0.02em; }
.login__sub { margin: 4px 0 28px; color: var(--text-2); }
.login .hint { margin-top: 12px; }
.login .alert { margin-top: 12px; }
.login .preview-badge { margin-top: 14px; }
.login__motto { min-height: 24px; margin: 40px 0 0; font-size: 13.5px; color: var(--text-3); }
.login__motto span { display: block; animation: motto 4.2s ease both; }
@keyframes motto {
  0% { opacity: 0; transform: translateY(6px); }
  10%, 88% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-6px); }
}

/* Botão do Google no padrão oficial: fundo branco, logo colorido, texto escuro. */
.btn--google {
  width: 100%; height: 50px; gap: 12px; border-radius: 12px;
  background: #fff; color: #1F1F1F; border-color: rgba(255, 255, 255, .6);
  font-size: 15px; font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(139, 53, 255, .6);
}
.btn--google:hover { background: #F4EEFF; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 14px 36px -12px rgba(139, 53, 255, .7); }
.btn--google:active { transform: translateY(0); }
.btn--google .g-logo { width: 20px; height: 20px; stroke: none; } /* logo colorido, sem o contorno dos ícones de traço */
.welcome__hero { display: grid; justify-items: center; text-align: center; gap: 6px; }
.welcome__hero .athena { margin-bottom: 6px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--lilac); }
.welcome h1 { margin: 0; font-size: clamp(30px, 5vw, 44px); line-height: 1.12; letter-spacing: -0.025em; font-weight: 700; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 8px 0 0; max-width: 560px; color: var(--text-2); font-size: 16px; }

.welcome__cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card {
  padding: 18px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(36, 22, 64, .55), rgba(18, 11, 31, .55));
  border: 1px solid var(--border);
  animation: rise .6s ease both;
}
.card:nth-child(2) { animation-delay: .06s; }
.card:nth-child(3) { animation-delay: .12s; }
.card__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: rgba(139, 53, 255, .16); color: var(--lilac); margin-bottom: 12px; }
.card__icon svg { width: 19px; height: 19px; }
.card h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.card p { margin: 0; color: var(--text-3); font-size: 13.5px; line-height: 1.5; }

.welcome__action { display: grid; justify-items: center; gap: 10px; }
.hint { margin: 0; font-size: 13px; color: var(--text-3); }
.alert { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(255, 107, 139, .10); border: 1px solid rgba(255, 107, 139, .3); color: #FFC0CD; font-size: 13.5px; max-width: 520px; text-align: center; }
.name-form { width: min(460px, 100%); justify-self: center; justify-items: stretch; }
.name-form label { font-weight: 600; text-align: center; }
.name-form__row { display: flex; gap: 8px; }
.name-form input, .dialog input {
  flex: 1; min-width: 0; height: 48px; padding: 0 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.name-form input:focus, .dialog input:focus { border-color: var(--purple-2); box-shadow: 0 0 0 4px rgba(139, 53, 255, .18); }
.name-form .btn { height: 48px; }
.preview-badge { margin: 0; justify-self: center; font-size: 12.5px; color: var(--warn); background: rgba(255, 197, 107, .08); border: 1px solid rgba(255, 197, 107, .22); padding: 6px 12px; border-radius: 999px; text-align: center; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Layout do app ---------- */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

/* Barra lateral minimalista (inspirada no Claude): itens de texto, ícones finos e pequenos, sem blocos pesados. */
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  padding: 14px 10px 10px; background: rgba(10, 6, 18, .88);
  border-right: 1px solid var(--border); backdrop-filter: blur(12px);
}
.sidebar__head { display: flex; justify-content: flex-end; margin-bottom: 4px; }

.side-nav { display: grid; gap: 1px; }
.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
  font-size: 14px; text-align: left; transition: background .12s, color .12s;
}
.side-item svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; color: var(--text-3); transition: color .12s; }
.side-item:hover { background: rgba(215, 139, 255, .06); color: var(--text); }
.side-item:hover svg { color: var(--text-2); }
.side-item[aria-pressed="true"], .side-item[aria-expanded="true"] { color: var(--text); background: rgba(168, 77, 255, .1); }
.side-item[aria-pressed="true"] svg, .side-item[aria-expanded="true"] svg { color: var(--lilac); }

.search { margin: 6px 0 2px; }
.search input {
  width: 100%; height: 34px; padding: 0 10px; border-radius: 8px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--border); outline: none; font-size: 13.5px;
}
.search input:focus { border-color: rgba(168, 77, 255, .45); }
.search input::placeholder { color: var(--text-3); }

.side-section { margin: 20px 10px 6px; font-size: 12px; font-weight: 500; color: var(--text-3); }

.conv-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1px; }
.conv { position: relative; display: flex; align-items: center; border-radius: 8px; transition: background .12s; }
.conv:hover, .conv:focus-within { background: rgba(215, 139, 255, .06); }
.conv[aria-current="true"] { background: rgba(168, 77, 255, .12); }
.conv__link {
  flex: 1; min-width: 0; display: block; height: 32px; padding: 0 4px 0 10px; border: 0; background: none; text-align: left;
  color: var(--text-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 8px;
}
.conv:hover .conv__link, .conv[aria-current="true"] .conv__link { color: var(--text); }
.conv__menu { opacity: 0; width: 28px; height: 28px; }
.conv__menu svg { width: 16px; height: 16px; }
.conv:hover .conv__menu, .conv:focus-within .conv__menu, .conv__menu[aria-expanded="true"] { opacity: 1; }
.conv-empty { margin: 0; padding: 4px 10px; color: var(--text-3); font-size: 13px; }

.sidebar__foot { position: relative; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.user { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.user:hover { background: rgba(215, 139, 255, .06); }
.user > svg { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.user__avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 600; font-size: 11.5px; line-height: 1; padding-top: 1.5px; flex: none; } /* compensa a maiúscula da Inter, que fica um pouco acima do centro */
.user__info { display: flex; align-items: baseline; gap: 5px; min-width: 0; flex: 1; white-space: nowrap; }
.user__name { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 70%; }
.user__mail { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.user__mail:not(:empty)::before { content: "· "; }


.menu {
  position: absolute; z-index: 40; min-width: 200px; padding: 6px; border-radius: 14px;
  background: var(--surface-2); box-shadow: var(--shadow); animation: pop .14s ease both;
}
.sidebar__foot .menu { left: 0; right: 0; bottom: calc(100% + 6px); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 14px; color: var(--text-2); }
.menu button svg { width: 16px; height: 16px; flex: none; stroke-width: 1.6; color: var(--text-3); }
.menu button:hover, .menu button:focus-visible { background: var(--surface-3); color: var(--text); }
.menu button:hover svg, .menu button:focus-visible svg { color: var(--lilac); }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }

.scrim { display: none; }

/* ---------- Área principal ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 20px; flex: none;
  border-bottom: 1px solid transparent; transition: border-color .2s, background .2s;
}
.topbar.is-scrolled { border-color: var(--border); background: rgba(7, 4, 13, .6); backdrop-filter: blur(10px); }
.topbar__title { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 4px; }
.status { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; margin-right: 6px; border-radius: 999px; font-size: 12.5px; color: var(--text-3); background: var(--surface); border: 1px solid var(--border); white-space: nowrap; }
.status__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status[data-state="online"] .status__dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status[data-state="preview"] .status__dot { background: var(--warn); }
.status[data-state="offline"] .status__dot { background: var(--danger); }

.thread { flex: 1; min-height: 0; overflow-y: auto; outline: none; scroll-behavior: smooth; }
.thread__inner { width: min(var(--thread-w), 100%); margin: 0 auto; padding: 12px 24px 28px; min-height: 100%; display: flex; flex-direction: column; }

.empty { margin: auto 0; padding: 32px 0 12px; display: grid; justify-items: center; text-align: center; animation: rise .5s ease both; }
.empty h2 { margin: 14px 0 4px; font-size: clamp(22px, 3.4vw, 28px); letter-spacing: -0.02em; }
.empty > p { margin: 0 0 24px; color: var(--text-3); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; }
.quick__item {
  display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--border); background: rgba(18, 11, 31, .7);
  transition: border-color .2s, background .2s, transform .15s;
}
.quick__item:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.quick__item strong { display: block; font-size: 14px; font-weight: 600; }
.quick__item small { display: block; font-size: 12.5px; color: var(--text-3); }
.quick__icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: rgba(139, 53, 255, .14); color: var(--lilac); flex: none; }
.quick__icon svg { width: 19px; height: 19px; }

/* ---------- Mensagens ---------- */
.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.msg { display: flex; gap: 12px; animation: rise .3s ease both; }
.msg--user { justify-content: flex-end; }
.msg__avatar { margin-top: 2px; }
.msg__body { min-width: 0; max-width: 100%; }
.msg--user .msg__body { max-width: 82%; display: grid; justify-items: end; gap: 6px; }
.msg--user .bubble {
  padding: 11px 15px; border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, rgba(139, 53, 255, .30), rgba(168, 77, 255, .22));
  border: 1px solid rgba(168, 77, 255, .3); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg--assistant .msg__body { flex: 1; }
.msg__name { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 3px; }
.msg--assistant .bubble { overflow-wrap: anywhere; }
.bubble p { margin: 0 0 10px; }
.bubble p:last-child, .bubble ul:last-child, .bubble ol:last-child, .bubble pre:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 0 0 10px; padding-left: 22px; }
.bubble li { margin: 3px 0; }
.bubble h3, .bubble h4 { margin: 14px 0 6px; font-size: 15px; }
.bubble code { font-family: var(--mono); font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); }
.bubble pre { margin: 0 0 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); overflow-x: auto; }
.bubble pre code { padding: 0; background: none; font-size: 13px; }
.bubble blockquote { margin: 0 0 10px; padding: 8px 14px; border-left: 3px solid var(--purple-2); background: rgba(139, 53, 255, .08); border-radius: 0 10px 10px 0; color: var(--text-2); }
.bubble hr { border: 0; border-top: 1px solid var(--border-strong); margin: 14px 0; }

.msg__images { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.msg__images img { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-strong); }
.msg__file { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 5px 10px; border-radius: 9px; background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }
.msg__file svg { width: 14px; height: 14px; stroke-width: 1.6; }

.msg__tools { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg__tools, .msg:focus-within .msg__tools { opacity: 1; }
.msg__tools .icon-btn { width: 30px; height: 30px; }
.msg__tools .icon-btn svg { width: 16px; height: 16px; }

.notice {
  padding: 12px 14px; border-radius: var(--radius); font-size: 14px;
  background: rgba(255, 197, 107, .07); border: 1px solid rgba(255, 197, 107, .22); color: #FFDFAE;
}
.notice--error { background: rgba(255, 107, 139, .08); border-color: rgba(255, 107, 139, .28); color: #FFC0CD; }
.notice .btn { margin-top: 10px; height: 32px; font-size: 13px; }

.typing { display: inline-flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 14px; padding-top: 4px; }
.typing__dots { display: inline-flex; gap: 4px; }
.typing__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--lilac); animation: dot 1.2s ease-in-out infinite; }
.typing__dots i:nth-child(2) { animation-delay: .15s; }
.typing__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Composer ---------- */
.composer-wrap { flex: none; width: min(var(--thread-w), 100%); margin: 0 auto; padding: 0 24px 14px; }
.composer {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; column-gap: 6px;
  padding: 10px 8px 10px 16px;
  border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--border-strong); box-shadow: 0 20px 50px -24px rgba(0, 0, 0, .9);
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: rgba(168, 77, 255, .55); box-shadow: 0 0 0 4px rgba(139, 53, 255, .12), 0 20px 50px -24px rgba(0, 0, 0, .9); }
.composer.is-dragging { border-color: var(--lilac); border-style: dashed; }
.drop-hint { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; border-radius: inherit; background: rgba(18, 0, 43, .88); color: var(--lilac); font-weight: 600; pointer-events: none; }
.composer textarea {
  width: 100%; min-height: 26px; max-height: 220px; padding: 6px 4px 4px; resize: none;
  border: 0; outline: none; background: transparent; line-height: 1.5; font-size: 15px;
}
.composer textarea::placeholder { color: var(--text-3); }

/* Barras de rolagem do app (caixa de texto, lista de conversas e chat): sem trilho cinza,
   alça roxa discreta e setinhas fixas no topo e na base. */
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar { width: 10px; }
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-track { background: transparent; }
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-thumb { background: rgba(168, 77, 255, .28); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-thumb:hover { background-color: rgba(168, 77, 255, .5); }
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-button:single-button { display: block; height: 12px; background-color: transparent; background-repeat: no-repeat; background-position: center; background-size: 8px 8px; }
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-button:single-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 5.5L4 3l2.5 2.5' fill='none' stroke='%23A84DFF' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-button:single-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 2.5L4 5l2.5-2.5' fill='none' stroke='%23A84DFF' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-button:single-button:hover { background-color: rgba(168, 77, 255, .12); }
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-button:vertical:start:increment,
:is(.composer textarea, .conv-list, .thread)::-webkit-scrollbar-button:vertical:end:decrement { display: none; }
.composer__tools { display: flex; align-items: center; gap: 2px; min-width: 0; margin-top: 6px; padding: 0 6px; }
.composer__note { margin-left: 6px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer__note.is-live { color: var(--lilac); }
/* Enviar: só o ícone roxo, sem fundo. */
.send {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--purple-2); transition: color .15s, background .15s, opacity .15s;
}
.send svg { width: 21px; height: 21px; stroke-width: 2.3; }
.send:hover:not(:disabled) { color: var(--lilac); background: rgba(139, 53, 255, .12); }
.send:disabled { color: var(--text-3); opacity: .45; cursor: not-allowed; }
.send.is-stop svg { stroke-width: 0; fill: currentColor; }

.attachments { grid-column: 1 / -1; list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.attachment { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-strong); }
.attachment img { width: 100%; height: 100%; object-fit: cover; }
.attachment__doc { display: grid; place-items: center; gap: 2px; width: 100%; height: 100%; padding: 6px 4px 0; background: var(--surface-2); color: var(--text-2); font-size: 10px; line-height: 1.2; text-align: center; overflow: hidden; }
.attachment__doc svg { width: 20px; height: 20px; fill: none; stroke: var(--lilac); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.attachment button {
  position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(7, 4, 13, .85); color: #fff;
}
.attachment button svg { width: 12px; height: 12px; stroke-width: 2.2; }

/* ---------- Diálogo e toasts ---------- */
.dialog {
  width: min(420px, calc(100% - 32px)); padding: 22px; border: 0; border-radius: var(--radius-lg);
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(3, 1, 8, .65); backdrop-filter: blur(4px); }
.dialog[open] { animation: pop .16s ease both; }
.dialog h2 { margin: 0 0 12px; font-size: 17px; }
.dialog p { margin: 0 0 14px; color: var(--text-2); font-size: 14px; }
.dialog input { width: 100%; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
#dialog-ok { order: 2; } /* visual: Cancelar à esquerda, Salvar à direita */

.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast {
  padding: 11px 16px; border-radius: 12px; background: var(--surface-3); box-shadow: var(--shadow);
  font-size: 14px; animation: pop .18s ease both; pointer-events: auto;
}
.toast--error { background: #3A1024; color: #FFD0DA; }

/* Tooltip próprio: branco, cantos arredondados, com setinha; posicionado por JS. */
.tooltip {
  position: fixed; z-index: 120; max-width: 260px; padding: 6px 10px; border-radius: 9px;
  background: #F7F2FF; color: #14082A; font-size: 12.5px; font-weight: 500; line-height: 1.35;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(168, 77, 255, .25);
  pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity .12s ease, transform .12s ease;
}
.tooltip.is-visible { opacity: 1; transform: none; }
.tooltip::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px;
  background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px;
}
.tooltip--below::after { bottom: auto; top: -5px; }

.only-mobile { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .only-mobile { display: inline-grid; }
  .sidebar__head.only-mobile { display: flex; }
  .sidebar {
    position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(86vw, 320px);
    transform: translateX(-102%); transition: transform .25s ease; background: var(--bg-2);
  }
  .app.is-nav-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .6); }
  .app.is-nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(3, 1, 8, .6); }
  .topbar { padding: 0 10px; }
  .thread__inner { padding: 8px 16px 24px; }
  .composer-wrap { padding: 0 12px calc(10px + env(safe-area-inset-bottom)); }
  .status { display: none; }
}
@media (max-width: 640px) {
  .welcome__cards { grid-template-columns: 1fr; }
  .card { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; padding: 14px; }
  .card__icon { grid-row: span 2; margin: 0; }
  .quick { grid-template-columns: 1fr; }
  .msg--user .msg__body { max-width: 90%; }
  .msg--assistant .msg__avatar { display: none; }
  .name-form__row { flex-direction: column; }
  .conv__menu { opacity: 1; }
  .msg__tools { opacity: 1; }
}
@media (hover: none) {
  .conv__menu, .msg__tools { opacity: 1; }
}

/* Notebooks com pouca altura (768 px): tela inicial mais compacta para caber sem rolar. */
@media (max-height: 820px) {
  .screen--center { padding: 20px 16px; }
  .welcome { gap: 18px; }
  .welcome__hero .athena { width: 104px; height: 104px; }
  .lead { margin-top: 4px; }
  .card { padding: 14px 16px; }
  .card__icon { margin-bottom: 8px; }
}

/* Telas grandes: a interface inteira cresce em degraus para continuar legível de longe
   (monitores 2K/4K, ultrawide e TVs em apresentações). O 3D acompanha, porque mede o tamanho real na tela. */
@media (min-width: 1800px) and (min-height: 1000px) { body { zoom: 1.12; } }
@media (min-width: 2400px) { body { zoom: 1.3; } }
@media (min-width: 3200px) and (min-height: 1700px) { body { zoom: 1.75; } }
