/* =====================================================================
   GASCA · Gestión de Reparto — réplica funcional de la demo «Gestión de Reparto» (Replit, transgaizka)
   con el ESTILO GENERAL DE VICTORIA (Inter, tarjetas blancas, bordes suaves, rojo GASCA), igual que el
   módulo Menús. Mismos elementos y pantallas que la app original: portada con los dos perfiles,
   panel del coordinador (métricas, rutas, «Configurar mercancía») y «Mi ruta» del chófer (selector,
   «Dónde está mi mercancía», botón ENTREGADO), con sus diálogos. Prefijo .rp- para no chocar con nada.
   ===================================================================== */
#reparto-view, .rp-dialog-root {
    --rp-red: #b4000c; --rp-red-2: #8f000a; --rp-red-soft: rgba(180,0,12,.07);
    --rp-ink: #0f172a; --rp-muted: #64748b; --rp-line: #e2e8f0; --rp-card: #fff; --rp-bg: #f8fafc;
    --rp-dark: #0f172a; --rp-green: #059669; --rp-green-soft: #ecfdf5; --rp-amber: #b45309; --rp-amber-soft: #fffbeb;
    --rp-radius: 14px; --rp-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.12);
    font-family: 'Inter', sans-serif; color: var(--rp-ink); font-size: 15px; line-height: 1.5;
}
#reparto-view.active { container-type: inline-size; container-name: rp; animation: none; }
:where(#reparto-view, .rp-dialog-root) :is(h1, h2, h3, p, ul, li, section, article, header, footer, nav, main, label, span) { margin: 0; padding: 0; font-family: inherit; }
:where(#reparto-view, .rp-dialog-root) :is(h1, h2, h3) { color: var(--rp-ink); display: block; }
:where(#reparto-view) ul { list-style: none; }
:where(#reparto-view) a { color: inherit; text-decoration: none; }
:where(#reparto-view, .rp-dialog-root) :is(button, label, select, input) { font-family: inherit; }
:where(#reparto-view, .rp-dialog-root) img { display: block; max-width: 100%; }
:where(#reparto-view, .rp-dialog-root) svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ----- utilidades ----- */
@keyframes rp-rise-in { 0% { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rp-shimmer { 0% { background-position: 180% 0; } to { background-position: -40% 0; } }
@keyframes rp-pulse { 50% { opacity: .5; } }
@keyframes rp-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rp-rise-in { animation: rp-rise-in .35s ease both; }
.rp-rise-in-delay-1 { animation-delay: 60ms; }
.rp-pressable { transition: transform .15s ease, box-shadow .15s ease, background .15s, border-color .15s, color .15s; }
.rp-pressable:hover { transform: translateY(-1px); }
.rp-pressable:active { transform: translateY(0); }
.rp-shimmer { background: linear-gradient(100deg, #eef2f6 20%, #f8fafc, #eef2f6 64%); background-size: 220% 100%; animation: rp-shimmer 1.6s linear infinite; }
.rp-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border-width: 0; }
.rp-mono { font-variant-numeric: tabular-nums; font-weight: 800; }
.rp-eyebrow { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--rp-red); }
.rp-animate-pulse { animation: rp-pulse 1.5s ease-in-out infinite; }
.rp-ico { width: 1rem; height: 1rem; }
.rp-ico-3 { width: .75rem; height: .75rem; }
.rp-ico-35 { width: .875rem; height: .875rem; }
.rp-ico-4 { width: 1rem; height: 1rem; }
.rp-ico-45 { width: 1.125rem; height: 1.125rem; }
.rp-ico-5 { width: 1.25rem; height: 1.25rem; }
.rp-ico-6 { width: 1.5rem; height: 1.5rem; }
.rp-root { display: flex; flex-direction: column; gap: 18px; }

/* ============================ PORTADA ============================ */
.rp-hero { position: relative; overflow: hidden; border-radius: 18px; padding: 26px 28px; color: #fff;
    background: radial-gradient(1200px 300px at 100% 0%, rgba(255,255,255,.14), transparent 60%), linear-gradient(135deg, #b4000c 0%, #7a0009 100%);
    box-shadow: 0 18px 40px -22px rgba(143,0,10,.55); }
.rp-hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; border: 36px solid rgba(255,255,255,.06); }
.rp-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; position: relative; z-index: 1; }
.rp-hero-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: .95rem; }
.rp-hero-brand svg { width: 1.2rem; height: 1.2rem; }
.rp-hero-code { font-size: .68rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; opacity: .8; }
.rp-hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); margin-bottom: 14px; position: relative; z-index: 1; }
.rp-dot-15 { width: 7px; height: 7px; border-radius: 50%; background: #86efac; display: inline-block; box-shadow: 0 0 0 3px rgba(134,239,172,.25); }
.rp-hero h2 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.08; color: #fff; position: relative; z-index: 1; max-width: 620px; }
.rp-hero h2 span { color: #fecaca; }
.rp-hero-p { margin: 10px 0 0; opacity: .88; font-size: .95rem; max-width: 720px; position: relative; z-index: 1; }
.rp-hero-feats { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.rp-hero-feats span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); }
.rp-block-title { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--rp-muted); margin: 6px 2px 0; display: flex; align-items: center; gap: 10px; }
.rp-block-title::after { content: ''; flex: 1; height: 1px; background: var(--rp-line); }
.rp-cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
.rp-card-link { display: block; background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: var(--rp-radius); box-shadow: var(--rp-shadow); padding: 20px 22px; color: var(--rp-ink); }
.rp-card-link:hover { border-color: rgba(180,0,12,.35); box-shadow: 0 14px 30px -16px rgba(15,23,42,.25); }
.rp-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.rp-card-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--rp-red-soft); color: var(--rp-red); }
.rp-c2 .rp-card-ico { background: var(--rp-dark); color: #fff; }
.rp-card-arrow { width: 1.2rem; height: 1.2rem; color: #94a3b8; transition: transform .15s, color .15s; }
.rp-card-link:hover .rp-card-arrow { transform: translateX(3px); color: var(--rp-red); }
.rp-card-link h3 { margin-top: 6px; font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.rp-card-desc { margin-top: 6px; font-size: .88rem; color: var(--rp-muted); }
.rp-landing-foot { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--rp-line); padding-top: 12px; font-size: .78rem; color: var(--rp-muted); }
.rp-landing-foot .rp-mono { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .7rem; }
@container rp (min-width: 640px) {
    .rp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rp-landing-foot { flex-direction: row; align-items: center; justify-content: space-between; }
    .rp-hero h2 { font-size: 2.2rem; }
}

/* ============================ ARMAZÓN (subnavegación + cabecera) ============================ */
.rp-topnav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.rp-nav a, .rp-back { height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--rp-line); background: #fff; color: var(--rp-muted); font-weight: 700; font-size: .84rem; transition: all .15s; }
.rp-nav a:hover, .rp-back:hover { border-color: var(--rp-red); color: var(--rp-red); }
.rp-nav a.rp-on { background: var(--rp-red); border-color: var(--rp-red); color: #fff; box-shadow: 0 6px 14px -8px rgba(180,0,12,.8); }
.rp-topnav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-jornada, .rp-sys { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 999px; font-size: .74rem; font-weight: 700; border: 1px solid var(--rp-line); background: #fff; color: var(--rp-muted); }
.rp-sys { color: var(--rp-green); background: var(--rp-green-soft); border-color: #bbf7d0; }
.rp-dot-2 { width: 8px; height: 8px; border-radius: 50%; background: var(--rp-green); display: inline-block; }
.rp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rp-head h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; margin-top: 2px; }
.rp-desc { font-size: .88rem; color: var(--rp-muted); max-width: 720px; margin-top: 4px; }
.rp-jornada-mobile { display: none; }

/* ============================ COORDINADOR ============================ */
.rp-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.rp-metric { background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: var(--rp-radius); box-shadow: var(--rp-shadow); padding: 16px 18px; }
.rp-metric-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #f1f5f9; color: var(--rp-muted); margin-bottom: 12px; }
.rp-metric-ico.rp-tone-primary { background: var(--rp-green-soft); color: var(--rp-green); }
.rp-metric-ico.rp-tone-accent { background: var(--rp-amber-soft); color: var(--rp-amber); }
.rp-metric-lbl { font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--rp-muted); }
.rp-metric-val { margin-top: 2px; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; color: var(--rp-ink); line-height: 1.15; }
.rp-sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rp-sec-head h2 { font-size: 1.2rem; font-weight: 800; margin-top: 2px; }
.rp-auto { display: none; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--rp-line); background: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--rp-muted); }
.rp-routes { display: grid; grid-template-columns: 1fr; gap: 16px; }
.rp-cargo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border: 1px solid var(--rp-line); border-radius: 12px; padding: 8px 10px 8px 14px; margin-bottom: 8px; box-shadow: var(--rp-shadow); }
.rp-cargo-bar-lbl { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--rp-muted); }
.rp-btn-cargo { height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--rp-line); background: #fff; color: var(--rp-ink); font-weight: 700; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.rp-btn-cargo:hover { border-color: var(--rp-red); color: var(--rp-red); }
@container rp (min-width: 640px) { .rp-auto { display: inline-flex; } }
@container rp (min-width: 1024px) { .rp-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container rp (min-width: 1200px) { .rp-routes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ----- tarjeta de ruta ----- */
.rp-route { background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: var(--rp-radius); box-shadow: var(--rp-shadow); overflow: hidden; }
.rp-route-head { padding: 16px 18px; color: #fff; background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); }
.rp-route-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rp-route-id-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rp-route-id { padding: 3px 8px; border-radius: 7px; background: var(--rp-red); color: #fff; font-size: .72rem; font-weight: 800; letter-spacing: .04em; }
.rp-route-kind { font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.rp-route h3 { font-size: 1.1rem; font-weight: 800; color: #fff; }
.rp-route-veh { margin-top: 5px; display: flex; align-items: center; gap: 6px; font-size: .78rem; color: rgba(255,255,255,.7); }
.rp-route-prog { text-align: right; }
.rp-route-prog-n { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: #fff; line-height: 1.1; }
.rp-route-prog-n span { color: rgba(255,255,255,.45); }
.rp-route-prog-l { font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.55); }
.rp-bar { margin-top: 14px; height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.18); }
.rp-bar > div { height: 100%; border-radius: 999px; background: #34d399; transition: width .5s ease-out; }
.rp-route-body { padding: 6px 18px; }
.rp-stop { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #f1f5f9; }
.rp-stop:first-child { border-top: 0; }
.rp-stop-ico { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: #f1f5f9; color: var(--rp-muted); }
.rp-stop-ico.rp-done { background: var(--rp-green-soft); color: var(--rp-green); }
.rp-stop-mid { min-width: 0; flex: 1; }
.rp-stop-name { font-size: .9rem; font-weight: 700; overflow-wrap: break-word; }
.rp-stop-addr { margin-top: 1px; font-size: .76rem; color: var(--rp-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-stop-right { flex-shrink: 0; text-align: right; }
.rp-stop-delivered { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--rp-green); }
.rp-stop-time { font-size: .7rem; font-weight: 600; color: var(--rp-muted); font-variant-numeric: tabular-nums; }
.rp-btn-deliver { height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--rp-green); background: var(--rp-green); color: #fff; font-size: .76rem; font-weight: 800; letter-spacing: .04em; cursor: pointer; box-shadow: 0 8px 18px -10px rgba(5,150,105,.7); }
.rp-btn-deliver:hover:not(:disabled) { background: #047857; border-color: #047857; }
.rp-btn-deliver:disabled { cursor: wait; opacity: .6; }
.rp-pending { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--rp-amber-soft); border: 1px solid #fde68a; color: var(--rp-amber); font-size: .72rem; font-weight: 700; }

/* ----- cargando / error / vacío ----- */
.rp-skel { display: grid; gap: 16px; }
.rp-skel-card { background: #fff; border: 1px solid var(--rp-line); border-radius: var(--rp-radius); padding: 18px; }
.rp-skel-head { height: 76px; border-radius: 12px; margin-bottom: 18px; }
.rp-skel-rows { display: flex; flex-direction: column; gap: 16px; }
.rp-skel-row { display: flex; gap: 12px; }
.rp-skel-dot { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.rp-skel-l1 { height: 11px; width: 40%; border-radius: 6px; margin-bottom: 8px; }
.rp-skel-l2 { height: 9px; width: 60%; border-radius: 6px; }
@container rp (min-width: 1200px) { .rp-skel { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rp-error { border-radius: var(--rp-radius); border: 1px solid #fecaca; background: #fef2f2; padding: 28px 20px; text-align: center; }
.rp-error-ico { margin: 0 auto 10px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: #fee2e2; color: #b91c1c; }
.rp-error b, .rp-empty b { display: block; font-weight: 800; }
.rp-error p, .rp-empty p { margin-top: 4px; font-size: .86rem; color: var(--rp-muted); }
.rp-btn-retry { margin-top: 16px; height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--rp-line); background: #fff; font-weight: 700; font-size: .85rem; cursor: pointer; }
.rp-btn-retry:hover { border-color: var(--rp-red); color: var(--rp-red); }
.rp-empty { border-radius: var(--rp-radius); border: 1px dashed var(--rp-line); background: #fff; padding: 40px 20px; text-align: center; color: var(--rp-muted); }
.rp-empty-ico { margin: 0 auto 10px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #f1f5f9; color: #94a3b8; }

/* ============================ CHÓFER ============================ */
.rp-driver-wrap { margin: 0 auto; max-width: 760px; }
.rp-driver-card { background: var(--rp-card); border: 1px solid var(--rp-line); border-radius: var(--rp-radius); box-shadow: var(--rp-shadow); padding: 16px 18px; margin-bottom: 16px; }
.rp-driver-row { display: flex; flex-direction: column; gap: 12px; }
.rp-driver-who { display: flex; align-items: center; gap: 12px; }
.rp-driver-ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--rp-red-soft); color: var(--rp-red); }
.rp-driver-lbl { font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--rp-muted); }
.rp-driver-name { font-weight: 800; font-size: 1rem; }
.rp-select-wrap { position: relative; display: block; }
.rp-select { width: 100%; height: 40px; appearance: none; -webkit-appearance: none; border-radius: 10px; border: 1px solid var(--rp-line); background: #fff; padding: 0 36px 0 12px; font-size: .88rem; font-weight: 700; color: var(--rp-ink); outline: none; transition: border-color .15s, box-shadow .15s; cursor: pointer; }
.rp-select:focus { border-color: var(--rp-red); box-shadow: 0 0 0 3px rgba(180,0,12,.12); }
.rp-select-chev { pointer-events: none; position: absolute; right: 12px; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); color: var(--rp-muted); }
.rp-route-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 2px; }
.rp-route-line-l { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 700; }
.rp-route-line-l svg, .rp-route-line-l .rp-mono { color: var(--rp-red); }
.rp-driver-route + .rp-driver-route { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--rp-line); }
.rp-route-line-name { font-weight: 600; color: var(--rp-muted); margin-left: 4px; }
.rp-live { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--rp-muted); font-weight: 600; }
.rp-btn-mycargo { width: 100%; height: 50px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; border-radius: 12px; border: 0; background: var(--rp-dark); color: #fff; font-size: .92rem; font-weight: 800; letter-spacing: .02em; cursor: pointer; box-shadow: 0 10px 24px -14px rgba(15,23,42,.8); }
.rp-btn-mycargo:hover { background: #1e293b; }
.rp-complete { margin-top: 14px; display: flex; align-items: center; gap: 10px; border-radius: 12px; border: 1px solid #bbf7d0; background: var(--rp-green-soft); padding: 12px 16px; font-size: .88rem; font-weight: 700; color: #166534; }
@container rp (min-width: 640px) {
    .rp-driver-row { flex-direction: row; align-items: center; justify-content: space-between; }
    .rp-select-wrap { width: 220px; }
}

/* ============================ DIÁLOGOS (portal en <body>, estilo gm-modal de Victoria) ============================ */
.rp-dialog-root { position: fixed; inset: 0; z-index: 20050; display: grid; place-items: center; padding: 16px; }
.rp-overlay { position: absolute; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(3px); animation: rp-in .15s ease; }
.rp-dialog { position: relative; width: min(720px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: #fff; border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(15,23,42,.45); overflow: hidden; animation: rp-in .2s ease; outline: none; }
.rp-dialog.rp-dialog-xl { width: min(600px, 100%); }
.rp-dialog > [data-dlg-body] { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.rp-dialog-close { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: #64748b; cursor: pointer; display: grid; place-items: center; z-index: 2; }
.rp-dialog-close:hover { background: #f1f5f9; color: #0f172a; }
.rp-dialog-close:focus-visible { outline: 2px solid rgba(180,0,12,.5); outline-offset: 1px; }
.rp-dialog-head { display: flex; flex-direction: column; gap: 3px; padding: 16px 52px 14px 20px; border-bottom: 1px solid #f1f5f9; flex-shrink: 0; }
.rp-dialog-head h2 { font-size: 1.1rem; font-weight: 800; }
.rp-dialog-head p.rp-dlg-desc { font-size: .84rem; color: var(--rp-muted); }
.rp-dialog-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; }
.rp-dialog-skel { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.rp-dialog-skel .rp-shimmer { height: 76px; border-radius: 12px; }
.rp-dialog-skel.rp-h24 .rp-shimmer { height: 92px; }
.rp-dialog-err { padding: 24px 20px; font-size: .88rem; }
.rp-dialog-err button { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; font-weight: 700; color: var(--rp-red); cursor: pointer; font-size: .86rem; }
.rp-dialog-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid #f1f5f9; background: #fafafa; flex-shrink: 0; }
.rp-dialog-alert { max-width: 380px; font-size: .78rem; font-weight: 600; color: #b91c1c; }
.rp-dialog-actions { margin-left: auto; display: flex; gap: 10px; }
.rp-btn-cancel, .rp-btn-save { height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--rp-line); background: #fff; color: var(--rp-ink); font-weight: 600; font-size: .85rem; cursor: pointer; transition: all .15s; }
.rp-btn-cancel:hover:not(:disabled) { border-color: var(--rp-red); color: var(--rp-red); }
.rp-btn-save { background: var(--rp-red); border-color: var(--rp-red); color: #fff; box-shadow: 0 8px 18px -10px rgba(180,0,12,.7); }
.rp-btn-save:hover:not(:disabled) { background: var(--rp-red-2); }
.rp-btn-cancel:disabled, .rp-btn-save:disabled { opacity: .55; cursor: not-allowed; }

/* ----- editor del coordinador: secciones por departamento ----- */
.rp-dep { border-radius: 12px; border: 1px solid var(--rp-line); background: #fff; padding: 12px 14px; transition: background .15s, border-color .15s; }
.rp-dep.rp-dep-on { border-color: #bbf7d0; background: #f7fdf9; }
.rp-dep-lbl { display: flex; cursor: pointer; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.rp-dep-title { display: flex; align-items: center; gap: 10px; font-size: .84rem; font-weight: 800; letter-spacing: .04em; }
.rp-dep-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: #f1f5f9; color: var(--rp-muted); }
.rp-dep-on .rp-dep-ico { background: var(--rp-green-soft); color: var(--rp-green); }
.rp-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 24px; cursor: pointer; flex-shrink: 0; }
.rp-switch input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.rp-switch .rp-sw { width: 44px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .18s; }
.rp-switch .rp-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s; }
.rp-switch input:checked + .rp-sw { background: #16a34a; }
.rp-switch input:checked + .rp-sw::after { transform: translateX(20px); }
.rp-switch input:focus-visible + .rp-sw { box-shadow: 0 0 0 3px rgba(180,0,12,.18); }
.rp-dep-body { margin-top: 12px; padding-left: 0; }
.rp-dep-hint { margin-bottom: 8px; font-size: .78rem; color: var(--rp-muted); }
.rp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-chip { min-width: 36px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--rp-line); background: #fff; font-size: .8rem; font-weight: 700; color: var(--rp-muted); cursor: pointer; transition: all .15s; }
.rp-chip:hover { border-color: var(--rp-red); color: var(--rp-red); }
.rp-chip.rp-sel { background: var(--rp-red); border-color: var(--rp-red); color: #fff; box-shadow: 0 6px 14px -8px rgba(180,0,12,.8); }
.rp-photo-sec { margin-top: 12px; border-top: 1px solid #f1f5f9; padding-top: 12px; }
.rp-photo-lbl { margin-bottom: 8px; font-size: .8rem; font-weight: 700; }
.rp-photo-lbl span { font-weight: 400; color: var(--rp-muted); }
.rp-photo-prev { margin-bottom: 10px; max-height: 220px; width: 100%; border-radius: 12px; border: 1px solid var(--rp-line); object-fit: contain; background: #f8fafc; }
.rp-photo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rp-btn-file { height: 34px; display: inline-flex; cursor: pointer; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--rp-line); background: #fff; font-size: .8rem; font-weight: 700; margin: 0; }
.rp-btn-file:hover { border-color: var(--rp-red); color: var(--rp-red); }
.rp-btn-file input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border-width: 0; }
.rp-btn-rmphoto { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border: 0; background: none; font-size: .8rem; font-weight: 700; color: #b91c1c; cursor: pointer; }
.rp-upl-status { font-size: .78rem; color: var(--rp-muted); }
@media (min-width: 640px) { .rp-dep-body { padding-left: 42px; } }

/* ----- vista del chófer: dónde está mi mercancía ----- */
.rp-cargo-list { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; }
.rp-cargo-item { display: flex; gap: 14px; border-radius: 12px; border: 1px solid var(--rp-line); background: #fff; padding: 14px 16px; }
.rp-cargo-ico { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; background: var(--rp-red-soft); color: var(--rp-red); }
.rp-cargo-txt { min-width: 0; flex: 1; }
.rp-cargo-txt h3 { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--rp-muted); }
.rp-cargo-sub { margin-top: 6px; font-size: .74rem; font-weight: 700; color: var(--rp-muted); }
.rp-cargo-big { margin-top: 2px; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; color: var(--rp-red); line-height: 1.1; }
.rp-cargo-mid { margin-top: 3px; font-size: 1rem; font-weight: 800; color: var(--rp-red); }
.rp-cargo-img { margin-top: 10px; max-height: 300px; width: 100%; border-radius: 12px; border: 1px solid var(--rp-line); background: #f8fafc; object-fit: contain; }
.rp-cargo-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.rp-cargo-tag { padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(180,0,12,.25); background: var(--rp-red-soft); font-size: .84rem; font-weight: 800; color: var(--rp-red); }
.rp-cargo-empty { display: flex; flex-direction: column; align-items: center; padding: 40px 24px; text-align: center; }
.rp-cargo-empty-ico { margin-bottom: 12px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: #f1f5f9; color: #94a3b8; }
.rp-cargo-empty b { font-weight: 800; }
.rp-cargo-empty p { margin-top: 4px; max-width: 320px; font-size: .86rem; color: var(--rp-muted); }

/* ----- leyendas (solo administradores), mismo estilo que GM.notas ----- */
.rp-notas { display: grid; gap: 8px; }
.rp-nota { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; font-size: .8rem; line-height: 1.5; border: 1px solid #bfdbfe; background: #eff6ff; color: #1e3a8a; }
.rp-nota svg { margin-top: 3px; }
.rp-nota b { font-weight: 800; }
.rp-nota button { border: 0; background: none; font-size: .8rem; font-weight: 700; color: #1d4ed8; text-decoration: underline; cursor: pointer; padding: 0; }

/* ============================ FASE 2: hora límite, indicaciones, incidencias, mapa ============================ */
.rp-metric-ico.rp-tone-bad { background: #fee2e2; color: #b91c1c; }
@container rp (min-width: 1024px) { .rp-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container rp (min-width: 640px) and (max-width: 1023px) { .rp-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rp-sec-right { display: flex; align-items: center; gap: 8px; }
.rp-stop-notes { margin-top: 4px; font-size: .78rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 4px 8px; display: inline-flex; gap: 6px; align-items: flex-start; }
.rp-stop-extras { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.rp-chip-info { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rp-line); background: #fff; font-size: .7rem; font-weight: 700; color: var(--rp-muted); }
.rp-chip-info.rp-chip-go { border-color: rgba(180,0,12,.3); color: var(--rp-red); }
.rp-chip-info.rp-late, .rp-pending.rp-late { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.rp-late-txt { color: #b91c1c !important; }
.rp-stop-actions { display: flex; align-items: center; gap: 6px; }
.rp-btn-inc { width: 34px; height: 34px; border-radius: 10px; border: 1px solid #fecaca; background: #fef2f2; color: #b91c1c; cursor: pointer; display: grid; place-items: center; }
.rp-btn-inc:hover:not(:disabled) { background: #fee2e2; }
.rp-stop-ico.rp-bad { background: #fee2e2; color: #b91c1c; }
.rp-stop.rp-stop-inc { background: #fff7f7; margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.rp-incident { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; color: #b91c1c; justify-content: flex-end; }
.rp-inc-photo { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: #fee2e2; color: #b91c1c; }
.rp-inc-txt { font-size: .72rem; color: var(--rp-muted); max-width: 220px; margin-top: 2px; text-align: right; }
.rp-link-undo { border: 0; background: none; font-size: .7rem; font-weight: 700; color: var(--rp-muted); text-decoration: underline; cursor: pointer; margin-top: 3px; padding: 0; }
.rp-link-undo:hover { color: var(--rp-red); }
.rp-link-map { border: 0; background: none; color: inherit; font: inherit; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; text-decoration: underline; padding: 0; }
.rp-prog-inc { color: #fca5a5; }
.rp-field { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--rp-muted); }
.rp-textarea { border: 1px solid var(--rp-line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: .88rem; color: var(--rp-ink); resize: vertical; }
.rp-textarea:focus { outline: none; border-color: var(--rp-red); box-shadow: 0 0 0 3px rgba(180,0,12,.12); }
.rp-field input[type=file] { font-size: .82rem; }
.rp-dialog.rp-dialog-map { width: min(960px, 100%); }
.rp-map { height: min(60vh, 520px); margin: 0; background: #e2e8f0; }
.rp-map-leyenda { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 20px; font-size: .74rem; font-weight: 700; color: var(--rp-muted); border-top: 1px solid #f1f5f9; }
.rp-map-leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.rp-pin span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 800 .72rem 'Inter', sans-serif; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.rp-sin-paradas { margin-top: 14px; font-size: .78rem; color: var(--rp-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rp-sin-paradas b { color: var(--rp-ink); margin-right: 4px; }
.rp-fecha-adm { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .72rem; color: var(--rp-muted); font-weight: 600; }
.rp-fecha-adm input { border: 1px solid var(--rp-line); border-radius: 8px; padding: 3px 6px; font: inherit; }
.rp-chip-info.rp-chip-load { border-color: #bfdbfe; background: #eff6ff; color: #1e3a8a; }
.rp-tag-rec { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #ede9fe; color: #5b21b6; font-size: .62rem; font-weight: 800; letter-spacing: .06em; vertical-align: 2px; }
.rp-no-driver { color: #fca5a5 !important; font-size: .95rem !important; }
/* distintivo del entorno de Reparto: el mismo chip que las portadas de Menús y Recetas (gm-chip / gm-chip-prod de gasca_menus.css) */
.rp-hero .rp-env { margin-left: 8px; vertical-align: middle; }
.rp-hero .rp-env[hidden] { display: none; }
