/* Toque NFC Rutas — sistema visual basado en toquenfc.uy */
@font-face { font-family: Manrope; font-weight: 700; font-display: swap; src: url(vendor/manrope-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Manrope; font-weight: 800; font-display: swap; src: url(vendor/manrope-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 400; font-display: swap; src: url(vendor/dm-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 500; font-display: swap; src: url(vendor/dm-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Sans'; font-weight: 700; font-display: swap; src: url(vendor/dm-sans-latin-700-normal.woff2) format('woff2'); }

:root {
  --blue: #2455f5;
  --blue-dark: #1740cc;
  --blue-soft: #e9efff;
  --ink: #121829;
  --text: #121829;
  --muted: #6a7081;
  --faint: #8e96a7;
  --line: #e5e8f0;
  --line-strong: #d9deeb;
  --bg: #f5f7fc;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --no: #6a7081;
  --no-soft: #eef0f5;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --shadow: 0 8px 30px rgba(13, 43, 104, .07);
  --shadow-float: 0 6px 24px rgba(18, 24, 41, .14);
  --radius: 16px;
  --radius-sm: 10px;
  --tabs-h: 64px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #5b7fff;
    --blue-dark: #4a6ff5;
    --blue-soft: #1b2650;
    --text: #e8ebf3;
    --muted: #9aa2b6;
    --faint: #7a8398;
    --line: #232b42;
    --line-strong: #2e3753;
    --bg: #0b0f1c;
    --surface: #151b2e;
    --surface-2: #1a2136;
    --ok: #4ade80;
    --ok-soft: #12301f;
    --warn: #fbbf24;
    --warn-soft: #33270d;
    --no: #9aa2b6;
    --no-soft: #222a3f;
    --danger: #f87171;
    --danger-soft: #3a1717;
    --shadow: 0 8px 30px rgba(0, 0, 0, .25);
    --shadow-float: 0 6px 24px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 15px/1.45 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
h1, h2, h3 { font-family: Manrope, 'DM Sans', sans-serif; margin: 0; letter-spacing: -.3px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
small { font-size: 12px; color: var(--muted); }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.ic { flex-shrink: 0; display: block; }

/* ---------- Cabecera ---------- */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: calc(var(--safe-top) + 10px) 12px 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-family: Manrope, sans-serif; color: var(--text); }
.brand-symbol {
  background: var(--blue); color: #fff; border-radius: 8px; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center; transform: rotate(-5deg);
}
.brand-word { display: flex; align-items: center; font-size: 22px; font-weight: 800; letter-spacing: -1.2px; line-height: 1; }
.brand-dot { color: var(--blue); }
.brand-word small { font: 700 9px Manrope, sans-serif; letter-spacing: .6px; color: var(--text); border-left: 1px solid var(--line-strong); margin-left: 8px; padding: 3px 0 3px 8px; }
.brand-tag { font: 700 10px 'DM Sans', sans-serif; text-transform: uppercase; letter-spacing: 1.2px; color: var(--blue); background: var(--blue-soft); border-radius: 999px; padding: 4px 9px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- Estructura ---------- */
main { flex: 1; position: relative; min-height: 0; }
.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }
.view.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view.overlay { z-index: 1500; background: var(--bg); }
.page { padding: 18px 16px 32px; max-width: 640px; margin: 0 auto; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.8px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.page-head.with-back { display: flex; align-items: center; gap: 6px; margin-left: -8px; }
.block { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-head h2 { font-size: 16px; font-weight: 800; }
.section-head.sub { margin: 16px 0 8px; }
.section-head h3 { font-size: 14px; font-weight: 700; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel.pad { padding: 16px; }
section.panel { margin-top: 14px; }
.disclaimer { font-size: 12px; color: var(--faint); text-align: center; margin: 14px 8px 0; }

/* ---------- Botones ---------- */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-weight: 700; font-size: 14px; cursor: pointer; transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-dark); }
.btn.soft { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; min-height: 52px; font-size: 15px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }
.link-btn { border: 0; background: none; color: var(--blue); font-weight: 700; font-size: 13px; padding: 4px 0; cursor: pointer; }

/* ---------- Formularios ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.field small { display: block; margin-top: 4px; }
input[type=number], input[type=text], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 12px 13px; font: 500 16px 'DM Sans', sans-serif;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
textarea { min-height: 120px; font: 400 13px ui-monospace, Consolas, monospace; }
.stepper { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.stepper button { width: 44px; border: 0; background: var(--surface-2); color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.stepper button:active { background: var(--blue-soft); color: var(--blue); }
.stepper input { border: 0; border-radius: 0; text-align: center; font: 800 18px Manrope, sans-serif; padding: 10px 4px; min-width: 0; }
.stepper input:focus { box-shadow: none; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 6px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(18, 24, 41, .12); }
.segmented.full { margin-bottom: 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 14px; font-weight: 500; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--blue); }
.switch:checked::after { transform: translateX(18px); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px; font-weight: 500; font-size: 14px; cursor: pointer; }
.check-chip input { accent-color: var(--blue); width: 18px; height: 18px; margin: 0; }
.check-chip:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0 12px; color: var(--faint); margin-bottom: 12px; }
.search input { border: 0; padding: 12px 0; background: transparent; }
.search input:focus { box-shadow: none; }
.inline-add { display: flex; gap: 8px; margin: 12px 0 8px; }

/* ---------- Chips de filtro ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip b { font-weight: 700; color: var(--faint); margin-left: 4px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.on b { color: rgba(255,255,255,.65); }
@media (prefers-color-scheme: dark) { .chip.on { background: var(--blue); border-color: var(--blue); } }

/* ---------- Estado (pills) ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill .ic { width: 13px; height: 13px; }
.pill.sold, .pill.paid { background: var(--ok-soft); color: var(--ok); }
.pill.no { background: var(--no-soft); color: var(--no); }
.pill.later, .pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.excluded { background: var(--danger-soft); color: var(--danger); }
.pill.route { background: var(--blue-soft); color: var(--blue); }

/* ---------- KPIs ---------- */
.kpis { display: grid; gap: 10px; margin-bottom: 14px; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
.kpis.two { grid-template-columns: 1fr 1fr; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font: 800 22px Manrope, sans-serif; letter-spacing: -.6px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12px; color: var(--faint); margin-top: 1px; }
.hero {
  background: var(--ink); color: #fff; border-radius: 20px; padding: 20px; margin-bottom: 14px; position: relative; overflow: hidden;
}
@media (prefers-color-scheme: dark) { .hero { background: linear-gradient(135deg, #1b2a6b, #121a3d); } }
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(36,85,245,.55), transparent 70%); }
.hero-label { font-size: 13px; color: rgba(255,255,255,.7); font-weight: 500; position: relative; }
.hero-value { font: 800 36px Manrope, sans-serif; letter-spacing: -1.4px; margin: 2px 0 4px; position: relative; }
.hero-sub { font-size: 13px; color: rgba(255,255,255,.75); position: relative; }
.hero-warn { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; background: rgba(251,191,36,.18); color: #fcd34d; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; position: relative; }
.hero .btn-row { margin-top: 16px; position: relative; }
.hero .btn { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; }
.hero .btn.primary { background: var(--blue); border-color: var(--blue); }
@media (prefers-color-scheme: light) { .hero .btn.primary { background: #2455f5; } }

/* ---------- Listas ---------- */
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; cursor: pointer; text-align: left; width: 100%;
}
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-amount { font: 800 15px Manrope, sans-serif; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.sold { background: var(--ok-soft); color: var(--ok); }
.avatar.no { background: var(--no-soft); color: var(--no); }
.avatar.later { background: var(--warn-soft); color: var(--warn); }
.avatar.excluded { background: var(--danger-soft); color: var(--danger); }
.avatar.blue { background: var(--blue-soft); color: var(--blue); }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 14px; font-size: 14px; }
.empty .ic { margin: 0 auto 8px; color: var(--faint); }
.prow { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow .row-main { min-width: 0; }
.prow-actions { display: flex; gap: 2px; }
.prow-actions .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.stock-big { font: 800 20px Manrope, sans-serif; text-align: right; }
.stock-big.low { color: var(--warn); }
.stock-big.neg { color: var(--danger); }
.move-qty { font: 800 14px Manrope, sans-serif; }
.move-qty.in { color: var(--ok); }
.move-qty.out { color: var(--text); }
.row-btn { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 14px 16px; text-align: left; cursor: pointer; color: var(--text); }
.row-btn:last-child { border-bottom: 0; }
.row-btn > span { color: var(--blue); }
.row-btn b { display: block; font-weight: 700; }
.row-btn small { display: block; }
.row-btn.danger, .row-btn.danger > span { color: var(--danger); }

/* ---------- Mapa y hoja inferior ---------- */
#map { position: absolute; inset: 0; background: #e8ecf4; }
.hud {
  position: absolute; z-index: 600; top: 12px; left: 12px; right: 64px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-float); padding: 12px 14px;
}
.hud-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.hud-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.hud-value { font: 800 24px Manrope, sans-serif; letter-spacing: -.6px; line-height: 1.1; }
.hud-value span { font-size: 15px; color: var(--faint); font-weight: 700; }
.hud-side { text-align: right; font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.5; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 999px; transition: width .3s; }
.map-tools { position: absolute; z-index: 600; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; }
.map-btn { width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-float); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.map-btn:active { color: var(--blue); }

.sheet {
  position: absolute; z-index: 700; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: 0 -6px 30px rgba(18, 24, 41, .14);
  display: flex; flex-direction: column; max-height: 46%; transition: max-height .25s ease;
}
.sheet.planner { max-height: 78%; }
.sheet.expanded { max-height: 86%; }
.sheet-handle { border: 0; background: none; padding: 10px 0 4px; display: flex; justify-content: center; cursor: pointer; flex-shrink: 0; }
.sheet-handle span { width: 40px; height: 5px; border-radius: 999px; background: var(--line-strong); }
.sheet-body { overflow-y: auto; padding: 4px 16px 16px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { font-size: 19px; font-weight: 800; }
.sheet-head small { display: block; margin-top: 2px; font-size: 13px; }
.note-row { display: flex; align-items: center; gap: 10px; background: var(--blue-soft); color: var(--blue); border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.note-row.warn { background: var(--warn-soft); color: var(--warn); }
.note-row b { font-weight: 800; }
.link-row { display: flex; align-items: center; gap: 12px; width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px; margin: 4px 0 14px; cursor: pointer; text-align: left; color: var(--text); }
.link-row > .ic:first-child { color: var(--blue); }
.link-row div { flex: 1; }
.link-row b { display: block; font-weight: 700; font-size: 14px; }
.link-row small { display: block; }
.link-row > .ic:last-child { color: var(--faint); }
.hint { font-size: 12px; color: var(--faint); text-align: center; margin: 10px 0 0; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 14px; font-size: 11px; color: var(--muted); font-weight: 500; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.legend i.hollow { background: #fff; border: 2px solid #2455f5; }

.stop { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; gap: 12px; background: var(--surface); }
.stop.next { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.stop.done { background: var(--surface-2); }
.stop-num { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; font: 800 13px Manrope, sans-serif; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stop.st-sold .stop-num { background: var(--ok); }
.stop.st-no .stop-num { background: var(--faint); }
.stop.st-later .stop-num { background: var(--warn); }
.stop-main { flex: 1; min-width: 0; }
.stop-name { font-weight: 700; font-size: 15px; }
.stop-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.stop-note { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.stop-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.stop-actions .btn { min-height: 40px; padding: 0 6px; font-size: 13px; gap: 5px; }
.stop-actions .btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.stop-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.stops { display: flex; flex-direction: column; gap: 8px; }
.done-state { text-align: center; padding: 18px 8px; }
.done-state .ic { margin: 0 auto 8px; color: var(--ok); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

/* ---------- Pestañas inferiores ---------- */
.tabs {
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 6px var(--safe-bottom); height: calc(var(--tabs-h) + var(--safe-bottom)); position: relative; z-index: 1000;
}
.tabs button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 11px; font-weight: 700; cursor: pointer; }
.tab-ic { width: 48px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.tabs button.active { color: var(--blue); }
.tabs button.active .tab-ic { background: var(--blue-soft); }

/* ---------- Gráfico ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--faint); font: 500 10px 'DM Sans', sans-serif; }
.chart .bar { fill: var(--blue); }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart table { width: 100%; border-collapse: collapse; font-size: 13px; }
.chart td, .chart th { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.chart td:last-child, .chart th:last-child { text-align: right; }
.chart-tip { position: fixed; z-index: 2200; background: var(--ink); color: #fff; border-radius: 10px; padding: 7px 10px; font-size: 12px; pointer-events: none; box-shadow: var(--shadow-float); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.chart-tip b { display: block; font: 800 14px Manrope, sans-serif; }
.hbar { margin-bottom: 12px; }
.hbar:last-child { margin-bottom: 0; }
.hbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; gap: 8px; }
.hbar-top b { font-family: Manrope, sans-serif; font-weight: 800; }
.hbar-track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--blue); border-radius: 999px; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 8px 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.checklist li label { flex: 1; display: flex; gap: 12px; align-items: center; cursor: pointer; font-weight: 500; }
.checklist li.done label span { text-decoration: line-through; color: var(--faint); }
.checklist input[type=checkbox] { flex: 0 0 22px; width: 22px; height: 22px; margin: 0; accent-color: var(--blue); }
.checklist .icon-btn { width: 32px; height: 32px; color: var(--faint); }

/* ---------- Estado ---------- */
.status-line { font-size: 13px; font-weight: 500; margin: 10px 0 0; }

/* ---------- Superposiciones ---------- */
.busy { position: fixed; inset: 0; z-index: 3000; background: rgba(11, 16, 32, .55); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; font-weight: 500; }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 3100; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + 16px + var(--safe-bottom)); background: var(--ink); color: #fff; padding: 13px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; text-align: center; box-shadow: var(--shadow-float); }
@media (prefers-color-scheme: dark) { .toast { background: #26304d; } }

dialog { border: 0; border-radius: 20px; padding: 20px; width: min(92vw, 440px); max-height: 88vh; background: var(--surface); color: var(--text); box-shadow: var(--shadow-float); }
dialog::backdrop { background: rgba(11, 16, 32, .5); }
dialog h3 { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.dlg-text { color: var(--muted); margin: 0 0 6px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dlg-actions .btn { min-width: 110px; }
.menu { display: flex; flex-direction: column; margin: -4px -8px 0; }
.menu-item { display: flex; align-items: center; gap: 14px; border: 0; background: none; padding: 13px 10px; border-radius: 10px; font-weight: 500; font-size: 15px; text-align: left; cursor: pointer; color: var(--text); }
.menu-item .ic { color: var(--muted); }
.menu-item:active { background: var(--surface-2); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.sale-pack { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sale-pack:first-child { padding-top: 0; }
.sale-pack .row-main b { display: block; }
.sale-pack .stepper { width: 132px; }
.sale-pack .stepper button { width: 40px; }
.sale-pack .stepper input { padding: 8px 2px; font-size: 16px; }
.sale-total { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0; }
.sale-total span { color: var(--muted); font-size: 13px; }
.sale-total b { font: 800 26px Manrope, sans-serif; letter-spacing: -.6px; }
.detail-list { margin: 0 0 6px; }
.detail-list div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; text-align: right; }

/* ---------- Leaflet ---------- */
.num-icon span { display: flex; width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 800 12px Manrope, sans-serif; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(18,24,41,.35); }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow-float); }
.leaflet-popup-content { margin: 14px; font-family: 'DM Sans', sans-serif; }
.pop b { font-size: 15px; display: block; }
.pop .muted { font-size: 12px; margin-top: 2px; }
.pop .pill { margin-top: 6px; }
.pop-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pop-actions .btn { min-height: 36px; font-size: 13px; justify-content: flex-start; }
.leaflet-control-attribution { font-size: 9px; }
@media (prefers-color-scheme: dark) { .stop-actions .btn.ok { color: #06240f; } }

/* ---------- Mapa minimalista ---------- */
#map[data-style="minimal"] { background: #f2f2ef; }
@media (prefers-color-scheme: dark) { #map[data-style="minimal"] { background: #1c1c1c; } }
.leaflet-container { font-family: 'DM Sans', sans-serif; }
.leaflet-tile { transition: opacity .35s ease; }

/* ---------- Animación de la ruta ---------- */
.num-icon span.await { opacity: 0; transform: scale(0); }
.num-icon span.pop { animation: stop-pop .55s cubic-bezier(.2, .9, .3, 1.35) both; }
@keyframes stop-pop {
  0% { opacity: 0; transform: scale(0) translateY(6px); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.num-icon span { position: relative; }
.num-icon span.next::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--c, #2455f5);
  animation: next-ring 1.8s cubic-bezier(.2, .6, .3, 1) infinite;
}
@keyframes next-ring { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.1); opacity: 0; } }
.shop-fade { animation: shop-fade .5s ease both; }
@keyframes shop-fade { from { opacity: 0; } to { opacity: 1; } }

/* Radar mientras busca */
.radar { pointer-events: none; }
.radar span {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 85, 245, .22) 0%, rgba(36, 85, 245, .08) 55%, transparent 70%);
  border: 1.5px solid rgba(36, 85, 245, .35);
  animation: radar 2.4s cubic-bezier(.2, .6, .35, 1) infinite;
}
.radar span:nth-child(2) { animation-delay: .8s; }
.radar span:nth-child(3) { animation-delay: 1.6s; }
.radar b {
  position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: #2455f5; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(36, 85, 245, .5);
}
@keyframes radar { 0% { transform: scale(.08); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

.scan {
  position: absolute; z-index: 650; top: 14px; left: 50%; transform: translateX(-50%);
  width: min(calc(100% - 32px), 340px); background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-float); padding: 12px 14px 12px; animation: scan-in .35s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes scan-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.scan-row { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.scan-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); flex-shrink: 0; animation: scan-dot 1.2s ease-in-out infinite; }
@keyframes scan-dot { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.1); opacity: 1; } }
.scan-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.scan-steps i { height: 4px; border-radius: 999px; background: var(--line); position: relative; overflow: hidden; }
.scan-steps i.done { background: var(--blue); }
.scan-steps i.on::after {
  content: ''; position: absolute; inset: 0; width: 45%; background: var(--blue); border-radius: 999px;
  animation: scan-bar 1.1s ease-in-out infinite;
}
@keyframes scan-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(230%); } }
.sheet { transition: max-height .25s ease, transform .4s cubic-bezier(.3, .8, .3, 1); }
.sheet.away { transform: translateY(105%); }
.map-tools, .hud { transition: opacity .25s; }

@media (prefers-reduced-motion: reduce) {
  .num-icon span.pop, .num-icon span.next::after, .radar span, .scan, .scan-dot, .scan-steps i.on::after, .shop-fade { animation: none !important; }
  .num-icon span.await { opacity: 1; transform: none; }
}
#scan-text { flex: 1; min-width: 0; }
.scan-cancel { flex-shrink: 0; color: var(--muted); }

/* ---------- Crédito del mapa compacto ---------- */
#map .leaflet-control-attribution {
  background: var(--surface); color: var(--muted); border-radius: 10px; padding: 4px 9px;
  margin: 0 8px 6px 0; box-shadow: var(--shadow-float); font-size: 10px; line-height: 1.4;
}
#map .leaflet-control-attribution a { color: var(--muted); text-decoration: none; }
#map:not(.attr-open) .leaflet-control-attribution { display: none; }
.attr-toggle {
  width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  margin: 0 8px 8px 0 !important; background: var(--surface); color: var(--muted); box-shadow: var(--shadow-float);
  font: italic 700 12px/22px Georgia, serif; text-align: center;
}
#map.attr-open .attr-toggle { color: var(--blue); }
.sheet-actions .wide { grid-column: 1 / -1; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin-bottom: 0; }
[data-seg="radius"] button { padding: 9px 2px; font-size: 12px; }

.chip.dim { opacity: .5; }
.chips-hint { width: 100%; margin-top: 2px; }
.check-chip.all { grid-column: 1 / -1; font-weight: 700; }
.check-chip.dim { opacity: .45; }

/* ---------- Reseñas y NFC ---------- */
.shop-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.shop-card .row-title { font-weight: 700; }
.shop-card .row-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; margin-right: 8px; vertical-align: 1px; }
.panel.dim { opacity: .6; }
.steps { margin: 0 0 14px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.steps b { font-weight: 700; }
.link-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 13px; color: var(--blue); }
.link-box span { min-width: 0; overflow-wrap: anywhere; }
.btn-row > .btn { min-width: 0; padding: 0 10px; }

.nfc { position: fixed; inset: 0; z-index: 2500; background: rgba(11, 16, 32, .6); display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + var(--safe-bottom)); }
.nfc-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 22px; padding: 28px 20px 16px; text-align: center; box-shadow: var(--shadow-float); }
.nfc-card h3 { font-size: 20px; font-weight: 800; }
.nfc-card p { color: var(--muted); margin: 6px 0 18px; font-size: 14px; }
.nfc-anim { width: 88px; height: 88px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--blue-soft); color: var(--blue); position: relative; }
.nfc[data-state="wait"] .nfc-anim::before, .nfc[data-state="wait"] .nfc-anim::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--blue); opacity: 0; animation: nfc-ring 1.8s ease-out infinite; }
.nfc[data-state="wait"] .nfc-anim::after { animation-delay: .9s; }
.nfc[data-state="ok"] .nfc-anim { background: var(--ok-soft); color: var(--ok); }
.nfc[data-state="error"] .nfc-anim { background: var(--warn-soft); color: var(--warn); }
.nfc-actions { display: flex; flex-direction: column; gap: 6px; }
@keyframes nfc-ring { from { transform: scale(1); opacity: .6; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .nfc-anim::before, .nfc-anim::after { animation: none !important; } }
.searching { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.searching b { display: block; font-weight: 700; }
.searching small { display: block; }
.spinner.sm { width: 22px; height: 22px; border-width: 2.5px; border-color: var(--blue-soft); border-top-color: var(--blue); flex-shrink: 0; }
