/* Ofertix — identidade visual
   Todas as cores ficam nestas variáveis: para ajustar a marca, mude aqui. */
:root {
  color-scheme: dark;            /* inputs, scrollbars e afins nativos no modo escuro */

  --bg: #0A0A0B;                 /* preto da marca (fundo) */
  --surface: #16181D;            /* cards e painéis */
  --surface-hover: #1E2128;
  --border: #2A2E36;
  --text: #F4F6F8;
  --muted: #8B93A1;

  --primary: #38BDF8;            /* azul da marca */
  --primary-hover: #0EA5E9;
  --on-primary: #0A0A0B;         /* texto sobre o azul: preto (branco teria contraste ruim) */
  --primary-soft: rgba(56, 189, 248, .14);

  --ok: #4ADE80;
  --error: #F87171;
  --error-bg: rgba(248, 113, 113, .1);

  --radius: 10px;
}

* { box-sizing: border-box; }

/* O atributo HTML "hidden" perde para qualquer regra CSS com display (ex.: .btn { display: inline-block }).
   Esta regra garante que elemento com hidden SEMPRE some. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

.container {
  max-width: 960px;
  margin: 32px auto;
  padding: 0 16px;
}

.muted { color: var(--muted); }
.status-ok { color: var(--ok); }
.status-error { color: var(--error); }

/* ---------- Logo ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.01em;
}
.logo img { width: 28px; height: 28px; }
.logo .x { color: var(--primary); }

/* ---------- Botões ---------- */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-hover); color: var(--text); }
.btn-block { width: 100%; }

/* ---------- Página inicial ---------- */
.hero {
  min-height: calc(100vh - 70px); /* deixa o rodapé (termos/privacidade) visível sem rolar */
  display: grid;
  place-items: center;
  padding: 24px 16px;
  text-align: center;
}
.hero-content { max-width: 560px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.15; margin: 24px 0 12px; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.1rem; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 28px 0; }
.hero .api-status { font-size: .85rem; }

/* ---------- Páginas de login/cadastro ---------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.auth-wrapper { width: 100%; max-width: 400px; }
.auth-wrapper > .logo { margin: 0 auto 20px; display: flex; justify-content: center; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 1.5rem; }
.auth-card .subtitle { margin: 0 0 24px; color: var(--muted); }
.auth-card .switch { margin: 16px 0 0; text-align: center; color: var(--muted); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9rem; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
/* Autopreenchimento do Chrome pinta o campo de claro: forçamos o fundo escuro */
.field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--bg) inset;
  -webkit-text-fill-color: var(--text);
}
.field .hint { font-size: .8rem; color: var(--muted); }
.field .field-error { font-size: .85rem; color: var(--error); }
.field.has-error input { border-color: var(--error); }

.alert {
  display: none;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error);
  font-size: .9rem;
}
.alert.visible { display: block; }

/* ---------- Área logada ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar .user { display: flex; align-items: center; gap: 12px; }
.badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { margin-top: 0; font-size: 1.1rem; }

.small { font-size: .85rem; }

/* ---------- Navegação ---------- */
/* min-width: 0 deixa o menu encolher; quando os itens não cabem, ele rola de lado
   (sem isso, o menu empurra a página inteira para fora da tela) */
.topbar-left { display: flex; align-items: center; gap: 24px; min-width: 0; flex: 1; }
.nav { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav a { white-space: nowrap; }
.topbar .user { flex-shrink: 0; }
.topbar .user-name { white-space: nowrap; }
@media (max-width: 1100px) {
  .topbar .user-name { display: none; } /* o nome some antes de apertar o menu */
}
.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--surface-hover); }
.nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }

/* ---------- Estrutura de página ---------- */
.container-wide { max-width: 1200px; }
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 1.6rem; }
.page-header p { margin: 4px 0 0; }

/* ---------- Campos genéricos (filtros e formulários) ---------- */
input[type="search"], select, textarea, .toolbar input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.field select, .field textarea { width: 100%; background: var(--bg); }
.field textarea { resize: vertical; }
select:focus, textarea:focus, input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toolbar {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
/* Itens de grid não encolhem abaixo do próprio conteúdo por padrão (min-width: auto).
   Sem isso, o select com a opção mais longa estoura a largura da tela. */
.toolbar > * { min-width: 0; width: 100%; }
.toolbar-4 { grid-template-columns: 2fr repeat(3, 1fr); }

/* ---------- Botões extras ---------- */
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-danger { background: transparent; border-color: var(--border); color: var(--error); }
.btn-danger:hover { background: var(--error-bg); border-color: var(--error); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); }

