/* El plano en directo de Arahal (calle.js): un mapa de operaciones sobrio, en claro u oscuro según el sistema; el color solo señala estados. */
.calle { display: grid; gap: 12px; margin-bottom: 14px; }
.calle-barra { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.calle-titulo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.punto-vivo { width: 9px; height: 9px; border-radius: 50%; background: var(--marca-verde); animation: vivo 1.8s ease-in-out infinite; }
@keyframes vivo { 0%, 100% { box-shadow: 0 0 0 0 rgba(68,177,118,.55); } 50% { box-shadow: 0 0 0 6px rgba(68,177,118,0); } }
.chip-fact { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-weight: 600; font-size: 12.5px; }
.chip-fact:hover { border-color: var(--accent); }
.chip-fact.n-bien { color: var(--ok); } .chip-fact.n-trab { color: var(--work); } .chip-fact.n-mal { color: var(--bad); }

.calle-lienzo { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface); line-height: 0; }
.calle-svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.calle-svg text { font-family: var(--font); font-weight: 700; }
.calle-svg .rotulo { font-weight: 650; }
.calle-svg .estado-local { font-weight: 600; }
.calle-svg .est-necesita .estado-local { font-weight: 700; }

/* Paleta del plano (tema claro) */
.calle-svg { --suelo: #EEF0F4; --rejilla: #E3E6EC; --manzana: #E6E9EF; --bordillo: #C9CED8; --asfalto: #FFFFFF; --linea: #D2D7E0; --tarjeta: #FFFFFF; --tarjeta-borde: #D3D8E2; --sombra: rgba(24,32,56,.10); --texto: #232838; --texto-suave: #6A7285; --garaje: #E4E7EE; --plaza: #BFC5D2; --isla: #F7F8FB; --isla-borde: #C3C9D6; --vivienda: #DCE0E8; --vivienda-borde: #C3C9D6; --hueco: #F4F5F8; --radar: #B9C0CE; --halo: #EEF0F4; --e-necesita: #C4372F; --e-trabajando: #2B8A5A; --e-espera: #C9892A; --e-cerrado: #A3A9B8; }
@media (prefers-color-scheme: dark) {
  .calle-svg { --suelo: #141821; --rejilla: #1B202B; --manzana: #181D27; --bordillo: #2C3342; --asfalto: #232937; --linea: #3A4252; --tarjeta: #1D222E; --tarjeta-borde: #323A4B; --sombra: rgba(0,0,0,.35); --texto: #E6E8F0; --texto-suave: #9099AE; --garaje: #1A1F2A; --plaza: #3A4252; --isla: #1A1F2A; --isla-borde: #343C4D; --vivienda: #232937; --vivienda-borde: #343C4D; --hueco: #2E3647; --radar: #3F485B; --halo: #141821; --e-necesita: #F2796F; --e-trabajando: #34D399; --e-espera: #E9AB4A; --e-cerrado: #5E667A; }
}

/* Fondo: suelo con cuadrícula, manzana central y calles */
.suelo { fill: var(--suelo); }
.rejilla { fill: none; stroke: var(--rejilla); stroke-width: 1; }
.manzana { fill: var(--manzana); }
.bordillo { fill: none; stroke: var(--bordillo); stroke-width: 36; stroke-linejoin: round; }
.asfalto { fill: none; stroke: var(--asfalto); stroke-width: 32; stroke-linejoin: round; }
.linea-via { fill: none; stroke: var(--linea); stroke-width: 1.6; stroke-dasharray: 9 11; }

/* Locales: tarjeta con barra del color de su estado */
.cuerpo-local, .cuerpo-casa { transform-box: fill-box; transform-origin: 50% 50%; }
.sombra-local { fill: var(--sombra); }
.tarjeta { fill: var(--tarjeta); stroke: var(--tarjeta-borde); stroke-width: 1.2; }
.barra-estado { fill: var(--e-espera); }
.est-necesita .barra-estado { fill: var(--e-necesita); }
.est-trabajando .barra-estado { fill: var(--e-trabajando); }
.est-espera .barra-estado { fill: var(--e-espera); }
.est-cerrado .barra-estado { fill: var(--e-cerrado); }
.rotulo { fill: var(--texto); font-weight: 650; letter-spacing: -.005em; }
.estado-local { fill: var(--texto-suave); font-weight: 600; letter-spacing: .02em; }
.est-necesita .estado-local { fill: var(--e-necesita); font-weight: 700; }
.franja-local { opacity: .9; }
.est-necesita .tarjeta { stroke: var(--e-necesita); stroke-width: 1.6; }
.est-cerrado .cuerpo-local { opacity: .6; }
.insignia circle { fill: #C4372F; stroke: var(--tarjeta); stroke-width: 2; }
.insignia text, .moto-carga text { fill: #fff; font-weight: 750; }
.insignia.oculta, .moto-carga.oculta { display: none; }
.local.rebote .cuerpo-local, .casa.rebote .cuerpo-casa { animation: rebote .6s ease; }
@keyframes rebote { 30% { transform: scale(1.05); } 60% { transform: scale(.985); } }
.local.est-necesita .barra-estado { animation: late-estado 1.6s ease-in-out infinite; }
@keyframes late-estado { 50% { opacity: .45; } }

/* Cajitas de pedidos en el mostrador */
.cj-n > rect:first-child { fill: var(--f-n); } .cj-p > rect:first-child { fill: var(--f-p); } .cj-l > rect:first-child { fill: var(--f-l); } .cj-m > rect:first-child { fill: var(--f-m); }
.cj > rect:first-child { stroke: rgba(0,0,0,.25); stroke-width: .8; }
/* El negro del pedido nuevo lleva un borde claro: sobre el suelo oscuro de la escena no se vería */
.cj-n > rect:first-child { stroke: rgba(255,255,255,.7); }
.cj.nueva { animation: cae-svg .55s cubic-bezier(.3, 1.7, .5, 1) both; }
@keyframes cae-svg { from { translate: 0 -26px; opacity: 0; } to { translate: 0 0; opacity: 1; } }

/* Elementos que se pueden tocar */
.tocable { cursor: pointer; outline: none; }
.toque { fill: transparent; }
.anillo { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 6 4; opacity: 0; transition: opacity .2s; pointer-events: none; }
.tocable:hover .anillo { opacity: .5; }
.sel .anillo, .tocable:focus-visible .anillo { opacity: 1; animation: marcha .8s linear infinite; }
@keyframes marcha { to { stroke-dashoffset: -10; } }
.moto .toque { fill: transparent; }

/* Base de las motos, viviendas y centro de vigilancia */
.base .tarjeta { fill: var(--tarjeta); }
.garaje-int { fill: var(--garaje); }
.plaza { stroke: var(--plaza); stroke-width: 1.4; stroke-dasharray: 3 3; fill: none; }
.cartel-zona { fill: var(--texto-suave); letter-spacing: .14em; font-weight: 700; }
.vivienda { fill: var(--vivienda); stroke: var(--vivienda-borde); stroke-width: 1; }
.tejado { fill: none; stroke: var(--vivienda-borde); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hueco { fill: var(--hueco); }
.isla { fill: var(--isla); stroke: var(--isla-borde); stroke-width: 1.2; }
.pildora rect { fill: #2B8A5A; }
.n-trab .pildora rect { fill: #B46A0A; } .n-mal .pildora rect { fill: #C4372F; }
.pildora text { fill: #fff; font-weight: 700; }
.anillo-radar, .cruz-radar { fill: none; stroke: var(--radar); stroke-width: 1; opacity: .75; }
.barrido { fill: #2B8A5A; opacity: .22; }
.aguja { stroke: #2B8A5A; stroke-width: 1.6; stroke-linecap: round; }
.torre.n-trab .barrido { fill: #B46A0A; } .torre.n-trab .aguja { stroke: #B46A0A; }
.torre.n-mal .barrido { fill: #C4372F; opacity: .3; } .torre.n-mal .aguja { stroke: #C4372F; }
.foco { fill: #2B8A5A; }
.torre.n-trab .foco { fill: #B46A0A; }
.torre.n-mal .foco { fill: #C4372F; animation: parpadeo .8s steps(2, jump-none) infinite; }
.haz-giro { animation: barre-torre 8s linear infinite; }
.torre.alerta .haz-giro { animation-duration: 2.6s; }
.torre.alarma .haz-giro { animation-duration: 1.2s; }
@keyframes barre-torre { to { transform: rotate(360deg); } }
.torre.alarma .pildora rect { animation: parpadeo .5s steps(2, jump-none) 8; }

/* Motos */
.moto-nombre rect { fill: rgba(28,32,44,.9); stroke: rgba(255,255,255,.14); stroke-width: 1; }
.moto-nombre text { fill: #fff; }
.moto-carga circle { fill: #3E4658; stroke: var(--tarjeta); stroke-width: 1.8; }
.m-rueda .rueda, .m-sale .rueda, .m-entra .rueda { animation: giro .4s linear infinite; }
.m-rueda .chasis, .m-sale .chasis, .m-entra .chasis { animation: vibra .26s ease-in-out infinite alternate; }
.m-espera .chasis { animation: espera 1.1s ease-in-out infinite alternate; }
.rep-inactivo { opacity: .55; filter: grayscale(1); }
/* Aparcadas en la base el rótulo se esconde para que no se pisen; aparece al tocar o pasar el ratón */
.m-park .moto-nombre { opacity: 0; transition: opacity .2s; }
.m-park.sel .moto-nombre, .m-park:hover .moto-nombre { opacity: 1; }

/* Bocadillos y marcas de los eventos */
.marca { font-size: 12.5px; font-weight: 800; stroke: var(--halo); stroke-width: 4px; paint-order: stroke; stroke-linejoin: round; pointer-events: none; }
.marca.nuevo { fill: #5B3FD6; } .marca.ok { fill: #2B8A5A; } .marca.mal { fill: #C4372F; } .marca.moto { fill: #6245BC; } .marca.info { fill: #5E5B85; }
.bocadillo-svg { pointer-events: none; }
.bocadillo-svg rect, .bocadillo-svg path { fill: #fff; stroke: #CFCBE6; stroke-width: 1; }
.bocadillo-svg text { fill: #1E1747; font-size: 11px; font-weight: 600; }
.bocadillo-svg.mal rect, .bocadillo-svg.mal path { stroke: #D6453D; stroke-width: 1.8; }
.bocadillo-svg.ok rect, .bocadillo-svg.ok path { stroke: #2B8A5A; stroke-width: 1.8; }

/* Panel de detalle y lista plegada */
.calle-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; min-height: 84px; align-content: start; }
.panel-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-cab h3 { font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ley { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.calle-panel .caja { display: inline-block; }
.lista-todo { margin-top: 4px; }
.lista-todo > summary { cursor: pointer; font-weight: 600; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); list-style: none; }
.lista-todo > summary::-webkit-details-marker { display: none; }
.lista-todo > summary::before { content: "▸ "; }
.lista-todo[open] > summary::before { content: "▾ "; }
.lista-todo[open] > summary { margin-bottom: 12px; }
.z-oficina .agentes { grid-template-columns: minmax(0, 1fr); }
.z-oficina .agente { max-width: 560px; }
@media (max-width: 760px) { .calle-panel { padding: 12px; } .calle-lienzo { border-radius: 12px; } }

/* Sugerencias de reparto (modo sombra): guía hasta la parada, bocadillo y bloques del panel */
.guia-reco { fill: none; stroke: #6245BC; stroke-width: 2.4; stroke-dasharray: 7 6; stroke-linecap: round; pointer-events: none; animation: hormigas .9s linear infinite; }
@media (prefers-color-scheme: dark) { .guia-reco, .diana-reco { stroke: #C4B5FD; } }
.diana-reco { fill: rgba(98,69,188,.12); stroke: #6245BC; stroke-width: 2.4; pointer-events: none; animation: late 1.4s ease-in-out infinite; }
.guia-reco.oculta, .diana-reco.oculta { display: none; }
@keyframes hormigas { to { stroke-dashoffset: -13; } }
@keyframes late { 50% { opacity: .45; } }
.bocadillo-svg.reco rect, .bocadillo-svg.reco path { stroke: #6245BC; stroke-width: 1.8; }
.reco { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.reco .reco { padding: 6px 0 0; background: none; border-top: 1px solid var(--line); border-radius: 0; }
.reco .reco .reco-prueba { display: none; }
.reco-cab { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reco-prueba { font-size: 10.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.reco-texto { margin: 0; font-weight: 600; }
.reco-plan { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 12.5px; counter-reset: paso; }
.reco-plan li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; gap: 8px; align-items: baseline; border-top: 1px solid var(--line); padding-top: 3px; }
.reco-plan li:first-child { border-top: 0; padding-top: 0; font-weight: 600; }
.reco-plan .h { color: var(--muted); }
.reco-plan em { color: var(--accent); font-style: normal; }
.reco-plan .t { color: var(--muted); white-space: nowrap; }
.reco-plan .t.mal { color: var(--bad); font-weight: 600; }
.reco-lista { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.reco-lista li { display: grid; grid-template-columns: minmax(5.5em, auto) minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 13px; }
.reco-rep { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; text-align: left; text-decoration: underline; text-decoration-color: transparent; }
.reco-rep:hover { text-decoration-color: currentColor; }
.reco-que.reco-libre { color: var(--muted); }
.reco-linea { margin: 2px 0 0; font-size: 12.5px; font-weight: 600; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .reco-lista li { grid-template-columns: minmax(0, 1fr); gap: 0; } }
@media (prefers-reduced-motion: reduce) { .punto-vivo, .guia-reco, .diana-reco { animation: none; } }

/* La moto en el tema oscuro: el scooter se aclara para que no se pierda en el asfalto */
@media (prefers-color-scheme: dark) {
  .m-cuerpo { fill: #9AA4B8; } .m-asiento { fill: #566077; } .m-miembro { stroke: #6B7690; } .m-neum { stroke: #A3ACBF; stroke-width: 1.4; }
}

/* selector de vista de la Oficina (Maqueta 3D / Mapa): un control segmentado sobrio en la barra de la escena */
.vista-selector { display: inline-flex; margin-left: auto; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.vs-opcion { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); min-height: 28px; }
.vs-opcion:hover { color: var(--fg); }
.vs-opcion[aria-pressed="true"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.oficina-vistas, .oficina-vista { display: contents; }
