:root {
  --bg: #f6f1e8;
  --ink: #1b2a33;
  --muted: #6b7a85;
  --primary: #1b3a4b;
  --accent: #e07a3f;
  --ok: #2e8b57;
  --card: #ffffff;
  --soft: #efe7da;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
}
#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--primary); color: #fff;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.brand { font-weight: 700; }
.gps { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.15); }
.gps-off { background: #8a8a8a; }
.gps-ok { background: var(--ok); }
.gps-bad { background: #c0392b; }

#map { flex: 1 1 45%; min-height: 220px; }

#panel {
  flex: 0 0 auto; max-height: 55%; overflow-y: auto;
  background: var(--bg); padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid #ddd4c4;
}
.hidden { display: none !important; }
h1 { font-size: 20px; margin: 4px 0 6px; }
p { margin: 0 0 12px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; margin-top: 6px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; white-space: pre-wrap; }

.btn {
  border: 0; border-radius: var(--radius); padding: 12px 16px; font-size: 16px;
  cursor: pointer; width: 100%; margin-top: 8px; background: var(--soft); color: var(--ink);
}
.btn-primary { background: var(--accent); color: #fff; font-weight: 700; }
.btn-ghost { background: transparent; border: 1px solid #c9bda9; }
.btn-small { width: auto; padding: 8px 12px; font-size: 14px; margin-top: 0; white-space: nowrap; }
.btn:disabled { opacity: .5; }

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.row input[type=text] { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid #c9bda9; font-size: 16px; }
.row select { flex: 1; padding: 8px; border-radius: 10px; border: 1px solid #c9bda9; font-size: 14px; }

.mode-switch { display: flex; flex: 1; background: var(--soft); border-radius: 999px; padding: 3px; }
.mode { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 999px; font-size: 14px; }
.mode.active { background: var(--primary); color: #fff; font-weight: 700; }

.card { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card-soft { background: var(--soft); box-shadow: none; }
.card-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card-title { font-size: 18px; font-weight: 700; margin: 2px 0; }
.card-sub { font-size: 14px; color: var(--muted); }
.controls { display: flex; gap: 8px; }
.controls .btn-primary { flex: 1; }
.controls .btn-ghost { width: 56px; }
.progress { height: 4px; background: var(--soft); border-radius: 2px; margin-top: 10px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .3s linear; }

#stop-list { list-style: none; padding: 0; margin: 0 0 10px; }
#stop-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card); border-radius: 12px; margin-bottom: 6px; cursor: pointer;
}
#stop-list li .num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft); font-weight: 700; flex-shrink: 0;
}
#stop-list li.done .num { background: var(--ok); color: #fff; }
#stop-list li.near { outline: 2px solid var(--accent); }
#stop-list li.locked { opacity: .55; }
#stop-list li .info { flex: 1; min-width: 0; }
#stop-list li .name { font-weight: 600; font-size: 15px; }
#stop-list li .dist { font-size: 12px; color: var(--muted); }

.check { display: block; font-size: 14px; margin: 6px 0; }
.range { display: block; font-size: 14px; margin: 8px 0; }
.range input { width: 100%; }
textarea { width: 100%; border-radius: 10px; border: 1px solid #c9bda9; padding: 8px; font-size: 12px; font-family: ui-monospace, monospace; }

/* Marcadores del mapa */
.stop-marker {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.stop-marker.done { background: var(--ok); }
.stop-marker.locked { background: #8a8a8a; }
.me-marker { width: 16px; height: 16px; border-radius: 50%; background: #2d7ff9; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(45,127,249,.3); }
