/* ATLAS KR AI — tema escuro, dourado + violeta. Sem dependências externas. */

:root {
  --bg: #0a0a10;
  --bg-soft: #101018;
  --surface: #16161f;
  --surface-2: #1d1d2a;
  --border: #2a2a3a;
  --text: #f2f0ea;
  --muted: #a3a3b5;
  --gold: #d4af37;
  --gold-soft: #e8c15a;
  --gold-dim: rgba(212, 175, 55, 0.16);
  --violet: #7c5cff;
  --violet-dim: rgba(124, 92, 255, 0.16);
  --green: #3ecf8e;
  --red: #ff6b6b;
  --amber: #f5a623;
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 248px;
  --topbar-h: 58px;
}

* { box-sizing: border-box; }

/* O atributo hidden precisa vencer as regras de display abaixo
 * (.auth-view e .app-shell usam display:flex). Sem esta regra, o
 * navegador aplica o display do autor e o [hidden] do user-agent
 * perde — e a tela do app aparecia junto com a de login, sem estar
 * autenticado. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h2 { font-size: 1.55rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }

a { color: var(--gold-soft); }
a:hover { color: var(--gold); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold);
  color: #111;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.muted { color: var(--muted); font-size: 0.92rem; }
.big { font-size: 1.5rem; font-weight: 700; margin: 0.25rem 0 0.5rem; }
.money-in { color: var(--green); }
.money-out { color: var(--red); }
.view-intro { color: var(--muted); max-width: 62ch; }

/* ---------- Botões ---------- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s ease, background 0.15s ease;
}
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #b8912a);
  color: #141410;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-outline {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold-soft);
}
.btn-outline:hover { background: var(--gold-dim); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
.btn-block { width: 100%; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--gold-soft);
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Formulários ---------- */
.field { display: block; margin-bottom: 1rem; }
.field > span {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 0.65rem 0.8rem;
}
.field input::placeholder, .field textarea::placeholder { color: #6d6d80; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25);
}
.form-card { max-width: 640px; }
.form-note { color: var(--muted); font-size: 0.88rem; margin-top: 0.75rem; }

/* ---------- Alertas / estados vazios / toast ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid;
}
.alert-error { background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.45); color: #ffc9c9; }
.alert-warning { background: rgba(245, 166, 35, 0.1); border-color: rgba(245, 166, 35, 0.45); color: #ffe1a8; }
.alert-info { background: var(--violet-dim); border-color: rgba(124, 92, 255, 0.5); color: #ddd3ff; }
.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--muted);
  text-align: center;
  margin-top: 1rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--gold);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 90;
  max-width: min(92vw, 560px);
}

/* ---------- Autenticação ---------- */
.auth-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(600px 300px at 20% 0%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(600px 300px at 85% 100%, rgba(212, 175, 55, 0.14), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.brand { display: flex; align-items: center; gap: 0.8rem; }
.brand h1 { font-size: 1.5rem; margin: 0; letter-spacing: 0.04em; }
.brand-sub { color: var(--muted); font-size: 0.9rem; margin: 0; }
.brand-mark {
  width: 44px; height: 44px;
  flex: 0 0 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-weight: 800; font-size: 1.4rem; color: #141410;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold) 55%, var(--violet));
}
.auth-intro { color: var(--muted); margin: 1.25rem 0; }
.auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.auth-tab {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  font: inherit; font-weight: 600; cursor: pointer;
}
.auth-tab.active { background: var(--gold-dim); border-color: var(--gold); color: var(--gold-soft); }
.auth-plans-teaser { color: var(--muted); font-size: 0.9rem; text-align: center; margin: 1.25rem 0 0; }

/* ---------- Rodapé ---------- */
.site-footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer p { margin-bottom: 0.25rem; }
.site-footer.inside { margin: 2.5rem 0 0.5rem; text-align: left; }

/* ---------- Shell do app ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand-small { font-weight: 800; letter-spacing: 0.04em; }
.brand-small .brand-mark { width: 34px; height: 34px; flex-basis: 34px; font-size: 1.1rem; border-radius: 9px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }
.credits-badge {
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.user-chip { color: var(--muted); font-size: 0.9rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}
.app-body { display: flex; flex: 1; align-items: stretch; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0.25rem 0.5rem 0.5rem;
}
.nav-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--gold-dim); border-color: var(--gold); color: var(--gold-soft); }
.nav-item .nav-desc { color: var(--muted); font-size: 0.8rem; font-weight: 400; margin-left: auto; text-align: right; }
.nav-item.nav-admin { border-style: dashed; border-color: var(--border); }
.sidebar-plan {
  margin-top: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}
.sidebar-plan-name { font-weight: 700; margin: 0; }
.sidebar-plan-credits { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 0.75rem; }

.main { flex: 1; min-width: 0; padding: 1.5rem 1.75rem 2rem; }
.view { max-width: 980px; }
.view[hidden] { display: none; }

/* ---------- Cartões / listas / tabelas ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}
.card h3 { margin-bottom: 0.4rem; }
.card .muted { margin-bottom: 0; }
.plans-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plan-card { display: flex; flex-direction: column; }
.plan-card.current { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.plan-price { font-size: 1.7rem; font-weight: 800; margin: 0.25rem 0; }
.plan-price small { font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.plan-credits { color: var(--gold-soft); font-weight: 600; }
.plan-features { list-style: none; padding: 0; margin: 0.75rem 0 1rem; color: var(--muted); font-size: 0.92rem; }
.plan-features li { padding: 0.15rem 0; }
.plan-features li::before { content: "✓ "; color: var(--green); }
.plan-card .btn { margin-top: auto; }
.current-badge {
  display: inline-block;
  background: var(--gold);
  color: #141410;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.5rem;
}

.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag-list li {
  background: var(--violet-dim);
  border: 1px solid rgba(124, 92, 255, 0.4);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
}
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.activity-list li:last-child { border-bottom: none; }
.activity-list time { color: var(--muted); font-size: 0.82rem; display: block; }

.progress {
  height: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.6rem 0;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--violet)); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.94rem;
}
.data-table th, .data-table td { padding: 0.65rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }

.task-card { margin-bottom: 1rem; }
.task-steps { list-style: none; padding: 0; margin: 0.75rem 0; }
.task-steps li { padding: 0.3rem 0; color: var(--muted); }
.task-steps li::before { content: "○ "; color: var(--gold); }
.task-steps li.done { color: var(--text); text-decoration: line-through; }
.task-steps li.done::before { content: "● "; color: var(--green); }
.task-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; }
.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--violet-dim);
  border: 1px solid rgba(124, 92, 255, 0.45);
}
.status-pill.ok { background: rgba(62, 207, 142, 0.12); border-color: rgba(62, 207, 142, 0.5); color: #9be8c6; }
.status-pill.pending { background: rgba(245, 166, 35, 0.12); border-color: rgba(245, 166, 35, 0.5); color: #ffe1a8; }

.report-box { white-space: pre-wrap; }
.report-box h4 { margin: 1rem 0 0.4rem; }
.report-box ul { margin: 0.25rem 0 0.75rem; padding-left: 1.25rem; }
.draft-warning {
  display: inline-block;
  background: rgba(245, 166, 35, 0.14);
  border: 1px solid rgba(245, 166, 35, 0.5);
  color: #ffe1a8;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .menu-toggle { display: inline-block; }
  .user-chip { display: none; }
  .app-body { flex-direction: column; }
  .sidebar {
    display: none;
    width: 100%;
    flex-basis: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar.open { display: flex; }
  .main { padding: 1.25rem 1rem 2rem; }
  .auth-card { padding: 1.5rem 1.25rem; }
  .credits-badge { font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- Adições — correções de frontend (dez/2026) ---------- */

/* Seletor de método de pagamento dentro do cartão do plano. */
.method-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  margin: 0 0 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
}
.method-picker legend {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0 0.35rem;
}
.method-picker label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.method-picker input { accent-color: var(--gold); }

/* Toast com tipo (sucesso/erro) — feedback visual em toda operação. */
.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); background: rgba(255, 107, 107, 0.14); }

