:root {
  --paper: #FBFAF8;
  --surface: #FFFFFF;
  --sunk: #F3F0EC;
  --ink: #2A1F1A;
  --ink-2: #5E524B;
  --ink-3: #8A7F78;
  --line: #E7E1DB;
  --line-2: #D6CEC6;
  --brand: #7A1F2B;
  --brand-hover: #651824;
  --brand-soft: #F5E8E9;
  --on-brand: #FFFFFF;

  --ok: #1E7A4C;   --ok-soft: #E4F2EA;
  --warn: #A9560E; --warn-soft: #FCEEDF;
  --bad: #B3261E;  --bad-soft: #FAE4E2;
  --next: #1D5FB8; --next-soft: #E4EDF9;
  --pend: #7D726B; --pend-soft: #EFEBE7;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(42, 31, 26, .06), 0 4px 16px rgba(42, 31, 26, .05);

  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, serif;
  color-scheme: light;
}

.dark {
  --paper: #17110F;
  --surface: #221A17;
  --sunk: #1C1512;
  --ink: #F3ECE7;
  --ink-2: #CFC4BD;
  --ink-3: #A0948D;
  --line: #3A2F2A;
  --line-2: #4A3D37;
  --brand: #D0566A;
  --brand-hover: #DD6A7D;
  --brand-soft: #3A1E23;
  --on-brand: #1A0F10;
  --ok: #5CC792;   --ok-soft: #1B3326;
  --warn: #F29A4A; --warn-soft: #3A2716;
  --bad: #F2766B;  --bad-soft: #3D1C1A;
  --next: #6EA6F2; --next-soft: #1A2A42;
  --pend: #A0948D; --pend-soft: #2C2421;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--next); outline-offset: 2px; }
.ic { width: 1.25em; height: 1.25em; flex: none; }
.muted { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--sunk); border-color: transparent; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }

/* ---------- Portada ---------- */
.home { max-width: 980px; margin: 0 auto; padding: 56px 24px 80px; }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; }
.wordmark .seal {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--on-brand);
  display: grid; place-items: center; font-family: var(--serif); font-size: 19px; font-weight: 600;
}
.wordmark small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12px; line-height: 1.1; }
.home h1 {
  font-family: var(--serif); font-weight: 500; font-size: clamp(38px, 6vw, 64px);
  letter-spacing: -.02em; margin: 56px 0 18px; max-width: 14ch;
}
.home .lead { font-size: 19px; color: var(--ink-2); max-width: 58ch; }
.roles { margin-top: 48px; border-top: 1px solid var(--line); }
.role {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 20px; align-items: center;
  padding: 26px 4px; border-bottom: 1px solid var(--line); text-decoration: none;
}
.role:hover h2 { color: var(--brand); }
.role .role-ic {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.role .role-ic .ic { width: 26px; height: 26px; }
.role h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; transition: color .15s; }
.role p { color: var(--ink-2); margin-top: 4px; max-width: 60ch; }
.role .go { color: var(--ink-3); }
.guion { margin-top: 48px; padding: 24px 28px; background: var(--sunk); border-radius: var(--r-lg); }
.guion h3 { font-size: 16px; margin-bottom: 12px; }
.guion ol { margin: 0; padding-left: 20px; color: var(--ink-2); }
.guion li { margin: 6px 0; }

/* ---------- Barra de oficina ---------- */
.topbar {
  position: sticky; top: 0; z-index: 800; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1360px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 24px; }
.topbar nav { display: flex; gap: 4px; margin-left: 12px; }
.topbar nav a {
  padding: 8px 14px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; color: var(--ink-2);
  display: inline-flex; gap: 8px; align-items: center;
}
.topbar nav a:hover { background: var(--sunk); }
.topbar nav a.on { background: var(--brand-soft); color: var(--brand); }
.topbar .spacer { flex: 1; }
.badge-demo { font-size: 12px; font-weight: 600; color: var(--ink-3); border: 1px dashed var(--line-2); padding: 4px 10px; border-radius: 99px; }

