/* Tokens e componentes do painel e do admin. O site público (index, termos, privacidade) tem o próprio CSS. */
:root {
  color-scheme: light dark;
  --bg: #F3F5F1;
  --surface: #FFFFFF;
  --surface-2: #ECF1ED;
  --text: #0E1F18;
  --muted: #55665D;
  --line: #DCE3DE;
  --line-forte: #7A8B82; /* borda de campo e botão: 3,6:1 sobre branco */
  --marca: #0F4D3A;
  --marca-viva: #0F4D3A; /* marca em texto e gráfico; no escuro clareia para manter 3:1 */
  --primaria: #C92A2E; /* texto branco: 5,4:1 (o #E5383B da marca dá 4,2:1 e reprova AA) */
  --primaria-hover: #A82226;
  --ok: #157A40; /* selo com texto branco: 5,4:1 */
  --ok-texto: #157A40;
  --aviso: #7A4F00;
  --aviso-fundo: #FFF1CC;
  --erro: #B3261E;
  --neutro: #4A5550;
  --sombra: 0 18px 44px -18px rgb(0 0 0 / .4);

  --e1: 4px;
  --e2: 8px;
  --e3: 12px;
  --e4: 16px;
  --e5: 24px;
  --e6: 32px;
  --e7: 48px;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --r-pill: 999px;
  --toque: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1712;
    --surface: #13261D;
    --surface-2: #1B3328;
    --text: #E8EEE9;
    --muted: #A9BBB1;
    --line: #263D31;
    --line-forte: #5E7469; /* 3,2:1 sobre a superfície escura */
    --marca-viva: #6FD3A0;
    --ok-texto: #6FD3A0;
    --aviso: #F2C14E;
    --aviso-fundo: #3A2E10;
    --erro: #FF8A80;
    --sombra: 0 18px 44px -18px rgb(0 0 0 / .8);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 15px/1.5 "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 800; font-variation-settings: "wdth" 112; }
:focus-visible { outline: 3px solid var(--primaria); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* botões: um primário, um secundário (padrão), um fantasma; perigo é só a cor do texto */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2);
  min-height: var(--toque); padding: 0 var(--e4);
  font: inherit; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line-forte); border-radius: var(--r); cursor: pointer;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.btn-primary:hover { background: var(--primaria-hover); border-color: var(--primaria-hover); }
.btn-ghost { background: none; border-color: transparent; }
.perigo { color: var(--erro); }
.icon-btn { width: var(--toque); padding: 0; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* campos: 16px para o iOS não dar zoom */
input[type=text], input[type=url], input[type=email], input[type=tel], input[type=search], textarea, select {
  width: 100%; min-height: var(--toque); padding: 10px 12px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-forte); border-radius: var(--r);
}
textarea { resize: vertical; line-height: 1.45; }
label { font-weight: 600; font-size: 14px; }
.campo { display: grid; gap: 6px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.error { color: var(--erro); }

/* interruptor (checkbox com role=switch) */
.switch { display: inline-flex; align-items: center; gap: var(--e3); min-height: var(--toque); font-weight: 700; font-size: 15px; cursor: pointer; }
.switch input {
  appearance: none; flex-shrink: 0; position: relative; width: 46px; height: 28px; margin: 0;
  border-radius: var(--r-pill); background: var(--line-forte); cursor: pointer; transition: background .15s;
}
.switch input::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }

/* selos de status */
.selo {
  display: inline-flex; align-items: center; gap: var(--e1); padding: 5px 9px;
  font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap;
  color: #fff; background: var(--neutro); border-radius: var(--r-pill);
}
.selo-ok { background: var(--ok); }
.selo-marca { background: var(--marca); }
.selo-alerta { background: var(--primaria); }
.selo-aviso { background: var(--aviso-fundo); color: var(--aviso); }
.selo-claro { background: var(--surface-2); color: var(--text); }

/* chips de filtro */
.chips { display: flex; flex-wrap: wrap; gap: var(--e2); }
.chips button { border-radius: var(--r-pill); border-color: var(--line); }
.chips button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.chips small { font-weight: 400; opacity: .75; }

.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* topo */
.topo {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: var(--e5); min-height: 64px; padding: var(--e2) var(--e5);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.marca { flex-shrink: 0; display: flex; align-items: center; gap: var(--e2); font-weight: 850; font-size: 20px; font-variation-settings: "wdth" 125; color: var(--text); text-decoration: none; }
.marca img { width: 30px; height: 30px; }
.abas { display: flex; gap: var(--e1); }
.abas a { display: inline-flex; align-items: center; min-height: var(--toque); padding: 0 var(--e3); border-radius: var(--r); color: var(--muted); font-weight: 600; text-decoration: none; }
.abas a:hover { color: var(--text); }
.abas a[aria-current] { color: var(--text); background: var(--surface-2); }

dialog { padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--sombra); }
dialog::backdrop { background: rgb(4 12 8 / .62); }

#toast {
  position: fixed; bottom: var(--e5); left: 50%; transform: translateX(-50%); z-index: 10;
  max-width: min(560px, calc(100vw - 32px)); padding: var(--e3) var(--e4);
  font-size: 14px; color: #fff; background: #17251E; border-radius: var(--r); box-shadow: var(--sombra);
}

@media (prefers-reduced-motion: reduce) {
  .switch input, .switch input::after { transition: none; }
}