/* Marketing: selo de status + cartão de rascunho. */
.marketing-card { margin-bottom: 1rem; }
.status-pill.failed { background: rgba(255, 107, 107, 0.12); border-color: rgba(255, 107, 107, 0.5); color: #ffc9c9; }

/* Research: selo de conteúdo estimado. */
.research-card { margin-bottom: 1rem; }
.badge-estimated {
  display: inline-block;
  background: rgba(245, 166, 35, 0.14);
  border: 1px solid rgba(245, 166, 35, 0.5);
  color: #ffe1a8;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Sales: selo de venda manual. */
.badge-manual {
  display: inline-block;
  background: var(--violet-dim);
  border: 1px solid rgba(124, 92, 255, 0.45);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Automation: explicação dos modos + status por passo. */
.mode-cards { margin-bottom: 1.25rem; }
.task-steps { list-style: none; padding: 0; margin: 0.75rem 0; counter-reset: step; }
.task-steps li {
  padding: 0.35rem 0;
  color: var(--muted);
  counter-increment: step;
}
.task-steps li::before { content: counter(step) ". "; color: var(--gold); font-weight: 700; }
.task-steps li.done { color: var(--text); }
.task-steps li.done::before { content: "✓ "; color: var(--green); }
.task-steps li.failed { color: #ffc9c9; }
.task-steps li.failed::before { content: "! "; color: var(--red); }
.task-steps li.executing::before { content: "… "; color: var(--gold); }
.step-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin-left: 0.35rem;
  white-space: nowrap;
}
.task-steps li.done .step-status { color: #9be8c6; border-color: rgba(62, 207, 142, 0.5); }
.task-steps li.failed .step-status { color: #ffc9c9; border-color: rgba(255, 107, 107, 0.5); }

/* ---------- Topbar em telas estreitas (~320px) ---------- */
@media (max-width: 400px) {
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    row-gap: 0.4rem;
  }
  .brand-small { font-size: 0.9rem; }
  .brand-small .brand-mark { width: 30px; height: 30px; flex-basis: 30px; font-size: 1rem; }
  .topbar-right { gap: 0.4rem; flex-wrap: wrap; }
  .credits-badge { font-size: 0.75rem; padding: 0.2rem 0.5rem; }
  .topbar-right .btn-small { padding: 0.35rem 0.6rem; font-size: 0.85rem; }
  .menu-toggle { padding: 0.3rem 0.55rem; }
}