.page { max-width: 1360px; margin: 0 auto; padding: 28px 24px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-family: var(--serif); font-weight: 500; font-size: 36px; letter-spacing: -.01em; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; }
.page-head .grow { flex: 1; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 12px 16px; text-decoration: none; font-weight: 600; color: var(--ink-3); border: 0; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap;
}
.tabs a.on, .tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.tabs .count { background: var(--bad); color: #fff; font-size: 12px; border-radius: 99px; padding: 1px 7px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field select, .field input, .input {
  min-height: 42px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); font-size: 15px; font-weight: 500; color: var(--ink);
}
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-pad { padding: 22px 24px; }
.panel h2 { font-size: 17px; font-weight: 700; }
.panel .panel-sub { color: var(--ink-3); font-size: 14px; margin-top: 2px; }

/* ---------- Importación ---------- */
.drop {
  border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 56px 24px; text-align: center; background: var(--surface);
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .big-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; }
.drop .big-ic .ic { width: 30px; height: 30px; }
.drop h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 18px 0 6px; }
.drop p { color: var(--ink-2); }
.drop .actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.history { margin-top: 28px; }
.history h3 { font-size: 14px; color: var(--ink-3); font-weight: 600; margin-bottom: 8px; }
.history li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 15px; align-items: center; }
.history ul { list-style: none; margin: 0; padding: 0; }

