/* =========================================================
   PIONET GIS · Ruta de campo móvil
   Referencia aprobada: mapa limpio + destino + bottom sheet.
   Solo se activa con body.is-mobile-field-route.
   ========================================================= */

body.is-mobile-field-route {
  overflow: hidden !important;
  background: #061a2e;
}

body.is-mobile-field-route .topbar,
body.is-mobile-field-route .workspace-toolbar,
body.is-mobile-field-route .layers-sidebar,
body.is-mobile-field-route .map-search-control,
body.is-mobile-field-route .coordinate-search-control,
body.is-mobile-field-route .workspace-layer-focus-chip,
body.is-mobile-field-route .element-info-panel,
body.is-mobile-field-route .element-radial-menu,
body.is-mobile-field-route #mapLaserRouteBanner,
body.is-mobile-field-route #mapLaserRouteLegend,
.mobile-field-hidden {
  display: none !important;
}

body.is-mobile-field-route .workspace-screen {
  height: 100dvh !important;
  min-height: 100dvh !important;
  overflow: hidden !important;
}

body.is-mobile-field-route .workspace-body {
  display: block !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  grid-template-columns: 1fr !important;
}

body.is-mobile-field-route .map-stage {
  position: relative;
  display: block !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  overflow: hidden !important;
}

body.is-mobile-field-route .map-stage > .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

body.is-mobile-field-route .leaflet-control-zoom {
  display: none !important;
}

body.is-mobile-field-route .leaflet-control-attribution {
  opacity: .55;
  transform: scale(.78);
  transform-origin: right bottom;
}

.mobile-field-route {
  position: absolute;
  z-index: 1500;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: #fff;
  font-family: inherit;
}

.mobile-field-route button {
  font: inherit;
}

.mobile-field-route button,
.mobile-field-route .mobile-field-sheet,
.mobile-field-route .mobile-field-appbar,
.mobile-field-route .mobile-field-assignment,
.mobile-field-route .mobile-field-floating-tools {
  pointer-events: auto;
}

/* Barra superior equivalente a la maqueta aprobada. */
.mobile-field-appbar {
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: max(8px,env(safe-area-inset-top)) 12px 8px;
  border-radius: 0 0 15px 15px;
  background:
    radial-gradient(circle at 12% 30%, rgba(13,119,193,.23), transparent 32%),
    linear-gradient(180deg,rgba(5,28,49,.98),rgba(7,35,59,.98));
  box-shadow: 0 7px 24px rgba(0,0,0,.18);
}

.mobile-field-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-field-brand > .material-symbols-outlined {
  color: #ff2d55;
  font-size: 29px;
}

.mobile-field-brand div {
  display: grid;
  gap: 1px;
}

.mobile-field-brand strong {
  font-size: 16px;
  letter-spacing: .01em;
}

.mobile-field-brand small {
  color: #71b6e2;
  font-size: 8px;
  font-weight: 700;
}

.mobile-field-head-actions {
  display: flex;
  gap: 6px;
}

.mobile-field-head-actions button,
.mobile-field-floating-tools button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(123,181,221,.28);
  border-radius: 10px;
  color: #fff;
  background: rgba(7,36,60,.94);
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}

.mobile-field-head-actions button:last-child {
  color: #ff8198;
}

.mobile-field-head-actions .material-symbols-outlined,
.mobile-field-floating-tools .material-symbols-outlined {
  font-size: 20px;
}

/* Tarjeta superior del destino. */
.mobile-field-assignment {
  position: absolute;
  z-index: 7;
  top: calc(max(8px,env(safe-area-inset-top)) + 67px);
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: 39px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 69px;
  padding: 9px 10px;
  border: 1px solid rgba(92,151,192,.35);
  border-radius: 12px;
  background: linear-gradient(135deg,rgba(7,35,59,.97),rgba(5,29,49,.96));
  box-shadow: 0 12px 26px rgba(0,0,0,.2);
  backdrop-filter: blur(8px);
}

.mobile-field-assignment > .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 9px;
  color: #fff;
  background: #0c304f;
  font-size: 20px;
}

.mobile-field-assignment-main {
  min-width: 0;
}

.mobile-field-assignment-main small,
.mobile-field-assignment-main strong,
.mobile-field-assignment-main em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-field-assignment-main small {
  color: #8eb1ca;
  font-size: 6px;
  font-weight: 800;
}

.mobile-field-assignment-main strong {
  margin-top: 2px;
  color: #fff;
  font-size: 12px;
}

.mobile-field-assignment-main em {
  margin-top: 2px;
  color: #85b7d9;
  font-size: 6px;
  font-style: normal;
}

.mobile-field-assignment-status {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 66px;
}

.mobile-field-assignment-status b {
  padding: 4px 7px;
  border: 1px solid rgba(83,177,253,.38);
  border-radius: 999px;
  color: #9dd5ff;
  background: rgba(83,177,253,.08);
  font-size: 6px;
}

.mobile-field-assignment-status b.is-route {
  color: #8af0ba;
  border-color: rgba(18,183,106,.5);
  background: rgba(18,183,106,.12);
}

.mobile-field-assignment-status b.is-arrived {
  color: #fff;
  border-color: #12b76a;
  background: #0c9d5b;
}

