/* Estilos partilhados por todas as páginas */
:root {
  --fundo: #0b110d;
  --cartao: #141d17;
  --cartao2: #1b261f;
  --linha: #2a3a2f;
  --texto: #eef3ef;
  --suave: #9aab9f;
  --verde: #2b9446;
  --verde-forte: #43c564;
  --ambar: #f0b23a;
  --vermelho: #e5534b;
  --azul: #5aa8e6;
  --raio: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--verde-forte); }
h1, h2, h3 { line-height: 1.2; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea {
  font: inherit;
  color: var(--texto);
  background: var(--cartao2);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--verde-forte); outline-offset: 1px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px;
  border-radius: 10px; background: var(--cartao2); border: 1px solid var(--linha);
  font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--texto);
}
.btn:active { transform: translateY(1px); }
.btn.primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.perigo { color: var(--vermelho); }
.btn.perigo-cheio { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.btn.pequeno { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.largo { width: 100%; min-height: 52px; font-size: 17px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

.topo {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(11, 17, 13, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linha);
}
.topo h1 { font-size: 19px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voltar { font-size: 24px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; margin-left: -8px; }
.voltar:active { background: var(--cartao2); }

.ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--vermelho); flex: none; box-shadow: 0 0 0 3px rgba(229, 83, 75, .2); }
.ponto.ligado { background: var(--verde-forte); box-shadow: 0 0 0 3px rgba(67, 197, 100, .2); }

.suave { color: var(--suave); }
.verde { color: var(--verde-forte); }
.ambar { color: var(--ambar); }
.vazio { padding: 40px 16px; text-align: center; color: var(--suave); }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: var(--ambar); color: #1a1200; font-size: 13px; font-weight: 800;
}

/* Janela que sobe do fundo */
.veu {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .6);
  display: flex; align-items: flex-end; justify-content: center;
  animation: aparece .15s;
}
.folha {
  background: var(--cartao); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sobe .2s ease-out;
}
@media (min-width: 700px) {
  .veu { align-items: center; }
  .folha { border-radius: 18px; }
}
.folha h2 { margin: 0 0 12px; font-size: 20px; }
.veu-pin { z-index: 70; background: var(--fundo); align-items: center; }
.veu-pin .folha { border-radius: 18px; max-width: 360px; margin: 16px; }
.veu-pin input { font-size: 24px; letter-spacing: 6px; text-align: center; }
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-size: 13px; color: var(--suave); margin-bottom: 5px; }
.acoes { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.acoes .btn { flex: 1 1 auto; }
.opcoes-escolha { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 14px; }
.opcoes-escolha button {
  min-height: 52px; border-radius: 10px; border: 1px solid var(--linha); background: var(--cartao2); font-weight: 600; padding: 6px;
}
.opcoes-escolha button[aria-pressed="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 48px; height: 48px; border-radius: 10px; background: var(--cartao2); border: 1px solid var(--linha); font-size: 22px; font-weight: 700; }
.stepper output { min-width: 32px; text-align: center; font-size: 22px; font-weight: 700; }

/* Avisos */
.avisos {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: calc(100% - 32px); max-width: 440px;
}
.aviso {
  background: #eef3ef; color: #0b110d; padding: 11px 16px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); animation: sobe .2s; text-align: center;
}
.aviso.pronto { background: var(--verde-forte); color: #04130a; font-size: 17px; }
.aviso.erro { background: var(--vermelho); color: #fff; }

@keyframes aparece { from { opacity: 0; } }
@keyframes sobe { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