/* ---------- Tabela ---------- */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto; /* tabela larga rola de lado em vez de ser cortada */
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-hover); }
.actions-col { text-align: right; white-space: nowrap; }
.actions-col .btn + .btn { margin-left: 6px; }

.product-cell { display: flex; align-items: center; gap: 12px; }
.product-name { font-weight: 600; }
.thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border);
}
.thumb-empty { display: grid; place-items: center; font-size: 1.2rem; }

.price { font-weight: 700; color: var(--primary); }
.price-old { font-size: .8rem; color: var(--muted); text-decoration: line-through; }

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-active { background: rgba(74, 222, 128, .12); color: var(--ok); }
.status-inactive { background: var(--surface-hover); color: var(--muted); }

/* Status das ofertas */
.offer-draft { background: var(--surface-hover); color: var(--muted); }
.offer-pending_review { background: rgba(250, 204, 21, .12); color: #FACC15; }
.offer-approved { background: var(--primary-soft); color: var(--primary); }
.offer-published { background: rgba(74, 222, 128, .12); color: var(--ok); }
.offer-rejected { background: var(--error-bg); color: var(--error); }
.offer-expired { background: var(--surface-hover); color: var(--muted); text-decoration: line-through; }

/* Status dos cupons */
.coupon-active { background: rgba(74, 222, 128, .12); color: var(--ok); }
.coupon-scheduled { background: var(--primary-soft); color: var(--primary); }
.coupon-expired { background: var(--error-bg); color: var(--error); }
.coupon-inactive { background: var(--surface-hover); color: var(--muted); }

/* Escolha em botões lado a lado (ex.: tipo de cupom) */
.field .label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9rem; }
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}
.segmented label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
/* .field input dá width:100% aos campos de texto; os rádios precisam desfazer isso */
.segmented input { width: auto; padding: 0; margin: 0; accent-color: var(--primary); }
.field[hidden] { display: none; }

.discount-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
}
.coupon {
  padding: 2px 8px;
  border: 1px dashed var(--primary);
  border-radius: 6px;
  color: var(--primary);
  font-size: .85rem;
}
.discount-preview {
  margin: -4px 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--primary-soft);
}
.discount-preview[hidden], .discount-preview [hidden] { display: none; }

.empty-state { padding: 48px 16px; text-align: center; }
.empty-state p { margin: 4px 0; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}
.pagination[hidden] { display: none; }

/* ---------- Modal (dialog) ---------- */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.dialog::backdrop { background: rgba(0, 0, 0, .7); }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dialog-header, .dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
.dialog-header { border-bottom: 1px solid var(--border); }
.dialog-header h2 { margin: 0; font-size: 1.15rem; }
.dialog-body { padding: 20px; overflow-y: auto; }
.dialog-footer { border-top: 1px solid var(--border); justify-content: flex-end; gap: 8px; }

/* ---------- Histórico de preços ---------- */
.dialog-wide { width: min(760px, calc(100vw - 32px)); }
.dialog-wide .dialog-body { max-height: calc(100vh - 110px); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-value { font-size: 1.25rem; font-weight: 700; }
.stat-hint { font-size: .75rem; color: var(--muted); }

.history-note { font-size: .9rem; color: var(--muted); margin: 12px 0; }
.history-note.warn { color: #FACC15; }

.chart-box { position: relative; margin: 8px 0 16px; }
.chart-empty { padding: 24px 0; text-align: center; }
.price-chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11px; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.chart-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.chart-guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: nowrap;
}
.chart-tooltip[hidden] { display: none; }

/* ".dialog .inline-form" para vencer a regra ".dialog form" (que é flex em coluna) */
.dialog .inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: start; margin-bottom: 16px; }
.inline-form .alert { grid-column: 1 / -1; margin-bottom: 0; }
.inline-form .field { margin-bottom: 0; }
.inline-form > .btn { margin-top: 27px; }
.table-compact td, .table-compact th { padding: 8px 12px; }
.table-compact { border: 1px solid var(--border); border-radius: 8px; }

