/* Hub de IAs — visual moderno, fluido e responsivo. Sem dependências externas além da fonte (opcional). */
:root {
  color-scheme: dark;
  --bg: #07080d;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --field: rgba(0, 0, 0, 0.28);
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.18);
  --text: #eceef6;
  --muted: #9096ab;
  --faint: #5f647a;
  --accent: #7c6cff;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #ff6b81;
  --openai: #19c37d;
  --anthropic: #ff8a5c;
  --gemini: #5b9dff;
  --radius: 22px;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.75);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f5fb;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-2: #ffffff;
    --field: rgba(20, 25, 60, 0.04);
    --border: rgba(20, 25, 60, 0.1);
    --border-2: rgba(20, 25, 60, 0.2);
    --text: #14172b;
    --muted: #5b6178;
    --faint: #8d92a8;
    --shadow: 0 30px 70px -34px rgba(40, 50, 110, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* fundo "aurora" */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.aurora::before,
.aurora::after {
  content: "";
  position: absolute;
  width: 62vmax;
  height: 62vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
  animation: drift 26s ease-in-out infinite alternate;
}
.aurora::before { background: radial-gradient(circle, var(--accent), transparent 65%); top: -28vmax; left: -14vmax; }
.aurora::after { background: radial-gradient(circle, var(--accent-2), transparent 65%); bottom: -34vmax; right: -16vmax; animation-delay: -9s; opacity: 0.2; }
@keyframes drift { to { transform: translate3d(8vmax, 5vmax, 0) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .aurora::before, .aurora::after { animation: none; } * { transition: none !important; } }

/* topo */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 650; letter-spacing: -0.01em; }
.orb {
  width: 30px; height: 30px; border-radius: 10px;
  background: conic-gradient(from 210deg, var(--accent), var(--accent-2), var(--openai), var(--accent));
  box-shadow: 0 0 24px -4px var(--accent);
  position: relative;
}
.orb::after { content: ""; position: absolute; inset: 7px; border-radius: 6px; background: var(--bg); opacity: 0.88; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0; margin-top: -2px; }
.spacer { flex: 1; }

.seg {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 7px 16px; border-radius: 999px; font-weight: 550; font-size: 13px;
  transition: color 0.2s, background 0.3s var(--ease), box-shadow 0.3s;
}
.seg button:hover { color: var(--text); }
.seg button.is-on { color: #fff; background: linear-gradient(135deg, var(--accent), #5b8cff); box-shadow: 0 6px 20px -8px var(--accent); }

.pill-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok);
  padding: 5px 11px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 26%, transparent);
}
.pill-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 17px; height: 17px; }

/* estrutura */
.shell { width: min(1120px, 100% - 32px); margin: 0 auto; padding: clamp(28px, 6vw, 64px) 0 80px; }
.view { animation: rise 0.5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; max-width: 720px; margin: 0 auto clamp(22px, 4vw, 36px); }
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 { margin: 8px 0 10px; font-size: clamp(28px, 5.4vw, 46px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 700; }
.lead { margin: 0; color: var(--muted); font-size: clamp(14px, 2vw, 16.5px); }

/* campo de comando */
.composer {
  max-width: 860px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.3s, box-shadow 0.4s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.composer textarea {
  display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent;
  padding: 16px 16px 6px; min-height: 84px; max-height: 340px; line-height: 1.55; font-size: 16px;
}
.composer textarea::placeholder { color: var(--faint); }
.composer-bar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; flex-wrap: wrap; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.quick button {
  border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.25s var(--ease);
}
.quick button:hover { color: var(--text); border-color: var(--border-2); background: var(--surface); transform: translateY(-1px); }
.composer-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.opts { padding: 4px 14px 14px; border-top: 1px dashed var(--border); margin-top: 6px; animation: rise 0.3s var(--ease) both; }
.opts label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.opts input {
  width: 100%; padding: 9px 12px; background: var(--field); border: 1px solid var(--border); border-radius: 12px; outline: 0; font-size: 13.5px;
}
.opts input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer; border: 0;
  padding: 11px 20px; border-radius: 14px; font-weight: 600; font-size: 14.5px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #4f8cff 55%, var(--accent-2));
  background-size: 160% 100%; background-position: 0 0;
  box-shadow: 0 10px 28px -10px var(--accent);
  transition: transform 0.25s var(--ease), box-shadow 0.3s, background-position 0.5s var(--ease), opacity 0.2s;
}
.btn:hover { background-position: 100% 0; box-shadow: 0 14px 34px -10px var(--accent); transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: progress; transform: none; }
.btn kbd { font: 500 11px var(--font); padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.18); }
@media (max-width: 640px) { .btn kbd { display: none; } }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 7px 11px; border-radius: 11px; font-size: 12.5px; font-weight: 550;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-2); background: var(--surface); }
.btn-ghost:active { transform: scale(0.96); }
.btn-ghost svg { width: 14px; height: 14px; }

.notice { max-width: 860px; margin: 12px auto 0; min-height: 20px; font-size: 13px; color: var(--warn); text-align: center; }

