:root {
  --verde:#17A35B; --teal:#0E9AA7; --amarillo:#F2B600; --naranja:#F27C1B; --rojo:#E0443E;
  --tinta:#14213D; --suave:#667085; --fondo:#F3F0EA;
}
* { box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
html, body { height:100%; }
body { font-family:'Poppins', -apple-system, "Segoe UI", system-ui, sans-serif; color:var(--tinta); background:var(--fondo); overflow:hidden; }
button, input, select, textarea { font-family:inherit; }
.maplibregl-popup-content { font-family:'Poppins', sans-serif; font-size:13px; line-height:1.5; color:var(--tinta); border-radius:14px; padding:12px 14px; box-shadow:0 10px 30px rgba(20,33,61,.22); }
.maplibregl-popup-content b { font-weight:600; font-size:14px; }
.maplibregl-ctrl, .maplibregl-ctrl-attrib { font-family:'Poppins', sans-serif; }
#mapa { position:absolute; inset:0; }
button { font-family:inherit; cursor:pointer; border:0; }
.oculto { display:none !important; }

.cristal { background:rgba(255,255,255,.76); -webkit-backdrop-filter:blur(22px) saturate(180%); backdrop-filter:blur(22px) saturate(180%);
           border:1px solid rgba(255,255,255,.9); box-shadow:0 12px 36px rgba(20,33,61,.18), inset 0 1px 0 rgba(255,255,255,.95); }

/* Panel */
#panel { position:absolute; z-index:5; left:16px; top:16px; bottom:16px; width:384px; border-radius:26px; padding:18px 18px 12px; overflow-y:auto; }
.asa { display:none; }
.marca { display:flex; gap:10px; align-items:center; margin-bottom:14px; }
.marca h1 { font-size:20px; letter-spacing:-.4px; line-height:1.1; }
.marca p { font-size:12px; color:var(--suave); }

.campo { display:flex; align-items:center; gap:10px; background:rgba(255,255,255,.85); border:1px solid rgba(20,33,61,.1); border-radius:14px; padding:4px 6px 4px 12px; margin-bottom:8px; }
.campo input { flex:1; border:0; outline:0; background:transparent; font:inherit; font-size:15px; padding:9px 0; color:var(--tinta); min-width:0; }
.punto { width:11px; height:11px; border-radius:50%; flex:none; }
.punto.a { background:var(--verde); box-shadow:0 0 0 3px rgba(23,163,91,.2); }
.punto.b { background:var(--rojo); box-shadow:0 0 0 3px rgba(224,68,62,.2); }
.mini { background:rgba(20,33,61,.07); color:var(--tinta); border-radius:10px; padding:7px 11px; font-size:12px; font-weight:600; }
.fila-btn { display:flex; gap:8px; margin-top:6px; }
.primario { flex:1; background:var(--verde); color:#fff; border-radius:14px; padding:12px; font-size:15px; font-weight:700; }
.primario:disabled { opacity:.55; cursor:wait; }
.suave { background:rgba(20,33,61,.08); color:var(--tinta); border-radius:14px; padding:12px 14px; font-size:14px; font-weight:600; }
.peligro { width:100%; margin-top:12px; background:rgba(224,68,62,.13); color:#b02c27; border-radius:14px; padding:11px; font-size:14px; font-weight:700; }
.ayuda { font-size:12px; color:var(--suave); margin-top:8px; line-height:1.4; }
.estado { font-size:13px; color:var(--suave); margin-top:10px; min-height:0; line-height:1.4; }
.estado.error { color:#7a1f1b; background:rgba(224,68,62,.1); border:1px solid rgba(224,68,62,.25); border-radius:14px; padding:10px 12px; }
.estado.error b { display:block; font-size:13.5px; color:#b02c27; margin-bottom:2px; }
.estado.error span { display:block; }
.estado.error .mini { margin-top:8px; background:#b02c27; color:#fff; }

h2 { font-size:12px; text-transform:uppercase; letter-spacing:.5px; color:var(--suave); margin:16px 0 8px; font-weight:700; }
h2 small { text-transform:none; letter-spacing:0; font-weight:400; }

/* Opciones de ruta */
.opcion { border-radius:16px; padding:11px 13px; margin-bottom:8px; border:1.5px solid transparent; background:rgba(255,255,255,.7); cursor:pointer; }
.opcion.sel { border-color:var(--verde); background:rgba(23,163,91,.1); }
.opcion .l1 { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.opcion .l1 b { font-size:15px; } .opcion .l1 span { font-size:13px; font-weight:700; white-space:nowrap; }
.opcion .l2 { margin-top:5px; display:flex; flex-wrap:wrap; gap:4px; }
.ins { font-size:11px; font-weight:700; padding:2px 8px; border-radius:10px; }
.ins.v { background:rgba(23,163,91,.15); color:#0e7a42; }
.ins.a { background:rgba(242,182,0,.22); color:#8a6700; }
.ins.r { background:rgba(224,68,62,.15); color:#b02c27; }
.barra { display:flex; height:8px; border-radius:5px; overflow:hidden; gap:2px; margin-top:8px; }
.barra i { display:block; height:100%; min-width:2px; }
#detalle { font-size:12.5px; line-height:1.5; color:var(--tinta); background:rgba(255,255,255,.55); border-radius:14px; padding:10px 12px; margin:4px 0 6px; }
#detalle .fila { display:flex; align-items:center; gap:8px; padding:2px 0; }
#detalle .fila i { width:22px; height:6px; border-radius:4px; flex:none; }
#detalle .fila span { margin-left:auto; color:var(--suave); }
#detalle .casco { margin-top:6px; padding-top:6px; border-top:1px solid rgba(20,33,61,.08); }

/* Leyenda */
.leyenda-caja ul { list-style:none; display:grid; gap:4px; }
.leyenda-caja li { display:flex; align-items:center; gap:10px; font-size:13px; padding:5px 6px; border-radius:10px; cursor:pointer; user-select:none; }
.leyenda-caja li:hover { background:rgba(20,33,61,.05); }
.leyenda-caja li i { width:28px; height:6px; border-radius:4px; flex:none; }
.leyenda-caja li span { margin-left:auto; font-size:11px; color:var(--suave); }
.leyenda-caja li.off { opacity:.4; }
.pie { font-size:12px; color:var(--suave); margin-top:16px; line-height:1.55; border-top:1px solid rgba(20,33,61,.1); padding-top:12px; }
.pie p { margin-bottom:6px; }
.pie a, .info-cuerpo a { color:#0b7a42; text-decoration:underline; text-underline-offset:2px; }
.enlace { background:none; color:#0b7a42; font-size:12.5px; font-weight:600; text-decoration:underline; text-underline-offset:2px; padding:4px 0; }

/* Ventana de datos, aviso y privacidad */
#info { border:0; border-radius:22px; padding:0; width:min(560px, calc(100% - 24px)); max-height:min(82vh, 640px); margin:auto; color:var(--tinta);
        background:rgba(255,255,255,.96); box-shadow:0 24px 60px rgba(20,33,61,.35); overflow:hidden; }
#info[open] { display:flex; flex-direction:column; }
#info::backdrop { background:rgba(20,33,61,.45); -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); }
.info-cab { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 18px 12px; border-bottom:1px solid rgba(20,33,61,.08); }
.info-cab h2 { margin:0; font-size:16px; text-transform:none; letter-spacing:-.2px; color:var(--tinta); }
.cerrar { background:rgba(20,33,61,.08); color:var(--tinta); border-radius:12px; padding:8px 14px; font-size:13px; font-weight:600; }
.info-cuerpo { padding:6px 18px 18px; overflow-y:auto; font-size:13.5px; line-height:1.6; }
.info-cuerpo h3 { font-size:13px; text-transform:uppercase; letter-spacing:.5px; color:var(--suave); margin:16px 0 6px; }
.info-cuerpo p { margin-bottom:8px; }
.info-cuerpo ul { padding-left:18px; } .info-cuerpo li { margin-bottom:5px; }

.chip { position:absolute; z-index:7; top:16px; left:50%; transform:translateX(-50%); padding:7px 14px; border-radius:20px; font-size:12.5px; color:var(--tinta); max-width:calc(100% - 100px); text-align:center; pointer-events:none; }
/* En seguimiento, el aviso baja sobre el panel inferior para no tapar la tarjeta de giro */
body.nav .chip { top:auto; bottom:236px; }
.mini.activo { background:var(--verde); color:#fff; }
.ancho { width:100%; margin-top:8px; }
.nav-texto { flex:1; min-width:0; }
.salir { margin-left:auto; flex:none; align-self:flex-start; background:rgba(255,255,255,.14); color:#fff; border-radius:12px; padding:7px 12px; font-size:12.5px; font-weight:700; }
.recalc { display:inline-block; margin-top:8px; background:var(--verde); color:#fff; border-radius:12px; padding:8px 14px; font-size:13px; font-weight:700; }
.salir:hover { background:rgba(255,255,255,.24); }
.voz-caja { display:flex; gap:8px; align-items:center; }
.voz-caja select { flex:1; min-width:0; font:inherit; font-size:13px; padding:9px 10px; border-radius:12px; border:1px solid rgba(20,33,61,.12); background:rgba(255,255,255,.85); color:var(--tinta); }
.voz-nota { font-size:11.5px; color:var(--suave); margin-top:6px; line-height:1.4; }

/* Marcadores A / B */
.pin { width:26px; height:26px; border-radius:50% 50% 50% 0; transform:rotate(-45deg); border:3px solid #fff; box-shadow:0 3px 10px rgba(0,0,0,.35); }
.pin.a { background:var(--verde); } .pin.b { background:var(--rojo); }
.yo { width:20px; height:20px; border-radius:50%; background:#2E7CF6; border:3px solid #fff; box-shadow:0 0 0 6px rgba(46,124,246,.25), 0 2px 8px rgba(0,0,0,.35); }

/* Seguimiento */
#nav { position:absolute; z-index:6; top:16px; left:50%; transform:translateX(-50%); width:min(480px, calc(100% - 24px)); border-radius:22px;
       background:rgba(20,33,61,.94); color:#fff; border-color:rgba(255,255,255,.1); padding:12px 14px; display:flex; gap:12px; align-items:center; }
.nav-icono { width:50px; height:50px; border-radius:15px; background:var(--verde); flex:none; display:grid; place-items:center; transition:background .3s; }
.nav-icono svg { width:28px; height:28px; stroke:#fff; fill:none; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.nav-texto b { font-size:19px; display:block; line-height:1.2; } .nav-texto span { font-size:13px; opacity:.8; }
.nav-aviso { display:inline-block; margin-top:6px; font-style:normal; font-size:12px; font-weight:700; padding:3px 9px; border-radius:10px; background:rgba(242,124,27,.25); color:#ffb072; }
#navPie .fila-btn { margin-top:12px; } #navPie .peligro { margin-top:0; flex:1; } #navPie .suave { padding:11px 14px; }
#navPie { position:absolute; z-index:6; bottom:16px; left:50%; transform:translateX(-50%); width:min(480px, calc(100% - 24px)); border-radius:24px; padding:14px 16px; }
.cifras { display:flex; justify-content:space-between; text-align:center; }
.cifras b { font-size:23px; display:block; letter-spacing:-.5px; } .cifras span { font-size:11px; color:var(--suave); }
body.nav #panel { display:none; }

/* Apple Watch */
#reloj { position:absolute; z-index:6; left:20px; bottom:20px; width:150px; height:182px; border-radius:42px; background:#0b1220; padding:9px; box-shadow:0 18px 40px rgba(20,33,61,.4), inset 0 0 0 2px #2a3652; }
.rpant { width:100%; height:100%; border-radius:33px; background:#000; color:#fff; display:flex; flex-direction:column; align-items:center; text-align:center; padding:10px 8px; }
.rhora { font-size:9px; opacity:.7; align-self:flex-end; margin-right:6px; }
.rcirc { width:50px; height:50px; border-radius:50%; background:var(--verde); display:grid; place-items:center; margin-top:2px; transition:background .3s; }
.rcirc svg { width:26px; height:26px; stroke:#fff; fill:none; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.rdist { font-size:23px; font-weight:700; margin-top:6px; letter-spacing:-.5px; line-height:1; }
.rtxt { font-size:9px; opacity:.75; margin-top:3px; }
.rpill { margin-top:6px; padding:3px 9px; border-radius:14px; font-size:9.5px; font-weight:700; }

.maplibregl-ctrl-bottom-right { margin-bottom:0; }
.maplibregl-ctrl-attrib { font-size:11px; }
@media (max-width:820px) { body.nav .maplibregl-ctrl-bottom-right { margin-bottom:210px; } }

/* Móvil: el panel pasa a hoja inferior */
@media (max-width:820px) {
  #panel { left:0; right:0; top:auto; bottom:0; width:auto; max-height:56vh; border-radius:26px 26px 0 0; padding:8px 16px calc(14px + env(safe-area-inset-bottom)); transition:max-height .25s; }
  #panel.cerrado { max-height:92px; overflow:hidden; }
  .asa { display:block; width:42px; height:5px; border-radius:3px; background:rgba(20,33,61,.22); margin:2px auto 10px; cursor:pointer; padding:0; }
  .marca { display:none; }
  #reloj { display:none; }
  .maplibregl-ctrl-top-right { top:8px; }
}
