/* Tokens copiados da landing (emphasis.ia.br/assets/css/style.css) */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #eef1fa;
  --ink: #141a33;
  --ink-2: #353c5a;
  --muted: #5d6482;
  --line: #dfe3f1;
  --accent: #435bdb;
  --accent-strong: #3245b5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(67, 91, 219, 0.1);
  --accent-soft-2: rgba(67, 91, 219, 0.16);
  --panel: #0e1330;
  --panel-ink: #eceffc;
  --panel-muted: #a5acd0;
  --panel-line: rgba(236, 239, 252, 0.14);
  --ok: #1f8a5b;
  --ok-soft: rgba(31, 138, 91, 0.12);
  --warn: #a35a00;
  --warn-soft: rgba(214, 140, 0, 0.14);
  --danger: #c0352b;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 26, 51, 0.05), 0 12px 32px -12px rgba(20, 26, 51, 0.14);
  --shadow-lg: 0 2px 6px rgba(20, 26, 51, 0.08), 0 32px 64px -24px rgba(20, 26, 51, 0.28);
  --font-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Avenir Next', 'Trebuchet MS', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

a { color: var(--accent); }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

.sub { color: var(--muted); margin: 6px 0 0; font-size: 0.95rem; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 22px;
  font: 600 0.98rem/1 var(--font-body);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:focus-visible, .chip:focus-visible, .link:focus-visible { outline: 3px solid var(--accent-soft-2); outline-offset: 2px; }
.btn-solid { background: var(--accent); color: var(--accent-ink); }
.btn-solid:hover:not(:disabled) { background: var(--accent-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 9px 16px; font-size: 0.9rem; }
.btn-bloco { width: 100%; }
.btn[aria-busy="true"] { opacity: 0.7; pointer-events: none; }

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Logo ---------- */
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo span { font-family: var(--font-body); font-weight: 500; font-size: 0.85rem; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.logo-claro { color: var(--panel-ink); }
.logo-claro span { color: var(--panel-muted); }

/* ---------- Telas de acesso ---------- */
.acesso {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.acesso-marca {
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(67, 91, 219, 0.45), transparent 60%),
    var(--panel);
  color: var(--panel-ink);
  padding: 40px clamp(24px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
.acesso-pitch h1 { font-size: clamp(2rem, 3.4vw, 3rem); max-width: 14ch; }
.acesso-pitch p { color: var(--panel-muted); font-size: 1.1rem; max-width: 42ch; }
.acesso-passos { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.acesso-passos li { display: flex; align-items: center; gap: 14px; font-weight: 500; }
.acesso-passos b {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}
.acesso-rodape { color: var(--panel-muted); margin: 0; font-size: 0.9rem; }

.acesso-form {
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

.cartao-form {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 16px;
}
.cartao-form h2 { font-size: 2rem; }
.cartao-form .sub { margin-top: -8px; }
.etapa { margin: 0; color: var(--accent); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }

label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; color: var(--ink-2); }
label small { font-weight: 400; color: var(--muted); font-size: 0.82rem; }

input, select, textarea {
  width: 100%;
  font: 400 1rem/1.4 var(--font-body);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.campo-codigo { font: 600 1.6rem/1 var(--font-mono); letter-spacing: 0.4em; text-align: center; }

.erro { color: var(--danger); margin: 0; font-size: 0.92rem; min-height: 0; }
.erro:empty { display: none; }

.alternar { margin: 0; text-align: center; color: var(--muted); font-size: 0.95rem; }

.criando { text-align: center; justify-items: center; }
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--accent-soft-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Painel ---------- */
.topo {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(245, 246, 251, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topo-direita { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topo-empresa { font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.aviso {
  margin: 20px clamp(16px, 4vw, 40px) 0;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 500;
}

.painel-grade {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 40px) 120px;
  max-width: 1320px;
  margin: 0 auto;
}

.cartao {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.cartao h2 { font-size: 1.2rem; }
.cartao > .sub { margin-bottom: 16px; }

.lateral { display: grid; gap: 20px; align-content: start; }
.pilha { display: grid; gap: 10px; }

.editor { display: flex; flex-direction: column; gap: 16px; }
.editor h1 { font-size: 1.6rem; }

.variaveis { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); }
.chip {
  border: 1px dashed var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 5px 12px;
  font: 600 0.85rem/1.2 var(--font-body);
  cursor: pointer;
}
.chip:hover { background: var(--accent-soft-2); }

#prompt {
  min-height: 58vh;
  resize: vertical;
  font: 400 0.95rem/1.6 var(--font-mono);
  padding: 16px;
  background: #fbfcff;
}

.editor-rodape { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.contador { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.contador.excedido { color: var(--danger); font-weight: 600; }
.estado-salvo { font-size: 0.88rem; color: var(--muted); }
.estado-salvo.pendente { color: var(--warn); font-weight: 600; }
.editor-acoes { margin-left: auto; display: flex; gap: 10px; }

.linha-entre { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.rotulo { margin: 18px 0 4px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.destaque { margin: 0; font: 700 1.35rem/1.2 var(--font-display); }

.barra { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.barra span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.3s; }
.barra.cheia span { background: var(--danger); }

.dica { font-size: 0.86rem; color: var(--muted); margin: 14px 0 0; }

/* Interruptor ligado/desligado */
.interruptor { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.trilho {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.2s;
  flex: none;
}
.trilho::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 26, 51, 0.25);
  transition: transform 0.2s;
}
.interruptor input:checked + .trilho { background: var(--ok); }
.interruptor input:checked + .trilho::after { transform: translateX(20px); }
.interruptor input:focus-visible + .trilho { outline: 3px solid var(--accent-soft-2); outline-offset: 2px; }
.interruptor-texto { font-size: 0.92rem; color: var(--ink-2); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--panel);
  color: var(--panel-ink);
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  max-width: calc(100vw - 32px);
}
.toast.erro-toast { background: var(--danger); }

/* ---------- Assistente "Escrever com IA" ---------- */
.btn-ia {
  background: linear-gradient(135deg, var(--accent), #7a5bdb);
  color: var(--accent-ink);
}
.btn-ia:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.dialogo {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--ink);
}
.dialogo::backdrop { background: rgba(14, 19, 48, 0.55); backdrop-filter: blur(2px); }
.dialogo form { display: grid; gap: 16px; padding: 24px; }
.dialogo-cabeca { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialogo-cabeca h2 { font-size: 1.4rem; }
.dialogo-cabeca h2 span { color: var(--accent); }
.fechar {
  border: 0;
  background: var(--surface-2);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-2);
}
.fechar:hover { background: var(--accent-soft-2); }
.ia-etapa { display: grid; gap: 16px; }
.ia-carregando { justify-items: center; text-align: center; padding: 32px 0; }
.dialogo-acoes { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.fontes { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.fontes li { padding: 5px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.fontes .ok { background: var(--ok-soft); color: var(--ok); }
.fontes .falhou { background: var(--warn-soft); color: var(--warn); }

.ia-listas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ia-listas .rotulo { margin-top: 0; }
.ia-listas ul { margin: 0; padding-left: 18px; font-size: 0.92rem; color: var(--ink-2); }
.ia-listas li + li { margin-top: 4px; }
[data-ia-rascunho] { font: 400 0.88rem/1.55 var(--font-mono); background: #fbfcff; }

/* ---------- WhatsApp ---------- */
.selo { padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.selo.ok { background: var(--ok-soft); color: var(--ok); }
.selo.off { background: var(--surface-2); color: var(--muted); }
.selo.espera { background: var(--warn-soft); color: var(--warn); }
[data-bloco="whatsapp"] .pilha { margin-top: 14px; }

.dialogo-estreito { width: min(640px, calc(100vw - 32px)); }
.dialogo-corpo { display: grid; gap: 16px; padding: 24px; }
.wa-grade { display: grid; grid-template-columns: 264px 1fr; gap: 20px; align-items: center; }
.wa-qr {
  width: 264px;
  height: 264px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}
.wa-qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.wa-qr.ok { background: var(--ok-soft); color: var(--ok); font: 700 3rem/1 var(--font-display); }
.wa-passos { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--ink-2); }
.wa-status { margin: 0; text-align: center; font-weight: 600; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .painel-grade { grid-template-columns: minmax(0, 1fr); }
  .lateral { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  #prompt { min-height: 50vh; }
}

@media (max-width: 820px) {
  .acesso { grid-template-columns: minmax(0, 1fr); }
  .acesso-marca { padding: 24px 16px 28px; gap: 20px; }
  .acesso-pitch h1 { font-size: 1.7rem; max-width: none; }
  .acesso-pitch p { font-size: 1rem; }
  .acesso-passos, .acesso-rodape { display: none; }
  .acesso-form { place-items: start center; padding: 28px 16px 48px; }
}

@media (max-width: 520px) {
  .wa-grade { grid-template-columns: 1fr; justify-items: center; }
  .wa-qr { width: min(264px, 100%); height: auto; aspect-ratio: 1; }
  .dialogo-corpo { padding: 18px; }
  .editor-acoes { flex-wrap: wrap; }
  .editor-acoes .btn-ia { flex-basis: 100%; }
  .ia-listas { grid-template-columns: 1fr; }
  .dialogo form { padding: 18px; }
  .dialogo-acoes .btn { flex: 1; }
  .topo-empresa { display: none; }
  .cartao { padding: 18px; }
  .editor-acoes { margin-left: 0; width: 100%; }
  .editor-acoes .btn { flex: 1; }
}
