/* Casca das páginas de conteúdo: planos, conta e admin. Depende de tokens.css. */

body.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
/* Ver a nota em dashboard.css: sem o `:not(.halo)` este seletor derruba o
   `position: fixed` dos halos e eles passam a ocupar espaço no fluxo. */
body.page > *:not(.halo) { position: relative; z-index: 1; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.nav-links { display: flex; gap: 2px; }
.nav-link { padding: 5px 10px; border-radius: 9999px; font-size: 13px; color: var(--muted); text-decoration: none; }
.nav-link:hover { color: var(--text); background: var(--glass-2); }
.nav-link.is-active { color: var(--accent-soft); background: rgba(97, 74, 252, 0.14); }
.nav-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-email { font-size: 12px; color: var(--muted); }

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}
.wrap-narrow { max-width: 560px; }
/* O painel tem tabelas de 6 colunas; 980px espreme a de custos até ilegível. */
.wrap-wide { max-width: 1240px; }

/* ── Abas do painel ───────────────────────────────────────────────────── */

.panel-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
  scrollbar-width: none;
}
.panel-tabs::-webkit-scrollbar { display: none; }

.panel-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.panel-tab:hover { color: var(--text); }
.panel-tab[aria-selected='true'] { color: var(--accent-soft); border-bottom-color: var(--accent); }

.pane { display: none; }
.pane.is-on { display: block; }

/* ── Números ──────────────────────────────────────────────────────────── */

.stat-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.stat-num.is-neg { color: var(--danger); }
.stat-num.is-pos { color: var(--ok); }

/* Barras de série mensal. Altura em porcentagem do maior valor da série —
   comparação relativa é o que interessa aqui, não a escala absoluta. */
.bars { display: flex; gap: 10px; align-items: flex-end; height: 120px; margin-top: 14px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-stack { flex: 1; display: flex; gap: 3px; align-items: flex-end; width: 100%; }
.bar {
  flex: 1;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--surface-3);
}
.bar-cadastros { background: rgba(135, 115, 255, 0.45); }
.bar-assinaturas { background: var(--accent); }
.bar-cancelamentos { background: var(--danger); }
.bar-label { font-size: 10.5px; color: var(--muted); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* Linha de dias: muitas colunas finas, sem rótulo em cada uma. */
.spark { display: flex; gap: 2px; align-items: flex-end; height: 60px; margin-top: 10px; }
.spark div { flex: 1; min-height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 0.75; }

.modal-wide { width: min(720px, calc(100vw - 32px)); max-height: 85vh; overflow-y: auto; }

.kv-inline { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; }
.kv-inline b { display: block; font-size: 17px; font-weight: 600; margin-top: 2px; }

.ctx-box {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  word-break: break-word;
}

.page-head { margin-bottom: 28px; }
.page-head p { margin-top: 10px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.push { margin-left: auto; }

/* ── Planos ───────────────────────────────────────────────────────────── */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.plan {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: var(--glass);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
/* Destaque por borda e preenchimento — o violeta base é cor de borda, não de
   texto corrido. */
.plan.is-featured { border-color: rgba(97, 74, 252, 0.55); background: rgba(97, 74, 252, 0.07); }
.plan.is-current  { border-color: rgba(61, 220, 151, 0.45); }

.plan-name { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.plan-price { font-size: 34px; font-weight: 300; letter-spacing: -0.025em; }
.plan-price small { font-size: 13px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.plan-features li { position: relative; padding-left: 18px; line-height: 1.45; }
.plan-features li::before { content: '✓'; position: absolute; left: 0; color: var(--accent-soft); }
.plan .btn { margin-top: auto; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 11px;
  background: rgba(97, 74, 252, 0.18);
  color: var(--accent-soft);
}
.badge-ok   { background: rgba(61, 220, 151, 0.15); color: var(--ok); }
.badge-warn { background: rgba(240, 173, 78, 0.15); color: var(--warn); }
.badge-err  { background: rgba(255, 93, 108, 0.15); color: var(--danger); }

/* ── Medidor de uso ───────────────────────────────────────────────────── */

.meter { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s ease; }
.meter-fill.is-low { background: var(--warn); }
.meter-fill.is-out { background: var(--danger); }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); }

/* ── Tabela do admin ──────────────────────────────────────────────────── */

/* A tabela é larga; ela rola dentro do próprio contêiner em vez de empurrar a
   página inteira para o lado. */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); }
table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
table.data tbody tr:hover { background: var(--glass); }
table.data td.num { font-variant-numeric: tabular-nums; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; background: var(--glass); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.stat-num { font-size: 26px; font-weight: 300; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Autenticação ─────────────────────────────────────────────────────── */

body.auth {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
body.auth > *:not(.halo) { position: relative; z-index: 1; }

.auth-box {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px;
  background: var(--glass);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
/* Peso 300 no nome, 26px: o contraste vem da escala, não do peso. A marca de
   30px alinha a altura da caixa alta — o anzol nunca passa do topo do H. */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--text);
}
.auth-sub { text-align: center; font-size: 13px; color: var(--muted); margin-top: -8px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label { font-size: 12px; color: var(--muted); }
.auth-foot { text-align: center; font-size: 12.5px; color: var(--muted); }
.auth-foot a { color: var(--accent-soft); }

@media (max-width: 600px) {
  .wrap { padding: 24px 16px 56px; }
  .nav-email { display: none; }
}
