:root {
  --ink: #14241c;
  --soft: #4d6157;
  --paper: #f3efe6;
  --card: #fffdf8;
  --line: #e4dccb;
  --signal: #e25b16;
  --signal-deep: #b8430c;
  --moss: #1f6b45;
  --moss-soft: #e7f3ec;
  --miss: #9d3b32;
  --miss-soft: #f8e8e5;
  --issue: #8a5a12;
  --issue-soft: #f8efd8;
  --shadow: 0 24px 60px rgba(20, 36, 28, 0.08);
  --sans: "Montserrat", "Segoe UI", sans-serif;
  --serif: "Montserrat", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }

.brand-link { text-decoration: none; display: inline-flex; }
.logo { height: 44px; width: auto; display: block; background: transparent; }
.foot .logo { height: 32px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}
.btn.solid { background: var(--ink); color: #f7f3ea; }
.btn.solid:hover { background: #24382e; }
.btn.ghost { background: transparent; border-color: #c9bfae; }
.btn.ghost.light { border-color: rgba(255,255,255,.35); color: white; }
.btn.signal { background: var(--signal); color: white; }
.btn.signal:hover { background: var(--signal-deep); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.92rem; }
.btn.danger { background: transparent; border-color: #e4c4be; color: var(--miss); }
.btn:disabled { opacity: 0.55; cursor: wait; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--signal-deep);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.muted { color: var(--soft); }
.alert {
  background: var(--miss-soft);
  color: var(--miss);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px 7vw;
}
.nav nav { display: flex; gap: 18px; margin-left: auto; }
.nav nav a { text-decoration: none; color: var(--soft); }
.nav-cta { margin-left: 8px; }

.hero, .steps, .features, .split, .closing, .foot {
  padding-left: 7vw;
  padding-right: 7vw;
}
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
  padding-top: 18px;
  padding-bottom: 64px;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; }
h1 { font-size: clamp(2.6rem, 5vw, 4.6rem); line-height: 0.98; margin: 0 0 16px; }
h2 { font-size: clamp(2rem, 3vw, 3rem); line-height: 1.05; margin: 0 0 18px; }
.lede { font-size: 1.15rem; color: var(--soft); max-width: 38rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.board {
  background: var(--ink);
  color: #f4efe4;
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.board-top, .live-pill { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.live-pill {
  justify-content: flex-start;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
}
.live-pill i, .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #7ddea8; display: inline-block;
  box-shadow: 0 0 0 0 rgba(125, 222, 168, 0.7);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(125, 222, 168, 0); }
}
.board-map { position: relative; margin-top: 12px; }
.route-svg { width: 100%; height: auto; opacity: 0.9; }
.ticket {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  background: #fffdf8;
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 8px;
}
.ticket b {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--paper); font-family: var(--serif);
}
.ticket strong, .ticket em { display: block; }
.ticket em { font-style: normal; color: var(--soft); font-size: 0.9rem; }
.ticket.done b { background: var(--moss-soft); color: var(--moss); }
.ticket.miss b { background: var(--miss-soft); color: var(--miss); }

.steps { padding-top: 20px; padding-bottom: 70px; }
.steps ol {
  list-style: none; padding: 0; margin: 28px 0 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.steps li {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px;
  min-height: 220px;
}
.steps li span { font-family: var(--serif); color: var(--signal); font-size: 1.4rem; }
.steps h3, .features h3 { margin: 10px 0 8px; font-size: 1.45rem; }
.steps p, .features p { margin: 0; color: var(--soft); }

.features { padding-bottom: 70px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid article {
  padding: 22px; border-radius: 22px; background: var(--card); border: 1px solid var(--line);
}

.split {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center;
  padding-bottom: 80px;
}
.ticks { padding: 0; margin: 18px 0 0; list-style: none; }
.ticks li { padding: 8px 0 8px 28px; position: relative; }
.ticks li:before { content: ""; position: absolute; left: 0; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--signal); }

.phone {
  background: var(--ink); color: #f6f1e7; border-radius: 36px; padding: 22px 18px 18px;
  max-width: 340px; justify-self: end; box-shadow: var(--shadow);
}
.phone-bar, .phone-stop { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.phone-bar span, .phone-stop small { color: #d9cbb6; }
.phone-title { font-family: var(--serif); font-size: 1.5rem; margin: 18px 0; }
.phone-stop { background: rgba(255,255,255,.05); border-radius: 16px; padding: 12px; margin-bottom: 8px; }
.phone-stop em {
  font-style: normal; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--signal); color: white; font-weight: 600;
}
.phone-stop strong, .phone-stop small { display: block; }
.phone-btn {
  margin-top: 14px; text-align: center; background: var(--signal); color: white;
  border-radius: 999px; padding: 12px; font-weight: 600;
}

.closing {
  margin: 0 7vw 70px; padding: 42px; border-radius: 32px; background: var(--ink); color: white;
}
.closing p { color: #d7ccbc; max-width: 36rem; }
.closing .btn { margin-right: 8px; }
.closing .btn.solid { background: white; color: var(--ink); }

.foot {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  padding-top: 10px; padding-bottom: 28px; color: var(--soft);
}
.foot a { text-decoration: none; }

.gate, .auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.auth-page { align-content: center; justify-items: center; gap: 18px; }
.gate-card, .auth-card {
  width: min(460px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 28px; padding: 28px; box-shadow: var(--shadow);
}
.gate-card h1, .auth-card h1 { font-size: 2.2rem; margin: 0 0 8px; }
label { display: block; margin: 18px 0 8px; font-weight: 600; font-size: 0.92rem; }
input, select, textarea {
  width: 100%; background: white; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; outline: none;
}
select, input[type="date"] { border-radius: 999px; }
textarea { min-height: 140px; resize: vertical; border-radius: 18px; }
input:focus, select:focus, textarea:focus { border-color: #b9aa90; box-shadow: 0 0 0 4px rgba(226, 91, 22, 0.12); }
.gate-card form > .btn, .auth-card form > .btn { width: 100%; margin-top: 28px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.form-actions .btn { width: auto; margin-top: 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.tabs a { text-align: center; text-decoration: none; padding: 8px; border-radius: 999px; color: var(--soft); }
.tabs a.on { background: white; color: var(--ink); font-weight: 600; }
.quiet-link { text-decoration: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; align-items: start; }
.side {
  background: var(--ink); color: #f4efe4; padding: 22px 16px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.side .logo { height: 40px; background: transparent; }
.side .brand-link { display: block; padding: 0; background: transparent; border-radius: 0; }
.side .brand-link:hover { background: transparent; }
.side .co { margin: 0; color: #d9ccb8; font-size: 0.92rem; }
.side nav { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; overflow: auto; }
.side button, .text-btn {
  background: transparent; border: 0; color: inherit; text-align: left; padding: 10px 12px;
  border-radius: 12px; cursor: pointer;
}
.side button.on, .side button:hover { background: rgba(255,255,255,.08); }
.side button.brand-link, .side button.brand-link:hover { width: auto; padding: 0; background: transparent; }
.side-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; color: #d9ccb8; font-size: 0.92rem; }
.side-foot a { color: white; }
.main { padding: 22px 22px 40px; }
.top { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.top-left { display: flex; align-items: end; gap: 12px; }
.top label { font-size: 0.85rem; font-weight: 600; color: var(--soft); margin: 0; }
.top input { margin-top: 8px; width: auto; }
.update-box { display: flex; align-items: center; gap: 14px; }
.update-box time { color: var(--soft); font-variant-numeric: tabular-nums; font-size: 0.92rem; white-space: nowrap; }
#reload { gap: 8px; }
#reload svg { width: 18px; height: 18px; flex: none; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat, .card, .driver-card, .stop {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
}
.stat { padding: 14px 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 1.8rem; line-height: 1; }
.stat span { color: var(--soft); font-size: 0.88rem; }
.layout { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; }
.card { padding: 16px; }
.card h3 { margin: 0 0 12px; }
.row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.row:first-of-type { border-top: 0; }
.person { display: flex; gap: 10px; align-items: center; }
.avatar, .mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: white; font-weight: 600; flex: none;
}
.pill {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px;
  font-size: 0.78rem; font-weight: 600; background: #ece7dc; color: var(--soft);
}
.pill.on { background: var(--moss-soft); color: var(--moss); }
.pill.off { background: #eee; color: #777; }
.st-pending { background: #5c6b64; }
.st-delivered { background: var(--moss); }
.st-absent { background: var(--miss); }
.st-issue { background: var(--issue); }
.tag-pending { background: #ece7dc; color: #3e4a45; }
.tag-delivered { background: var(--moss-soft); color: var(--moss); }
.tag-absent { background: var(--miss-soft); color: var(--miss); }
.tag-issue { background: var(--issue-soft); color: var(--issue); }

.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 18px; }
.driver-search { position: relative; flex: 1; min-width: 220px; }
.driver-search input { margin: 0; }
.driver-results {
  position: fixed; z-index: 2200; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 6px; max-height: 280px; overflow: auto;
  box-shadow: var(--shadow); display: grid; gap: 4px;
}
.driver-results[hidden] { display: none !important; }
.driver-results button {
  border: 0; background: transparent; border-radius: 12px; padding: 8px 10px;
  text-align: left; font: inherit; cursor: pointer; display: grid;
}
.driver-results button:hover { background: var(--paper); }
.gps-puck { width: 36px; height: 36px; position: relative; display: block; }
.gps-dot {
  position: absolute; left: 8px; top: 8px; width: 16px; height: 16px; border-radius: 50%;
  background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26,115,232,.28);
}
.gps-puck.live .gps-dot { box-shadow: 0 0 0 8px rgba(26,115,232,.38); }
.gps-arrow {
  position: absolute; left: 13px; top: 1px; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 9px solid #1a73e8; transform-origin: 5px 17px;
}
.fleet-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr); gap: 18px; align-items: start; }
.fleet { display: grid; grid-template-columns: 1fr; gap: 14px; }
.driver-card { padding: 14px; display: grid; gap: 12px; }
.driver-card.on { box-shadow: inset 0 0 0 2px var(--ink); }
.driver-head { min-width: 0; }
.driver-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px; min-width: 0;
  background: transparent; border: 0; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.driver-toggle .who { min-width: 0; flex: 1; }
.driver-toggle .who strong, .driver-toggle .who .meta { display: block; }
.driver-toggle .pill { flex: none; }
.driver-actions { display: flex; align-items: center; gap: 8px; }
.route-editor { display: grid; gap: 12px; align-content: start; }
.route-editor h3 { margin: 0; }
.route-editor .stops { display: grid; gap: 8px; }
.route-editor .return-leg { margin: 0; }
.menu-pin { margin: 2px 6px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.menu-pin .pin { font-size: 1rem; }
.driver-actions .btn { flex: 1; justify-content: center; }
.driver-body { display: grid; gap: 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: white;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; color: var(--ink);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.add-row { margin-top: 10px; }
.addr-rows { display: grid; gap: 10px; margin-top: 8px; }
.addr-row { display: grid; grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; }
.addr-row input { margin: 0; }
.addr-row .kind-picks { grid-column: 1 / 3; }
.kind-picks { display: flex; gap: 8px; align-items: center; }
.kind-picks .btn.on { background: var(--ink); color: #f7f3ea; border-color: var(--ink); }
.place-search { position: relative; }
.place-search:focus-within { z-index: 30; }
.place-hits {
  position: absolute; left: 0; right: 0; top: calc(100% - 2px); z-index: 8;
  background: white; border: 1px solid var(--line); border-radius: 14px;
  max-height: 220px; overflow: auto; box-shadow: var(--shadow);
}
.place-hits button {
  display: grid; width: 100%; text-align: left; background: transparent; border: 0;
  border-bottom: 1px solid var(--line); padding: 8px 12px; cursor: pointer; font: inherit;
}
.place-hits p { margin: 0; padding: 8px 12px; }
.place-row > span, .stop > div { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.stop-title { font-weight: 700; }
.stop-title .pill { margin-left: 6px; vertical-align: 1px; font-weight: 650; }
.place-row .meta, .stop .meta { flex-basis: 100%; }
.oz-stop-pop .leaflet-popup-content-wrapper { border-radius: 14px; }
.oz-stop-pop .leaflet-popup-content { margin: 10px 12px; }
.pin-pop { display: grid; gap: 2px; min-width: 140px; max-width: 220px; }
.pin-pop strong, .pin-pop span { line-height: 1.25; }
.pin-pop span, .pin-pop em { font-style: normal; font-size: 0.82rem; color: var(--soft); }
.pin-pop em.pickup { color: #8a5a12; }
.pin-pop em.delivery { color: var(--moss); font-weight: 650; }
.addr-rows .addr-row:only-child [data-action="remove-row"] { visibility: hidden; }
#fleet-map { height: calc(100vh - 140px); min-height: 460px; border-radius: 0; border: 0; background: #e7e1d4; position: sticky; top: 16px; isolation: isolate; z-index: 0; }
.shell.flota-on { height: 100vh; overflow: hidden; }
.shell.flota-on .main {
  padding: 0; height: 100vh; min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
}
.shell.flota-on .top { display: none; }
.shell.flota-on #screen, .shell.flota-on .fleet-layout { display: contents; }
.shell.flota-on .fleet-pane { grid-column: 1; grid-row: 1 / span 2; min-height: 0; overflow: auto; padding: 16px 16px 24px; }
.route-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; position: relative; }
.route-heading h3 { margin: 0; font-size: 1.45rem; }
.route-heading .text-btn { padding: 0; text-decoration: underline; font-weight: 600; }
.date-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.shell.flota-on #fleet-map {
  grid-column: 2; grid-row: 1 / span 2; height: 100%; width: 100%; min-height: 0;
  border: 0; border-radius: 0; position: relative; top: auto; isolation: isolate; z-index: 0;
}
.places-page { padding-bottom: 12px; }
.place-list { display: grid; gap: 10px; margin-top: 16px; }
.place-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px;
}
#saved-pop {
  position: fixed; inset: 0; z-index: 2300; display: grid; place-items: center;
  padding: 24px; background: rgba(16, 24, 20, .5);
}
#saved-pop .sheet { width: min(520px, 100%); }
#saved-pop .saved-list { max-height: min(460px, 55vh); }
.saved-list { display: grid; gap: 8px; overflow: auto; margin-top: 8px; }
.source-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.source-actions .btn { width: auto; }
.saved-place {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center;
  margin: 0; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--paper); font-weight: 500;
}
.saved-place input { width: auto; }
.saved-place .meta { display: block; font-weight: 400; }
.place-row input { width: auto; }
.place-row .meta { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.chips .btn.on { background: var(--ink); color: #f7f3ea; }
.pin {
  font-family: "Courier New", ui-monospace, monospace; font-size: 1.35rem; letter-spacing: 0.18em;
  background: var(--paper); display: inline-block; padding: 6px 10px; border-radius: 10px;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.stop { padding: 12px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; background: var(--paper); }
.stop .actions { grid-column: 1 / -1; margin-top: 0; flex-wrap: nowrap; justify-content: flex-end; }
.icon-btn.danger { color: var(--miss); border-color: transparent; background: transparent; }
.status-btn { border: 0; cursor: pointer; }
.picker-menu {
  position: fixed; z-index: 2200; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 8px; display: grid; gap: 6px; min-width: 168px;
  box-shadow: var(--shadow);
}
.picker-menu button {
  border: 0; background: var(--paper); border-radius: 999px; padding: 8px 14px;
  text-align: left; font: inherit; font-weight: 600; cursor: pointer;
}
.picker-menu button:hover, .picker-menu button.on { background: #efe6d6; }
.picker-menu button.danger { color: var(--miss); }
.meta { color: var(--soft); font-size: 0.9rem; }
.empty { padding: 28px; text-align: center; color: var(--soft); }

.map-layout { display: grid; grid-template-columns: 320px 1fr; gap: 12px; min-height: calc(100vh - 150px); }
#map { min-height: 560px; border-radius: 22px; border: 1px solid var(--line); background: #e7e1d4; }
.map-side { overflow: auto; max-height: calc(100vh - 150px); }
.oz-div { background: transparent !important; border: 0 !important; overflow: visible !important; display: grid !important; place-items: center; }
.mark { border: 2px solid white; box-shadow: 0 8px 16px rgba(20,36,28,.25); }
.shell .btn.signal { background: var(--ink); color: #f7f3ea; }
.shell .btn.signal:hover { background: #24382e; }
.mark.here, .avatar.here { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.mark.passed.st-delivered, .avatar.passed.st-delivered { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--moss); }
.mark.passed.st-absent, .avatar.passed.st-absent { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--miss); }
.mark.passed.st-issue, .avatar.passed.st-issue { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--issue); }
.stop.here { box-shadow: inset 0 0 0 2px var(--ink); }
.mark.driver { border-radius: 12px; }
.mark.start {
  width: auto; height: auto; padding: 3px 8px; border-radius: 999px;
  background: #163028; font-size: 0.72rem; letter-spacing: 0.02em;
}
.avatar.depot, .mark.depot { background: #1c3d66; }
.fact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 14px; }
.fact-grid article { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; min-width: 0; }
.fact-grid span { display: block; color: var(--soft); font-size: 0.75rem; font-weight: 650; line-height: 1.25; }
.fact-grid strong { display: block; margin-top: 6px; font-size: 1.05rem; line-height: 1.2; }
.fact-grid.report-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 12px; }
.live-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.live-stats article { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 7px; }
.live-stats b { display: block; font-size: 1.15rem; line-height: 1; }
.live-stats span { color: var(--soft); font-size: 0.68rem; font-weight: 650; }
.live-stats .warn b { color: var(--issue); }
.live-online { display: grid; gap: 6px; margin-bottom: 10px; }
.live-online > div { display: flex; flex-wrap: wrap; gap: 6px; }
.live-chip, .live-alert {
  border: 1px solid var(--line); background: white; border-radius: 999px; padding: 5px 10px;
  font: inherit; cursor: pointer; color: inherit; text-align: left;
}
.live-chip { display: inline-flex; align-items: center; gap: 6px; }
.live-chip i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.live-alerts { display: grid; gap: 8px; }
.live-alert { display: grid; border-radius: 14px; padding: 8px 10px; }
.live-alert strong, .live-alert .meta { display: block; }
.report-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr); gap: 16px; align-items: start; }
.report-layout.solo { grid-template-columns: 1fr; }
.report-kpis { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.report-list { display: grid; }
.report-driver, .report-hero {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
}
.report-driver { padding: 12px 0; border-top: 1px solid var(--line); }
.report-list .report-driver:first-child { border-top: 0; padding-top: 0; }
.report-hero { margin-bottom: 14px; }
.report-driver > div, .report-hero > div { min-width: 0; }
.report-driver .meta, .report-hero .meta { display: block; }
.report-hero h3, .report section h3, .card h3 { margin: 0 0 8px; }
.report-side { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 240px; }
.report .card { margin-bottom: 14px; }
.meter { display: block; height: 8px; margin-top: 8px; background: #ece7dc; border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--moss); }
.meter-row { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.meter-row .meter { flex: 1; margin: 0; }
#report-map { height: min(72vh, 680px); min-height: 360px; border-radius: 18px; border: 1px solid var(--line); background: #e7e1d4; position: sticky; top: 12px; }
.leaflet-tooltip.depot-label {
  background: #1c3d66; color: white; border: 0; border-radius: 999px;
  padding: 2px 8px; font-weight: 700; box-shadow: none;
}
.leaflet-tooltip.depot-label::before { display: none; }
.route-legend { display: flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 22px; height: 4px; border-radius: 99px; }
.swatch.done { background: #7d8b84; }
.swatch.todo { background: #e25b16; }

#modal { display: none; position: fixed; inset: 0; background: rgba(16, 24, 20, .46); z-index: 2000; padding: 24px; }
#modal.on { display: grid; place-items: center; }
.sheet {
  width: min(560px, 100%); background: var(--card); border-radius: 24px; padding: 22px;
  max-height: calc(100vh - 48px); overflow: auto;
}
.sheet h3 { margin-top: 0; font-size: 1.8rem; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 20px; font-weight: 500; }
.check input { width: auto; }
#toast {
  position: fixed; bottom: 18px; right: 18px; background: var(--ink); color: white;
  padding: 12px 14px; border-radius: 14px; display: none; z-index: 2100; max-width: 320px;
}
#toast.on { display: block; }
.boot { padding: 48px; }

.shell, .main, #screen, .fleet-pane, .route-editor, .card, .place-row, .stop, .driver-card, .report, .report-layout, .fleet-layout { min-width: 0; }
.shell { max-width: 100%; }
input, select, textarea, button { max-width: 100%; }
.stop strong, .place-row strong, .who strong, .meta, .live-stats span, .fact-grid span, .fact-grid strong { overflow-wrap: anywhere; }
#fleet-map, #report-map, #map { width: 100%; max-width: 100%; }
.leaflet-container { max-width: 100%; }

@media (max-width: 980px) {
  .hero, .steps ol, .grid, .split, .layout, .map-layout { grid-template-columns: 1fr; }
  .phone { justify-self: start; }
  .nav { padding: 16px; gap: 12px; }
  .nav nav { display: none; }
  .hero, .steps, .features, .split, .closing, .foot { padding-left: 16px; padding-right: 16px; }
  .closing { margin-left: 16px; margin-right: 16px; padding: 24px; }
  .steps ol { grid-template-columns: 1fr; }
  .steps li { min-height: 0; }

  .shell { grid-template-columns: 1fr; }
  .main { padding: 16px 16px 28px; }
  .top, .update-box, .toolbar, .route-heading, .driver-actions, .form-actions, .source-actions { flex-wrap: wrap; }
  .top { align-items: stretch; margin-bottom: 16px; }
  .update-box { width: 100%; justify-content: space-between; }
  .update-box time { white-space: normal; }
  .toolbar { align-items: stretch; gap: 10px; }
  .driver-search { min-width: 0; width: 100%; flex: 1 1 100%; }
  .toolbar > .btn { width: 100%; }

  .side {
    position: sticky; top: 0; z-index: 6; height: auto; overflow: visible;
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "logo foot" "nav nav";
    align-items: center; gap: 8px 12px; padding: 10px 12px;
  }
  .side .brand-link { grid-area: logo; }
  .side .co { display: none; }
  .side-foot { grid-area: foot; margin: 0; justify-content: flex-end; min-width: 0; }
  .side-foot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side nav {
    grid-area: nav; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px; overflow: visible; flex: none; min-height: 0;
  }
  .side button {
    white-space: normal; text-align: center; font-size: 0.72rem; line-height: 1.15;
    padding: 8px 2px; min-width: 0;
  }
  .side button.brand-link { text-align: left; padding: 0; font-size: inherit; }

  .stats, .stats.report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px; }
  .stat b { font-size: 1.45rem; }
  .live-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .live-stats article { padding: 10px 12px; }
  .live-stats b { font-size: 1.25rem; }
  .live-stats span { font-size: 0.78rem; }
  .fact-grid, .fact-grid.report-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fact-grid article { padding: 10px 12px; }
  .fact-grid span { font-size: 0.75rem; }
  .fact-grid strong { font-size: 1rem; }

  .report-layout, .fleet-layout { grid-template-columns: 1fr; }
  .report-hero, .report-driver { grid-template-columns: auto minmax(0, 1fr); }
  .report-side { grid-column: 1 / -1; max-width: none; justify-content: flex-start; }
  #report-map { position: static; height: 42vh; min-height: 220px; }

  .place-row { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .place-row > .icon-btn { justify-self: end; }
  .place-row .actions { justify-content: flex-end; }
  .addr-row { grid-template-columns: minmax(0, 1fr) auto; }
  .addr-row input[name="address"], .addr-row .kind-picks { grid-column: 1 / -1; }
  .stop { align-items: start; }
  .stop .actions { flex-wrap: wrap; }
  .driver-toggle { align-items: flex-start; flex-wrap: wrap; }
  .driver-toggle .pill { max-width: 100%; }
  .driver-actions .btn { flex: 1 1 auto; }

  .shell.flota-on { align-items: stretch; height: 100dvh; overflow: hidden; grid-template-rows: auto minmax(0, 1fr); }
  body:has(.shell.flota-on) { overflow: hidden; }
  .shell.flota-on .main {
    display: flex; flex-direction: column; height: 100%; max-height: 100%; min-height: 0; overflow: hidden; padding: 0;
  }
  .shell.flota-on #screen { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
  .shell.flota-on .fleet-layout {
    display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden;
  }
  .shell.flota-on #fleet-map {
    order: 0; position: relative; height: 34vh; min-height: 180px; flex: none; width: 100%; border-radius: 0;
  }
  .shell.flota-on .fleet-pane {
    order: 1; flex: 1; min-height: 0; overflow: auto; padding: 12px 12px 20px;
  }

  #map { min-height: 280px; }
  .map-side { max-height: none; }
  #modal, #saved-pop { padding: 12px; align-items: end; }
  .sheet, #saved-pop .sheet { width: 100%; max-height: calc(100dvh - 24px); padding: 16px; border-radius: 20px 20px 16px 16px; }
  .sheet h3 { font-size: 1.45rem; }
  .form-actions .btn, .source-actions .btn { flex: 1 1 auto; }
  #toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .gate, .auth-page { padding: 16px; }
  .gate-card, .auth-card { padding: 20px; border-radius: 22px; }
  .gate-card h1, .auth-card h1 { font-size: 1.8rem; }
}

@media (max-width: 700px) {
  .side nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Home mínimo: solo logo (fondo oscuro = logo OBD Check) */
.home-solo {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background: #0b1220;
}
.home-solo .logo {
  height: clamp(56px, 14vw, 110px);
  width: auto;
}

/* Legal / privacy */
.legal-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 24px 72px;
}
.legal-page.legal-dark {
  min-height: 100dvh;
  max-width: none;
  background: #0b1220;
  color: #e8eef9;
  padding: 40px 24px 80px;
}
.legal-page.legal-dark .legal-top,
.legal-page.legal-dark .legal-body,
.legal-page.legal-dark .legal-foot {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}
.legal-top { margin-bottom: 28px; }
.legal-top .quiet-link { display: inline-flex; margin-bottom: 28px; }
.legal-top h1 {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.025em;
}
.legal-top .lede {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: #9db0c7;
}
.legal-body section { margin: 0 0 28px; }
.legal-body h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 600;
}
.legal-body h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
  font-weight: 600;
}
.legal-body p,
.legal-body li {
  color: var(--soft);
}
.legal-body ul,
.legal-body ol {
  margin: 0 0 12px;
  padding-left: 1.2em;
}
.legal-body a { color: var(--ink); text-underline-offset: 3px; }
.legal-closing {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.legal-foot {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.legal-foot a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.legal-foot a:hover { text-decoration: underline; }

.legal-page.legal-dark .eyebrow { color: #4ea1ff; }
.legal-page.legal-dark h1,
.legal-page.legal-dark h2,
.legal-page.legal-dark h3 { color: #f4f7fb; }
.legal-page.legal-dark .muted,
.legal-page.legal-dark .legal-body p,
.legal-page.legal-dark .legal-body li { color: #9db0c7; }
.legal-page.legal-dark .legal-body a { color: #7ec8ff; }
.legal-page.legal-dark .legal-foot {
  border-top-color: rgba(255,255,255,.12);
}
.legal-page.legal-dark .legal-foot a { color: #e8eef9; }
.legal-page.legal-dark .logo {
  height: clamp(48px, 10vw, 72px);
}

/* Legal pages share Montserrat too */
.legal-page,
.legal-page.legal-dark,
.gate,
.auth-page {
  font-family: "Montserrat", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
