:root {
  --primary: #1f4e79;
  --primary-2: #2c6aa3;
  --accent: #ffb703;
  --ok: #2a9d5b;
  --danger: #c0392b;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #687687;
  --border: #dde3ea;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; }
body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
header#topbar { position: sticky; top: 0; z-index: 1000; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top)); }
.brand { font-weight: 700; font-size: 18px; }
.net { font-size: 13px; opacity: .9; }
.net.off { background: var(--danger); padding: 2px 8px; border-radius: 10px; }
.net.pending { background: var(--accent); color: #000; padding: 2px 8px; border-radius: 10px; }
main { max-width: 900px; margin: 0 auto; padding: 16px; }
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; background: #fff;
  border-top: 1px solid var(--border); display: flex; padding-bottom: env(safe-area-inset-bottom); }
nav#tabs a { flex: 1; text-align: center; padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: 12px; }
nav#tabs a span { display: block; font-size: 20px; }
nav#tabs a.active { color: var(--primary); font-weight: 600; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 18px; margin: 18px 0 10px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; color: var(--text); }
input[type=checkbox] { width: auto; }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 12px 16px; font-size: 16px; font-weight: 600;
  background: var(--primary); color: #fff; cursor: pointer; text-decoration: none; text-align: center; }
.btn:disabled { opacity: .5; }
.btn.secondary { background: #e7edf4; color: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.btn.small { padding: 7px 10px; font-size: 14px; }
.btn.block { display: block; width: 100%; }
.btn.big { padding: 22px; font-size: 22px; border-radius: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--muted); font-size: 14px; }
.err { color: var(--danger); font-size: 14px; margin-top: 8px; }
.map { height: 300px; border-radius: var(--radius); margin-bottom: 14px; z-index: 1; }
.map.tall { height: 380px; }
.stat { display: flex; gap: 10px; margin-bottom: 14px; }
.stat > div { flex: 1; background: var(--card); border-radius: var(--radius); padding: 12px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat b { display: block; font-size: 22px; color: var(--primary); }
.stat span { font-size: 13px; color: var(--muted); }
.points { list-style: none; padding: 0; margin: 0; }
.points li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.points li:last-child { border-bottom: 0; }
.dot { width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--primary-2); }
.dot.start { background: var(--ok); } .dot.end, .dot.return { background: var(--danger); }
.points .grow { flex: 1; min-width: 0; }
.points .addr { font-weight: 500; overflow-wrap: anywhere; }
.points .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.list-item { display: block; background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
  color: inherit; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.list-item .top { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.list-item .sub { color: var(--muted); font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #e7edf4; color: var(--primary); font-weight: 600; }
.badge.open { background: #fff3cd; color: #8a6100; }
.badge.ceges { background: #e2f3ea; color: #1f6b40; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; }
.table-wrap { overflow-x: auto; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 3000;
  background: #1d2733; color: #fff; padding: 12px 16px; border-radius: 10px; text-align: center; }
#toast.error { background: var(--danger); }
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2000; display: flex; align-items: flex-end; justify-content: center; }
#modal[hidden] { display: none; }
.modal-box { background: #fff; width: 100%; max-width: 600px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { #modal { align-items: center; } .modal-box { border-radius: 16px; } }
.search-results { list-style: none; padding: 0; margin: 8px 0 0; }
.search-results li { padding: 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.search-results li:hover { background: #f0f4f8; }
.login-wrap { max-width: 380px; margin: 10vh auto 0; }
.login-wrap .logo { text-align: center; margin-bottom: 20px; }
.login-wrap .logo img { width: 72px; height: 72px; border-radius: 16px; }
.pill-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.pill-tabs a { padding: 8px 14px; border-radius: 20px; background: #e7edf4; color: var(--primary); text-decoration: none; font-weight: 600; font-size: 14px; }
.pill-tabs a.active { background: var(--primary); color: #fff; }
.gps-status { font-size: 14px; text-align: center; color: var(--muted); margin-top: 8px; min-height: 20px; }
.leaflet-marker-num { background: var(--primary-2); color: #fff; border: 2px solid #fff; border-radius: 50%;
  width: 28px !important; height: 28px !important; line-height: 24px; text-align: center; font-weight: 700; font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.leaflet-marker-num.start { background: var(--ok); }
.leaflet-marker-num.end, .leaflet-marker-num.return { background: var(--danger); }
