:root {
  --green: #009c3b;
  --green-dark: #00702a;
  --green-50: #e8f6ed;
  --yellow: #ffdf00;
  --yellow-soft: #fff6b3;
  --blue: #002776;
  --ink: #0f2418;
  --muted: #4d6356;
  --line: #d5e3da;
  --bg: #f6faf7;
  --card: #ffffff;
  --danger: #c62828;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 60, 25, .06), 0 6px 20px rgba(0, 60, 25, .07);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--green-dark); }
img { max-width: 100%; }

/* ---------- topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--green);
  color: #fff;
  border-bottom: 4px solid var(--yellow);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 20px; letter-spacing: -.2px; }
.brand b { color: var(--yellow); font-weight: 800; }
.topbar .linkish { color: #fff; font-weight: 600; }

main { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px 32px; flex: 1; }
.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- hero ---------- */
.hero {
  margin: 0 -16px 20px;
  padding: 28px 20px 30px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 223, 0, .35) 0, transparent 55%),
    linear-gradient(160deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
}
.eyebrow {
  display: inline-block; margin: 0 0 10px; padding: 4px 12px;
  background: var(--yellow); color: var(--ink);
  border-radius: 999px; font-weight: 700; font-size: 14px;
}
.hero h1 { font-size: clamp(28px, 7.5vw, 38px); line-height: 1.08; margin: 0 0 12px; letter-spacing: -.5px; }
.lead { margin: 0 0 16px; font-size: 18px; color: #eafff1; }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.pills li {
  padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .35);
}

/* ---------- escolhas ---------- */
.choices { display: grid; gap: 12px; margin-bottom: 16px; }
.choice {
  display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto;
  align-items: center; column-gap: 12px;
  width: 100%; padding: 18px; text-align: left;
  border: 0; border-radius: var(--radius); cursor: pointer;
  box-shadow: var(--shadow); font: inherit;
  transition: transform .1s ease;
}
.choice:active { transform: scale(.98); }
.choice-icon { grid-row: span 2; font-size: 34px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; }
.choice-title { font-size: 21px; font-weight: 800; }
.choice-sub { font-size: 15px; }
.choice-pass { background: var(--yellow); color: var(--ink); }
.choice-pass .choice-icon { background: rgba(255, 255, 255, .55); }
.choice-drive { background: var(--green); color: #fff; }
.choice-drive .choice-icon { background: rgba(255, 255, 255, .16); }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 16px; text-align: center;
}
.stats div { background: var(--card); border-radius: 12px; padding: 10px 6px; box-shadow: var(--shadow); }
.stats b { display: block; font-size: 24px; color: var(--green-dark); }
.stats span { font-size: 13px; color: var(--muted); }

/* ---------- cartões ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin: 0 0 14px; border: 0;
}
.card h2 { font-size: 19px; margin: 0 0 8px; }
.how ol { margin: 0; padding-left: 22px; }
.how li { margin-bottom: 8px; }
.notice { background: var(--yellow-soft); }
.notice p { margin: 0; }
.muted { color: var(--muted); font-size: 15px; }
.foot-links { text-align: center; font-size: 15px; }

/* ---------- formulário ---------- */
.back { margin: 14px 0 4px; }
#view-form h1, #view-dash h1 { font-size: 28px; margin: 6px 0 4px; letter-spacing: -.3px; }
fieldset.card { min-width: 0; }
legend { font-weight: 800; font-size: 18px; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
legend + * { clear: both; }
label, .field { display: block; margin: 12px 0; font-weight: 600; font-size: 16px; }
.field-label { display: block; margin-bottom: 6px; }
input[type=text], input:not([type]), input[type=tel], input[type=time], select {
  display: block; width: 100%; margin-top: 6px;
  padding: 13px 14px; font: inherit; font-weight: 400;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--yellow); outline-offset: 2px; border-color: var(--green);
}
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { margin: 0; flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 11px 12px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; font-weight: 600; cursor: pointer;
}
.seg input:checked + span { border-color: var(--green); background: var(--green-50); color: var(--green-dark); box-shadow: inset 0 -3px 0 var(--yellow); }
.seg input:focus-visible + span { outline: 3px solid var(--yellow); }

.check { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--green); }
.terms .check { padding: 8px 0; border-top: 1px solid var(--line); margin: 0; }

.driver-only, .passenger-only { display: none; }
body[data-role=driver] .driver-only { display: block; }
body[data-role=passenger] .passenger-only { display: grid; }

