@font-face {
  font-family: "Mona Sans";
  src: url("mona-sans-variable.woff2") format("woff2");
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-display: swap;
}

:root {
  --navy: #0b2d6b;
  --navy-deep: #071f4d;
  --brand: #114fdb;
  --brand-hover: #0e44bf;
  --electric: #00aeef;
  --ice: #93c5fd;
  --canvas: #f6f8fc;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-muted: #5b6b82;
  --line: #e3e8f0;
  --tint: #e6eefd;
  --tint-line: #c9daf8;
  --on-navy: #e6eefd;
  --on-navy-muted: #c9d6f2;
  --on-navy-faint: #afc1e8;
  --positive: #0f7b53;
  --warning: #b45309;
  --warning-surface: #fef3e2;
  --side-w: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Mona Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 2px solid var(--electric); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }

/* Estructura */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  background: var(--navy); color: #fff;
  display: flex; flex-direction: column; padding: 28px 14px; z-index: 10;
}
.side-head { padding: 0 10px 26px; }
.side-company { font-size: 19px; font-weight: 650; font-stretch: 112%; letter-spacing: -0.01em; }
.side-note { font-size: 13px; color: var(--on-navy-faint); margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--on-navy-muted); text-decoration: none; font-size: 15px; font-weight: 500;
  position: relative;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav a.is-active { color: #fff; background: rgba(255,255,255,.1); }
.nav a.is-active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--electric);
}
.nav svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.nav-short { display: none; }

main { margin-left: var(--side-w); min-height: 100vh; padding: 40px 44px 56px; transition: background-color .3s; }
body[data-view="mando"] { background: var(--navy-deep); }
body[data-view="mando"] main { color: #fff; }

.view { display: none; max-width: 1180px; }
.view.is-active { display: block; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.view-head h1 { font-size: 30px; line-height: 36px; font-weight: 600; font-stretch: 112%; letter-spacing: -0.01em; }
.view-head p { color: var(--ink-muted); margin-top: 6px; max-width: 60ch; }
body[data-view="mando"] .view-head p { color: var(--on-navy-muted); }

.btn {
  border: 0; border-radius: 10px; background: var(--brand); color: #fff;
  padding: 12px 20px; font-weight: 600; font-size: 15px; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--brand-hover); }
.btn:disabled { background: #9db3e6; }

/* 1. Centro de mando */
.live { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--on-navy) !important; margin: 0 !important; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--electric); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0,174,239,.7); } 100% { box-shadow: 0 0 0 12px rgba(0,174,239,0); } }

