/* Lead Hound V1.0 — sistema de diseño. Móvil primero; riel lateral en escritorio; claro/oscuro
 * automático por sistema, con un interruptor manual (ver LH.theme en core.js) que fija
 * :root[data-theme="light"|"dark"] — por especificidad de atributo, gana siempre a la preferencia
 * del sistema cuando la persona elige explícitamente. */
:root {
  --bg: #f6f5fa;
  --surface: #ffffff;
  --surface-2: #f0eef7;
  --text: #1b1930;
  --muted: #6b6885;
  --border: #e3e0ee;
  --primary: #6c46e8;
  --primary-ink: #ffffff;
  --primary-soft: #f1ecfe;
  --danger: #d42e44;
  --danger-soft: #fceaee;
  --ok: #0b8a57;
  --ok-soft: #e7f8ef;
  --warn: #b36a00;
  --warn-soft: #fdf1df;
  --info: #1d5fd1;
  --shadow: 0 1px 2px rgba(27, 25, 48, .06), 0 4px 16px rgba(27, 25, 48, .07);
  --shadow-lg: 0 10px 40px rgba(27, 25, 48, .22);
  --radius: 14px;
  --hdr-h: 56px;
  --tab-h: 62px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --st-nuevo: #7d7a96;
  --st-contactado: #1d5fd1;
  --st-interesado: #d97706;
  --st-cliente: #0b8a57;
  --st-descartado: #b4344a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d18;
    --surface: #181528;
    --surface-2: #211e35;
    --text: #efedf8;
    --muted: #a19fba;
    --border: #2d2a45;
    --primary: #8b6cf5;
    --primary-soft: #262046;
    --danger: #ff6b7f;
    --danger-soft: #3a1a22;
    --ok: #34d399;
    --ok-soft: #12302a;
    --warn: #fbbf24;
    --warn-soft: #382c10;
    --info: #6ea2ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
    --st-nuevo: #9a97b4;
    --st-contactado: #6ea2ff;
    --st-interesado: #fbbf24;
    --st-cliente: #34d399;
    --st-descartado: #ff8a9b;
  }
}

/* Elección manual (LH.theme): mismas paletas que arriba, pero fijas en vez de "según el sistema". */
:root[data-theme="dark"] {
  --bg: #0f0d18; --surface: #181528; --surface-2: #211e35; --text: #efedf8; --muted: #a19fba;
  --border: #2d2a45; --primary: #8b6cf5; --primary-soft: #262046; --danger: #ff6b7f; --danger-soft: #3a1a22;
  --ok: #34d399; --ok-soft: #12302a; --warn: #fbbf24; --warn-soft: #382c10; --info: #6ea2ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
  --st-nuevo: #9a97b4; --st-contactado: #6ea2ff; --st-interesado: #fbbf24; --st-cliente: #34d399; --st-descartado: #ff8a9b;
}
:root[data-theme="light"] {
  --bg: #f6f5fa; --surface: #ffffff; --surface-2: #f0eef7; --text: #1b1930; --muted: #6b6885;
  --border: #e3e0ee; --primary: #6c46e8; --primary-soft: #f1ecfe; --danger: #d42e44; --danger-soft: #fceaee;
  --ok: #0b8a57; --ok-soft: #e7f8ef; --warn: #b36a00; --warn-soft: #fdf1df; --info: #1d5fd1;
  --shadow: 0 1px 2px rgba(27, 25, 48, .06), 0 4px 16px rgba(27, 25, 48, .07);
  --st-nuevo: #7d7a96; --st-contactado: #1d5fd1; --st-interesado: #d97706; --st-cliente: #0b8a57; --st-descartado: #b4344a;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
[hidden] { display: none !important; }
svg[aria-hidden="true"] { width: 1.3em; height: 1.3em; flex: none; }
.list-item > svg, .list-item > span > svg { color: var(--muted); width: 22px; height: 22px; margin-top: 1px; }
.stop .num svg { width: 16px; height: 16px; }

/* ── Layout ─────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100dvh; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 10px;
  min-height: calc(var(--hdr-h) + var(--safe-t)); padding: var(--safe-t) 14px 0;
  background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.01em; font-size: 17px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; color: #fff; }
.brand-mark svg { width: 16px; height: 16px; }
.topbar .ws { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .grow { flex: 1; min-width: 0; }
#view { flex: 1; min-height: 0; position: relative; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.page { padding: 14px 14px 96px; max-width: 880px; margin: 0 auto; }
.page-title { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 12px; }
.page-sub { color: var(--muted); font-size: 13px; margin: -8px 0 14px; }

.tabbar {
  flex: none; display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b); z-index: 20;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tab-h); background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer;
  position: relative;
}
.tab svg { width: 23px; height: 23px; }
.tab[aria-current="page"] { color: var(--primary); }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 4px 4px; background: var(--primary);
}
.tab .badge {
  position: absolute; top: 7px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
}
.tab .badge.soft { background: var(--primary); }

/* Botón central de acciones rápidas: flota JUSTO ENCIMA de la barra de pestañas, sin tocarla ni
 * tapar ninguna pestaña (antes se superponía a "Ruta" y la dejaba inaccesible). */
.quick-fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-b) + var(--tab-h) + 14px);
  width: 58px; height: 58px; border-radius: 50%; border: 4px solid var(--bg);
  background: var(--primary); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-lg); cursor: pointer; z-index: 21;
}
.quick-fab svg { width: 26px; height: 26px; }
@media (min-width: 900px) {
  /* En escritorio la barra es el riel lateral (5 pestañas apiladas arriba, ~360px). El botón va
     debajo de todas, no encima de ninguna. */
  .quick-fab { left: 46px; bottom: 20px; top: auto; transform: translateX(-50%); }
}