/* cartões das IAs */
.agents { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
@media (max-width: 960px) { .agents { grid-template-columns: 1fr; } }
.agent {
  --c: var(--accent);
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); overflow: hidden;
  animation: rise 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms);
  transition: border-color 0.3s, transform 0.4s var(--ease), box-shadow 0.4s;
}
.agent::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 120px; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 0, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%);
}
.agent:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--border)); transform: translateY(-3px); box-shadow: 0 24px 50px -28px var(--c); }
.agent-head { position: relative; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff;
  background: linear-gradient(145deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
  box-shadow: 0 8px 22px -8px var(--c);
}
.agent-head h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.agent-head p { margin: 0; font-size: 12.5px; color: var(--muted); }
.agent textarea {
  position: relative; width: 100%; resize: none; min-height: 150px; max-height: 280px; overflow: auto;
  padding: 12px 13px; font-size: 13px; line-height: 1.55; color: var(--muted);
  background: var(--field); border: 1px solid var(--border); border-radius: 14px; outline: 0;
  transition: border-color 0.2s, color 0.2s;
}
.agent textarea:focus { border-color: var(--c); color: var(--text); }
.go {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; cursor: pointer; border: 0;
  padding: 12px 14px; border-radius: 14px; color: #fff; font-weight: 650; font-size: 14px;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 60%, #000));
  box-shadow: 0 12px 28px -14px var(--c);
  transition: transform 0.25s var(--ease), box-shadow 0.3s, filter 0.2s;
}
.go:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 16px 32px -14px var(--c); }
.go:active { transform: scale(0.98); }
.go svg { width: 16px; height: 16px; }
.agent-row { position: relative; display: flex; flex-wrap: wrap; gap: 6px; }
.agent-note { position: relative; min-height: 18px; font-size: 12px; color: var(--muted); }

/* esqueleto de carregamento */
.skel { height: 330px; border-radius: var(--radius); border: 1px solid var(--border); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* painéis */
.panel {
  max-width: 100%; margin-top: 22px; padding: clamp(16px, 3vw, 26px); border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); animation: rise 0.6s var(--ease) both;
}
.panel h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -0.01em; }
.panel > p { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }
.triple { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 820px) { .triple { grid-template-columns: 1fr; } }
.field {
  width: 100%; min-height: 130px; resize: vertical; padding: 12px 13px; font-size: 13px;
  background: var(--field); border: 1px solid var(--border); border-radius: 14px; outline: 0;
  transition: border-color 0.2s;
}
.field:focus { border-color: var(--accent); }
.field-label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent)); display: inline-block; }
.synth-out { margin-top: 16px; animation: rise 0.4s var(--ease) both; }
.synth-out textarea { min-height: 170px; }
.synth-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* modo API: andamento + resultado */
.stepper { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px auto 0; padding: 0; max-width: 860px; }
@media (max-width: 640px) { .stepper { grid-template-columns: 1fr; } }
.step {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; font-size: 13px; color: var(--faint);
  background: var(--surface); border: 1px solid var(--border); transition: all 0.4s var(--ease);
}
.step i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; transition: all 0.3s; }
.step.is-active { color: var(--text); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.step.is-active i { background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 1.4s infinite; }
.step.is-done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.step.is-done i { background: var(--ok); }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

details.plan { max-width: 860px; margin: 14px auto 0; font-size: 13px; color: var(--muted); }
details.plan summary { cursor: pointer; padding: 6px 0; }
details.plan summary:hover { color: var(--text); }
.plan-body { display: grid; gap: 10px; margin-top: 8px; }
.plan-body strong { color: var(--text); font-size: 13px; }
.plan-body pre { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; font: inherit; padding: 12px 14px; background: var(--field); border: 1px solid var(--border); border-radius: 14px; }

.result { margin-top: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); overflow: hidden; animation: rise 0.6s var(--ease) both; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px; border-bottom: 1px solid var(--border); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  padding: 8px 14px; border-radius: 12px; font-size: 13px; font-weight: 550; transition: all 0.25s var(--ease);
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.is-active { color: var(--text); background: var(--surface-2); border-color: var(--border-2); }
.tab.has-error .dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.result-body { padding: clamp(16px, 3vw, 28px); }
.result-meta { margin: 0 0 12px; font-size: 12px; color: var(--faint); }
.result-text { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; line-height: 1.7; }
.result-text.is-error { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 18px; }
.chip { font-size: 12px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.chip.off { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

/* aviso flutuante */
.toast-zone { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 18px; border-radius: 14px; font-size: 13.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); animation: toast-in 0.4s var(--ease) both;
}
.toast.is-out { animation: toast-out 0.35s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(400px, 100%); padding: 34px 30px; border-radius: 26px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(18px); animation: rise 0.7s var(--ease) both;
}
.login-card .orb { width: 52px; height: 52px; border-radius: 17px; margin: 0 auto 18px; }
.login-card .orb::after { inset: 12px; border-radius: 9px; }
.login-card h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.login-card p { margin: 6px 0 22px; color: var(--muted); font-size: 14px; }
.login-card input {
  width: 100%; padding: 13px 15px; font-size: 15px; text-align: center; letter-spacing: 0.04em;
  background: var(--field); border: 1px solid var(--border); border-radius: 14px; outline: 0; transition: border-color 0.2s, box-shadow 0.3s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.login-card .btn { width: 100%; margin-top: 12px; }
.login-error { margin: 10px 0 0; color: var(--danger); font-size: 13.5px; }