.reading { text-align: center; padding: 80px 20px; }
.reading .steps-live { list-style: none; padding: 0; margin: 24px auto 0; max-width: 340px; text-align: left; }
.reading .steps-live li { display: flex; gap: 10px; align-items: center; padding: 6px 0; color: var(--ink-3); }
.reading .steps-live li.done { color: var(--ok); }
.reading .steps-live li.doing { color: var(--ink); font-weight: 600; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--brand); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.stat { background: var(--surface); padding: 18px 22px; }
.stat .v { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.stat .k { color: var(--ink-3); font-size: 14px; font-weight: 500; }
.stat .v.ok { color: var(--ok); } .stat .v.warn { color: var(--warn); } .stat .v.bad { color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 20px; }
.avisos { list-style: none; margin: 0; padding: 0; }
.aviso { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.aviso:first-child { border-top: 0; }
.aviso .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.aviso .dot.warn { background: var(--warn-soft); color: var(--warn); }
.aviso .dot.info { background: var(--next-soft); color: var(--next); }
.aviso .dot.ok { background: var(--ok-soft); color: var(--ok); }
.aviso b { display: block; }
.aviso span { color: var(--ink-2); font-size: 14px; }
details.mapeo summary { cursor: pointer; font-weight: 600; color: var(--ink-2); padding: 6px 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-size: 13px; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--sunk); }
.foot-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Rutas (encargado) ---------- */
.rutas { display: grid; grid-template-columns: 1fr 440px; gap: 20px; align-items: start; }
.map-big { height: calc(100vh - 230px); min-height: 520px; border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; position: sticky; top: 80px; }
.route-list { display: flex; flex-direction: column; gap: 12px; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.rcard-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.rcard-head .sw { width: 12px; height: 36px; border-radius: 6px; flex: none; }
.rcard-head h3 { font-size: 16px; }
.rcard-head .meta { font-size: 13px; color: var(--ink-3); }
.rcard-head .grow { flex: 1; min-width: 0; }
.rcard-head select { min-height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 8px; font-size: 13px; }
.rstops { list-style: none; margin: 0; padding: 6px 0; min-height: 40px; }
.rstops li {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 7px 16px;
  font-size: 14px; cursor: grab; border-top: 2px solid transparent;
}
.rstops li:hover { background: var(--sunk); }
.rstops li.drop-before { border-top-color: var(--brand); }
.rstops li.dragging { opacity: .4; }
.rstops .n { width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.rstops .t b { font-weight: 600; display: block; line-height: 1.2; }
.rstops .t span { color: var(--ink-3); font-size: 12.5px; }
.rstops .late { color: var(--warn); font-weight: 600; }
.rstops select { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 4px; max-width: 110px; color: var(--ink-2); }
.state-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 99px; }
.state-pill.draft { background: var(--pend-soft); color: var(--ink-2); }
.state-pill.live { background: var(--ok-soft); color: var(--ok); }

.pin-num {
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 700 12px/26px var(--sans); text-align: center;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.pin-wh { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pin-wh svg { width: 16px; height: 16px; }
.pin-van { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.pin-van svg { width: 18px; height: 18px; }
.pin-me { width: 20px; height: 20px; border-radius: 50%; background: var(--next); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(29,95,184,.25); }
.pin-flag { width: 26px; height: 26px; border-radius: 50%; background: var(--warn); color: #fff; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.leaflet-popup-content { font-family: var(--sans); font-size: 14px; margin: 12px 14px; }

.live-side { display: flex; flex-direction: column; gap: 14px; }
.live-rep { padding: 14px 16px; }
.live-rep .row { display: flex; align-items: center; gap: 10px; }
.live-rep .row .grow { flex: 1; }
.live-rep .bar { height: 8px; border-radius: 4px; background: var(--sunk); margin-top: 10px; overflow: hidden; }
.live-rep .bar i { display: block; height: 100%; border-radius: 4px; }
.live-rep .estado { font-size: 13px; font-weight: 600; margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.live-rep .estado.ok { color: var(--ok); } .live-rep .estado.warn { color: var(--warn); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.feed li:first-child { border-top: 0; }
.feed .d { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }

/* ---------- Contabilidad ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 20px 0 28px; }
.kpi h3 { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.kpi .big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 14px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bars .b { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; font-size: 14px; }
.bars .b .track { height: 10px; background: var(--sunk); border-radius: 5px; overflow: hidden; }
.bars .b .track i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.bars .b .val { text-align: right; font-weight: 600; }
.plist { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.plist li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.plist li:first-child { border-top: 0; }
.plist small { color: var(--ink-3); display: block; }
.estados-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.sem { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.sem.bad { background: var(--bad); } .sem.warn { background: var(--warn); } .sem.info { background: var(--next); } .sem.ok { background: var(--ok); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.next { background: var(--next-soft); color: var(--next); }
.tag.pend { background: var(--pend-soft); color: var(--ink-2); }
.revisada { color: var(--ok); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.check-row { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.check-row input { width: 18px; height: 18px; accent-color: var(--brand); }
.diff.ok { color: var(--ok); font-weight: 700; } .diff.bad { color: var(--bad); font-weight: 700; }
.cash-input { width: 130px; text-align: right; }
.table-wrap { overflow-x: auto; }

/* ---------- Modal / hoja ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(23, 17, 15, .5); z-index: 2000; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); color: var(--ink); border-radius: var(--r-lg); width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { font-size: 19px; flex: 1; }
.modal-body { padding: 20px 22px; }
.modal-map { height: 380px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 16px 1fr; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .d { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--line-2); margin-top: 2px; background: var(--line-2); }
.timeline .d.ok { background: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.timeline .d.warn { background: var(--warn); box-shadow: 0 0 0 2px var(--warn); }
.timeline small { color: var(--ink-3); display: block; }
.firma-img { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sunk); height: 90px; display: grid; place-items: center; }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 3000;
  background: var(--ink); color: var(--paper); padding: 12px 14px 12px 18px; border-radius: 14px;
  display: flex; gap: 14px; align-items: center; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  max-width: calc(100vw - 32px); animation: rise .2s ease-out;
}
.toast .ic { color: #6FD39F; }
.toast button { background: transparent; border: 1px solid rgba(255,255,255,.35); color: inherit; border-radius: 8px; padding: 6px 12px; font-weight: 700; }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }

/* =========================================================
   APP DEL REPARTIDOR
   ========================================================= */
.phone-stage { min-height: calc(100vh - 57px); display: grid; grid-template-columns: 1fr auto 1fr; gap: 40px; align-items: center; padding: 32px 24px; }
.phone-note { max-width: 300px; justify-self: end; color: var(--ink-2); }
.phone-note h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; color: var(--ink); margin-bottom: 10px; }
.phone-note p { margin-bottom: 10px; }
.phone-note .tip { font-size: 14px; color: var(--ink-3); }
.phone {
  width: 400px; height: min(860px, calc(100vh - 110px)); min-height: 640px; border-radius: 48px; padding: 12px;
  background: #1E1715; box-shadow: 0 30px 80px rgba(42,31,26,.25), inset 0 0 0 2px #3A2F2A;
}
.screen {
  width: 100%; height: 100%; border-radius: 38px; overflow: hidden; background: var(--paper); color: var(--ink);
  display: flex; flex-direction: column; position: relative;
}
.drv { font-size: 18px; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.drv-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.drv-top { display: flex; align-items: center; gap: 10px; padding: 18px 18px 10px; }
.drv-top .who { flex: 1; min-width: 0; }
.drv-top .who b { font-size: 21px; display: block; }
.drv-top .who small { color: var(--ink-3); font-size: 15px; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--ink-2); flex: none;
}
.sync {
  display: flex; align-items: center; gap: 10px; margin: 0 18px; padding: 10px 14px; border-radius: 12px;
  border: 0; width: calc(100% - 36px); text-align: left; font-size: 15px; font-weight: 600;
  background: var(--ok-soft); color: var(--ok);
}
.sync.off { background: var(--warn-soft); color: var(--warn); }
.sync.sending { background: var(--next-soft); color: var(--next); }
.sync span { flex: 1; }
.sync small { font-weight: 500; opacity: .85; }

.progress-card { margin: 14px 18px 0; padding: 18px; background: var(--brand); color: var(--on-brand); border-radius: var(--r-lg); }
.progress-card .step { font-size: 15px; opacity: .85; }
.progress-card .big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.progress-card .big span { font-weight: 500; opacity: .75; font-size: 22px; }
.progress-card .bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.25); margin: 12px 0 14px; overflow: hidden; }
.progress-card .bar i { display: block; height: 100%; background: currentColor; border-radius: 4px; }
.progress-card .cash { display: flex; justify-content: space-between; gap: 10px; font-size: 16px; border-top: 1px solid rgba(255,255,255,.25); padding-top: 12px; }
.progress-card .cash b { font-size: 20px; }

.drv-map { height: 190px; margin: 14px 18px 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); flex: none; }
.leaflet-tile-pane { filter: saturate(.55) contrast(.97); }
.dark .leaflet-tile-pane { filter: saturate(.4) invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }

.sec-title { font-size: 15px; color: var(--ink-3); font-weight: 600; margin: 22px 18px 10px; }
.stops { list-style: none; margin: 0; padding: 0 18px; display: flex; flex-direction: column; gap: 10px; }

/* La tarjeta-albarán: talón con el número + cuerpo, separados por una línea troquelada */
.stop {
  display: grid; grid-template-columns: 76px 1fr; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
  position: relative; box-shadow: var(--shadow);
}
.stop .stub {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12px 4px;
  background: var(--pend-soft); color: var(--pend); position: relative;
}
.stop .stub::after {
  content: ""; position: absolute; right: -1px; top: 8px; bottom: 8px; width: 0;
  border-right: 2px dashed var(--surface);
}
.stop .stub .num { font-size: 32px; font-weight: 800; line-height: 1; }
.stop .stub .lbl { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.1; }
.stop .stub .ic { width: 26px; height: 26px; }
.stop .body { padding: 13px 14px 13px 16px; min-width: 0; }
.stop h3 { font-size: 19px; font-weight: 700; }
.stop .addr { color: var(--ink-2); font-size: 16px; margin-top: 2px; }
.stop .meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 15px; color: var(--ink-2); }
.stop .meta span { display: inline-flex; gap: 6px; align-items: center; }
.stop .cobrar { display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; padding: 5px 10px; border-radius: 8px; font-weight: 700; font-size: 16px; background: var(--brand-soft); color: var(--brand); }
.stop .cobrar.hecho { background: var(--ok-soft); color: var(--ok); }
.stop.s-next { border: 2px solid var(--next); }
.stop.s-next .stub { background: var(--next); color: #fff; }
.stop.s-ok .stub { background: var(--ok-soft); color: var(--ok); }
.stop.s-inc .stub { background: var(--warn-soft); color: var(--warn); }
.stop.s-no .stub { background: var(--bad-soft); color: var(--bad); }
.stop.s-ok h3, .stop.s-inc h3, .stop.s-no h3 { color: var(--ink-2); }

.drv-foot { padding: 20px 18px 28px; display: flex; flex-direction: column; gap: 10px; }

.big-btn {
  min-height: 60px; border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-size: 19px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 18px;
  text-decoration: none; width: 100%; transition: transform .1s, background .15s;
}
.big-btn:active { transform: scale(.98); }
.big-btn .ic { width: 26px; height: 26px; }
.big-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.big-btn.next { background: var(--next); border-color: var(--next); color: #fff; }
.big-btn[disabled] { opacity: .35; pointer-events: none; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.drv-bar { display: flex; align-items: center; gap: 8px; padding: 14px 14px 8px; }
.drv-bar .back { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 12px 0 6px; border-radius: 12px; border: 0; background: transparent; font-size: 17px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.drv-bar .grow { flex: 1; }

.stop-head { padding: 4px 18px 0; }
.stop-head .n { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; font-size: 15px; padding: 4px 12px; border-radius: 99px; background: var(--next-soft); color: var(--next); }
.stop-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.01em; margin-top: 10px; }
.stop-head .addr { color: var(--ink-2); margin-top: 4px; }
.stop-head .franja { display: inline-flex; gap: 8px; align-items: center; margin-top: 10px; font-weight: 600; font-size: 16px; }
.nota { margin: 16px 18px 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--ink); display: flex; gap: 10px; font-size: 16px; }
.nota .ic { color: var(--warn); margin-top: 2px; }
.cobro-box { margin: 16px 18px 0; padding: 16px; border-radius: var(--r-md); background: var(--brand-soft); display: flex; gap: 12px; align-items: center; }
.cobro-box .ic { width: 30px; height: 30px; color: var(--brand); }
.cobro-box b { font-size: 24px; display: block; color: var(--brand); }
.cobro-box span { font-size: 15px; color: var(--ink-2); }
.fac { margin: 12px 18px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.fac-head { display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.fac-head b { font-size: 16px; }
.fac-line { display: flex; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 16px; align-items: baseline; }
.fac-line:last-child { border-bottom: 0; }
.fac-line .q { font-weight: 800; min-width: 34px; }
.fac-line .p { flex: 1; }
.fac-line .p small { display: block; color: var(--ink-3); font-size: 14px; }
.fac-total { display: flex; justify-content: space-between; padding: 11px 16px; font-weight: 700; background: var(--sunk); border-radius: 0 0 var(--r-md) var(--r-md); }
.sticky-cta { padding: 12px 18px 22px; background: linear-gradient(to top, var(--paper) 70%, transparent); position: sticky; bottom: 0; }
.result-box { margin: 16px 18px 0; padding: 16px; border-radius: var(--r-md); display: flex; gap: 12px; align-items: flex-start; }
.result-box.ok { background: var(--ok-soft); } .result-box.inc { background: var(--warn-soft); } .result-box.no { background: var(--bad-soft); }
.result-box .ic { width: 28px; height: 28px; }
.result-box.ok .ic { color: var(--ok); } .result-box.inc .ic { color: var(--warn); } .result-box.no .ic { color: var(--bad); }
.result-box p { font-size: 15px; color: var(--ink-2); margin-top: 2px; }

/* Asistente de entrega */
.wiz-top { display: flex; align-items: center; gap: 10px; padding: 16px 14px 6px; }
.wiz-top .grow { flex: 1; }
.wiz-top .who { font-size: 15px; color: var(--ink-3); font-weight: 600; }
.dots { display: flex; gap: 6px; padding: 4px 18px 0; }
.dots i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.dots i.on { background: var(--brand); }
.wiz-body { padding: 22px 18px 10px; }
.wiz-q { font-size: 29px; font-weight: 800; letter-spacing: -.015em; line-height: 1.15; }
.wiz-hint { color: var(--ink-2); margin-top: 8px; font-size: 17px; }
.choices { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.choice {
  display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 12px 18px; border-radius: 18px;
  border: 2px solid var(--line-2); background: var(--surface); text-align: left; font-size: 20px; font-weight: 700; width: 100%;
}
.choice .ci { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.choice .ci .ic { width: 26px; height: 26px; }
.choice small { display: block; font-size: 15px; font-weight: 500; color: var(--ink-3); }
.choice.ok .ci { background: var(--ok-soft); color: var(--ok); }
.choice.inc .ci { background: var(--warn-soft); color: var(--warn); }
.choice.no .ci { background: var(--bad-soft); color: var(--bad); }
.choice.neutral .ci { background: var(--sunk); color: var(--ink-2); }
.choice.sel { border-color: var(--brand); background: var(--brand-soft); }
.choice.sel.ok { border-color: var(--ok); background: var(--ok-soft); }
.choice.sel.inc { border-color: var(--warn); background: var(--warn-soft); }
.choice.sel.no { border-color: var(--bad); background: var(--bad-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { min-height: 48px; padding: 0 16px; border-radius: 99px; border: 2px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 16px; }
.chip.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.grid-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.pay { min-height: 84px; border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 16px; }
.pay .ic { width: 28px; height: 28px; color: var(--ink-2); }
.pay.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.pay.sel .ic { color: var(--brand); }
.prevista { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--sunk); font-size: 16px; display: flex; justify-content: space-between; gap: 10px; }
.money-in { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.money-in label { font-weight: 700; font-size: 17px; flex: 1; }
.money-in input { width: 150px; min-height: 60px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--surface); font-size: 24px; font-weight: 800; text-align: right; padding: 0 14px; }
.dev-line { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dev-line b { display: block; font-size: 17px; }
.dev-line small { color: var(--ink-3); font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 52px; height: 52px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--surface); display: grid; place-items: center; }
.stepper button .ic { width: 22px; height: 22px; }
.stepper output { min-width: 36px; text-align: center; font-size: 22px; font-weight: 800; }
.stepper output.has { color: var(--warn); }
.photo-btn { margin-top: 16px; }
.photo-ok { display: flex; gap: 10px; align-items: center; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.sign-pad { margin-top: 18px; border: 2px dashed var(--line-2); border-radius: 16px; background: var(--surface); position: relative; height: 210px; touch-action: none; }
.sign-pad canvas { width: 100%; height: 100%; display: block; border-radius: 14px; }
.sign-pad .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); pointer-events: none; font-size: 17px; }
.sign-pad .line { position: absolute; left: 20px; right: 20px; bottom: 50px; border-bottom: 1px solid var(--line-2); pointer-events: none; }
.obs { width: 100%; min-height: 140px; margin-top: 18px; border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); padding: 14px; font-size: 18px; resize: vertical; }
.mic-hint { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 15px; margin-top: 8px; }
.resumen { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.resumen .r { display: flex; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 16px; }
.resumen .r:last-child { border-bottom: 0; }
.resumen .r span { color: var(--ink-3); }
.resumen .r b { text-align: right; }
.wiz-foot { padding: 12px 18px 22px; display: flex; gap: 10px; }
.wiz-foot .big-btn.back-b { width: auto; flex: none; padding: 0 16px; }

/* Cierre de jornada */
.cierre-hero { margin: 8px 18px 0; padding: 22px 18px; border-radius: var(--r-lg); background: var(--ink); color: var(--paper); }
.cierre-hero small { font-size: 15px; opacity: .75; }
.cierre-hero .big { font-size: 44px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: 4px; }
.cierre-hero p { font-size: 15px; opacity: .8; margin-top: 6px; }
.cierre-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 18px 0; }
.cierre-grid div { padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.cierre-grid b { font-size: 28px; display: block; }
.cierre-grid span { font-size: 15px; color: var(--ink-2); }
.cierre-grid .ok b { color: var(--ok); } .cierre-grid .warn b { color: var(--warn); } .cierre-grid .bad b { color: var(--bad); }
.cierre-list { margin: 12px 18px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.cierre-list .r { display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 16px; }
.cierre-list .r:last-child { border-bottom: 0; }
.cierre-list .r small { display: block; color: var(--ink-3); font-size: 14px; }
.aviso-pend { margin: 12px 18px 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--warn-soft); display: flex; gap: 10px; font-size: 16px; }
.aviso-pend .ic { color: var(--warn); }

.sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 1500; display: flex; align-items: flex-end; animation: fade .15s; }
.sheet { background: var(--surface); width: 100%; border-radius: 26px 26px 0 0; padding: 22px 18px 26px; animation: up .2s ease-out; }
.sheet h2 { font-size: 23px; font-weight: 800; }
.sheet p { color: var(--ink-2); margin: 6px 0 16px; font-size: 16px; }
.sheet .choices { margin-top: 0; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .rutas { grid-template-columns: 1fr; }
  .map-big { position: relative; top: 0; height: 460px; min-height: 0; }
  .phone-stage { grid-template-columns: 1fr; justify-items: center; }
  .phone-note { justify-self: center; max-width: 400px; text-align: center; }
  .phone-note.right { display: none; }
}
@media (max-width: 900px) {
  .grid-2, .kpis { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .estados-mini { grid-template-columns: repeat(2, 1fr); }
  .topbar nav a .lbl-long { display: none; }
}
@media (max-width: 640px) {
  .topbar-in { padding: 10px 16px; gap: 10px; }
  .topbar .wordmark small, .badge-demo { display: none; }
  .topbar nav { margin-left: 0; }
  .topbar nav a { padding: 8px 10px; font-size: 14px; }
  .page { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 28px; }
  .home { padding: 32px 16px 56px; }
  .role { grid-template-columns: 48px 1fr; }
  .role .role-ic { width: 44px; height: 44px; }
  .role .go { display: none; }
  .role h2 { font-size: 23px; }
  /* En el móvil la app del repartidor ocupa toda la pantalla, sin marco */
  body.is-driver .topbar { display: none; }
  .phone-stage { padding: 0; display: block; min-height: 100vh; }
  .phone-note { display: none; }
  .phone { width: 100%; height: 100vh; height: 100dvh; min-height: 0; border-radius: 0; padding: 0; box-shadow: none; background: none; }
  .screen { border-radius: 0; }
  .toast { bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ajustes */
.phone-note.right { justify-self: start; }
@media (max-width: 640px) {
  .topbar .wordmark > span:last-child { display: none; }
  .topbar .lbl-long { display: none; }
}

.toast[hidden] { display: none; }
.toast { width: max-content; }
.dark .progress-card { background: #4A1A22; color: #F3ECE7; }
@media (max-width: 640px) {
  .topbar nav { gap: 0; }
  .topbar nav a { padding: 8px 8px; }
  .topbar nav a .ic { display: none; }
}