.form-error {
  background: #fdecea; color: var(--danger); border-radius: 12px; padding: 12px 14px; font-weight: 600;
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px; border: 2px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  min-height: 48px;
}
.btn:disabled { opacity: .55; cursor: wait; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-blue { background: var(--blue); color: #fff; width: 100%; }
.btn-outline { background: #fff; color: var(--green-dark); border-color: var(--green); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-big { width: 100%; font-size: 19px; padding: 16px; box-shadow: inset 0 -4px 0 var(--yellow); }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 15px; }
#btn-loc { width: 100%; }
#btn-loc.ok { background: var(--green-50); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--green-dark); text-decoration: underline; cursor: pointer; }
.linkish.danger { color: var(--danger); }

/* ---------- painel ---------- */
.me { margin-top: 16px; border-left: 6px solid var(--green); }
.me-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.me-role { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--green-dark); }
.me h2 { margin: 2px 0 6px; font-size: 22px; }
.me p { margin: 2px 0; font-size: 15px; color: var(--muted); }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.status-dot.off { background: #9aa8a0; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #e3eee7; border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.tab { border: 0; background: transparent; padding: 11px; border-radius: 10px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.tab.active { background: #fff; color: var(--green-dark); box-shadow: var(--shadow); }
.badge { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--yellow); color: var(--ink); font-size: 13px; }

.radius { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.radius label { margin: 0; white-space: nowrap; font-weight: 600; }
.radius input { flex: 1; accent-color: var(--green); }

.list { display: grid; gap: 10px; }
.item { background: var(--card); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.item h3 { margin: 0; font-size: 18px; }
.dist { font-weight: 800; color: var(--green-dark); white-space: nowrap; }
.meta { margin: 6px 0 10px; font-size: 15px; color: var(--muted); display: grid; gap: 2px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--green-50); color: var(--green-dark); }
.tag.y { background: var(--yellow-soft); color: #5c4d00; }
.tag.b { background: #e5ebf7; color: var(--blue); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { flex: 1 1 auto; }
.item.accepted { border: 2px solid var(--green); background: linear-gradient(0deg, #fff 70%, var(--green-50)); }
.contact { margin: 8px 0 10px; padding: 10px 12px; background: var(--yellow-soft); border-radius: 10px; font-size: 15px; }
.contact div { margin: 2px 0; }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); background: var(--card); border-radius: 14px; border: 2px dashed var(--line); }

.safety { margin-top: 18px; background: #eef2fb; }
.safety p { margin: 0 0 12px; }

/* ---------- diálogos ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100% - 24px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(0, 39, 18, .55); }
.dlg { padding: 20px; }
.dlg h2 { margin: 0 0 12px; font-size: 21px; }
.steps { padding-left: 22px; }
.steps li { margin-bottom: 8px; }
.dlg-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.dlg-actions .btn { flex: 1 1 auto; }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: max-content; max-width: min(480px, calc(100% - 32px)); text-align: center; padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: #fff; font-weight: 600; z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

.flagbar { display: grid; grid-template-columns: 3fr 1fr 3fr; height: 8px; }
.flagbar i:nth-child(1) { background: var(--green); }
.flagbar i:nth-child(2) { background: var(--yellow); }
.flagbar i:nth-child(3) { background: var(--blue); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.cep-row { margin-top: 10px; font-weight: 400; }
.cep-input { display: flex; gap: 8px; margin-top: 6px; }
.cep-input input { margin-top: 0; flex: 1; min-width: 0; }
.cep-input .btn { white-space: nowrap; }

.busy { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--yellow-soft); color: #5c4d00; font-weight: 600; font-size: 15px; }

/* ---------- v2: papéis, encerramento, anti-robô ---------- */
.passenger-only-block { display: none; }
body[data-role=passenger] .passenger-only-block { display: block; }
body:not([data-role=driver]) .driver-only-check { display: none; }
body[data-dash=driver] .passenger-ui { display: none !important; }
body:not([data-dash=driver]) .driver-ui { display: none !important; }
.driver-info { border-left: 6px solid var(--yellow); }
.driver-info p { margin: 0; }
.item.pending { border-left: 6px solid var(--yellow); }
.empty-actions { margin-top: 12px; }
.closed-card { background: var(--yellow-soft); border-left: 6px solid var(--blue); }
.closed-card p { margin: 0; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
select option:disabled { color: #9aa8a0; }
.doc h2 { margin-top: 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc th, .doc td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { background: var(--green-50); }
.table-wrap { overflow-x: auto; }

/* ---------- v3: alcance do motorista, aviso de localização ---------- */
.reach { display: grid; gap: 8px; }
.reach label { margin: 0; }
.reach input { position: absolute; opacity: 0; pointer-events: none; }
.reach span { display: block; padding: 11px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 400; }
.reach b { display: block; font-size: 16px; }
.reach small { color: var(--muted); font-size: 14px; }
.reach input:checked + span { border-color: var(--green); background: var(--green-50); box-shadow: inset 0 -3px 0 var(--yellow); }
.reach input:focus-visible + span { outline: 3px solid var(--yellow); }
.seg label.disabled span { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
#loc-status.warn { display: block; margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: #fdecea; color: var(--danger); font-weight: 600; }
.near-hint { margin: 0 0 10px; }

#plate-hint.bad { color: var(--danger); font-weight: 600; }
[name=plate] { text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }

.help-list { padding-left: 4px; list-style: none; margin: 0 0 8px; }
.help-list li { margin-bottom: 8px; }
/* ---------- painel de moderação ---------- */
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }
.admin-top h1 { margin: 0; font-size: 24px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.kpis div { background: var(--card); border-radius: 12px; padding: 10px 6px; text-align: center; box-shadow: var(--shadow); }
.kpis b { display: block; font-size: 22px; color: var(--green-dark); }
.kpis span { font-size: 12px; color: var(--muted); }
.rep { border-left: 6px solid var(--yellow); }
.rep.hidden-entry { border-left-color: var(--danger); }
.rep .reason { font-weight: 800; }
.rep .who { font-size: 15px; color: var(--muted); margin: 4px 0 10px; display: grid; gap: 2px; }
.filter { display: flex; gap: 8px; margin-bottom: 10px; }

/* Ônibus primeiro e aviso de abertura no domingo */
.bus-first { border-left: 5px solid var(--green); }
.rides-soon { background: #e8eefb; border-left: 5px solid var(--blue); }
.rides-soon p { margin: 0; }