.mobile-field-assignment-status span {
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}

.mobile-field-assignment-status small {
  color: #779ab3;
  font-size: 5px;
}

/* Botones laterales del mapa. */
.mobile-field-floating-tools {
  position: absolute;
  z-index: 7;
  top: 162px;
  right: 10px;
  display: grid;
  gap: 6px;
}

.mobile-field-floating-tools button {
  width: 40px;
  height: 40px;
}

/* Bottom sheet principal. */
.mobile-field-sheet {
  position: absolute;
  z-index: 9;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 8px;
  max-height: min(46dvh,430px);
  padding: 8px 10px max(10px,env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid #31546d;
  background:
    linear-gradient(180deg,rgba(6,29,50,.985),rgba(4,24,42,.995));
  box-shadow: 0 -16px 38px rgba(0,0,0,.28);
  -webkit-overflow-scrolling: touch;
}

.mobile-field-grabber {
  width: 44px;
  height: 4px;
  margin: 0 auto 1px;
  border-radius: 999px;
  background: #7892a6;
  opacity: .7;
}

.mobile-field-target {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mobile-field-target > .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #31546e;
  border-radius: 9px;
  color: #fff;
  background: #0c2c48;
  font-size: 20px;
}

.mobile-field-target > div:nth-child(2) {
  min-width: 0;
}

.mobile-field-target strong,
.mobile-field-target small {
  display: block;
}

.mobile-field-target > div:nth-child(2) strong {
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-field-target > div:nth-child(2) small {
  margin-top: 3px;
  overflow: hidden;
  color: #89abc4;
  font-size: 6px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-field-distance {
  display: grid;
  grid-template-columns: 17px auto;
  column-gap: 3px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #244a65;
  border-radius: 9px;
  background: #0b2944;
}

.mobile-field-distance .material-symbols-outlined {
  grid-row: 1 / 3;
  color: #ff2d55;
  font-size: 17px;
}

.mobile-field-distance strong {
  font-size: 9px;
}

.mobile-field-distance small {
  color: #789ab2;
  font-size: 5px;
}

.mobile-field-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 5px;
}

.mobile-field-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 42px;
  padding: 5px 6px;
  border: 1px solid #2c5877;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(180deg,#0f3554,#0b2944);
}

.mobile-field-actions button.is-primary {
  border-color: #12b76a;
  background: linear-gradient(180deg,#14bd70,#0b9958);
}

.mobile-field-actions button:disabled {
  opacity: .38;
}

.mobile-field-actions .material-symbols-outlined {
  font-size: 16px;
}

.mobile-field-actions b {
  overflow: hidden;
  font-size: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-field-optical {
  overflow: hidden;
  border: 1px solid #244a65;
  border-radius: 11px;
  background: rgba(7,31,53,.88);
}

.mobile-field-optical > header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 8px;
  border-bottom: 1px solid #1b3c55;
}

.mobile-field-optical > header .material-symbols-outlined {
  color: #ff2d55;
  font-size: 16px;
}

.mobile-field-optical > header strong {
  font-size: 8px;
}

.mobile-field-optical-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 1px;
  background: #1a3b53;
}

.mobile-field-optical-grid > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 54px;
  padding: 7px;
  background: #071f35;
}

.mobile-field-optical-grid span {
  color: #7297b2;
  font-size: 5px;
  font-weight: 850;
  text-transform: uppercase;
}

.mobile-field-optical-grid strong,
.mobile-field-optical-grid small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-field-optical-grid strong {
  color: #fff;
  font-size: 6px;
  white-space: nowrap;
}

.mobile-field-optical-grid small {
  color: #84a9c2;
  font-size: 5px;
  line-height: 1.3;
}

.mobile-field-optical > button {
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) 18px;
  align-items: center;
  gap: 5px;
  width: calc(100% - 12px);
  min-height: 38px;
  margin: 6px;
  padding: 5px 7px;
  border: 1px solid #2b5572;
  border-radius: 8px;
  color: #fff;
  background: #0b2944;
  text-align: left;
}

.mobile-field-optical > button .material-symbols-outlined {
  color: #9dd4fa;
  font-size: 16px;
}

.mobile-field-optical > button strong {
  font-size: 7px;
}

/* Evita que etiquetas permanentes tapen la vista de campo. */
body.is-mobile-field-route .pionet-laser-node-label {
  font-size: 6px !important;
  padding: 2px 4px !important;
  max-width: 115px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mantener espacio real visible para el mapa incluso en Safari pequeño. */
@media (max-height: 680px) {
  .mobile-field-sheet {
    max-height: 43dvh;
  }

  .mobile-field-optical-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .mobile-field-optical-grid > div:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .mobile-field-appbar {
    min-height: 58px;
  }

  .mobile-field-assignment {
    top: calc(max(8px,env(safe-area-inset-top)) + 61px);
  }

  .mobile-field-assignment-main strong {
    font-size: 10px;
  }

  .mobile-field-actions {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-field-actions button:last-child {
    grid-column: 1 / -1;
  }

  .mobile-field-optical-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-field-optical-grid > div:last-child {
    grid-column: 1 / -1;
  }
}
