/* Global Rioja Express · Gestión
   Paleta: papel frío, tinta azul noche, granate de marca (configurable),
   ámbar "cinta de embalar" solo en la etiqueta de cotización. */
:root {
  --paper: #F3F5F8;
  --card: #FFFFFF;
  --ink: #1B2433;
  --ink-2: #4A5568;
  --ink-3: #6B7585;
  --line: #D9DEE6;
  --line-2: #E8ECF1;
  --brand: #7A1F3D;
  --brand-ink: #FFFFFF;
  --brand-soft: #F6EAEE;
  --tape: #F2A900;
  --good: #1F8A4C;
  --good-soft: #E6F4EC;
  --bad: #C8352E;
  --bad-soft: #FBEAE9;
  --warn-soft: #FFF6DE;
  --focus: #2F6FED;
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--font); font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Tipografía ---------- */
h1, h2, h3 { font-stretch: 78%; font-weight: 750; letter-spacing: -0.005em; line-height: 1.15; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--brand); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 14px; padding: 28px 24px; }
.login-card h1 { font-size: 1.9rem; }
.login-card p { color: var(--ink-2); margin: 6px 0 18px; }
.login-logo { max-height: 64px; max-width: 220px; display: block; margin-bottom: 14px; }

/* ---------- Estructura ---------- */
.app { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--brand); color: var(--brand-ink);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; flex: 1; }
.brand img { height: 30px; width: auto; max-width: 120px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px 4px; }
.brand span { font-weight: 750; font-stretch: 78%; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: inherit; }
.icon-btn:hover { background: rgba(255,255,255,.14); }
.sync { width: 9px; height: 9px; border-radius: 50%; background: #7EE2A8; box-shadow: 0 0 0 3px rgba(255,255,255,.15); }
.sync.off { background: #FFB4AE; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); text-decoration: none; font-size: .75rem; font-weight: 600;
}
.tabs a.active { color: var(--brand); }
.tabs a.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.tab-desktop-only { display: none !important; }
.badge {
  position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; font-weight: 700;
}
.view { padding: 16px 16px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; outline: none; }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; padding: 12px 24px; }
  .topbar #top-ajustes, .topbar #top-clientes, .topbar #top-mas { display: none; }
  .tabs {
    position: sticky; top: 62px; align-self: start; height: auto; grid-template-columns: 1fr; padding: 16px 12px; gap: 2px;
    border-top: 0; border-right: 1px solid var(--line); height: calc(100dvh - 62px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #C9CFD8 transparent; background: var(--card); align-content: start; grid-auto-rows: max-content;
  }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: .95rem; }
  .tabs a:hover { background: var(--paper); color: var(--ink); }
  .tabs a.active { background: var(--brand-soft); color: var(--brand); }
  .tabs a.active::before { display: none; }
  .tabs::-webkit-scrollbar { width: 8px; }
  .tabs::-webkit-scrollbar-thumb { background: #C9CFD8; border-radius: 8px; }
  .tabs::-webkit-scrollbar-thumb:hover { background: #9AA3B0; }
  .tab-desktop-only { display: flex !important; }
  .badge { position: static; margin-left: auto; }
  .view { padding: 28px 32px 48px; width: 100%; min-width: 0; }
}

/* ---------- Cabecera de vista ---------- */
.view-head { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 16px; }
.view-head h1 { flex: 1; min-width: 180px; }
.view-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.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); background: var(--card); color: var(--ink);
  font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #B9C1CD; }
.btn svg { width: 19px; height: 19px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--brand); }
.ce-cli { max-width: 230px; }
.btn-wa { background: #128C4A; border-color: #128C4A; color: #fff; }
.btn-wa:hover { filter: brightness(1.07); border-color: #128C4A; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: .875rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Formularios ---------- */
label, .label { display: block; font-weight: 600; font-size: .875rem; color: var(--ink-2); margin: 0 0 5px; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); font-size: 16px;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47,111,237,.15); }
input[readonly] { background: var(--paper); }
.field { margin-bottom: 14px; min-width: 0; }
.field .hint { font-size: .8rem; color: var(--ink-3); margin-top: 4px; }
.field .hint.ok { color: var(--good); }
.field .hint.err { color: var(--bad); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.row-2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.row-3 { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-cp { display: grid; gap: 10px; grid-template-columns: 110px minmax(0, 1fr); }
.form-error { color: var(--bad); font-size: .9rem; min-height: 1.2em; margin: 4px 0 10px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); min-height: 44px; margin: 0; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); }

/* Selector segmentado */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 3px; width: 100%; }
.seg button { min-height: 40px; border: 0; background: transparent; border-radius: 7px; font-weight: 650; color: var(--ink-2); cursor: pointer; padding: 0 10px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(27,36,51,.12); }
.seg.seg-iva button[aria-pressed="true"][data-v="1"] { color: var(--brand); }

/* ---------- Paneles ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.panel h2 { margin-bottom: 12px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2, .panel-head h3 { margin: 0; flex: 1; }

/* ---------- Cotizador ---------- */
.quote { display: grid; gap: 16px; }
.quote > * { min-width: 0; }
.label-actions .btn { white-space: normal; text-align: center; line-height: 1.2; padding: 6px 12px; }
@media (min-width: 900px) { .quote { grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); align-items: start; } .quote .label-card { position: sticky; top: 86px; } }
.route { display: grid; gap: 4px; }
.route-arrow { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: .8rem; margin: -2px 0 10px; }
.route-arrow::before, .route-arrow::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }

/* La etiqueta: lo que el cliente va a pagar, como una etiqueta de envío */
.label-card {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 20px 18px 30px; overflow: hidden;
}
.label-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; background: var(--tape);
  background-image: repeating-linear-gradient(180deg, transparent 0 14px, rgba(0,0,0,.07) 14px 16px); }
.label-top { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-3); font-size: .85rem; }
.label-route { font-weight: 700; font-stretch: 85%; font-size: 1.05rem; margin: 6px 0 2px; color: var(--ink); overflow-wrap: anywhere; }
.label-total { font-stretch: 62%; font-weight: 800; font-size: clamp(3.4rem, 15vw, 4.6rem); line-height: .95; letter-spacing: -0.01em; margin: 14px 0 4px; font-variant-numeric: tabular-nums; }
.label-total small { font-size: .42em; font-weight: 700; margin-left: 4px; }
.label-break { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: .95rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.label-break b { color: var(--ink); font-weight: 650; text-align: right; }
.label-empty { color: var(--ink-3); padding: 18px 0; }
.label-cut { border: 0; border-top: 2px dashed var(--line); margin: 16px -20px 14px -30px; }
.label-actions { display: grid; gap: 8px; }
.label-actions .row-2 { gap: 8px; }
.profit { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--paper); font-size: .9rem; display: flex; justify-content: space-between; gap: 8px; }
.profit b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.profit.neg b { color: var(--bad); }
.profit.pos b { color: var(--good); }
.alert { padding: 11px 13px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 14px; }
.alert-bad { background: var(--bad-soft); color: #8E2019; }
.alert-warn { background: var(--warn-soft); color: #6B4E00; }
.alert-ok { background: var(--good-soft); color: #14603A; }

/* ---------- Resumen ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .k { font-size: .82rem; color: var(--ink-3); }
.stat .v { font-stretch: 70%; font-weight: 780; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .8rem; color: var(--ink-3); }
.stat.alertish .v { color: var(--bad); }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 14px; }
.filters .seg { width: auto; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.filters .seg::-webkit-scrollbar { display: none; }
.filters .seg button { white-space: nowrap; }
.filters .grow { flex: 1; min-width: 180px; }
.filters input { min-height: 42px; }
.filters .dates { display: flex; gap: 6px; align-items: center; }
.filters .dates input { width: 150px; }

/* ---------- Lista de recogidas ---------- */
.list { display: grid; gap: 8px; }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
}
.item:hover { border-color: #B9C1CD; }
.item-main { min-width: 0; }
.item-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { font-size: .86rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-right { text-align: right; display: grid; justify-items: end; gap: 4px; }
.item-amount { font-weight: 750; font-stretch: 80%; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.day-head { font-size: .82rem; font-weight: 700; color: var(--ink-3); margin: 14px 2px 2px; }
.day-head:first-child { margin-top: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 11px; border-radius: 15px; border: 0;
  font-size: .8rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-paid { background: var(--good-soft); color: var(--good); }
.pill-unpaid { background: var(--bad-soft); color: var(--bad); }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: var(--line-2); color: var(--ink-2); vertical-align: 1px; }
.tag-rec { background: var(--brand-soft); color: var(--brand); }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-3); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin: 0 0 12px; }

/* Tabla en escritorio */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: left; font-size: .78rem; color: var(--ink-3); font-weight: 650; padding: 10px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFC; }
.t td { padding: 10px 9px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { cursor: pointer; }
.t tbody tr:hover td { background: #FAFBFC; }
.t .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t .ell { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.only-mobile { display: block; }
.only-desktop { display: none; }
@media (min-width: 900px) { .only-mobile { display: none; } .only-desktop { display: block; } }

/* ---------- Cobros ---------- */
.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.group + .group { margin-top: 10px; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #FAFBFC; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.group-head h3 { flex: 1; min-width: 140px; }
.group-total { font-weight: 780; font-stretch: 75%; font-size: 1.25rem; color: var(--bad); font-variant-numeric: tabular-nums; }
.group-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.group-row:last-child { border-bottom: 0; }
.group-row .item-sub { white-space: normal; }

/* ---------- Clientes ---------- */
.client { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; background: var(--line-2); color: var(--ink-2); font-stretch: 80%; }
.avatar.rec { background: var(--brand-soft); color: var(--brand); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .95rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Ajustes ---------- */
.settings { display: grid; gap: 14px; }
.grid-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.grid-table th { font-size: .78rem; color: var(--ink-3); text-align: left; padding: 4px 4px 6px; font-weight: 650; }
.grid-table td { padding: 3px; }
.grid-table input { min-height: 38px; padding: 6px 8px; font-size: .95rem; }
.scroll-x { overflow-x: auto; }

/* ---------- Modal ---------- */
.modal {
  border: 0; padding: 0; width: min(720px, 100vw); max-width: 100vw; max-height: 100dvh; border-radius: 14px;
  background: var(--paper); color: var(--ink);
}
.modal::backdrop { background: rgba(20, 26, 38, .5); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 16px; }
.modal-foot { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.fs { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 2px; margin-bottom: 12px; }
.fs-title { font-weight: 700; font-size: .95rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.money-box { background: var(--paper); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-variant-numeric: tabular-nums; }
.money-box .tot { font-weight: 800; font-stretch: 75%; font-size: 1.35rem; }
@media (max-width: 720px) {
  .modal { width: 100vw; height: 100dvh; border-radius: 0; margin: 0; }
  .modal[open] { display: flex; flex-direction: column; }
  .modal form, .modal > div { display: flex; flex-direction: column; min-height: 100%; }
  .modal-body { flex: 1; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 9px; font-weight: 600; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }
@media (min-width: 900px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

#imp-cli select { min-width: 140px; }
#imp-cli td:last-child select { min-width: 110px; }

/* ---------- Fase 3: Hoy, solicitudes y ruta ---------- */
.tabs a span { white-space: nowrap; }
@media (max-width: 380px) { .tabs a { font-size: .68rem; } }
.today-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 14px; }
.today-head h1 { flex: 1; min-width: 200px; }
.open-pill { font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 12px; background: var(--good-soft); color: var(--good); }
.open-pill.closed { background: var(--line-2); color: var(--ink-2); }
.urgent { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--brand); color: #fff; text-decoration: none; margin-bottom: 14px; }
.urgent b { font-stretch: 70%; font-size: 2rem; line-height: 1; font-weight: 800; }
.urgent span { flex: 1; }
.urgent small { display: block; opacity: .85; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; flex-wrap: wrap; }
.section-title h2 { flex: 1; min-width: 160px; }
.stop { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stop + .stop { margin-top: 8px; }
.stop.done { opacity: .6; }
.stop-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-stretch: 75%; background: var(--brand); color: #fff; }
.stop.done .stop-n { background: var(--good); }
.stop-main { min-width: 0; }
.stop-addr { font-size: .92rem; color: var(--ink-2); overflow-wrap: anywhere; }
.stop-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.stop-actions .btn { flex: 1 1 auto; }
.stop-warn { grid-column: 1 / -1; font-size: .85rem; color: #6B4E00; background: var(--warn-soft); border-radius: 6px; padding: 5px 9px; }
.wait { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; padding: 2px 9px; border-radius: 11px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wait.hot { background: var(--bad-soft); color: var(--bad); }
.wait.warm { background: var(--warn-soft); color: #6B4E00; }
.tag-canal { background: #E8EEF9; color: #2C4A7F; }
.tag-est-nueva { background: var(--bad-soft); color: var(--bad); }
.tag-est-contactada, .tag-est-presupuestada { background: var(--warn-soft); color: #6B4E00; }
.tag-est-ganada { background: var(--good-soft); color: var(--good); }
.tag-est-perdida { background: var(--line-2); color: var(--ink-3); }
.sol { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.sol.is-new { border-left: 4px solid var(--bad); }
.sol:hover { border-color: #B9C1CD; }
.sol + .sol { margin-top: 8px; }
.sol-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.log { white-space: pre-line; font-size: .88rem; color: var(--ink-2); background: var(--paper); border-radius: 7px; padding: 8px 10px; }
details.raw summary { cursor: pointer; font-size: .85rem; color: var(--ink-3); }
details.raw dl { font-size: .85rem; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-size: .85rem; min-width: 0; }
.qr-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.qr-box #qr { background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.qr-box #qr img, .qr-box #qr canvas { display: block; }
.hours { display: grid; grid-template-columns: max-content 1fr 1fr; gap: 6px 10px; align-items: center; max-width: 420px; }
.hours input { min-height: 38px; padding: 6px 8px; }
@media (max-width: 720px) {
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .spacer { display: none; }
  .modal-foot .btn { flex: 1 1 calc(50% - 8px); }
  .modal-foot .btn-primary { flex-basis: 100%; order: 9; }
}

/* ---------- Ruta optimizada ---------- */
.route-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.route-bar .seg-nav { width: auto; }
.route-meta { margin: 4px 0 12px; }
.next-stop { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.next-k { font-size: .8rem; opacity: .85; }
.next-t { font-weight: 780; font-stretch: 78%; font-size: 1.35rem; line-height: 1.15; }
.next-a { opacity: .92; margin: 2px 0 10px; overflow-wrap: anywhere; }
.next-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.next-actions .btn { flex: 1 1 auto; }
.next-actions .btn-primary { background: #fff; color: var(--brand); border-color: #fff; }
.next-actions .btn:not(.btn-primary) { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.map-box { height: 280px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; margin-bottom: 12px; background: var(--line-2); }
.map-pin { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font: 800 13px/1 var(--font); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.map-pin.start { background: var(--ink); }
.map-pin.aprox { background: var(--tape); color: var(--ink); }
.done-box { margin-top: 18px; }
.done-box summary { cursor: pointer; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }

.stop .item-sub { white-space: normal; }

/* ---------- v1.4 · En la calle ---------- */
.input-btn { display: flex; gap: 8px; }
.input-btn input { flex: 1; min-width: 0; }
.input-btn .btn { flex: none; padding: 0 12px; }
.input-btn .btn span { display: none; }
@media (min-width: 420px) { .input-btn .btn span { display: inline; } }
.sug-wrap { position: relative; }
.sugs { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin-top: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(27,36,51,.14); overflow: hidden; }
.sugs button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line-2); background: none; cursor: pointer; font: inherit; }
.sugs button:last-child { border-bottom: 0; }
.sugs button:hover, .sugs button:focus { background: var(--brand-soft); outline: none; }
.sugs b { display: block; font-size: .95rem; }
.sugs span { display: block; font-size: .8rem; color: var(--ink-3); }
.wa-row { display: flex; flex-wrap: wrap; gap: 8px; }
.wa-preview { white-space: pre-wrap; background: #E7F6EC; border: 1px solid #CBE9D5; border-radius: 10px 10px 10px 2px; padding: 10px 12px; font-size: .9rem; color: #173A26; max-height: 240px; overflow: auto; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 6px; }
.thumbs img { height: 96px; max-width: 160px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; display: block; }
.thumbs figure { margin: 0; }
.thumbs .sig-img { object-fit: contain; width: 160px; }
.thumbs figcaption { font-size: .78rem; color: var(--ink-3); margin-top: 3px; }
.foto-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.foto-row img { height: 72px; max-width: 120px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.sig-box { position: relative; border: 1.5px dashed #B9C1CD; border-radius: var(--radius-sm); background: #fff; height: 150px; }
.sig-box canvas { width: 100%; height: 100%; display: block; border-radius: var(--radius-sm); cursor: crosshair; }
.sig-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); pointer-events: none; font-size: .9rem; }
.sig-box::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: 34px; border-bottom: 1px solid var(--line); pointer-events: none; }
.done-ok { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--good-soft); border-radius: var(--radius); margin-bottom: 14px; }
.done-ok > span { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; font-size: 1.3rem; font-weight: 800; }
.dias { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dias button { min-height: 44px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-sm); font-weight: 750; color: var(--ink-2); cursor: pointer; }
.dias button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
/* Lector de códigos */
.scan { position: fixed; inset: 0; z-index: 50; background: #0D1118; color: #fff; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.scan-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.scan-head b { flex: 1; font-size: 1rem; }
.scan-view { position: relative; flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; background: #000; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; left: 7%; right: 7%; top: 32%; height: 36%; border: 3px solid var(--tape); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
.scan-frame::after { content: ''; position: absolute; left: 8px; right: 8px; top: 50%; height: 2px; background: #FF4D4D; box-shadow: 0 0 8px #FF4D4D; animation: scanline 1.6s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-36px); } 50% { transform: translateY(36px); } }
@media (prefers-reduced-motion: reduce) { .scan-frame::after { animation: none; } }
.scan-msg { margin: 10px 2px 0; font-size: .9rem; color: #C9D1DD; }
#scan-view video + * { max-width: 100%; }

/* ---------- v1.5 · Control ---------- */
body:not(.is-admin) .tab-admin { display: none !important; }
.icon-btn { position: relative; }
.badge-dot { top: 6px; left: auto; right: 6px; min-width: 10px; width: 10px; height: 10px; padding: 0; border: 2px solid var(--brand); }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav b { min-width: 130px; text-align: center; font-stretch: 85%; text-transform: capitalize; }
.delta { font-weight: 700; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.stat.goodish .v { color: var(--good); }
.panel-grid { display: grid; gap: 14px; margin-bottom: 16px; align-items: start; }
.panel-grid .panel + .panel { margin-top: 0; }
@media (min-width: 900px) { .panel-grid { grid-template-columns: 1.25fr 1fr; } }
.seg-sm { width: auto; }
.seg-sm button { min-height: 32px; font-size: .82rem; }
/* gráfico */
.chart { position: relative; padding-left: 4px; }
.chart-plot { position: relative; height: 190px; margin: 26px 0 0 0; }
.chart-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.chart-grid.zero { border-top: 1px solid #B9C1CD; }
.chart-grid i { position: absolute; right: 0; top: -18px; font-style: normal; font-size: .72rem; color: var(--ink-3); background: var(--card); padding-left: 4px; }
.chart-bars { position: absolute; inset: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.chart-col { position: relative; cursor: pointer; outline: none; border-radius: 4px; }
.chart-col:hover, .chart-col:focus-visible { background: rgba(27,36,51,.04); }
.chart-bar { position: absolute; left: 18%; right: 18%; background: var(--brand); opacity: .55; border-radius: 4px 4px 0 0; }
.chart-bar.neg { background: var(--bad); border-radius: 0 0 4px 4px; }
.chart-col.is-now .chart-bar { opacity: 1; }
.chart-val { position: absolute; left: 50%; transform: translateX(-50%); font-size: .75rem; font-weight: 750; white-space: nowrap; color: var(--ink); }
.chart-x { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; margin-top: 6px; }
.chart-x span { text-align: center; font-size: .7rem; color: var(--ink-3); text-transform: capitalize; }
.chart-x span.is-now { color: var(--ink); font-weight: 700; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 8px; padding: 7px 10px; font-size: .8rem; pointer-events: none; z-index: 3; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.chart-tip b { display: block; text-transform: capitalize; }
.chart-tip span { display: block; font-variant-numeric: tabular-nums; font-weight: 700; }
.chart-tip small { display: block; opacity: .8; }
/* cascada */
.waterfall { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: baseline; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.waterfall small { display: block; font-size: .75rem; color: var(--ink-3); }
.waterfall b { text-align: right; white-space: nowrap; }
.waterfall .neg { color: var(--ink-2); font-weight: 600; }
.waterfall .sum { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 700; }
.waterfall .tot { border-top: 2px solid var(--ink); padding-top: 8px; font-weight: 800; font-size: 1.1rem; }
.waterfall b.tot.pos { color: var(--good); }
.waterfall b.tot.neg { color: var(--bad); }
/* ranking */
.rank { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n v" "b b"; gap: 3px 10px; color: inherit; text-decoration: none; }
a.rank-row[href]:hover .rank-name { color: var(--brand); }
.rank-name { grid-area: n; font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.rank-name small { display: block; font-weight: 400; color: var(--ink-3); font-size: .78rem; }
.rank-row b { grid-area: v; font-variant-numeric: tabular-nums; }
.rank-bar { grid-area: b; height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.rank-bar i.alt { background: #5B6B82; }
/* menú más */
.tiles { display: grid; gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile { position: relative; display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; min-height: 72px; }
.tile:hover { border-color: #B9C1CD; }
.tile-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.tile b { display: block; font-size: 1.02rem; }
.tile small { display: block; color: var(--ink-3); font-size: .84rem; }
.tile-badge { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: var(--bad); color: #fff; border-radius: 10px; min-width: 22px; height: 22px; padding: 0 6px; font-size: .78rem; display: grid; place-items: center; }
.btn-big { width: 100%; min-height: 54px; font-size: 1.02rem; }
.hoy-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.hoy-foot .btn { flex: 1 1 200px; }
.stop.frio .stop-n { background: #DCEBFA; }
.tag-inc-abierta { background: var(--bad-soft); color: var(--bad); }
.tag-inc-reclamada { background: var(--warn-soft); color: #6B4E00; }
.tag-inc-resuelta { background: var(--good-soft); color: #14603A; }
.t tr.tot td { border-top: 2px solid var(--line); font-weight: 700; background: #FAFBFC; }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.copy-row code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font-size: .8rem; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 8px; }
details summary { cursor: pointer; }

/* ---------- v1.6 ---------- */
.pend { font-size: .78rem; font-weight: 750; background: #FFF6DE; color: #6B4E00; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.voz { position: fixed; inset: 0; z-index: 50; background: rgba(13,17,24,.72); display: grid; place-items: center; padding: 16px; }
.voz-box { background: var(--card); border-radius: 16px; padding: 22px 20px; width: 100%; max-width: 440px; text-align: center; }
.voz-box b { display: block; font-size: 1.15rem; margin-top: 6px; }
.voz-mic { width: 74px; height: 74px; margin: 0 auto; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 2rem; animation: latido 1.3s ease-in-out infinite; }
@keyframes latido { 0%, 100% { box-shadow: 0 0 0 0 rgba(122,31,61,.45); } 50% { box-shadow: 0 0 0 16px rgba(122,31,61,0); } }
@media (prefers-reduced-motion: reduce) { .voz-mic { animation: none; } }
.voz-ej { font-size: .82rem; color: var(--ink-3); margin: 6px 0 12px; }
.voz-txt { min-height: 70px; background: var(--paper); border-radius: 10px; padding: 10px 12px; text-align: left; font-size: 1rem; }
.voz-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

/* ---------- v1.7 · Marketing ---------- */
.seg-scroll { overflow-x: auto; grid-auto-columns: minmax(max-content, 1fr); }
.red-tag { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.red-tag::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--rc); }
.mk-urgent { background: var(--bad); color: #fff; box-shadow: 0 2px 10px rgba(200,53,46,.25); }
.mk-urgent b { flex: none; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.4rem; }
.mk-urgent span { font-weight: 700; font-size: 1.02rem; }
.mk-urgent small { font-weight: 500; opacity: .92; }
.mk-urgent::after { content: 'Publicar →'; flex: none; background: #fff; color: var(--bad); font-weight: 800; font-size: .88rem; border-radius: 999px; padding: 8px 14px; }
.mk-urgent:hover { filter: brightness(1.05); }
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat-list { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 92%; }
.msg-yo { align-self: flex-end; background: var(--brand); color: #fff; border-radius: 14px 14px 4px 14px; padding: 10px 13px; }
.msg-ia { align-self: flex-start; display: flex; gap: 10px; }
.msg-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; }
.msg-c { background: var(--card); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 10px 14px; min-width: 0; }
.msg-c p { margin: 0 0 8px; } .msg-c p:last-child { margin-bottom: 0; }
.msg-c ul { margin: 0 0 8px; padding-left: 20px; }
.dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); margin-left: 3px; animation: dots 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dots { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 12px; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chat-in { display: flex; gap: 8px; align-items: flex-end; }
.chat-in textarea { min-height: 52px; flex: 1; }
.chat-btns { display: flex; gap: 6px; }
.chat-meta { margin: 0; }
.props { display: grid; gap: 10px; margin-top: 10px; }
@media (min-width: 900px) { #ideas.props { grid-template-columns: 1fr 1fr; } }
.prop { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; }
.msg-c .prop { background: var(--paper); }
.prop-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.prop-txt { font-size: .9rem; white-space: pre-wrap; color: var(--ink-2); max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.cal-nav { margin-bottom: 12px; justify-content: center; }
.cal-nav b { min-width: 220px; text-transform: none; }
.cal { display: grid; gap: 8px; }
@media (min-width: 1000px) { .cal { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.cal-dia { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 6px; align-content: start; min-height: 70px; }
.cal-dia.is-hoy { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.cal-d { font-size: .8rem; font-weight: 700; color: var(--ink-3); text-transform: capitalize; }
.cal-post { border: 1px solid var(--line-2); border-left: 4px solid #B9C1CD; border-radius: 7px; padding: 7px 9px; cursor: pointer; display: grid; gap: 2px; background: #FAFBFC; }
.cal-post b { font-size: .88rem; line-height: 1.25; }
.cal-post.est-lista { border-left-color: #F2A900; }
.cal-post.est-publicada { border-left-color: var(--good); opacity: .75; }
.cal-est { font-size: .72rem; color: var(--ink-3); }
.estudio { display: grid; gap: 16px; }
@media (min-width: 900px) { .estudio { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); align-items: start; } .est-prev { position: sticky; top: 80px; } }
.est-prev { background: repeating-conic-gradient(#EEF1F5 0% 25%, #fff 0% 50%) 0 0 / 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; place-items: center; }
.est-prev canvas { width: 100%; max-width: 520px; max-height: 70vh; object-fit: contain; height: auto; box-shadow: 0 6px 22px rgba(27,36,51,.18); border-radius: 4px; }
.row-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .row-4 { grid-template-columns: repeat(4, 1fr); } }
.mini-bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; height: 120px; align-items: end; margin: 8px 0 10px; }
.mini-bars div { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.mini-bars i { width: 70%; background: var(--brand); border-radius: 4px 4px 0 0; opacity: .8; }
.mini-bars span { font-size: .72rem; color: var(--ink-3); }

.espera { display: flex; gap: 14px; align-items: center; }
.spin { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: girar .9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

.pl-lista { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; }
.pl-lista li { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--ink-3); }
.pl-lista li.ok { color: var(--ink); }
.pl-est { width: 18px; text-align: center; font-weight: 800; color: var(--brand); }

.ia-box { border: 1px solid #E3D3F3; background: linear-gradient(180deg, #FBF7FF, #fff); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.ia-box summary { list-style: none; } .ia-box summary::-webkit-details-marker { display: none; }
.ia-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.foto-row #ia-ref-img { height: 48px; width: 48px; object-fit: cover; border-radius: 6px; }
.ia-gal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.ia-gal button { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: none; aspect-ratio: 1; }
.ia-gal button:hover, .ia-gal button:focus-visible { border-color: var(--brand); }
.ia-gal img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 480px) { .mk-urgent small { display: none; } .mk-urgent::after { content: 'Ver →'; } }

/* ---------- v1.9 Correos Express ---------- */
.ce-urgent::after { content: 'Revisar →'; }
@media (max-width: 480px) { .ce-urgent::after { content: 'Ver →'; } }
.ce-recordar { display: block; padding: 12px 16px; margin-bottom: 14px; border-radius: var(--radius); border: 1px dashed var(--brand); background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.ce-recordar span { font-weight: 700; }
.ce-recordar small { display: block; color: var(--ink-2); }
.ce-drop.over { outline: 3px dashed var(--brand); outline-offset: 6px; border-radius: var(--radius); }
.ce-intro { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.ce-intro p { margin: 0 0 8px; } .ce-intro ul { margin: 0 0 8px; padding-left: 20px; }
.ce-imports { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ce-imp { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.ce-imp span { display: block; font-size: .78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.ce-imp b { display: block; } .ce-imp small { color: var(--ink-3); }
.ce-imp.old { border-color: var(--tape); background: var(--warn-soft); }
.seg-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .74rem; line-height: 20px; margin-left: 4px; }
.list-cards { display: grid; gap: 10px; }
.ce-card { --c: var(--line); background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--radius); padding: 12px 14px; }
.nivel-rojo, .caso-rojo { --c: var(--bad); }
.nivel-naranja, .caso-naranja { --c: #E07B00; }
.nivel-amarillo { --c: var(--tape); }
.nivel-verde, .caso-verde { --c: var(--good); }
.nivel-gris, .caso-igual { --c: #A7AFBC; }
.ce-card-top { display: flex; gap: 10px; align-items: flex-start; }
.ce-card-main { flex: 1; min-width: 0; }
.ce-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); margin-top: 6px; }
.ce-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .84rem; color: var(--ink-3); margin-top: 2px; }
.ce-num { border: 0; background: var(--line-2); border-radius: 6px; padding: 1px 7px; font: inherit; font-variant-numeric: tabular-nums; color: var(--ink-2); cursor: pointer; }
.ce-num:hover { background: var(--brand-soft); color: var(--brand); }
.tag-ce-rojo { background: var(--bad-soft); color: var(--bad); }
.tag-ce-naranja { background: #FDEEDC; color: #8A4B00; }
.tag-ce-amarillo { background: var(--warn-soft); color: #6B4E00; }
.tag-ce-verde { background: var(--good-soft); color: #14603A; }
.tag-ce-gris, .tag-ce-g { background: var(--line-2); color: var(--ink-2); }
.ce-motivo { margin: 8px 0 0; font-size: .92rem; }
.ce-aviso { background: #FDEEDC; color: #6E3C00; border-radius: var(--radius-sm); padding: 6px 10px; }
.ce-acc { margin-top: 10px; flex-wrap: wrap; }
.ce-dkg { flex: none; font-weight: 800; font-stretch: 80%; font-size: 1.15rem; color: var(--c); }
.ce-cmp { display: grid; grid-template-columns: 1fr auto 1fr 1fr; gap: 8px; align-items: center; margin-top: 10px; background: var(--paper); border-radius: var(--radius-sm); padding: 8px 10px; }
.ce-cmp span { display: block; font-size: .74rem; color: var(--ink-3); }
.ce-cmp b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ce-cmp small { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ce-cmp-vs { color: var(--ink-3); font-size: .8rem; }
.ce-cmp .neg b { color: var(--bad); } .ce-cmp .pos b { color: var(--good); }
@media (max-width: 480px) { .ce-cmp { grid-template-columns: 1fr 1fr 1fr; } .ce-cmp-vs { display: none; } }
.ce-sem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.ce-sem-i { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--radius); padding: 8px 10px; text-align: center; }
.ce-sem-i b { display: block; font-size: 1.5rem; font-stretch: 75%; line-height: 1.1; }
.ce-sem-i span { font-size: .78rem; color: var(--ink-3); }
.ce-buscar { margin-bottom: 12px; }
.ce-det { margin-top: 14px; }
.ce-det summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.ce-rows { display: grid; gap: 6px; }
.ce-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.ce-row-main { flex: 1; min-width: 0; }
.ce-row-main small { display: block; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.ce-row[data-rid], .ce-cand { cursor: pointer; }
.ce-cand:hover, .ce-row[data-rid]:hover { border-color: var(--brand); }
.card.ce-sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; }
.ce-sec h3 { margin: 0 0 6px; font-size: 1rem; }
.ce-plazos { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 8px; }
.ce-plazos span { display: block; font-size: .78rem; color: var(--ink-3); }
.ce-plazos b { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.ce-plazos small { color: var(--ink-3); }
.ce-imp-res { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; }
.ce-imp-res b { display: block; } .ce-imp-res small { color: var(--ink-3); display: block; }
.ce-h3 { font-size: 1rem; margin: 16px 0 6px; }
.ce-puntos { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.ce-puntos li { padding: 8px 12px; border-radius: var(--radius-sm); }
.ce-puntos .p-bad { background: var(--bad-soft); color: #8E2019; }
.ce-puntos .p-warn { background: #FDEEDC; color: #6E3C00; }
.ce-puntos .p-ok { background: var(--good-soft); color: #14603A; }
#ce .month-nav { margin-bottom: 12px; }
.list-cards { grid-template-columns: minmax(0, 1fr); }
.ce-card, .ce-card-main, .ce-row-main { min-width: 0; }
.ce-card .item-title { white-space: normal; overflow-wrap: anywhere; }
.ce-ok { background: var(--good-soft); color: #14603A; border-radius: var(--radius-sm); padding: 6px 10px; font-weight: 600; }

/* ===================== v2.0 · Comercial ===================== */
.tag-grupo { min-width: 20px; text-align: center; font-weight: 800; }
.tag-gA { background: #7A1F3D; color: #fff; }
.tag-gB { background: #C9849A; color: #fff; }
.tag-gC { background: var(--line-2); color: var(--ink-2); }
.tag-gD { background: #DCE7F7; color: #1F4E8C; }
.tag-com-prueba { background: #E3F0FA; color: #1F5E8C; }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-good:hover { filter: brightness(1.07); border-color: var(--good); }
.com-item .item-title { white-space: normal; }
.com-item .item-sub { white-space: normal; }
.com-vencida { color: var(--bad); font-weight: 650; }
.com-quick { grid-auto-flow: column; align-items: center; }
.com-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .com-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.com-bar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.com-bar-k { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; color: var(--ink-3); }
.com-bar-k b { font-size: 1.35rem; font-stretch: 75%; color: var(--ink); font-variant-numeric: tabular-nums; }
.com-bar-k small { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.com-bar-t { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.com-bar-t i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.com-bar.ok .com-bar-t i { background: var(--good); }
.com-filtros { display: grid; gap: 10px; margin-bottom: 10px; }
.com-filtros .seg { width: auto; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.com-filtros .seg button { white-space: nowrap; }
@media (max-width: 640px) { .com-filtros .row-3, #ptf .row-3, #im-body .row-3 { grid-template-columns: 1fr 1fr; } .com-filtros .row-3 .field:first-child, #ptf .row-3 .field:first-child, #im-body .row-3 .field:last-child { grid-column: 1 / -1; } }
.com-lote { display: flex; gap: 10px; align-items: center; justify-content: space-between; min-height: 0; margin-bottom: 8px; }
.com-lote:empty { display: none; }
.com-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.com-datos { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 14px; font-size: .93rem; }
.com-datos dt { color: var(--ink-3); }
.com-datos dd { margin: 0; overflow-wrap: anywhere; }
.com-next { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--brand-soft); margin-bottom: 14px; }
.com-next span { font-size: .82rem; color: var(--ink-3); }
.com-next.venc { background: var(--bad-soft); }
.com-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.com-h3 { margin: 18px 0 8px; font-size: 1rem; }
.com-hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.com-hist li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.com-hi { font-size: 1.05rem; line-height: 1.4; }
.com-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.com-chips button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); background: var(--card); border-radius: 19px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.com-chips button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.input-btn textarea { flex: 1; min-width: 0; }
.im-map select { min-width: 160px; }
.im-dups { display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.im-dup { align-items: flex-start; font-weight: 400; padding: 8px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.com-ruta-f { display: grid; gap: 10px; margin-bottom: 4px; }
@media (min-width: 700px) { .com-ruta-f { grid-template-columns: 1fr 1fr; align-items: end; } }
.com-semana { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 12px; }
.com-pipe { display: grid; gap: 6px; margin-bottom: 8px; }
.com-pipe-r { display: grid; grid-template-columns: 110px 1fr 36px; gap: 10px; align-items: center; font-size: .88rem; }
.com-pipe-r b { text-align: right; font-variant-numeric: tabular-nums; }
.com-pipe-b { height: 12px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.com-pipe-b i { display: block; height: 100%; border-radius: 6px; background: var(--ink-3); }
.com-pipe-b i.tag-est-nueva { background: var(--bad); } .com-pipe-b i.tag-est-contactada { background: #D99A00; } .com-pipe-b i.tag-est-presupuestada { background: #B07A00; }
.com-pipe-b i.tag-com-prueba { background: #1F5E8C; } .com-pipe-b i.tag-est-ganada { background: var(--good); } .com-pipe-b i.tag-est-perdida { background: #A9B1BD; }
.com-hist6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; }
.com-h6 { display: grid; justify-items: center; gap: 2px; text-align: center; }
.com-h6-b { height: 90px; width: 100%; max-width: 46px; background: var(--line-2); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.com-h6-b i { display: block; width: 100%; background: var(--brand); }
.com-h6 small { font-size: .72rem; color: var(--ink-3); }
.com-t td, .com-t th { white-space: nowrap; }
.qr-box { display: grid; place-items: center; min-height: 270px; }
.qr-box img { image-rendering: pixelated; border: 8px solid #fff; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.dx-cols { margin: 6px 0 12px; padding-left: 22px; display: grid; gap: 4px; }
.dx-cols li { padding: 2px 0; }
.dx-cols li > * { vertical-align: middle; }
.dx-cols li span { display: inline-block; width: min(240px, 52vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-cols li .btn-sm { min-height: 32px; padding: 0 8px; }
.wa-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ===================== v2.1 · Google ===================== */
.g-list { display: grid; gap: 8px; }
.g-cand { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.g-cand input[type="radio"] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.g-cand.cerrada { background: var(--bad-soft); }
.g-main { min-width: 0; flex: 1; }
.g-conf { font-size: .72rem; font-weight: 750; padding: 1px 6px; border-radius: 5px; vertical-align: 1px; }
.g-ok { background: var(--good-soft); color: var(--good); } .g-med { background: var(--warn-soft); color: #6B4E00; } .g-bad { background: var(--line-2); color: var(--ink-3); }
.g-rell { color: var(--good); font-weight: 650; }
.g-hor summary, .g-pasos summary { cursor: pointer; font-size: .85rem; color: var(--brand); }
.g-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); font-weight: 400; cursor: pointer; }
.g-row input { width: 20px; height: 20px; flex: none; accent-color: var(--brand); margin-top: 2px; }
.g-dud { margin-bottom: 14px; }
.g-dud > .item-title { margin-bottom: 6px; }
.g-pasos { margin: 0 0 12px; }
.g-pasos ol { padding-left: 20px; margin: 8px 0 0; }

/* ===================== v2.2 · Tareas ===================== */
.tk-prog { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tk-bloque { margin-top: 18px; }
.tk-bh { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.tk-bh h2 { flex: 1; font-size: 1rem; margin: 0; }
.tk-list { display: grid; gap: 6px; }
.tk { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.tk-check { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); color: #fff; font-weight: 800; cursor: pointer; display: grid; place-items: center; margin-top: -2px; transition: background .15s, border-color .15s; }
.tk-check:hover { border-color: var(--good); }
.tk.done .tk-check { background: var(--good); border-color: var(--good); }
.tk-main { flex: 1; min-width: 0; cursor: pointer; }
.tk-t { font-weight: 650; line-height: 1.35; }
.tk-d { font-size: .85rem; color: var(--ink-3); margin-top: 2px; white-space: pre-wrap; }
.tk.done .tk-t { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.tk.done .tk-d { display: none; }
.tk-imp { color: var(--brand); font-size: .8rem; vertical-align: 1px; }
.tk-f { flex: none; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tk-f.hoy { background: var(--brand-soft); color: var(--brand); }
.tk-f.venc { background: var(--bad-soft); color: var(--bad); }
.tk.done .tk-f { background: var(--line-2); color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .tk-check { transition: none; } }

/* v2.2.1 · deshacer avisos de WhatsApp marcados por error */
.aviso-hecho { display: inline-flex; gap: 2px; align-items: center; }
.aviso-x { color: var(--ink-3); font-weight: 600; padding: 0 8px; }
.aviso-x:hover { color: var(--bad); }

/* ===================== v2.3 · Leer albarán y ficha para Correos Express ===================== */
.alb-top { margin-bottom: 14px; }
.alb-top .btn .spin { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.alb-res { margin: 10px 0 0; font-size: .9rem; }
.alb-dudas { margin-top: 6px; }
.alb-dudas ul { margin: 4px 0 0; padding-left: 18px; }
.ia-fill { background: #FFF6CC !important; border-color: #E8C547 !important; }
.cx summary { cursor: pointer; list-style: revert; }
.cx-g { margin: 10px 0; }
.cx-g > b { display: block; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); margin-bottom: 4px; }
.cx-r { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line-2); font-size: .92rem; }
.cx-k { color: var(--ink-3); }
.cx-v { overflow-wrap: anywhere; font-weight: 600; }
.cx-c { min-height: 30px; padding: 0 10px; }
@media (max-width: 420px) { .cx-r { grid-template-columns: 86px 1fr auto; } }

/* ===================== v2.4 · Tarifas especiales y propuestas ===================== */
.pt-tabla th { vertical-align: top; min-width: 120px; }
.pt-tabla th:first-child, .pt-tabla td:first-child { min-width: 90px; }
.pt-tabla .pt-col { font-weight: 700; }
.pt-tabla .pt-prov { margin-top: 4px; font-size: .78rem; min-height: 32px; font-weight: 400; }
.pt-tabla .pt-xcol { min-height: 26px; padding: 0 6px; margin-top: 2px; }
.pt-tabla tfoot td { background: var(--line-2); }
.pt-prueba { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.pt-prueba output { align-self: center; }
.pe-bar { position: sticky; bottom: calc(var(--tabbar) + 6px); z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(27,36,51,.12); }
@media (min-width: 900px) { .pe-bar { bottom: 10px; } }

/* ===================== v2.5 · Recogidas automáticas desde Correos Express ===================== */
.ce-auto { margin-top: 12px; padding: 10px 12px; border: 1px solid #CBE9D5; background: #F2FAF5; border-radius: var(--radius-sm); }
.ce-auto .ce-h3 { margin-top: 0; }
.ce-auto-cfg { margin: 8px 0 0; color: var(--ink-2); }

/* ---------- v2.12 Envíos multitransportista ---------- */
a.chip { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 4px; }
.ev-t td { vertical-align: middle; padding: 8px 6px; border-top: 1px solid var(--line-2); }
.ev-t .num, .ev-t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ev-t { min-width: 700px; }