.visit-bar {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--ok); color: #fff;
  font-weight: 600; z-index: 19;
}
.visit-bar .dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; flex: none; }
.visit-bar .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; cursor: pointer; }
.visit-bar .btn { background: #fff; color: var(--ok); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (min-width: 900px) {
  #app.has-shell { display: grid; grid-template-columns: 92px 1fr; grid-template-rows: auto auto minmax(0, 1fr); }
  .tabbar { grid-column: 1; grid-row: 1 / 4; flex-direction: column; justify-content: flex-start; border-top: 0; border-right: 1px solid var(--border); padding-top: 10px; }
  .tab { flex: none; height: 68px; }
  .tab[aria-current="page"]::before { top: 20%; bottom: 20%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 4px 4px 0; }
  .topbar { grid-column: 2; grid-row: 1; }
  .visit-bar { grid-column: 2; grid-row: 2; }
  #view { grid-column: 2; grid-row: 3; }
}

/* ── Controles ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 16px;
  border-radius: 11px; border: 1px solid transparent; background: var(--primary); color: var(--primary-ink);
  font-weight: 650; cursor: pointer; white-space: nowrap; transition: transform .06s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn.secondary.busy::after, .btn.soft.busy::after, .btn.ghost.busy::after { border-color: var(--border); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 11px; border: 0; background: transparent;
  color: var(--text); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label, .label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.hint { font-size: 12.5px; color: var(--muted); }
.error-text { color: var(--danger); font-size: 13px; margin: 6px 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .n { opacity: .75; font-weight: 500; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.st-nuevo { --c: var(--st-nuevo); } .st-contactado { --c: var(--st-contactado); } .st-interesado { --c: var(--st-interesado); }
.st-cliente { --c: var(--st-cliente); } .st-descartado { --c: var(--st-descartado); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag svg { width: 13px; height: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; cursor: pointer; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.list-item:active { background: var(--surface-2); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; align-items: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: 8px; }
.empty .btn { margin-top: 14px; }
.loading { text-align: center; color: var(--muted); padding: 36px; }

.fab {
  position: absolute; right: 16px; bottom: 18px; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--primary);
  color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-lg); cursor: pointer; z-index: 5;
}
.fab svg { width: 26px; height: 26px; }
.fab-wrap { position: sticky; bottom: 0; height: 0; }

/* ── Mapa ───────────────────────────────────────────── */
.map-wrap { position: absolute; inset: 0; }
.map-el { position: absolute; inset: 0; z-index: 1; }
.map-top { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 500; pointer-events: none; }
.map-top > * { pointer-events: auto; }
.map-top .chips { padding-bottom: 0; }
.map-top .chip { box-shadow: var(--shadow); }
.map-banner {
  margin-top: 8px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow); font-size: 13.5px;
}
.map-banner .grow { flex: 1; }
.map-btns { position: absolute; right: 12px; bottom: 16px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.map-btns .icon-btn { background: var(--surface); box-shadow: var(--shadow); border-radius: 13px; width: 46px; height: 46px; }
.leaflet-container { font: inherit; background: var(--surface-2); }
.pin > span {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--c, var(--st-nuevo)); border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); color: #fff; font-size: 11px; font-weight: 800;
}
.pin > span > b { transform: rotate(45deg); font-weight: 800; }
.pin.in-route > span { width: 28px; height: 28px; background: var(--primary); border-color: #fff; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2b7fff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(43, 127, 255, .25); }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content { margin: 12px 14px; min-width: 200px; }
.pop-title { font-weight: 800; margin-bottom: 2px; color: #1b1930; }
.pop-sub { color: #6b6885; font-size: 13px; margin-bottom: 8px; }
.pop-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(108, 70, 232, .28); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: rgba(108, 70, 232, .85); color: #fff; font-weight: 800; }

/* ── Bottom sheet / modal ───────────────────────────── */
#sheet-root { position: relative; z-index: 1000; }
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(15, 13, 24, .5); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease; z-index: 1000;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } }
.sheet {
  width: 100%; max-width: 640px; max-height: 94dvh; display: flex; flex-direction: column; background: var(--bg);
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); animation: rise .22s ease; padding-bottom: var(--safe-b);
}
.sheet.wide { max-width: 720px; height: 94dvh; }
.sheet-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 18px; }
.sheet-title { flex: 1; min-width: 0; font-weight: 800; font-size: 17px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; padding: 10px 16px 14px; border-top: 1px solid var(--border); background: var(--surface); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 20px; max-height: 88dvh; }
  .sheet.wide { height: 88dvh; }
}

