/* Mobile-first, alto contraste (fundo preto, texto branco, destaque amarelo), botões grandes para uso com luvas. */

:root {
  --bg: #000;
  --panel: #161616;
  --line: #3a3a3a;
  --text: #fff;
  --muted: #d0d0d0;
  --accent: #ffd400;     /* amarelo: ação principal, contraste 15:1 com o preto */
  --ok: #2ecc40;
  --bad: #ff4136;
  --warn: #ffb000;
  --info: #00b3ff;
  --radius: 14px;
}

* { box-sizing: border-box; }
/* Garante que o atributo hidden esconda elementos mesmo quando uma classe define display (ex.: .btn) */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: env(safe-area-inset-bottom); }

h1 { margin: 0; font-size: 1.6rem; color: var(--accent); }
h2 { font-size: 1.25rem; margin: 0 0 .6rem; }
h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; }

.topbar {
  position: sticky; top: 0; z-index: 1000;
  padding: .75rem 1rem;
  background: #000;
  border-bottom: 3px solid var(--accent);
}

main { padding: .75rem; max-width: 760px; margin: 0 auto; }

.card {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: .6rem;
  color: var(--muted);
}

input[type="text"], input[type="number"], select, .note {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .7rem .8rem;
  font: inherit;
  color: var(--text);
  background: #000;
  border: 2px solid #777;
  border-radius: 10px;
}

input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; }

/* Botões: mínimo de 52px de altura para toque com luva. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px;
  padding: .6rem 1rem;
  font: inherit; font-weight: 700;
  color: var(--text);
  background: #2b2b2b;
  border: 2px solid #888;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  flex: 1 1 auto;
  text-align: center;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #000; border-color: var(--accent); }
.btn.big { min-height: 60px; font-size: 1.1rem; }
.btn.small { min-height: 52px; padding: .3rem .7rem; font-size: .95rem; flex: 0 0 auto; }
.btn.ok { background: var(--ok); color: #000; border-color: var(--ok); }
.btn.bad { background: var(--bad); color: #000; border-color: var(--bad); }
.btn.danger { background: #000; color: var(--bad); border-color: var(--bad); }
.btn.waze { background: var(--info); color: #000; border-color: var(--info); width: 100%; margin-top: .5rem; }
.btn.active { background: var(--info); color: #000; border-color: var(--info); }
.btn-row .btn { flex: 1 1 45%; }

.hint { color: var(--muted); font-size: .92rem; margin: .4rem 0; }
.warn-text { color: var(--warn); font-weight: 600; font-size: .95rem; }
code { background: #000; padding: 0 .3rem; border-radius: 4px; }

.notice {
  margin: .4rem 0 0;
  padding: .6rem .8rem;
  border-radius: 10px;
  background: #1f2a44;
  color: #fff;
  font-size: .95rem;
}
.notice.warn { background: #3d2e00; border-left: 6px solid var(--warn); }
.notice.error { background: #3d0000; border-left: 6px solid var(--bad); }
.notice.ok { background: #00260d; border-left: 6px solid var(--ok); }

details.sub { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
details.sub summary { font-weight: 700; cursor: pointer; min-height: 52px; display: flex; align-items: center; }
input[type="file"] { color: var(--text); margin-top: .5rem; }

.geo-results { list-style: none; padding: 0; margin: .5rem 0; }
.geo-results li { margin-bottom: .4rem; }
.geo-results .btn { width: 100%; text-align: left; font-weight: 500; font-size: .95rem; }

/* Mapa */
.map-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
#map {
  height: 42vh;
  min-height: 260px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  margin: .4rem 0;
  z-index: 0;
}
/* Marcadores em forma de pino com contraste alto. */
.pin {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 3px solid #000;
  font-weight: 800; font-size: 15px; color: #000;
  box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.pin-depot { background: #fff; font-size: 17px; }
.pin-pending { background: var(--accent); }
.pin-delivered { background: var(--ok); }
.pin-failed { background: var(--bad); color: #fff; }

/* Resumo */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .8rem 0; }
.stat {
  background: #000; border: 2px solid var(--line); border-radius: 12px;
  padding: .6rem .3rem; text-align: center;
}
.stat-val { display: block; font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat-lbl { display: block; font-size: .8rem; color: var(--muted); }

/* GPS e próxima parada */
.gps-box { margin: .8rem 0; }
.next-box {
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: .8rem;
  margin: .8rem 0;
  background: #000;
}
.next-title { margin: 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 800; }
.next-text { margin: .2rem 0 0; font-size: 1.15rem; font-weight: 700; }
.next-text small { font-weight: 400; color: var(--muted); }
.nav-box { margin: .6rem 0 1rem; }

/* Lista de paradas */
.list-title { margin-top: 1.2rem; }
.stop-list { list-style: none; padding: 0; margin: 0; }
.stop {
  background: #000;
  border: 2px solid var(--line);
  border-left: 8px solid var(--accent);
  border-radius: 12px;
  padding: .8rem;
  margin-bottom: .8rem;
}
.stop.is-next { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent) inset; }
.stop.s-delivered { border-left-color: var(--ok); opacity: .75; }
.stop.s-failed { border-left-color: var(--bad); }

.stop-head { display: flex; gap: .6rem; align-items: flex-start; }
.num {
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #000; font-weight: 800;
}
.stop.s-delivered .num, .stop.s-failed .num { background: #555; color: #fff; }
.stop-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stop-info strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.stop-info small { color: var(--muted); overflow-wrap: anywhere; }
.badge { flex: 0 0 auto; font-size: .8rem; font-weight: 800; padding: .25rem .5rem; border-radius: 8px; }
.b-pending { background: var(--accent); color: #000; }
.b-delivered { background: var(--ok); color: #000; }
.b-failed { background: var(--bad); color: #000; }

.stop .note { margin: .6rem 0; font-size: .95rem; }
.stop .actions { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.stop .actions .big { grid-column: span 2; }

/* Rodapé de limitações */
.limits { color: var(--muted); font-size: .92rem; padding: .5rem 0 2rem; }
.limits h2 { color: var(--warn); font-size: 1.05rem; }
.limits ul { padding-left: 1.2rem; }

/* Telas largas: duas colunas para formulários */
@media (min-width: 900px) {
  main { max-width: 1100px; }
  #map { height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
  html { scroll-behavior: auto !important; }
}