.kpis { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.kpi, .panel {
  background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
}
.kpi { padding: 20px 22px; }
.kpi-main { background: var(--brand); border-color: transparent; }
.kpi-label { font-size: 14px; color: var(--on-navy-muted); }
.kpi-main .kpi-label, .kpi-main .kpi-foot { color: var(--on-navy); }
.kpi-value { font-size: 34px; line-height: 1.15; font-weight: 650; font-stretch: 112%; letter-spacing: -0.02em; margin: 6px 0 4px; }
.kpi-main .kpi-value { font-size: 46px; }
.kpi-foot { font-size: 13px; color: var(--on-navy-faint); }
.kpi-value.bump { animation: bump .5s ease-out; }
@keyframes bump { 0% { color: var(--ice); } 100% { color: inherit; } }

.mando-grid { display: grid; grid-template-columns: 1.5fr 1fr; grid-template-areas: "chart feed" "routes feed"; gap: 16px; }
.panel { padding: 20px 22px; min-width: 0; }
.panel h2 { font-size: 15px; font-weight: 600; color: var(--on-navy); margin-bottom: 12px; }
.panel-chart { grid-area: chart; }
.panel-routes { grid-area: routes; }
.panel-feed { grid-area: feed; }
#chart { display: block; width: 100%; height: 200px; }
.panel-routes svg { display: block; width: 100%; max-height: 260px; }
.route-lines path { fill: none; stroke: rgba(147,197,253,.35); stroke-width: 1.5; stroke-dasharray: 4 5; }
.route-trucks circle { fill: var(--electric); }
.route-nodes circle { fill: var(--navy-deep); stroke: var(--ice); stroke-width: 2; }
.route-nodes .hub { fill: #fff; stroke: var(--brand); stroke-width: 4; }
.route-labels text { fill: var(--on-navy-muted); font-size: 12px; font-family: inherit; }

#feed li {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.09); font-size: 14px;
  animation: feed-in .45s ease-out;
}
#feed li:last-child { border-bottom: 0; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
#feed .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ice); transform: translateY(-1px); }
#feed .is-pago .dot { background: #4ade80; }
#feed .is-alerta .dot { background: #fbbf24; }
#feed strong { display: block; font-weight: 600; color: #fff; }
#feed span.what { color: var(--on-navy-muted); }
#feed time { color: var(--on-navy-faint); font-size: 13px; white-space: nowrap; }

/* 2. Proceso */
.process-meter {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 20px;
}
.process-meter > div { padding: 18px 24px; border-left: 1px solid var(--line); }
.process-meter > div:first-child { border-left: 0; }
.meter-label { font-size: 14px; color: var(--ink-muted); }
.meter-value { font-size: 32px; font-weight: 650; font-stretch: 112%; letter-spacing: -0.02em; color: var(--navy); }
.meter-compare .meter-value { color: var(--ink-muted); }

.stages { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; counter-reset: st; }
.stage {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; min-height: 230px; opacity: .55; transition: opacity .3s, border-color .3s, box-shadow .3s, transform .3s;
}
.stage::before {
  counter-increment: st; content: counter(st);
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--tint); color: var(--navy); font-weight: 650; font-size: 14px; margin-bottom: 10px;
  transition: background-color .3s, color .3s;
}
.stage h2 { font-size: 15px; font-weight: 600; line-height: 1.3; }
.stage .took { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.stage .detail { margin-top: 12px; font-size: 13.5px; line-height: 1.45; opacity: 0; transform: translateY(6px); transition: opacity .35s .15s, transform .35s .15s; }
.stage.is-active, .stage.is-done { opacity: 1; }
.stage.is-active { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(17,79,219,.14); transform: translateY(-4px); }
.stage.is-active::before { background: var(--brand); color: #fff; }
.stage.is-done::before { background: var(--positive); color: #fff; content: "✓"; }
.stage.is-active .detail, .stage.is-done .detail { opacity: 1; transform: none; }
.bubble { background: #e7f8ec; border-radius: 12px 12px 12px 3px; padding: 9px 11px; color: #14361f; }
.bubble.out { background: var(--tint); border-radius: 12px 12px 3px 12px; color: var(--navy); }
.detail b { font-weight: 600; }
.detail .ok { color: var(--positive); font-weight: 600; }
.process-done {
  margin-top: 20px; padding: 16px 20px; border-radius: 14px; background: var(--navy); color: #fff;
  font-size: 17px; font-weight: 500; animation: feed-in .4s ease-out;
}

/* 3. Asistente */
.chat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; max-width: 860px; }
.chat-log { padding: 24px; display: flex; flex-direction: column; gap: 16px; min-height: 300px; max-height: 56vh; overflow-y: auto; }
.msg { max-width: 88%; animation: feed-in .3s ease-out; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 16px 16px 4px 16px; }
.msg.bot { align-self: flex-start; background: var(--canvas); border: 1px solid var(--line); padding: 14px 18px; border-radius: 16px 16px 16px 4px; width: min(88%, 620px); }
.msg.bot .lead { font-size: 17px; }
.msg.bot .lead b { font-weight: 650; color: var(--navy); }
.typing { display: flex; gap: 5px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.viz { margin-top: 14px; display: grid; gap: 8px; }
.viz-row { display: grid; grid-template-columns: 120px 1fr 88px; gap: 10px; align-items: center; font-size: 14px; }
.viz-row .track { height: 14px; background: var(--tint); border-radius: 7px; overflow: hidden; }
.viz-row .fill { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 7px; transition: width .8s cubic-bezier(.2,.7,.2,1); }
.viz-row.warn .fill { background: var(--warning); }
.viz-row b { text-align: right; font-weight: 600; }
.cols { display: flex; align-items: flex-end; gap: 10px; height: 150px; margin-top: 16px; }
.cols div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; font-size: 13px; color: var(--ink-muted); }
.cols i { display: block; width: 100%; height: 0; background: var(--brand); border-radius: 6px 6px 0 0; transition: height .8s cubic-bezier(.2,.7,.2,1); }
.cols .top i { background: var(--electric); }
.msg-action { margin-top: 14px; }
.msg-action .btn { padding: 9px 16px; font-size: 14px; }
.msg-action .sent { color: var(--positive); font-weight: 600; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px 16px; }
.chips button {
  border: 1px solid var(--tint-line); background: var(--tint); color: var(--navy);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
}
.chips button:hover { background: #d8e5fc; }
.chat-form { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.chat-form input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

/* 4. Documentos */
.doc-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.doc-picker button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 18px;
  font-weight: 600; font-size: 15px; text-align: left;
}
.doc-picker button small { display: block; font-weight: 400; color: var(--ink-muted); font-size: 13px; }
.doc-picker button[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17,79,219,.14); }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.paper-wrap { position: relative; }
.paper {
  background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 30px 30px 34px; min-height: 470px;
  box-shadow: 0 18px 40px -22px rgba(11,45,107,.45); font-size: 13.5px; color: #1f2937;
}
.paper:empty::before { content: "Aquí aparece el documento."; color: var(--ink-muted); }
.paper .p-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #1f2937; padding-bottom: 12px; margin-bottom: 14px; }
.paper .p-issuer { font-weight: 700; font-size: 15px; }
.paper .p-type { font-weight: 700; font-size: 18px; text-align: right; font-stretch: 112%; }
.paper .p-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin-bottom: 16px; }
.paper .p-meta span { color: #6b7280; display: block; font-size: 12px; }
.paper table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.paper th { text-align: left; font-size: 12px; color: #6b7280; font-weight: 500; border-bottom: 1px solid #d1d5db; padding: 6px 4px; }
.paper td { padding: 7px 4px; border-bottom: 1px solid #eef0f3; }
.paper th.n, .paper td.n { text-align: right; }
.paper .p-totals { margin-left: auto; width: min(240px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; }
.paper .p-totals .t { font-weight: 700; font-size: 15px; }
.paper [data-k] { border-radius: 3px; transition: background-color .25s, box-shadow .25s; padding: 0 2px; margin: 0 -2px; }
.paper [data-k].hit { background: rgba(0,174,239,.2); box-shadow: 0 0 0 1.5px var(--electric); }
.scan {
  position: absolute; left: 0; right: 0; top: 0; height: 64px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,174,239,0), rgba(0,174,239,.28));
  border-bottom: 2px solid var(--electric);
  animation: scan 1.3s ease-in-out forwards;
}
@keyframes scan { from { transform: translateY(-64px); } to { transform: translateY(var(--scan-to, 420px)); opacity: .2; } }

.extract { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.extract h2 { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.extract-empty { color: var(--ink-muted); }
#extract-list div { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); animation: feed-in .3s ease-out; }
#extract-list dt { color: var(--ink-muted); font-size: 14px; }
#extract-list dd { font-weight: 600; text-align: right; }
.extract-result { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: #e8f6f0; color: #0b5c3e; font-weight: 600; animation: feed-in .4s ease-out; }

/* 5. Ahorro */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
.calc-controls { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 26px; }
.field { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 18px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.field:last-child { border-bottom: 0; }
.field label { font-weight: 500; }
.field output { font-size: 22px; font-weight: 650; color: var(--navy); font-stretch: 112%; }
.field input { grid-column: 1 / -1; width: 100%; accent-color: var(--brand); height: 28px; margin: 0; }
.calc-result { background: var(--navy); color: #fff; border-radius: 20px; padding: 32px 34px; }
.result-label { color: var(--on-navy-muted); }
.result-money { font-size: clamp(44px, 6.4vw, 78px); line-height: 1.05; font-weight: 700; font-stretch: 112%; letter-spacing: -0.03em; margin: 6px 0 22px; }
.result-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px 0; border-top: 1px solid rgba(255,255,255,.14); border-bottom: 1px solid rgba(255,255,255,.14); }
.result-num { font-size: 34px; font-weight: 650; font-stretch: 112%; letter-spacing: -0.02em; }
.result-cap { font-size: 14px; color: var(--on-navy-muted); }
.bars { display: grid; gap: 12px; margin: 22px 0 18px; }
.bar-line { display: grid; grid-template-columns: 150px 1fr 76px; gap: 12px; align-items: center; font-size: 14px; color: var(--on-navy); }
.bar { height: 16px; background: rgba(255,255,255,.1); border-radius: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ice); border-radius: 8px; transition: width .35s ease-out; }
.bar i.after { background: var(--electric); }
.bar-line b { text-align: right; font-weight: 600; }
.result-note { font-size: 13px; color: var(--on-navy-faint); max-width: 62ch; }

/* Tableta y celular */
@media (max-width: 1100px) {
  .stages { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi-main { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .side {
    inset: auto 0 0 0; width: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.12);
  }
  .side-head { display: none; }
  .nav { flex-direction: row; flex: 1; gap: 2px; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 11px; min-width: 0; }
  .nav a.is-active::before { display: none; }
  .nav-long { display: none; }
  .nav-short { display: block; }
  main { margin-left: 0; padding: 24px 16px 104px; }
  .view-head h1 { font-size: 25px; line-height: 30px; }
  .mando-grid { grid-template-columns: 1fr; grid-template-areas: "chart" "feed" "routes"; }
  .kpi-value { font-size: 28px; }
  .kpi-main .kpi-value { font-size: 40px; }
  .kpi { padding: 16px; }
  #chart { height: 150px; }
  .stages { grid-template-columns: 1fr; }
  .stage { min-height: 0; }
  .process-meter > div { padding: 14px; }
  .meter-value { font-size: 24px; }
  .meter-label { font-size: 12.5px; }
  .doc-grid, .calc { grid-template-columns: 1fr; }
  .paper { padding: 20px 18px; min-height: 0; font-size: 12.5px; }
  .chat-log { padding: 16px; max-height: none; min-height: 220px; }
  .chips { padding: 0 16px 14px; }
  .chat-form { padding: 12px 16px; }
  .msg, .msg.bot { max-width: 100%; width: 100%; }
  .msg.user { width: auto; }
  .viz-row { grid-template-columns: 92px 1fr 76px; font-size: 13px; }
  .calc-result { padding: 24px 20px; }
  .bar-line { grid-template-columns: 1fr 70px; }
  .bar-line span { grid-column: 1 / -1; }
  .view-head .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Segunda pasada: más impacto ---------- */
body[data-view="mando"] main {
  background-image: radial-gradient(900px 520px at 85% -8%, rgba(17,79,219,.55), transparent 62%),
    radial-gradient(700px 420px at -5% 105%, rgba(0,174,239,.16), transparent 60%);
}
.panel-chart { box-shadow: inset 0 -60px 80px -60px rgba(0,174,239,.25); }
#chart-line { filter: drop-shadow(0 0 6px rgba(0,174,239,.8)); }
.route-trucks circle { filter: drop-shadow(0 0 5px rgba(0,174,239,.9)); }

.kpi-ring { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-ring svg { width: 68px; height: 68px; flex: none; transform: rotate(-90deg); }
.kpi-ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: rgba(255,255,255,.12); }
.ring-fg { stroke: var(--electric); stroke-linecap: round; stroke-dasharray: 163.4; stroke-dashoffset: 163.4; transition: stroke-dashoffset 1.6s cubic-bezier(.2,.7,.2,1); }

.arrival {
  position: fixed; top: 24px; right: 28px; z-index: 30; width: min(340px, calc(100vw - 32px));
  background: #fff; color: var(--ink); border-radius: 16px; padding: 14px 18px 14px 20px;
  border-left: 6px solid #25a35a; box-shadow: 0 24px 60px -18px rgba(0,0,0,.55);
  animation: arrive .5s cubic-bezier(.2,.9,.3,1.2);
}
.arrival-title { font-weight: 650; font-size: 15px; }
.arrival-body { color: var(--ink-muted); font-size: 14px; }
.arrival-body b { color: var(--navy); font-weight: 650; font-size: 20px; display: block; font-stretch: 112%; }
@keyframes arrive { from { opacity: 0; transform: translateX(60px) scale(.94); } to { opacity: 1; transform: none; } }

.tour-btn {
  margin-top: auto; border: 1px solid rgba(255,255,255,.28); background: transparent; color: #fff;
  border-radius: 10px; padding: 11px 12px; font-weight: 600; font-size: 14px;
}
.tour-btn:hover { background: rgba(255,255,255,.08); }
.tour-btn.is-on { background: var(--electric); border-color: var(--electric); color: var(--navy-deep); }

.process-body { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.process-body .stages { grid-template-columns: repeat(3, 1fr); }
.process-body .stage { min-height: 168px; }
.phone {
  background: #0a1730; border-radius: 38px; padding: 12px; box-shadow: 0 30px 60px -28px rgba(11,45,107,.7);
  display: flex; flex-direction: column; height: 520px;
}
.phone-head { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 14px 14px 12px; border-radius: 28px 28px 0 0; }
.phone-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; font-weight: 650; font-size: 13px; }
.phone-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.phone-status { font-size: 12px; color: var(--on-navy-faint); }
.phone-chat { flex: 1; background: #eef1f6; padding: 14px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; font-size: 13.5px; line-height: 1.4; }
.phone-chat p { max-width: 86%; padding: 8px 11px; border-radius: 12px; animation: pop .3s cubic-bezier(.2,.9,.3,1.3); box-shadow: 0 1px 1px rgba(15,23,42,.08); }
.phone-chat .me { align-self: flex-end; background: #d6f5dc; border-bottom-right-radius: 3px; color: #12331c; }
.phone-chat .them { align-self: flex-start; background: #fff; border-bottom-left-radius: 3px; }
.phone-chat .them.typing { display: flex; gap: 5px; padding: 12px; }
.phone-chat small { display: block; text-align: right; font-size: 10.5px; color: #6b7a8f; margin-top: 2px; }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(8px); } to { opacity: 1; transform: none; } }
.phone-input {
  border-radius: 0 0 28px 28px; padding: 0 10px 12px; color: #94a3b8; font-size: 13px; line-height: 38px; text-indent: 16px;
  background: #eef1f6 linear-gradient(#fff, #fff) no-repeat 10px 0 / calc(100% - 20px) 38px;
}

@media (max-width: 1100px) {
  .process-body .stages { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .tour-btn { display: none; }
  .process-body { grid-template-columns: 1fr; }
  .process-body .stages { grid-template-columns: 1fr; }
  .phone { height: 400px; max-width: 320px; width: 100%; margin: 0 auto; }
  .arrival { top: 12px; right: 16px; }
  .kpi-ring svg { width: 52px; height: 52px; }
}

.phone-chat .typing i { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: blink 1s infinite; }
.phone-chat .typing i:nth-child(2) { animation-delay: .15s; }
.phone-chat .typing i:nth-child(3) { animation-delay: .3s; }

/* ---------- Tercera pasada: recolección y documentos ampliados ---------- */
.route-meter { grid-template-columns: repeat(5, 1fr); }
.route-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.route-map { position: relative; background: var(--navy-deep); border-radius: 20px; padding: 10px; overflow: hidden;
  background-image: radial-gradient(520px 320px at 80% 0%, rgba(17,79,219,.5), transparent 65%); }
.route-map svg { display: block; width: 100%; height: auto; }
.streets path { fill: none; stroke: rgba(147,197,253,.13); stroke-width: 9; stroke-linecap: round; }
#rt-plan { fill: none; stroke: rgba(147,197,253,.55); stroke-width: 2; stroke-dasharray: 5 6; stroke-linejoin: round; }
#rt-done { fill: none; stroke: var(--electric); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(0,174,239,.9)); }
.rt-base rect { fill: #fff; }
.rt-base text, #rt-stops text { fill: var(--on-navy-muted); font-size: 12px; font-family: inherit; }
#rt-stops circle { fill: var(--navy-deep); stroke: var(--ice); stroke-width: 2.5; transition: fill .3s, stroke .3s; }
#rt-stops .is-go circle { stroke: #fff; }
#rt-stops .is-at circle { fill: var(--electric); stroke: #fff; }
#rt-stops .is-done circle { fill: #34d399; stroke: #34d399; }
#rt-stops .is-done text, #rt-stops .is-at text, #rt-stops .is-go text { fill: #fff; }
#rt-stops .is-new { animation: pop .5s cubic-bezier(.2,.9,.3,1.4); transform-box: fill-box; transform-origin: center; }
#rt-truck .core { fill: #fff; stroke: var(--brand); stroke-width: 4; }
#rt-truck .halo { fill: rgba(0,174,239,.3); animation: halo 1.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.rt-request {
  position: absolute; left: 16px; right: 16px; bottom: 16px; background: #fff; color: var(--ink-muted); font-size: 14px;
  border-radius: 14px; padding: 12px 16px; border-left: 6px solid #25a35a; box-shadow: 0 20px 50px -16px rgba(0,0,0,.6);
  animation: arrive .5s cubic-bezier(.2,.9,.3,1.2);
}
.rt-request b { display: block; color: var(--ink); font-weight: 650; }

.rt-list { display: grid; gap: 10px; counter-reset: rt; }
.rt-list li {
  counter-increment: rt; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 12px 54px;
  position: relative; transition: border-color .3s, box-shadow .3s;
}
.rt-list li::before {
  content: counter(rt); position: absolute; left: 14px; top: 13px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--tint); color: var(--navy); font-weight: 650; font-size: 14px;
}
.rt-list li.is-new { animation: feed-in .5s ease-out; }
.rt-list li.is-go, .rt-list li.is-at { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(17,79,219,.13); }
.rt-list li.is-done::before { background: var(--positive); color: #fff; content: "\2713"; }
.rt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rt-top b { font-weight: 600; }
.rt-chip { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eef1f6; color: var(--ink-muted); white-space: nowrap; }
.is-go .rt-chip { background: var(--tint); color: var(--brand); }
.is-at .rt-chip { background: #d9f3fd; color: #03698f; }
.is-done .rt-chip { background: #e8f6f0; color: #0b5c3e; }
.rt-meta { font-size: 13.5px; color: var(--ink-muted); }
.rt-proof { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13.5px; animation: feed-in .4s ease-out; }
.rt-proof svg { width: 84px; height: 30px; flex: none; }
.rt-proof path { fill: none; stroke: var(--navy); stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 220; stroke-dashoffset: 220; animation: sign 1s .2s ease-out forwards; }
@keyframes sign { to { stroke-dashoffset: 0; } }

.batch { background: var(--navy); color: #fff; border-radius: 18px; padding: 22px 24px; margin-bottom: 20px; animation: feed-in .4s ease-out; }
.batch-nums { display: flex; flex-wrap: wrap; gap: 8px 36px; margin-bottom: 16px; color: var(--on-navy-muted); }
.batch-nums b { font-size: 30px; font-weight: 650; font-stretch: 112%; color: #fff; margin-right: 6px; }
.batch-nums .flag b { color: #fbbf24; }
.batch-tiles { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; }
.tile {
  aspect-ratio: 3 / 4; border-radius: 6px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  display: flex; align-items: flex-end; padding: 5px 6px; font-size: 11px; line-height: 1.1; color: var(--on-navy-faint);
  transition: background-color .25s, color .25s, transform .25s; position: relative; overflow: hidden;
}
.tile.is-reading { background: rgba(0,174,239,.35); border-color: var(--electric); transform: scale(1.08); color: #fff; }
.tile.is-ok { background: #fff; color: var(--navy); border-color: #fff; }
.tile.is-ok::before { content: "\2713"; position: absolute; top: 4px; right: 6px; color: var(--positive); font-weight: 700; font-size: 13px; }
.tile.is-flag { background: #fef3e2; color: #7a3a05; border-color: #fbbf24; }
.tile.is-flag::before { content: "!"; position: absolute; top: 4px; right: 8px; color: var(--warning); font-weight: 800; font-size: 14px; }
.batch-done { margin-top: 16px; font-size: 16px; font-weight: 500; animation: feed-in .4s ease-out; }

.doc-picker button.is-warn small { color: var(--warning); }
.paper.is-photo { transform: rotate(-1.1deg); background: #fbf8f1; box-shadow: 0 22px 44px -20px rgba(11,45,107,.55); }
.paper .hand { font-family: "Segoe Script", "Bradley Hand", "Comic Sans MS", cursive; color: #1d3a8a; font-size: 15px; }
.paper .p-obs { color: #6b7280; font-size: 12px; display: block; }
.paper .p-sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 28px; }
.paper .p-sign svg { width: 150px; height: 46px; display: block; }
.paper .p-sign path { fill: none; stroke: #1d3a8a; stroke-width: 2; stroke-linecap: round; }
.paper .p-sign .p-line { display: block; border-top: 1px solid #6b7280; padding-top: 3px; }
.checks-title { margin-top: 20px; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 7px 0; font-size: 14.5px; animation: feed-in .3s ease-out; }
.checks li::before { content: "\2713"; color: var(--positive); font-weight: 700; }
.checks li.is-warn { color: #7a3a05; font-weight: 600; }
.checks li.is-warn::before { content: "!"; color: var(--warning); font-weight: 800; text-align: center; }
.extract-result.is-warn { background: var(--warning-surface); color: #7a3a05; }
.paper [data-k].hit-warn { background: rgba(251,191,36,.3); box-shadow: 0 0 0 1.5px #f59e0b; }

@media (max-width: 1100px) {
  .route-meter { grid-template-columns: repeat(3, 1fr); }
  .route-meter > div:nth-child(4) { border-left: 0; }
  .route-meter > div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .batch-tiles { grid-template-columns: repeat(8, 1fr); }
}
@media (max-width: 860px) {
  .nav a { font-size: 10px; }
  .route-body { grid-template-columns: 1fr; }
  .route-meter { grid-template-columns: 1fr 1fr; }
  .route-meter > div { border-left: 0; border-top: 1px solid var(--line); }
  .route-meter > div:nth-child(-n+2) { border-top: 0; }
  .route-meter > div:nth-child(even) { border-left: 1px solid var(--line); }
  .route-meter > div:last-child { grid-column: 1 / -1; border-left: 0; }
  .batch-tiles { grid-template-columns: repeat(6, 1fr); }
  .batch { padding: 18px 16px; }
  .paper.is-photo { transform: none; }
}

/* ---------- Cuarta pasada: lo que ve cada involucrado en la recolección ---------- */
.route-body { grid-template-columns: minmax(0, 1fr) 252px 252px; gap: 20px; }
.rt-col { min-width: 0; }
.rt-cap { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.phone-sm { height: 468px; border-radius: 34px; padding: 10px; }
.phone-sm .phone-head { border-radius: 25px 25px 0 0; padding: 12px; }
.phone-sm .phone-input { border-radius: 0 0 25px 25px; }
.phone-sm .phone-chat { font-size: 13px; }
.phone-chat .file { display: block; margin-top: 6px; padding: 7px 9px; border-radius: 8px; background: #eef1f6; font-weight: 600; color: var(--navy); font-size: 12.5px; }

.drv { flex: 1; background: #fff; border-radius: 0 0 25px 25px; padding: 14px 14px 12px; display: flex; flex-direction: column; min-height: 0; }
.drv-step { font-size: 12.5px; color: var(--ink-muted); }
.drv-client { font-size: 18px; font-weight: 650; line-height: 1.2; font-stretch: 112%; color: var(--navy); margin-top: 2px; }
.drv-info { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.drv-state { margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: #eef1f6; color: var(--ink-muted); font-weight: 600; font-size: 13.5px; text-align: center; transition: background-color .3s, color .3s; }
.drv-state.is-go { background: var(--brand); color: #fff; }
.drv-state.is-at { background: var(--electric); color: #04283a; }
.drv-state.is-end { background: var(--positive); color: #fff; }
.drv-checks { margin-top: 10px; display: grid; gap: 0; }
.drv-checks li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-muted); min-height: 40px; }
.drv-checks li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #c5cedb; transition: background-color .25s, border-color .25s; }
.drv-checks li.is-ok { color: var(--ink); }
.drv-checks li.is-ok::before { background: var(--positive); border-color: var(--positive); box-shadow: inset 0 0 0 2.5px #fff; }
.drv-checks b { font-weight: 600; color: var(--ink); }
.drv-checks svg { width: 62px; height: 22px; }
.drv-checks path { fill: none; stroke: var(--navy); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 220; stroke-dashoffset: 220; }
.drv-checks li.is-ok path { stroke-dashoffset: 0; transition: stroke-dashoffset .7s ease-out; }
.drv-note { margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: #e7f8ec; color: #14361f; font-size: 12.5px; font-weight: 600; animation: pop .35s cubic-bezier(.2,.9,.3,1.3); }
.drv-close { margin-top: auto; padding: 11px; border-radius: 11px; background: #eef1f6; color: #94a3b8; font-weight: 650; font-size: 14px; text-align: center; transition: background-color .3s, color .3s; }
.drv-close.is-ready { background: var(--brand); color: #fff; }
.drv-close.is-ok { background: var(--positive); color: #fff; }

.route-under { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 26px; align-items: start; }
.adm { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.adm-empty { color: var(--ink-muted); font-size: 14.5px; }
.adm-rows li { display: grid; grid-template-columns: 74px 1fr auto; gap: 4px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; animation: feed-in .4s ease-out; }
.adm-rows .folio { font-weight: 650; color: var(--navy); }
.adm-rows .kg { color: var(--ink-muted); font-size: 13px; grid-column: 2; }
.adm-rows .rt-chip { background: #e8f6f0; color: #0b5c3e; grid-row: 1; grid-column: 3; }
.adm-total { margin-top: 12px; font-weight: 600; }

@media (max-width: 1100px) {
  .route-body { grid-template-columns: 1fr 1fr; }
  .rt-col-map { grid-column: 1 / -1; }
  .phone-sm { max-width: 300px; margin: 0 auto; }
}
@media (max-width: 860px) {
  .route-body, .route-under { grid-template-columns: 1fr; }
  .phone-sm { height: 440px; width: 100%; }
}

/* ---------- Quinta pasada: apartado de lotes ---------- */
.lot-meter { grid-template-columns: repeat(4, 1fr); }
.lt-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 22px; counter-reset: lt; }
.lt-steps li {
  counter-increment: lt; display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-size: 14px; font-weight: 500;
  color: var(--ink-muted); transition: border-color .3s, box-shadow .3s, color .3s;
}
.lt-steps li::before {
  content: counter(lt); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tint); color: var(--navy); font-weight: 650; font-size: 13px;
}
.lt-steps li.is-active { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(17,79,219,.14); color: var(--ink); }
.lt-steps li.is-active::before { background: var(--brand); color: #fff; }
.lt-steps li.is-done { color: var(--ink); }
.lt-steps li.is-done::before { background: var(--positive); color: #fff; content: "\2713"; }

.lt-street { fill: rgba(147,197,253,.1); }
.lt-park { fill: rgba(52,211,153,.2); stroke: rgba(52,211,153,.5); stroke-width: 1.5; }
.lt-label { fill: var(--on-navy-muted); font-size: 12px; font-family: inherit; }
#lt-lots rect { fill: #fff; transition: fill .5s; }
#lt-lots text { fill: var(--navy); font-size: 13px; font-weight: 650; font-family: inherit; pointer-events: none; }
#lt-lots .is-sold rect { fill: rgba(147,197,253,.2); }
#lt-lots .is-sold text { fill: var(--on-navy-faint); font-weight: 500; }
#lt-lots .is-held rect { fill: #fbbf24; }
#lt-lots .is-held text { fill: #3b2504; }
#lt-lots .is-pick rect { stroke: var(--electric); stroke-width: 4; animation: pick 1s ease-in-out infinite; }
@keyframes pick { 50% { stroke-opacity: .25; } }
#lt-lots .is-just rect { animation: just 1s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes just { 0% { transform: scale(1); } 35% { transform: scale(1.5); } 100% { transform: scale(1); } }
.lt-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 4px 12px 10px; color: var(--on-navy-muted); font-size: 14px; }
.lt-legend li { display: flex; align-items: center; gap: 7px; }
.lt-legend b { color: #fff; font-weight: 650; }
.lt-legend i { width: 14px; height: 14px; border-radius: 4px; }
.sw-free { background: #fff; } .sw-held { background: #fbbf24; } .sw-sold { background: rgba(147,197,253,.3); }

.web { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 24px 50px -30px rgba(11,45,107,.6); }
.web-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: #eef1f6; border-bottom: 1px solid var(--line); }
.web-bar i { width: 9px; height: 9px; border-radius: 50%; background: #c5cedb; }
.web-bar span { margin-left: 6px; flex: 1; background: #fff; border-radius: 6px; padding: 3px 10px; font-size: 12px; color: var(--ink-muted); }
.web-body { padding: 16px 16px 18px; }
.web-title { font-size: 19px; font-weight: 650; font-stretch: 112%; color: var(--navy); line-height: 1.2; }
.web-count { margin: 4px 0 12px; color: var(--ink-muted); font-size: 14px; }
.web-count b { font-size: 26px; color: var(--ink); font-weight: 650; margin-right: 4px; }
.web-count b.bump { animation: bumpdark .9s ease-out; }
@keyframes bumpdark { 0% { color: var(--brand); transform: scale(1.4); display: inline-block; } 100% { color: var(--ink); } }
.web-lots li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-weight: 600; font-size: 14.5px; }
.web-lots small { display: block; font-weight: 400; color: var(--ink-muted); font-size: 12.5px; line-height: 1.3; }
.web-lots em { font-style: normal; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #e8f6f0; color: #0b5c3e; transition: background-color .4s, color .4s; }
.web-lots li.is-held { color: var(--ink-muted); }
.web-lots li.is-held em { background: #fef3e2; color: #7a3a05; }
.web-flash { margin-top: 12px; padding: 8px 10px; border-radius: 9px; background: var(--tint); color: var(--navy); font-size: 13px; font-weight: 600; animation: pop .4s cubic-bezier(.2,.9,.3,1.3); }

.lt-areas-cap { margin-top: 26px; }
.lt-areas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.lt-areas li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-height: 118px; }
.lt-areas b { font-weight: 600; font-size: 15px; }
.lt-areas p { margin-top: 6px; font-size: 14px; color: var(--ink-muted); }
.lt-areas p.is-new { color: var(--ink); animation: feed-in .4s ease-out; }
.lt-areas p span { display: block; margin-top: 6px; }

.nav { overflow-x: visible; }
@media (max-width: 1100px) {
  .lt-steps { grid-template-columns: repeat(2, 1fr); }
  .lt-areas { grid-template-columns: repeat(2, 1fr); }
  .lot-meter { grid-template-columns: repeat(2, 1fr); }
  .lot-meter > div:nth-child(3) { border-left: 0; }
  .lot-meter > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .web { max-width: 300px; margin: 0 auto; }
}
@media (max-width: 860px) {
  .nav { overflow-x: auto; scrollbar-width: none; }
  .nav a { flex: 0 0 auto; min-width: 62px; }
  .lt-steps, .lt-areas { grid-template-columns: 1fr; }
  .lt-areas li { min-height: 0; }
  .web { max-width: none; }
}