.lead-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.lead-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.actions .btn { flex: 1 1 auto; }
.tabs { display: flex; gap: 4px; margin: 12px 0; padding: 4px; background: var(--surface-2); border-radius: 12px; position: sticky; top: 0; z-index: 3; }
.tabs button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 650; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.section { margin: 16px 0 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; font-weight: 600; }

.timeline { position: relative; margin-left: 8px; padding-left: 18px; border-left: 2px solid var(--border); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border); }
.tl-item.visit::before { border-color: var(--ok); }
.tl-item.note::before { border-color: var(--primary); }
.tl-head { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.tl-head b { color: var(--text); }
.tl-body { margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.tl-item.system .tl-body { color: var(--muted); font-size: 13.5px; }

.task {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px;
}
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.check {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); display: grid; place-items: center;
  cursor: pointer; flex: none; color: transparent; padding: 0;
}
.check svg { width: 15px; height: 15px; }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.t-main { flex: 1; min-width: 0; }
.t-title { font-weight: 600; }
.t-sub { font-size: 12.5px; color: var(--muted); }
.due { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.due.late { color: var(--danger); } .due.today { color: var(--warn); }

.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt {
  padding: 12px 10px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; text-align: left;
  font-weight: 650; font-size: 14px; line-height: 1.25;
}
.opt small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; font-size: 12px; }
.opt[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); }
.opt.full { grid-column: 1 / -1; }

/* ── Ruta ───────────────────────────────────────────── */
.stop { display: flex; align-items: center; gap: 11px; padding: 11px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; }
.stop.visited { opacity: .6; }
.stop .num { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13.5px; flex: none; }
.stop.visited .num { background: var(--ok); }
.stop .mid { flex: 1; min-width: 0; cursor: pointer; }
.stop .ctl { display: flex; flex-direction: column; gap: 2px; }
.stop .ctl .icon-btn { width: 30px; height: 26px; border-radius: 7px; }
.stop .ctl .icon-btn svg { width: 17px; height: 17px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 650; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* ── Panel ──────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { padding: 13px 14px; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.kpi.alert .v { color: var(--danger); }
.hbar { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 13.5px; }
.hbar .name { width: 92px; flex: none; color: var(--muted); }
.hbar .track { flex: 1; height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 6px; background: var(--c, var(--primary)); min-width: 3px; }
.hbar .val { width: 34px; text-align: right; font-weight: 700; }
.cols { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-top: 6px; }
.cols .c { flex: 1; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 3px; opacity: .85; position: relative; }
.cols .c.zero { background: var(--border); opacity: 1; }
.cols-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--muted); font-weight: 650; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--border); }
.table td.num, .table th.num { text-align: right; }
.scroll-x { overflow-x: auto; }

/* ── Auth ───────────────────────────────────────────── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; background:
  radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: 26px 22px; }
.auth-logo { width: 54px; height: 54px; border-radius: 16px; background: var(--primary); color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.auth-logo svg { width: 30px; height: 30px; }
.auth h1 { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.auth .lead { color: var(--muted); margin: 4px 0 20px; }

/* ── Toasts ─────────────────────────────────────────── */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 3000; pointer-events: none; padding: 0 14px; }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.toast { background: #1b1930; color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); max-width: 460px; animation: rise .2s ease; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

.progress { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 12px 0; }
.progress > div { height: 100%; background: var(--primary); transition: width .3s; }
.warnbox { padding: 10px 12px; border-radius: 11px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; margin: 10px 0; }
.okbox { padding: 10px 12px; border-radius: 11px; background: var(--ok-soft); color: var(--ok); font-size: 13.5px; margin: 10px 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Popups del mapa acordes al tema */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.pop-title { color: var(--text); }
.pop-sub { color: var(--muted); }
.leaflet-container a.btn { color: inherit; }
.leaflet-container a.btn.secondary { color: var(--text); }
.leaflet-control-attribution { font-size: 10px; }