/* Selos de histórico nas ofertas */
.insight {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.insight-good { background: rgba(74, 222, 128, .12); color: var(--ok); }
.insight-warn { background: rgba(250, 204, 21, .12); color: #FACC15; cursor: help; }
.insight-none { color: var(--muted); font-weight: 400; padding-left: 0; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 6px; }
.kpi {
  display: block;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
a.kpi:hover { border-color: var(--primary); color: var(--text); }
.kpi-label { font-size: .85rem; color: var(--muted); }
.kpi-value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.kpi-value.kpi-empty { font-size: 1rem; font-weight: 500; color: var(--muted); padding: 8px 0 5px; }
.kpi-detail { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.tracking-note { margin: 0 0 20px; }

.usage-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.progress { height: 8px; margin-top: 10px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--primary); }
.progress-fill.warn { background: #FACC15; }

.onboarding { border-color: var(--primary); }
.steps { margin: 0; padding-left: 20px; }
.steps li { padding: 4px 0; }
.steps li.done { color: var(--ok); }

.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panels .card { margin-bottom: 0; }

.bar-row { display: grid; grid-template-columns: 96px 1fr 32px; align-items: center; gap: 10px; padding: 4px 0; }
.bar-label { font-size: .85rem; color: var(--muted); }
.bar-track { height: 10px; background: var(--bg); border-radius: 4px; }
.bar-fill { height: 100%; min-width: 2px; background: var(--primary); border-radius: 4px; }
.bar-value { text-align: right; font-weight: 600; }

.line-list { list-style: none; margin: 0; padding: 0; }
.line-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.line-list li:last-child { border-bottom: none; }
.line-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
a.line-main:hover { color: var(--primary); }
.line-side { flex-shrink: 0; }
.alerts-list .insight { margin-top: 0; }
.empty-panel { margin: 8px 0; }

/* ---------- Configurações ---------- */
.mode-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.mode-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mode-option input { accent-color: var(--primary); margin: 0 0 4px; }
.mode-option.locked { opacity: .6; cursor: not-allowed; }
.mode-option.locked a { opacity: 1; }
.field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.message-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.message-editor textarea { font-family: inherit; }
.message-preview {
  margin: 0;
  min-height: 100%;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: .9rem;
  line-height: 1.5;
}
.variables { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.variable-chip {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--primary);
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.variable-chip:hover { border-color: var(--primary); }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: 40px; }

/* ---------- Motor (página de ofertas) ---------- */
.score {
  display: inline-block;
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  text-align: center;
}
.score-excellent { background: rgba(74, 222, 128, .15); color: var(--ok); }
.score-good { background: var(--primary-soft); color: var(--primary); }
.score-regular { background: rgba(250, 204, 21, .12); color: #FACC15; }
.score-weak { background: var(--surface-hover); color: var(--muted); }
.report { list-style: none; margin: 8px 0 0; padding: 0; font-size: .85rem; }
.report li { padding: 2px 0; }
.report .fail { color: var(--error); }
.report .ok { color: var(--ok); }
.report .warn { color: #FACC15; }
.report .info { color: var(--muted); }
.run-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.run-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.run-item:last-child { border-bottom: none; }
.run-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.run-head strong { flex: 1; min-width: 0; }

/* ---------- Afiliados e fontes ---------- */
.dialog .inline-form, .inline-form.program-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: start; }
.program-form { margin: 12px 0; }
.program-form .field { margin-bottom: 0; }
.program-form > .btn { margin-top: 27px; }
.program-form .alert { grid-column: 1 / -1; margin-bottom: 0; }
.import-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 16px;
  margin: 12px 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.import-box input[type="file"] { color: var(--muted); max-width: 100%; }
.import-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.check input { accent-color: var(--primary); }
.csv-preview {
  max-height: 160px;
  overflow: auto;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .8rem;
}
.csv-preview[hidden] { display: none; }
.import-report { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.import-report h3 { margin: 0 0 8px; font-size: 1rem; }
.columns-help { margin-top: 12px; }
.columns-help summary { cursor: pointer; color: var(--primary); font-size: .9rem; }
.integration { padding: 12px 0; border-bottom: 1px solid var(--border); }
.integration:last-child { border-bottom: none; }
.integration p { margin: 6px 0; }
.steps.small { font-size: .85rem; color: var(--muted); }

/* ---------- Canais e publicações ---------- */
.channel-form { display: grid; grid-template-columns: 180px 1fr 1fr auto; gap: 10px; align-items: start; margin: 12px 0; }
.channel-form .field { margin-bottom: 0; }
.channel-form > .btn { margin-top: 27px; }
.channel-form .alert { grid-column: 1 / -1; margin-bottom: 0; }
.channel-form select, .channel-form input { width: 100%; }
.channel-help { margin-bottom: 8px; }
.channel-help summary { cursor: pointer; color: var(--primary); font-size: .9rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.publish-channels { display: grid; gap: 8px; margin-bottom: 12px; }
.publish-result { padding: 10px 0; border-bottom: 1px solid var(--border); }
.publish-result:last-child { border-bottom: none; }

/* ---------- Automação ---------- */
.switch-row { margin: 12px 0 16px; font-size: 1rem; }
.switch-row input { width: 18px; height: 18px; }
.automation-status { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.automation-status .section-head { margin-bottom: 4px; }
input[type="time"], input[type="number"] { color-scheme: dark; }

/* ---------- Planos e admin ---------- */
.badge-link { cursor: pointer; }
.user-link { cursor: pointer; }
.user-link:hover { color: var(--primary); }
.badge-link:hover { background: var(--primary); color: var(--on-primary); }
.plans-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.plan-card.current { border: 2px solid var(--primary); }
.plan-card .badge { align-self: flex-start; }
.plan-card h3 { margin: 0; font-size: 1.2rem; }
.plan-card ul { margin: 4px 0 8px; padding-left: 18px; font-size: .9rem; }
.plan-card .btn { margin-top: auto; text-align: center; }
.usage-item { margin-bottom: 14px; }
.progress-fill.full { background: var(--error); }
.warn-box {
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #FACC15;
  border-radius: var(--radius);
  background: rgba(250, 204, 21, .08);
  color: #FACC15;
}
.admin-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.admin-actions select { padding: 5px 8px; font-size: .85rem; }

/* ---------- Conta, e-mail e páginas legais (Fase 16) ---------- */
/* Caixinha "aceito os termos": o checkbox fica ao lado do texto, não em cima */
.field-check label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  font-size: .9rem;
  color: var(--muted);
  cursor: pointer;
}
.field-check input { width: 18px; height: 18px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--primary); }
.field-check.has-error label { color: var(--error); }
.auth-card .forgot { display: block; text-align: right; font-size: .85rem; margin: -8px 0 16px; }

/* Mensagem de sucesso (mesma caixa do .alert, em verde) */
.alert.alert-success { background: rgba(74, 222, 128, .1); color: var(--ok); }

/* Aviso "confirme seu e-mail" no topo das páginas logadas */
.verify-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.verify-banner .btn { border-color: #FACC15; color: #FACC15; }

/* Zona de perigo (excluir conta) */
.card-danger { border-color: rgba(248, 113, 113, .45); }
.card-danger h2 { color: var(--error); }
.btn-danger-solid { background: var(--error); color: var(--bg); }
.btn-danger-solid:hover { background: #EF4444; }

/* Termos de uso e Política de privacidade */
.legal { max-width: 760px; }
.legal h1 { margin-bottom: 4px; }
.legal h2 { font-size: 1.15rem; margin-top: 32px; }
.legal p, .legal li { color: #D5D9E0; }
.legal .placeholder { background: rgba(250, 204, 21, .15); color: #FACC15; padding: 0 4px; border-radius: 4px; }
.legal-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }

.site-footer { text-align: center; font-size: .85rem; padding: 24px 16px; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panels { grid-template-columns: 1fr; }
  .mode-options, .message-editor, .field-row-3, .plans-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar input[type="search"] { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .topbar-left { gap: 12px; flex-wrap: wrap; width: 100%; }
  /* No celular o menu rola de lado quando não cabe (mais páginas virão nas próximas fases) */
  .nav { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav a { white-space: nowrap; }

  /* Tabela vira lista de cartões no celular */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table td { padding: 4px 0; border: none; }
  .table td[data-label="Categoria"]::before,
  .table td[data-label="Status"]::before,
  .table td[data-label="Cupom"]::before,
  .table td[data-label="Validade"]::before,
  .table td[data-label="Loja"]::before,
  .table td[data-label="Nota"]::before,
  .table td[data-label="Compra mínima"]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: .85rem;
  }
  .actions-col { text-align: left; padding-top: 8px !important; }
  .field-row { grid-template-columns: 1fr; }
  .dialog .inline-form, .inline-form.program-form, .channel-form { grid-template-columns: 1fr; }
  .channel-form > .btn { margin-top: 0; }
  .program-form > .btn { margin-top: 0; }
  .import-actions { margin-left: 0; }
  .inline-form > .btn { margin-top: 0; }
}

@media (max-width: 480px) {
  .topbar .user-name { display: none; }
  .toolbar { grid-template-columns: 1fr; }
  .kpis-3 { grid-template-columns: 1fr; }
  .kpi-value { font-size: 1.5rem; }
}
