/* ---- Mapa 3D (laboratorio) ---- */
.m3-page { position: relative; height: calc(100dvh - 78px); min-height: 460px; margin: -8px; border-radius: 14px; overflow: hidden; background: #b7d3ee; }
.m3-escena { position: absolute; inset: 0; }
.m3-escena canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; }
.m3-barra { position: absolute; top: 12px; left: 12px; right: 12px; max-width: 640px; display: flex; gap: 8px; z-index: 12; }
.m3-barra .form-input { box-shadow: 0 6px 18px rgba(0, 0, 0, .25); border-radius: 12px; height: 44px; background: var(--o-surface,#fff); }
.m3-barra > select { max-width: 200px; flex: none; }
.m3-buscar { position: relative; flex: 1; min-width: 0; }
.m3-buscar .form-input { width: 100%; }
.m3-resultados { position: absolute; top: 50px; left: 0; right: 0; background: var(--o-surface,#fff); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 28px rgba(0, 0, 0, .3); }
.m3-resultados button { display: grid; width: 100%; text-align: left; border: 0; background: var(--o-surface,#fff); padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--o-border,#eef2f7); }
.m3-resultados button:hover { background: var(--o-info-bg,#eaf1fb); } .m3-resultados small { color: var(--o-muted,#64748b); }
.m3-modos { position: absolute; top: 68px; left: 12px; z-index: 5; display: flex; gap: 6px; flex-wrap: wrap; }
.m3-modos button { border: 0; border-radius: 999px; padding: 8px 14px; background: var(--o-glass,rgba(255, 255, 255, .94)); color: var(--o-text-2,#1e293b); font-weight: 600; font-size: 13.5px; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .22); }
.m3-modos button.on { background: #1d3f73; color: #fff; }
.m3-capas { position: absolute; left: 12px; bottom: 34px; z-index: 5; background: var(--o-glass,rgba(255, 255, 255, .94)); border-radius: 14px; padding: 10px 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); display: grid; gap: 6px; max-width: min(360px, calc(100% - 24px)); }
.m3-capas label { display: grid; gap: 3px; font-size: 12px; font-weight: 600; color: var(--o-muted,#475569); } .m3-capas select { height: 34px; font-size: 13px; }
.m3-leyenda { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--o-text-2,#334155); }
.m3-leyenda i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; } .m3-leyenda i.libre { background: #34d399; opacity: .6; }
.m3-ayuda { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 12px; font-size: 12px; color: #fff; background: linear-gradient(0deg, rgba(15, 23, 42, .6), rgba(15, 23, 42, 0)); z-index: 4; pointer-events: none; }
.m3-stats { position: absolute; right: 12px; bottom: 28px; z-index: 5; font-size: 12px; color: #fff; background: rgba(15, 23, 42, .6); padding: 4px 10px; border-radius: 999px; }
.m3-cargando { position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center; gap: 10px; background: rgba(183, 211, 238, .7); color: var(--o-text-2,#1e293b); font-weight: 600; }
.m3-aviso { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); z-index: 16; width: max-content; max-width: min(520px, calc(100% - 24px)); display: flex; align-items: flex-start; gap: 8px; background: var(--o-warn-bg,#fffbeb); border: 1px solid var(--o-warn-b,#fde68a); color: var(--o-warn,#92400e); padding: 10px 8px 10px 14px; border-radius: 12px; box-shadow: 0 8px 22px rgba(0, 0, 0, .25); font-size: 13.5px; line-height: 1.4; }
.m3-aviso-x { flex: none; width: 32px; height: 32px; margin: -5px 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(146, 64, 14, .1); color: var(--o-warn,#92400e); cursor: pointer; }
.m3-ficha { position: absolute; right: 12px; top: 12px; z-index: 6; box-sizing: border-box; width: min(340px, calc(100% - 24px)); max-width: calc(100% - 24px); background: var(--o-surface,#fff); border-radius: 16px; padding: 14px 16px; box-shadow: 0 14px 40px rgba(0, 0, 0, .35); display: grid; gap: 6px; overflow-x: hidden; }
.m3-ficha h3 { margin: 0; font-size: 18px; } .m3-x { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; font-size: 16px; cursor: pointer; color: var(--o-muted,#64748b); }
.m3-estado { justify-self: start; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; } .m3-estado.libre { background: var(--o-ok-bg,#d1fae5); color: var(--o-ok,#047857); } .m3-estado.ocupada { background: var(--o-info-bg,#dbeafe); color: var(--o-info,#1d4ed8); }
.m3-dato { display: grid; grid-template-columns: minmax(86px, auto) minmax(0, 1fr); align-items: start; gap: 10px; font-size: 13px; border-bottom: 1px dashed var(--o-border,#e2e8f0); padding: 3px 0; } .m3-dato span { color: var(--o-muted,#64748b); } .m3-dato b { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.m3-alerta { background: var(--o-bad-bg,#fef2f2); color: var(--o-bad,#b91c1c); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.m3-cruz { position: absolute; right: 16px; bottom: 56px; z-index: 6; width: 150px; height: 150px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); touch-action: none; }
.m3-cruz button { border: 0; border-radius: 14px; background: var(--o-glass,rgba(255, 255, 255, .85)); font-size: 20px; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); user-select: none; -webkit-user-select: none; touch-action: none; }
.m3-cruz .arr { grid-column: 2; grid-row: 1; } .m3-cruz .izq { grid-column: 1; grid-row: 2; } .m3-cruz .der { grid-column: 3; grid-row: 2; } .m3-cruz .aba { grid-column: 2; grid-row: 3; }
.m3-resumen { position: absolute; right: 12px; top: 12px; z-index: 5; width: min(290px, calc(100% - 24px)); background: var(--o-glass,rgba(255, 255, 255, .95)); border-radius: 14px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); display: grid; gap: 6px; font-size: 13px; }
.m3-resumen > b { font-size: 15px; } .m3-resumen small { color: var(--o-muted,#64748b); font-size: 11.5px; }
.m3-barra-ocup { height: 7px; border-radius: 999px; background: var(--o-ok-bg,#d1fae5); overflow: hidden; } .m3-barra-ocup i { display: block; height: 100%; background: #2563eb; }
.m3-cifras { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--o-text-2,#334155); }
@media (max-width: 760px) {
  .m3-resumen { top: auto; bottom: 150px; right: 8px; left: 8px; width: auto; } .m3-resumen small:last-child { display: none; }
  .m3-page { height: calc(100dvh - 70px); margin: -10px; border-radius: 0; }
  .m3-barra > select { max-width: 120px; }
  .m3-capas { bottom: 30px; left: 8px; padding: 8px 10px; } .m3-capas .m3-leyenda { display: none; }
  .m3-ficha { top: auto; bottom: 90px; right: 8px; left: 8px; width: auto; }
  .m3-aviso { top: 108px; }
  .m3-stats { display: none; }
}

.m3-modos button { display: inline-flex; align-items: center; gap: 6px; } .m3-x { display: grid; place-items: center; }
.m3-sat { display: flex; align-items: center; gap: 5px; } .m3-alerta { display: flex; align-items: center; gap: 6px; }

.m3-situar { position: absolute; left: 12px; top: 112px; z-index: 6; width: min(330px, calc(100% - 24px)); background: var(--o-glass,rgba(255, 255, 255, .97)); border-radius: 14px; padding: 12px 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, .3); display: grid; gap: 7px; }
.m3-situar small { color: var(--o-muted,#64748b); font-size: 12px; } .m3-res { display: grid; text-align: left; border: 1px solid var(--o-border,#e2e8f0); background: var(--o-surface,#fff); border-radius: 10px; padding: 7px 10px; cursor: pointer; } .m3-res:hover { background: var(--o-info-bg,#eaf1fb); }
.m3-fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; } .m3-fotos button { border: 0; padding: 0; background: none; cursor: zoom-in; } .m3-fotos img { width: 100%; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--o-border,#e2e8f0); }
.m3-3d { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.m3-fondo { position: absolute; inset: 0; z-index: 20; background: rgba(15, 23, 42, .65); display: grid; place-items: center; padding: 12px; }
.m3-foto-grande { max-width: 96%; max-height: 92%; border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.m3-coche { width: min(940px, 100%); max-height: 100%; overflow: auto; background: var(--o-surface,#fff); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); display: grid; }
.m3-coche header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--o-border,#e2e8f0); } .m3-coche header small { display: block; color: var(--o-muted,#64748b); font-family: ui-monospace, monospace; }
.m3-coche-cuerpo { display: grid; grid-template-columns: minmax(280px, 1.6fr) minmax(220px, 1fr); } .c3-escena { position: relative; min-height: 380px; background: var(--o-info-bg,#dfe9f5); }
.m3-coche-lado { padding: 12px 14px; display: grid; gap: 7px; align-content: start; max-height: 420px; overflow: auto; } .m3-coche-lado h4 { margin: 8px 0 0; font-size: 13px; } .m3-vacio { color: var(--o-muted,#64748b); font-size: 13px; margin: 0; }
.m3-coche-lado small { color: var(--o-muted,#64748b); font-size: 12px; } .m3-dano { border: 1px solid var(--o-border,#e2e8f0); border-radius: 10px; padding: 6px 10px; font-size: 13px; cursor: pointer; display: grid; } .m3-dano small { margin-top: 2px; } .m3-dano.sel { border-color: #dc2626; background: var(--o-bad-bg,#fef2f2); }
.m3-vr { position: absolute; left: 50%; bottom: 54px; transform: translateX(-50%); z-index: 8; border: 0; border-radius: 999px; padding: 10px 20px; background: #1d3f73; color: #fff; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
@media (max-width: 760px) { .m3-coche-cuerpo { grid-template-columns: 1fr; } .c3-escena { min-height: 280px; } .m3-situar { top: 108px; } }

/* aspecto «cristal oscuro» (como la tarjeta VEHICULO DETALLE) para la ficha y el resumen */
.m3-ficha, .m3-resumen { background: rgba(26, 32, 44, .88); backdrop-filter: blur(10px); color: #fff; border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.m3-ficha h3 { letter-spacing: .02em; } .m3-x { color: #cbd5e1; }
.m3-ficha .m3-dato { border-bottom-color: rgba(255, 255, 255, .14); } .m3-ficha .m3-dato span, .m3-resumen small { color: #aab6c8; } .m3-ficha .m3-dato b { color: #fff; }
.m3-estado.libre { background: rgba(52, 211, 153, .2); color: #6ee7b7; } .m3-estado.ocupada { background: rgba(245, 158, 11, .2); color: #fcd34d; }
.m3-alerta { background: rgba(239, 68, 68, .2); color: #fecaca; }
.m3-ficha .btn-primary { background: #2563eb; border-color: #2563eb; } .m3-ficha .m3-3d { background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .25); }
.m3-ficha .m3-fotos img { border-color: rgba(255, 255, 255, .25); } .m3-barra-ocup { background: rgba(255, 255, 255, .18); } .m3-barra-ocup i { background: #38bdf8; } .m3-cifras { color: #e2e8f0; }
.m3-capas { background: rgba(26, 32, 44, .86); backdrop-filter: blur(8px); color: #e2e8f0; border: 1px solid rgba(255, 255, 255, .14); } .m3-capas label { color: #cbd5e1; } .m3-leyenda { color: #cbd5e1; }
.m3-modos button { background: rgba(26, 32, 44, .82); color: #e2e8f0; backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .14); } .m3-modos button.on { background: #2563eb; color: #fff; }
.m3-stats { background: rgba(26, 32, 44, .75); }

/* viñeta suave y un toque de contraste: aspecto de render */
.m3-escena::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 62%, rgba(10,16,28,.34) 100%); }
.m3-escena canvas { filter: contrast(1.04) saturate(1.06); }

/* visor del coche: estudio oscuro, limpio */
.m3-coche { background: rgba(20, 26, 38, .94); backdrop-filter: blur(14px); color: #fff; border: 1px solid rgba(255, 255, 255, .14); border-radius: 20px; }
.m3-coche header { border-bottom: 1px solid rgba(255, 255, 255, .1); } .m3-coche header b { font-size: 17px; letter-spacing: .01em; } .m3-coche header small { color: var(--o-faint,#94a3b8); }
.c3-escena { background: radial-gradient(ellipse at 50% 62%, #2c3a52 0%, #172033 55%, #0e1420 100%); min-height: 400px; }
.m3-coche-lado small, .m3-coche-lado .m3-vacio { color: var(--o-faint,#94a3b8); } .m3-coche-lado h4 { color: #e2e8f0; letter-spacing: .08em; text-transform: uppercase; font-size: 11px; }
.m3-dano { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #f1f5f9; } .m3-dano.sel { background: rgba(239, 68, 68, .2); border-color: #ef4444; }
.m3-coche .m3-x { color: #cbd5e1; }

/* ficha: daños y galeria */
.m3-sec { margin-top: 8px; font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--o-faint,#94a3b8); }
.m3-dano-fila { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #f1f5f9; border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.m3-dano-fila:hover { background: rgba(255, 255, 255, .12); } .m3-dano-fila span { display: grid; flex: 1; min-width: 0; } .m3-dano-fila small { color: #aab6c8; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sev { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #f59e0b; } .sev-Moderado { background: #f97316; } .sev-Grave { background: #ef4444; } .sev-MuyGrave { background: #b91c1c; box-shadow: 0 0 0 2px rgba(239, 68, 68, .35); }
.m3-mas { color: var(--o-faint,#94a3b8); font-size: 11.5px; } .m3-fotos-scroll { max-height: 150px; overflow: auto; padding-right: 2px; }
.m3-ficha { max-height: calc(100% - 24px); overflow: auto; }
.m3-visor { display: grid; gap: 10px; justify-items: center; max-width: 96%; max-height: 96%; } .m3-visor .m3-foto-grande { max-width: 100%; max-height: calc(100vh - 220px); object-fit: contain; }
.m3-visor-pie { display: flex; align-items: center; gap: 14px; background: rgba(26, 32, 44, .9); color: #fff; border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px; padding: 8px 14px; } .m3-visor-pie span { display: grid; text-align: center; min-width: 200px; } .m3-visor-pie small { color: var(--o-faint,#94a3b8); }
.m3-nav { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; } .m3-nav:disabled { opacity: .35; cursor: default; }

.m3-cargando-extras { display: flex; align-items: center; gap: 8px; color: #aab6c8; font-size: 12.5px; } .m3-cargando-extras .spinner { width: 16px; height: 16px; border-width: 2px; }
.m3-sub { display: grid; gap: 1px; font-size: 13px; font-weight: 700; letter-spacing: .04em; color: #e2e8f0; margin-top: -2px; } .m3-sub small { color: var(--o-faint,#94a3b8); font-weight: 500; letter-spacing: 0; }

/* boton principal de la ficha: expediente visual del coche */
.m3-ficha .m3-expediente { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 12px; padding: 11px 14px; margin-top: 8px; cursor: pointer; color: #fff; text-align: left; font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, #7c3aed, #2563eb); box-shadow: 0 6px 18px rgba(79, 70, 229, .45); transition: transform .15s, filter .15s; }
.m3-ficha .m3-expediente:hover { transform: translateY(-1px); filter: brightness(1.1); }
.m3-ficha .m3-expediente span { display: grid; } .m3-ficha .m3-expediente small { font-weight: 500; opacity: .85; font-size: 12px; }
.m3-sin { display: flex; align-items: center; gap: 8px; padding: 11px 14px; color: var(--o-muted,#64748b); font-size: 13px; } .m3-sin .spinner { width: 16px; height: 16px; }

/* acciones operativas de la ficha: compactas para no tapar el mapa ni romper en móvil */
.m3-acciones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 5px; min-width: 0; }
.m3-acciones button, .m3-destino { border: 1px solid rgba(255,255,255,.24); border-radius: 10px; background: rgba(255,255,255,.09); color: #fff; cursor: pointer; font-weight: 700; padding: 8px 10px; }
.m3-acciones button { min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding-inline: 7px; white-space: nowrap; font-size: 12px; }
.m3-acciones button:hover { background: rgba(56,189,248,.2); border-color: rgba(125,211,252,.7); }
.m3-dialogo { position: relative; width: min(420px, 100%); display: grid; gap: 10px; padding: 20px; border-radius: 18px; background: rgba(20,26,38,.98); color: #fff; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 24px 60px rgba(0,0,0,.48); }
.m3-dialogo h3 { margin: 0; padding-right: 28px; font-size: 18px; }.m3-dialogo p { margin: 0; color: #cbd5e1; font-size: 13px; }.m3-dialogo .form-input { background: var(--o-surface,#fff); color: var(--o-heading,#172033); }
.m3-destino { display: grid; text-align: left; }.m3-destino small { color: #aab6c8; font-weight: 500; }.m3-destino.sel { border-color: #38bdf8; background: rgba(56,189,248,.2); }.m3-dialogo .btn-secondary { justify-self: start; }
.m3-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }.m3-form-grid label { display: grid; gap: 4px; color: #cbd5e1; font-size: 12px; }.m3-check { display: flex; gap: 8px; align-items: center; color: #e2e8f0; font-size: 13px; }
@media (max-width: 560px) { .m3-form-grid { grid-template-columns: 1fr; } }

/* tarjeta «Vehículo detalle» anclada al coche seleccionado */
.m3-call { position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; display: none; min-width: 150px; max-width: 210px; padding: 9px 12px; border-radius: 10px; color: #f1f5f9; font: 500 11.5px/1.45 system-ui, sans-serif; letter-spacing: .02em;
  background: rgba(38, 64, 73, .9); border: 1px solid rgba(125, 211, 252, .35); box-shadow: 0 10px 26px rgba(0, 0, 0, .35); backdrop-filter: blur(6px); will-change: transform; }
.m3-call-t { display: block; font-size: 10.5px; letter-spacing: .1em; opacity: .85; padding-bottom: 5px; margin-bottom: 4px; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.m3-call-mat { font: 700 17px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .06em; margin-bottom: 3px; }
.m3-call-vin { font-family: ui-monospace, Consolas, monospace; }
.m3-call-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; display: none; }
.m3-call-svg line { stroke: #7dd3fc; stroke-width: 1.3; opacity: .9; } .m3-call-svg circle { fill: #7dd3fc; stroke: #fff; stroke-width: 1.5; }
@media (max-width: 760px) { .m3-call { font-size: 10.5px; min-width: 130px; padding: 7px 9px; } .m3-call-mat { font-size: 15px; } }

/* tarjeta «Vehículo detalle»: cristal translúcido, estado con punto de color y filas etiqueta/valor */
.m3-call { min-width: 190px; max-width: 250px; padding: 11px 14px; border-radius: 14px; background: rgba(18, 38, 48, .66); border: 1px solid rgba(255, 255, 255, .2); backdrop-filter: blur(12px) saturate(1.2); box-shadow: 0 14px 34px rgba(0, 0, 0, .32);
  font: 500 11.5px/1.5 Inter, system-ui, sans-serif; letter-spacing: .015em; }
.m3-call-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, .16); }
.m3-call-cab .m3-call-t { border: 0; margin: 0; padding: 0; }
.m3-call-est { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 999px; background: rgba(52, 211, 153, .18); color: #6ee7b7; font-size: 10px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; }
.m3-call-est i { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; }
.m3-call-est.bloq { background: rgba(248, 113, 113, .2); color: #fca5a5; } .m3-call-est.bloq i { background: #f87171; box-shadow: 0 0 8px #f87171; }
.m3-call-f { display: flex; justify-content: space-between; gap: 14px; margin-top: 2px; } .m3-call-f span { color: var(--o-faint,#94a3b8); font-size: 10px; letter-spacing: .08em; align-self: center; } .m3-call-f b { text-align: right; font-weight: 650; }

/* panel de capas compacto: los cuatro selectores en una cuadrícula para que no tape la escena */
.m3-capas { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: min(470px, calc(100% - 24px)); padding: 8px 10px; gap: 6px 8px; }
.m3-capas > label:nth-child(2) { grid-column: 1 / -1; }
.m3-capas .m3-leyenda { grid-column: 1 / -1; }
.m3-capas label { font-size: 11px; } .m3-capas select { height: 30px; font-size: 12px; padding: 0 6px; }
@media (max-width: 560px) { .m3-capas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* paneles inferiores: en escritorio cada uno va en su sitio; en movil se apilan en un solo bloque (nunca superpuestos) y se pueden cambiar/ocultar */
.m3-paneles { display: contents; }
.m3-btn-paneles { display: none !important; }
@media (max-width: 760px) {
  .m3-btn-paneles { display: inline-flex !important; }
  .m3-paneles { display: flex; flex-direction: column; gap: 8px; position: absolute; left: 8px; right: 8px; bottom: 30px; z-index: 5; pointer-events: none; }
  .m3-paneles > * { position: static !important; width: auto !important; max-width: none !important; pointer-events: auto; margin: 0; }
  .m3-paneles .m3-resumen { padding: 8px 12px; } .m3-paneles .m3-resumen small { display: none; }
  .m3-paneles[data-p="0"] .m3-capas, .m3-paneles[data-p="1"] .m3-resumen, .m3-paneles[data-p="2"] > * { display: none; }
  .m3-paneles .m3-capas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m3-page:has(.m3-ficha) .m3-paneles > :not(.m3-herramientas) { display: none !important; }   /* con una ficha abierta, solo la fila de herramientas (cabe debajo de la ficha) */
  .m3-page:has(.m3-paneles[data-p="2"]) .m3-ayuda { display: none; }
  .m3-cruz { bottom: 110px; }
}


/* Linterna a pie: de noche se resalta para sugerirla */
.m3-modos .m3-btn-linterna.sugerida { box-shadow: 0 0 0 2px #fbbf24, 0 0 14px rgba(251,191,36,.55); }
.m3-modos .m3-btn-linterna.on { background: #fbbf24; color: var(--o-text,#1f2937); border-color: #f59e0b; }

/* ── asistente de tareas: menú, panel de la tarea y guía (ruta, giros, distancia) ── */
.m3-menu-tareas { position: absolute; left: 12px; top: 112px; z-index: 9; width: min(380px, calc(100% - 24px)); max-height: calc(100% - 150px); overflow: auto; display: grid; gap: 8px; padding: 14px; border-radius: 16px;
  background: rgba(20, 26, 38, .95); color: #f1f5f9; border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 18px 44px rgba(0, 0, 0, .45); backdrop-filter: blur(10px); }
.m3-menu-tareas > b { font-size: 16px; padding-right: 26px; } .m3-menu-tareas > small { color: #aab6c8; font-size: 12.5px; }
.m3-menu-opciones { display: grid; gap: 6px; }
.m3-menu-opciones button { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #f1f5f9; border-radius: 12px; padding: 9px 12px; cursor: pointer; font-weight: 700; font-size: 13.5px; }
.m3-menu-opciones button span { display: grid; } .m3-menu-opciones button small { color: #aab6c8; font-weight: 500; font-size: 12px; }
.m3-menu-opciones button:hover, .m3-menu-opciones button.on { background: rgba(56, 189, 248, .18); border-color: rgba(125, 211, 252, .7); }
.m3-menu-tareas .form-input { background: var(--o-surface,#fff); color: var(--o-heading,#172033); height: 40px; }
.m3-menu-tareas .m3-res { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #f1f5f9; } .m3-menu-tareas .m3-res small { color: #aab6c8; } .m3-menu-tareas .m3-res:hover { background: rgba(255, 255, 255, .12); }
.m3-menu-lista { display: grid; gap: 6px; max-height: 280px; overflow: auto; } .m3-menu-tareas .m3-sin { color: #aab6c8; padding: 6px 2px; }

.m3-tarea { position: absolute; right: 12px; top: 64px; z-index: 7; box-sizing: border-box; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 100px); overflow: auto; display: grid; gap: 8px; padding: 14px 16px;
  background: rgba(20, 26, 38, .93); color: #f1f5f9; border: 1px solid rgba(255, 255, 255, .16); border-radius: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, .45); backdrop-filter: blur(10px); }
.m3-tarea h3 { margin: 0; font-size: 19px; letter-spacing: .02em; } .m3-tarea p { margin: 0; font-size: 13.5px; color: #dbe4ee; } .m3-tarea p b { color: #fff; }
.m3-tarea-cab { display: flex; gap: 8px; align-items: center; padding-right: 28px; }
.m3-tarea-tipo { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #7dd3fc; } .m3-tarea-paso { font-size: 11.5px; font-weight: 700; color: var(--o-text,#0f172a); background: #7dd3fc; border-radius: 999px; padding: 1px 9px; }
.m3-tarea .btn-primary, .m3-tarea .btn-secondary { width: 100%; justify-content: center; display: inline-flex; align-items: center; gap: 7px; }
.m3-tarea .btn-primary { background: #2563eb; border-color: #2563eb; } .m3-tarea .btn-secondary { background: rgba(255, 255, 255, .08); color: #e2e8f0; border: 1px solid rgba(255, 255, 255, .22); }
.m3-tarea .form-input { background: var(--o-surface,#fff); color: var(--o-heading,#172033); height: 40px; }
.m3-sugerencias { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .m3-sugerencias .m3-destino { padding: 7px 10px; } .m3-sugerencias .m3-destino b { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.m3-elegir-mapa { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px dashed rgba(125, 211, 252, .6); background: rgba(56, 189, 248, .08); color: #bae6fd; border-radius: 10px; padding: 8px 10px; cursor: pointer; font-weight: 700; font-size: 13px; }
.m3-elegir-mapa.on { background: rgba(34, 197, 94, .2); border-color: var(--o-ok-b,#4ade80); color: #bbf7d0; animation: m3-latido 1.2s ease-in-out infinite; }
@keyframes m3-latido { 50% { box-shadow: 0 0 0 4px rgba(74, 222, 128, .25); } }
.m3-ruta-resumen { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(14, 165, 233, .16); color: #e0f2fe; font-size: 13.5px; }
.m3-nota { color: #fcd34d; font-size: 12px; line-height: 1.4; } .m3-coche-act { font-size: 14px !important; }
.m3-recogida { display: flex; flex-wrap: wrap; gap: 5px; } .m3-recogida span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .1); color: #cbd5e1; border: 1px solid rgba(255, 255, 255, .18); }
.m3-recogida span.hecho { background: #16a34a; color: #fff; border-color: #16a34a; } .m3-recogida span.actual { background: #f59e0b; color: var(--o-warn,#1f1300); border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .3); }
.m3-hecho { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(34, 197, 94, .18); color: #bbf7d0; font-weight: 700; font-size: 14px; }

.m3-guia { position: absolute; left: 12px; top: 112px; z-index: 8; width: min(400px, calc(100% - 380px)); display: grid; gap: 8px; padding: 10px 12px; border-radius: 16px;
  background: rgba(15, 23, 42, .92); color: #fff; border: 1px solid rgba(125, 211, 252, .35); box-shadow: 0 16px 36px rgba(0, 0, 0, .45); backdrop-filter: blur(8px); }
.m3-guia.desvio { border-color: #f87171; } .m3-guia.llegado { border-color: var(--o-ok-b,#4ade80); }
.m3-guia-fila { display: flex; align-items: center; gap: 12px; }
.m3-guia-giro { flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: #0ea5e9; color: #fff; }
.m3-guia.desvio .m3-guia-giro { background: #dc2626; } .m3-guia.llegado .m3-guia-giro { background: #16a34a; }
.m3-guia-giro .ico { stroke-width: 2.4; }
.m3-guia-txt { display: grid; min-width: 0; flex: 1; } .m3-guia-txt b { font-size: 17px; line-height: 1.25; } .m3-guia-txt small { color: var(--o-faint,#94a3b8); font-size: 12.5px; }
.m3-guia-brujula { display: none; flex: none; width: 44px; height: 44px; border-radius: 50%; place-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2); }
.m3-guia-brujula.on { display: grid; } .m3-guia-brujula svg { fill: #fbbf24; transform: rotate(var(--rot, 0deg)); transition: transform .25s linear; }
.m3-guia-btns { display: flex; gap: 6px; } .m3-guia-btns button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .07); color: #e2e8f0; border-radius: 10px; padding: 6px 8px; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.m3-guia-btns button:hover, .m3-guia-btns button.on { background: rgba(56, 189, 248, .22); border-color: rgba(125, 211, 252, .6); }
.m3-modos .m3-btn-asistente { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff; border-color: rgba(255, 255, 255, .3); }
@media (max-width: 760px) {
  .m3-tarea { top: auto; bottom: 84px; left: 8px; right: 8px; width: auto; max-height: calc(100% - 150px); }   /* más alta y un poco más arriba: cabe sin barra de desplazamiento */
  .m3-guia { top: 108px; left: 8px; width: calc(100% - 16px); } .m3-guia-txt b { font-size: 15.5px; }
  .m3-menu-tareas { top: 108px; left: 8px; right: 8px; width: auto; }
}

/* ── daños y trabajos: resumen, capa y trabajos en la ficha ── */
.m3-resumen-avisos { display: flex; flex-wrap: wrap; gap: 4px 10px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); color: #f1f5f9; border-radius: 10px; padding: 6px 9px; cursor: pointer; font-size: 12.5px; font-weight: 700; text-align: left; }
.m3-resumen-avisos:hover { background: rgba(255, 255, 255, .12); } .m3-resumen-avisos .dano { color: #fdba74; } .m3-resumen-avisos .trab { color: #93c5fd; }
.m3-check-capa { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 7px !important; font-weight: 600; }
.m3-trabajo { display: grid; gap: 3px; border: 1px solid rgba(255, 255, 255, .14); border-left: 4px solid #3b82f6; background: rgba(255, 255, 255, .06); border-radius: 10px; padding: 7px 10px; }
.m3-trabajo.est-encurso { border-left-color: #22c55e; } .m3-trabajo.est-incidencia, .m3-trabajo.est-bloqueado { border-left-color: #e11d48; } .m3-trabajo.est-esperandozona { border-left-color: #eab308; }
.m3-trabajo-cab { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; } .m3-trabajo-cab b { font-size: 13.5px; }
.m3-trabajo-est { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #93c5fd; white-space: nowrap; }
.m3-trabajo.est-encurso .m3-trabajo-est { color: #86efac; } .m3-trabajo.est-incidencia .m3-trabajo-est, .m3-trabajo.est-bloqueado .m3-trabajo-est { color: #fda4af; }
.m3-trabajo small { color: #aab6c8; font-size: 12px; } .m3-trabajo .m3-trabajo-aviso { color: #fcd34d; }
.m3-trabajo-btns { display: flex; gap: 6px; margin-top: 3px; } .m3-trabajo-btns button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: #e2e8f0; border-radius: 8px; padding: 5px 10px; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.m3-trabajo-btns button.ok { background: #2563eb; border-color: #2563eb; color: #fff; } .m3-trabajo-btns button:disabled { opacity: .6; cursor: default; }
.m3-servicios-sueltos { display: block; color: #93c5fd; font-size: 12.5px; font-weight: 700; text-decoration: none; padding: 4px 0; } .m3-servicios-sueltos:hover { text-decoration: underline; }

/* ── vista real: cámara del móvil de fondo y la capa 3D encima ── */
.m3-ar-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; background: #000; }
.m3-escena canvas { position: relative; z-index: 1; }
.m3-escena.m3-ar-sin-camara { background: radial-gradient(ellipse at 50% 40%, #334155, #0f172a); }
.m3-page.ar .m3-escena canvas { filter: none; cursor: pointer; } .m3-page.ar .m3-escena::after { display: none; }
.m3-page.ar .m3-stats { display: none; }
.m3-page.ar .m3-paneles > :not(.m3-herramientas) { display: none !important; }   /* (las herramientas siguen en realidad aumentada) */
.m3-page.ar { background: #000; }
.m3-ar-barra { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 9; width: min(560px, calc(100% - 16px)); display: grid; gap: 6px; padding: 9px 10px; border-radius: 16px;
  background: rgba(15, 23, 42, .82); color: #f1f5f9; border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(8px); box-shadow: 0 10px 28px rgba(0, 0, 0, .45); }
.m3-ar-estado { display: flex; flex-wrap: wrap; gap: 6px; } .m3-ar-estado span { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.m3-ar-estado .ok { background: rgba(34, 197, 94, .2); color: #86efac; } .m3-ar-estado .no { background: rgba(234, 179, 8, .18); color: #fde047; }
.m3-ar-btns { display: flex; gap: 6px; } .m3-ar-btns button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: #fff; border-radius: 10px; padding: 8px 6px; font-weight: 700; font-size: 13px; cursor: pointer; }
.m3-ar-btns button.salir { background: #dc2626; border-color: #dc2626; } .m3-ar-barra small { color: var(--o-faint,#94a3b8); font-size: 11.5px; }
.m3-page.ar .m3-tarea { bottom: 150px; top: auto; }
@media (max-width: 760px) { .m3-page.ar .m3-tarea { bottom: 150px; max-height: 38%; } .m3-page.ar .m3-ficha { bottom: 150px; max-height: 45%; } }

.m3-ar-gps { border: 1px solid rgba(125, 211, 252, .6); background: rgba(14, 165, 233, .2); color: #e0f2fe; border-radius: 999px; padding: 2px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.m3-page.ar .m3-cruz { right: auto; left: 16px; bottom: 140px; }

@media (max-width: 760px) {
  .m3-page .m3-ficha { bottom: 96px; max-height: calc(100% - 156px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .m3-page.ar .m3-ficha { max-height: calc(100% - 270px); }
  .m3-ficha .m3-x { position: sticky; top: 0; justify-self: end; margin-bottom: -38px; z-index: 2; background: rgba(26, 32, 44, .9); border-radius: 8px; width: 32px; height: 32px; }
}

/* minimapa (abajo a la derecha; en el móvil, más pequeño y oculto con una ficha o tarea abierta) */
.m3-escena canvas.m3-minimapa { position: absolute; right: 12px; bottom: 58px; z-index: 5; width: 170px; height: 170px; border-radius: 14px; background: rgba(15, 23, 42, .72); border: 1px solid rgba(255, 255, 255, .2); box-shadow: 0 8px 22px rgba(0, 0, 0, .35); cursor: crosshair; touch-action: none; filter: none; }
.m3-page:has(.m3-ficha) canvas.m3-minimapa, .m3-page:has(.m3-tarea) canvas.m3-minimapa { display: none; }
@media (max-width: 760px) { .m3-escena canvas.m3-minimapa { width: 112px; height: 112px; right: 8px; bottom: auto; top: 160px; } .m3-page.ar .m3-escena canvas.m3-minimapa { top: 120px; } }

/* paneles por encima de las flechas de andar; el minimapa sube cuando están las flechas */
.m3-capas, .m3-resumen { z-index: 7; }
.m3-page:has(.m3-cruz) .m3-escena canvas.m3-minimapa { bottom: 222px; }
@media (max-width: 760px) {
  .m3-paneles { z-index: 7; }
  .m3-page:has(.m3-cruz) .m3-escena canvas.m3-minimapa { bottom: auto; }
  /* con un panel abierto (capas o resumen) las flechas se quitan para poder tocar las opciones; se ocultan los paneles con «Ocultar» */
  .m3-page:has(.m3-paneles[data-p="0"]) .m3-cruz, .m3-page:has(.m3-paneles[data-p="1"]) .m3-cruz { display: none; }
}

/* ficha: lo sacado de las fotos de entrada */
.m3-fotos3d { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; align-items: center; } .m3-fotos3d span { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.m3-fotos3d small { color: var(--o-faint,#94a3b8); font-weight: 500; } .m3-muestra { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .5); display: inline-block; }
.m3-fotos3d-btns { display: flex; gap: 6px; flex-wrap: wrap; } .m3-fotos3d-btns button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: #e2e8f0; border-radius: 8px; padding: 5px 10px; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.m3-fotos3d-btns button.on { background: rgba(56, 189, 248, .22); border-color: rgba(125, 211, 252, .6); } .m3-fotos3d-btns button:disabled { opacity: .6; }

/* mando para andar (joystick): arriba anda, a los lados gira, al fondo corre */
.m3-mando { display: block; width: 136px; height: 136px; border-radius: 50%; background: radial-gradient(circle, rgba(15, 23, 42, .28) 0%, rgba(15, 23, 42, .5) 100%); border: 2px solid rgba(255, 255, 255, .55); box-shadow: 0 6px 22px rgba(0, 0, 0, .35); backdrop-filter: blur(3px); cursor: grab; }
.m3-mando i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #dbe4ee 70%); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); transition: transform .12s ease-out; pointer-events: none; }
.m3-mando.activo i { transition: none; }
.m3-mando.corre { border-color: var(--o-warn-b,#fbbf24); box-shadow: 0 0 0 4px rgba(251, 191, 36, .35), 0 6px 22px rgba(0, 0, 0, .35); }
.m3-mando span { position: absolute; color: rgba(255, 255, 255, .85); font-size: 12px; pointer-events: none; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.m3-mando .n { top: 6px; left: 50%; transform: translateX(-50%); } .m3-mando .s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.m3-mando .o { left: 8px; top: 50%; transform: translateY(-50%); } .m3-mando .e { right: 8px; top: 50%; transform: translateY(-50%); }

/* herramientas de la vista: brújula, pantalla completa, foto, 2D/3D */
.m3-herramientas { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 8; display: flex; flex-direction: column; gap: 6px; }
.m3-herramientas button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .5); background: rgba(15, 23, 42, .72); color: #f1f5f9; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); backdrop-filter: blur(4px); font-size: 13px; }
.m3-herramientas button:hover { background: rgba(30, 41, 59, .9); }
.m3-brujula { position: relative; }
.m3-brujula i { font-style: normal; font-weight: 800; font-size: 12px; width: 28px; height: 28px; display: grid; place-items: start center; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7);
  background: linear-gradient(180deg, #ef4444 0 50%, #e2e8f0 50% 100%); background-size: 6px 22px; background-repeat: no-repeat; background-position: center; color: #fff; line-height: 1; padding-top: 0; text-shadow: 0 1px 2px #000; transition: transform .08s linear; }

/* pantalla completa: la campa ocupa toda la ventana (también donde el navegador no deja la pantalla completa de verdad) */
.m3-page.inmersivo { position: fixed; inset: 0; height: 100dvh; margin: 0; border-radius: 0; z-index: 1200; }
.m3-page.inmersivo .m3-ayuda, .m3-page.inmersivo .m3-stats { display: none; }

@media (max-width: 760px) {
  .m3-herramientas { top: auto; bottom: 120px; transform: none; left: 8px; }
  .m3-herramientas button { width: 38px; height: 38px; }
  .m3-mando { width: 128px; height: 128px; }
  /* a pie en el móvil: el mando abajo a la derecha, la ayuda fuera y la barra de modos más compacta */
  .m3-page.a-pie .m3-ayuda { display: none; }
  .m3-page.a-pie .m3-cruz { bottom: 28px; right: 18px; }
  .m3-page.a-pie .m3-herramientas { bottom: 28px; }
}
.m3-herramientas button.on { background: rgba(37, 99, 235, .85); border-color: rgba(191, 219, 254, .8); }

/* flecha al destino cuando queda fuera de la pantalla */
.m3-flecha-destino { position: absolute; z-index: 7; transform: translate(-50%, -50%); display: none; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; pointer-events: auto; }
.m3-flecha-destino i { font-style: normal; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: #fff; background: #f59e0b; box-shadow: 0 4px 16px rgba(0, 0, 0, .4); border: 2px solid var(--o-border,#fff); }
.m3-flecha-destino span { font-size: 12px; font-weight: 800; color: #fff; background: rgba(15, 23, 42, .8); border-radius: 8px; padding: 1px 6px; }

/* vistas guardadas y medir */
.m3-vistas { position: absolute; left: 62px; top: 50%; transform: translateY(-50%); z-index: 9; width: min(300px, 80vw); background: rgba(15, 23, 42, .94); color: #e2e8f0; border-radius: 14px; padding: 12px; display: grid; gap: 8px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.m3-vistas small { color: var(--o-faint,#94a3b8); }
.m3-vista { display: flex; gap: 6px; } .m3-vista .ir { flex: 1; text-align: left; display: flex; flex-direction: column; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); color: #f1f5f9; border-radius: 10px; padding: 7px 10px; font-weight: 700; cursor: pointer; }
.m3-vista .ir small { font-weight: 500; } .m3-vista .x { width: 32px; border: 0; border-radius: 10px; background: rgba(239, 68, 68, .25); color: #fecaca; cursor: pointer; font-size: 16px; }
.m3-vista-nueva { display: grid; gap: 6px; }
.m3-medir-info { position: absolute; left: 50%; top: 118px; transform: translateX(-50%); z-index: 8; background: rgba(15, 23, 42, .9); color: #fde68a; font-weight: 800; border-radius: 12px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; }
.m3-medir-info button { border: 1px solid rgba(255, 255, 255, .3); background: transparent; color: #e2e8f0; border-radius: 8px; padding: 3px 8px; cursor: pointer; font-weight: 600; }
@media (max-width: 760px) { .m3-vistas { left: 54px; top: auto; bottom: 120px; transform: none; } .m3-medir-info { top: 150px; font-size: 13px; } }


/* campa grande: aviso mientras llega el resto (lo de alrededor ya se ve) */
.m3-cargando-resto { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 6; background: rgba(15, 23, 42, .82); color: #e2e8f0; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 6px 14px; pointer-events: none; animation: m3-latido 1.4s ease-in-out infinite; }
@keyframes m3-latido { 50% { opacity: .55; } }

/* seleccionar varios, línea de tiempo y filtro */
.m3-caja-sel { position: absolute; z-index: 8; border: 2px dashed #f59e0b; background: rgba(245, 158, 11, .14); border-radius: 4px; pointer-events: none; display: none; }
.m3-seleccion { position: absolute; right: 64px; bottom: 18px; z-index: 9; width: min(320px, 82vw); background: rgba(15, 23, 42, .94); color: #e2e8f0; border-radius: 14px; padding: 10px 12px; display: grid; gap: 8px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.m3-seleccion .cab { display: flex; justify-content: space-between; align-items: center; }
.m3-seleccion .x { border: 0; background: transparent; color: #cbd5e1; font-size: 20px; cursor: pointer; }
.m3-seleccion .lista { display: flex; flex-wrap: wrap; gap: 4px; max-height: 110px; overflow: auto; }
.m3-seleccion .lista span { font: 600 12px/1.6 ui-monospace, monospace; background: rgba(245, 158, 11, .18); color: #fde68a; border-radius: 6px; padding: 0 6px; }
.m3-seleccion .acc { display: flex; gap: 6px; } .m3-seleccion .acc button { flex: 1; }
.m3-linea-tiempo { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 8; width: min(560px, 86vw); background: rgba(15, 23, 42, .92); color: #e2e8f0; border-radius: 14px; padding: 8px 14px 6px; display: grid; gap: 2px; box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.m3-linea-tiempo span { font-weight: 700; font-size: 13px; }
.m3-linea-tiempo input { width: 100%; accent-color: #f59e0b; }
.m3-linea-tiempo .marcas { display: flex; justify-content: space-between; color: var(--o-faint,#94a3b8); }
.m3-filtro-cuenta { display: block; color: #f59e0b; font-weight: 700; margin-top: 2px; }
@media (max-width: 760px) { .m3-seleccion { right: 54px; bottom: 120px; } .m3-linea-tiempo { bottom: 120px; } }

/* panel «Vista y capas»: cabecera para minimizarlo y, en escritorio, a la derecha de la columna de herramientas (antes se montaban) */
.m3-capas-cab { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; color: inherit; padding: 0 2px; cursor: pointer; font: inherit; text-align: left; }
.m3-capas-cab b { flex: 1; font-size: 12.5px; letter-spacing: .02em; } .m3-capas-cab span { font-size: 13px; opacity: .8; }
.m3-capas.min { grid-template-columns: 1fr; width: auto; padding: 7px 12px; }
.m3-capas.min > :not(.m3-capas-cab) { display: none !important; }
@media (min-width: 761px) { .m3-capas { left: 64px; } }
@media (max-width: 760px) {
  /* móvil: las herramientas en una fila justo encima del panel de abajo (van dentro de .m3-paneles), deslizable si no caben */
  .m3-paneles > .m3-herramientas { flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 2px 0; transform: none !important; }
  .m3-paneles > .m3-herramientas::-webkit-scrollbar { display: none; }
  .m3-paneles > .m3-herramientas button { flex: 0 0 auto; }
  .m3-paneles[data-p="2"] > .m3-herramientas { display: flex; }   /* (con el panel oculto, las herramientas siguen) */
  .m3-page.a-pie .m3-paneles > .m3-herramientas { margin-right: 140px; }   /* sin tapar el mando de andar */
}

/* ── modo operario: vista sencilla para la calle (botones grandes, sin paneles de oficina) ── */
.m3-volver { flex: 0 0 auto; width: 46px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .5); background: rgba(15, 23, 42, .82); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.m3-btn-vista { opacity: .85; }
.m3-page.operario .m3-capas, .m3-page.operario .m3-resumen, .m3-page.operario .m3-stats, .m3-page.operario .m3-ayuda { display: none !important; }
.m3-page.operario .m3-buscar input { height: 50px; font-size: 17px; font-weight: 600; }
.m3-page.operario .m3-resultados button { padding: 12px 14px; font-size: 15px; }
.m3-page.operario .m3-modos button { min-height: 46px; padding: 0 16px; font-size: 15px; font-weight: 700; }
.m3-page.operario .m3-btn-asistente { background: #2563eb; color: #fff; border-color: #2563eb; }
.m3-page.operario .m3-herramientas button { width: 46px; height: 46px; }
.m3-page.operario .m3-acciones button { min-height: 48px; font-size: 15px; }
.m3-page.operario .m3-ficha .btn-primary, .m3-page.operario .m3-tarea .btn-primary, .m3-page.operario .m3-tarea .btn-secondary { min-height: 50px; font-size: 16px; }

.m3-page.operario .m3-modos .m3-btn-vista { min-height: 34px; padding: 0 12px; font-size: 12.5px; font-weight: 600; opacity: .75; }   /* (cambiar de vista: discreto, no es para el día a día) */
.m3-enlace-uso { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: #93c5fd; text-decoration: none; justify-self: end; }
.m3-enlace-uso:hover { text-decoration: underline; }

/* botón × de los paneles flotantes (línea de tiempo, vistas guardadas) */
.m3-cerrar { position: absolute; top: 4px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .12); color: #e2e8f0; font-size: 18px; line-height: 1; cursor: pointer; }
.m3-cerrar:hover { background: rgba(255, 255, 255, .22); }
.m3-linea-tiempo { padding-right: 44px; }
@media (max-width: 760px) {
  /* en el móvil se apilan con los paneles de abajo (sin desplazamientos de escritorio) y siguen visibles aunque el panel esté oculto */
  .m3-paneles > .m3-linea-tiempo, .m3-paneles > .m3-vistas, .m3-paneles > .m3-seleccion { transform: none !important; position: relative !important; inset: auto !important; width: auto !important; }
  .m3-paneles[data-p="2"] > .m3-linea-tiempo, .m3-paneles[data-p="2"] > .m3-vistas, .m3-paneles[data-p="2"] > .m3-seleccion { display: grid; }
  /* mientras hay uno abierto, el resumen y las capas se apartan (si no, la pila llegaba hasta arriba) */
  .m3-paneles:has(> .m3-linea-tiempo, > .m3-vistas, > .m3-seleccion) > .m3-resumen,
  .m3-paneles:has(> .m3-linea-tiempo, > .m3-vistas, > .m3-seleccion) > .m3-capas { display: none !important; }
  /* a pie: el mando ocupa la esquina derecha; las herramientas, en columna a la izquierda (antes una fila que se perdía tras el mando) */
  .m3-page.a-pie .m3-paneles > .m3-herramientas { position: absolute !important; left: 0; bottom: 0; flex-direction: column; overflow: visible; margin-right: 0; width: auto !important; }
  .m3-page.a-pie .m3-paneles:has(> .m3-linea-tiempo, > .m3-vistas, > .m3-seleccion) > .m3-herramientas { position: static !important; flex-direction: row; overflow-x: auto; margin-right: 140px; }
  .m3-page.a-pie .m3-paneles > .m3-linea-tiempo, .m3-page.a-pie .m3-paneles > .m3-vistas, .m3-page.a-pie .m3-paneles > .m3-seleccion { margin-right: 140px; }
  /* la línea de tiempo nunca más ancha que la pantalla: el texto parte en líneas, la barra y las marcas se ajustan */
  .m3-paneles > .m3-linea-tiempo { box-sizing: border-box; min-width: 0; max-width: 100% !important; padding: 8px 40px 6px 12px; }
  .m3-paneles > .m3-linea-tiempo > * { min-width: 0; }
  .m3-paneles > .m3-linea-tiempo span { font-size: 12.5px; overflow-wrap: anywhere; }
  .m3-paneles > .m3-linea-tiempo .marcas small { font-size: 10.5px; white-space: nowrap; }
  .m3-paneles[data-p] > .m3-linea-tiempo { display: grid !important; }   /* se ve aunque el panel de abajo esté oculto */
}


/* tarea terminada: el siguiente trabajo de Mi jornada */
.m3-siguiente { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: rgba(56, 189, 248, .14); border: 1px solid rgba(125, 211, 252, .45); }
.m3-siguiente small { color: #7dd3fc; font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; } .m3-siguiente b { font-size: 15px; } .m3-siguiente span { color: #cbd5e1; font-size: 13px; }

/* corrección del GPS (panel y aviso de referencia cercana) */
.m3-gps, .m3-gps-ref { position: absolute; left: 50%; top: 110px; transform: translateX(-50%); z-index: 9; width: min(360px, calc(100% - 24px)); box-sizing: border-box; display: grid; gap: 8px; padding: 14px 16px; border-radius: 14px; background: rgba(15, 23, 42, .94); color: #e2e8f0; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.m3-gps small { color: var(--o-faint,#94a3b8); } .m3-gps label { display: grid; gap: 4px; font-size: 13px; }
.m3-gps-donde { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.m3-gps-donde button { padding: 9px 4px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .06); color: #e2e8f0; font-weight: 700; }
.m3-gps-donde button.on { background: #2563eb; border-color: #2563eb; }
.m3-gps-ref-sel { display: flex; gap: 6px; } .m3-gps-ref-sel select { flex: 1; }
.m3-gps-toma { display: grid; gap: 4px; text-align: center; } .m3-gps-toma b { font-size: 18px; }
.m3-gps-ref { grid-template-columns: 1fr auto auto; align-items: center; padding-right: 40px; }
.m3-herramientas button.aviso { box-shadow: 0 0 0 2px #f59e0b; }
