:root {
  --bg: #f4f1ea; --card: #ffffff; --txt: #1d2621; --muted: #6b7566; --linha: rgba(0,0,0,.07);
  --verde: #2a8191; --verde2: #45a58a; --verde3: #8fd06f; --escuro: #0f2b31;
  --ambar: #c98a1b; --verm: #b8432f; --ok: #2f8f5a;
  --raio: 18px; --sombra: 0 2px 14px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1a1d; --card: #15262a; --txt: #e6efe9; --muted: #95a8a0; --linha: rgba(255,255,255,.08); --sombra: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--txt); min-height: 100vh; }
main { max-width: 440px; margin: 0 auto; padding: 22px 16px 40px; }
main.largo { max-width: 860px; }
a { color: var(--verde); }
[hidden] { display: none !important; }

/* marca */
.marca { text-align: center; margin: 6px 0 22px; }
.marca img { height: 150px; display: block; margin: 0 auto 10px; filter: drop-shadow(0 8px 18px rgba(42,129,145,.25)); }
.marca.pequena img { height: 64px; margin-bottom: 6px; }
.marca h1 { margin: 0; font-size: 1.8rem; font-weight: 800; letter-spacing: .06em; line-height: 1.1;
  background: linear-gradient(90deg, var(--verde3), var(--verde2) 45%, var(--verde)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.marca.pequena h1 { font-size: 1.15rem; }
.marca .empresa { color: var(--muted); font-weight: 600; letter-spacing: .12em; font-size: .9rem; margin-top: 4px; }

/* blocos */
.card { background: var(--card); border-radius: var(--raio); padding: 20px; box-shadow: var(--sombra); margin-bottom: 14px; }
.card h2 { font-size: 1.02rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.pequeno { font-size: .85rem; }
.linha { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.linha:last-child { border-bottom: 0; }

/* formulários */
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea { width: 100%; font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--linha); background: var(--bg); color: var(--txt); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--verde2); outline-offset: 1px; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.btn { display: inline-block; width: 100%; margin-top: 16px; padding: 13px 16px; border: 0; border-radius: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(160deg, var(--verde2), var(--verde)); text-align: center; text-decoration: none; }
.btn:disabled { opacity: .55; }
.btn.sec { background: none; color: var(--verde); border: 1.5px solid var(--verde); }
.btn.perigo { background: none; color: var(--verm); border: 1.5px solid var(--verm); }
.btn.auto { width: auto; margin-top: 0; padding: 8px 14px; font-size: .9rem; }
.ligacao { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 6px 0; font-size: .9rem; }
.erro { color: var(--verm); font-size: .9rem; min-height: 1.2em; margin-top: 10px; }
.sucesso { color: var(--ok); }

/* botão grande do portão */
.portao { text-align: center; }
.portao .nome { font-weight: 700; font-size: 1.15rem; }
.portao .estado { font-size: 1.7rem; font-weight: 800; margin: 6px 0 2px; }
.portao .sub { color: var(--muted); font-size: .88rem; }
.grande { margin: 22px auto 6px; width: 190px; height: 190px; border-radius: 50%; border: 0; color: #fff; font-size: 1.2rem; font-weight: 800;
  background: linear-gradient(160deg, var(--verde2), var(--verde)); box-shadow: 0 10px 26px rgba(42,129,145,.35); transition: transform .1s; display: block; }
.grande:active { transform: scale(.96); }
.grande:disabled { background: #8a9a96; box-shadow: none; }
.e-fechado { color: var(--ok); } .e-aberto { color: var(--verm); } .e-mov { color: var(--ambar); } .e-off { color: var(--muted); }

/* lista de portões */
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 4px; border-bottom: 1px solid var(--linha); cursor: pointer; }
.item:last-child { border-bottom: 0; }
.ponto { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; background: var(--muted); }
.ponto.on { background: var(--ok); }
.etiqueta { font-size: .78rem; padding: 3px 9px; border-radius: 99px; background: var(--linha); color: var(--muted); white-space: nowrap; }

/* histórico */
.hist { list-style: none; padding: 0; margin: 0; }
.hist li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--linha); font-size: .9rem; }
.hist li:last-child { border-bottom: 0; }
.hist time { color: var(--muted); white-space: nowrap; font-size: .82rem; }

/* caixa para copiar */
.copiar { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.copiar code { flex: 1; font-size: .78rem; padding: 10px; border-radius: 10px; background: var(--bg); word-break: break-all; border: 1px dashed var(--linha); }
.copiar button { border: 1px solid var(--verde); color: var(--verde); background: none; border-radius: 10px; padding: 0 12px; font-size: .85rem; }

.topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.voltar { background: none; border: 0; color: var(--muted); font-size: .95rem; padding: 6px 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--linha); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
pre { background: var(--bg); padding: 10px; border-radius: 10px; font-size: .75rem; overflow: auto; max-height: 260px; }
