/* Flotta — estilos de las pantallas nuevas (configuración, entrega/devolución,
   histórico). Aparte del index.html, que ya es bastante grande.

   Móvil primero: la tablet del almacén y los móviles de los encargados son la única
   forma de usar esto. Objetivos táctiles de 44 px y letra de 16 px en los campos
   (con menos, iOS hace zoom solo al enfocar y descoloca la pantalla). */

#fp-capa {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { #fp-capa { align-items: center; } }

.fp-caja {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh;
  border-radius: 16px 16px 0 0; display: flex; flex-direction: column;
  box-shadow: 0 -6px 30px rgba(0,0,0,.35);
}
@media (min-width: 700px) { .fp-caja { border-radius: 16px; } }

.fp-cabecera {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  border-bottom: 1px solid #eceff1; position: sticky; top: 0; background: #fff;
  border-radius: 16px 16px 0 0;
}
.fp-cabecera h3 { flex: 1; font-size: 17px; color: #1b5e20; margin: 0; }
.fp-x {
  border: 0; background: #eceff1; color: #37474f; width: 34px; height: 34px;
  border-radius: 50%; font-size: 15px; cursor: pointer;
}
.fp-cuerpo { padding: 16px 18px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.fp-cuerpo label {
  display: block; font-size: 12px; font-weight: 600; color: #455a64; margin: 14px 0 5px;
}
.fp-cuerpo input[type=text], .fp-cuerpo input[type=number], .fp-cuerpo input[type=password],
.fp-cuerpo input[type=date], .fp-cuerpo select, .fp-cuerpo textarea {
  width: 100%; padding: 12px; border: 1px solid #cfd8dc; border-radius: 8px;
  font-size: 16px; font-family: inherit; background: #fff;
}
.fp-sub { color: #78909c; font-size: 13px; margin: 0 0 4px; }
.fp-seccion { margin-top: 18px; padding-top: 14px; border-top: 1px solid #eceff1; }
.fp-check { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600;
            color: #37474f; margin: 10px 0; cursor: pointer; }
.fp-check input { width: 20px; height: 20px; }

.fp-principal {
  width: 100%; margin-top: 20px; padding: 15px; border: 0; border-radius: 10px;
  background: #1b5e20; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.fp-principal[disabled] { opacity: .55; }

.fp-aviso { margin-top: 14px; padding: 11px 13px; border-radius: 8px; font-size: 13px; }
.fp-aviso.mal { background: #ffebee; color: #b71c1c; }
.fp-aviso.aviso { background: #fff8e1; color: #e65100; }
.fp-caja-aviso {
  margin-top: 14px; padding: 12px; border-radius: 8px;
  background: #fff8e1; color: #e65100; font-size: 13px; line-height: 1.45;
}

/* --- la firma --- */
.fp-firma-marco { border: 2px dashed #b0bec5; border-radius: 10px; overflow: hidden; }
canvas.fp-firma {
  display: block; width: 100%; height: 150px; background: #fafafa;
  touch-action: none;   /* si no, arrastrar el dedo hace scroll y no dibuja nada */
  cursor: crosshair;
}
.fp-firma-pie {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 11px; background: #eceff1; font-size: 11px; color: #78909c;
}
.fp-borrar-firma { border: 0; background: none; color: #1b5e20; font-size: 12px;
                   font-weight: 600; cursor: pointer; padding: 4px 8px; }

/* --- foto --- */
.fp-foto-boton {
  display: inline-block; padding: 11px 16px; border-radius: 8px; background: #eceff1;
  color: #37474f; font-size: 14px; font-weight: 600; cursor: pointer; margin: 0;
}
.fp-foto-vista img { max-width: 100%; max-height: 180px; border-radius: 8px; margin-top: 10px; }

/* --- listas de configuración --- */
.fp-pestanas { display: flex; gap: 6px; margin-bottom: 14px; }
.fp-pest {
  flex: 1; padding: 11px 6px; border: 0; border-radius: 8px; background: #eceff1;
  color: #546e7a; font-size: 13px; font-weight: 600; cursor: pointer;
}
.fp-pest.activo { background: #1b5e20; color: #fff; }

.fp-lista { display: flex; flex-direction: column; gap: 8px; }
.fp-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  background: #f7f9fa; border-radius: 9px;
}
.fp-item.fp-baja { opacity: .55; }
.fp-item-txt { flex: 1; min-width: 0; }
.fp-item-txt b { display: block; font-size: 14px; color: #263238; }
.fp-item-txt small { display: block; font-size: 11px; color: #78909c; margin-top: 2px; }
.fp-punto { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.fp-mini {
  border: 0; background: #cfd8dc; color: #263238; padding: 8px 11px; border-radius: 7px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.fp-mini.fp-rojo { background: #ffcdd2; color: #b71c1c; }
.fp-nuevo { display: flex; gap: 7px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.fp-nuevo input[type=text], .fp-nuevo input:not([type]), .fp-nuevo select { flex: 1; min-width: 140px; }
.fp-nuevo input[type=color] { width: 46px; height: 44px; padding: 2px; border: 1px solid #cfd8dc;
                              border-radius: 8px; }
.fp-nuevo .fp-principal { width: auto; margin: 0; padding: 12px 18px; }

/* --- histórico --- */
.fp-filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.fp-filtros > div { flex: 1; min-width: 120px; }
.fp-filtros label { margin-top: 0; }
.fp-chips { display: flex; gap: 7px; margin: 14px 0; flex-wrap: wrap; }
.fp-chip {
  border: 0; background: #eceff1; color: #546e7a; padding: 8px 13px; border-radius: 16px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.fp-chip.activo { background: #1b5e20; color: #fff; }
.fp-vacio { color: #90a4ae; font-size: 13px; text-align: center; padding: 26px 0; }

.fh-fila { padding: 12px 14px; background: #f7f9fa; border-radius: 9px;
           border-left: 4px solid #cfd8dc; }
.fh-fila.abierto { border-left-color: #e65100; background: #fff8f2; }
.fh-alto { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.fh-alto b { font-family: 'Courier New', monospace; font-size: 15px; color: #1b5e20; }
.fh-alto span { font-size: 13px; color: #37474f; font-weight: 600; }
.fh-linea { font-size: 12px; color: #607d8b; line-height: 1.7; }
.fh-fuera { color: #e65100; font-weight: 600; }
.fh-inc { margin-top: 6px; font-size: 12px; color: #b71c1c; }
.fh-inc a { color: #b71c1c; }
.fh-cruzado { margin-top: 4px; font-size: 11px; color: #6a1b9a; }

/* --- botones de acción en cada furgoneta --- */
.fv-acciones { display: flex; gap: 8px; margin-top: 12px; }
.fv-accion {
  flex: 1; padding: 12px; border: 0; border-radius: 9px; font-size: 14px;
  font-weight: 600; cursor: pointer; color: #fff;
}
.fv-entregar { background: #1b5e20; }
.fv-devolver { background: #e65100; }
.fv-accion[disabled] { background: #cfd8dc; color: #90a4ae; }

/* Entregar/Devolver va FUERA de la ficha plegable, visible en cada tarjeta sin tocar
   nada: es la acción principal de la app y estaba escondida. */
.fv-arriba { padding: 10px 14px 12px; background: #fff; }

.fv-secundarias { margin-top: 8px; }

/* Una furgoneta de baja: su propia foto en gris con una banda. Antes se enseñaba una
   foto de un COCHE DE POLICÍA siniestrado, heredada de ZETTA. */
.fv-foto { position: relative; margin-bottom: 10px; }
.fv-foto img { width: 100%; max-height: 150px; object-fit: cover; border-radius: 8px; display: block; }
.fv-foto.de-baja img { filter: grayscale(1) contrast(.9); opacity: .75; }
.fv-banda {
  position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%);
  text-align: center; background: rgba(198,40,40,.88); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: 2px; padding: 5px 0;
}
.fv-menor {
  flex: 1; padding: 10px 6px; border: 0; border-radius: 8px; background: #eceff1;
  color: #455a64; font-size: 12px; font-weight: 600; cursor: pointer;
}

/* Qué caduca y cuándo, dentro de la ficha. La FECHA siempre se ve: antes solo salía
   cuando ya avisaba, y mirando una furgoneta tranquila no había forma de saber cuándo
   le tocaba la ITV. */
.fv-caducidades {
  margin-top: 10px; display: flex; flex-direction: column; gap: 4px;
  background: #f7f9fa; border-radius: 8px; padding: 8px 10px;
}
.fv-cad { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.fv-cad span { color: #78909c; font-weight: 600; }
.fv-cad b { color: #37474f; font-weight: 600; text-align: right; }
.fv-cad.aviso b { color: #e65100; }
.fv-cad.vencido b { color: #b71c1c; }

/* La pantalla del botón grande: elegir furgoneta para recoger o entregar. */
#fm-buscar { margin: 4px 0 12px; }

/* Filtro por departamento dentro de esa pantalla: con 35 furgonetas y tres cuadrillas,
   quien está en el almacén casi siempre quiere ver solo las suyas. */
.fp-chips-dpto { margin: 2px 0 10px; gap: 6px; }
.fp-chip-dpto {
  border: 1px solid #cfd8dc; background: #fff; color: #546e7a;
  padding: 7px 13px; border-radius: 16px; font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.fp-chip-dpto.activo { background: #1b5e20; border-color: #1b5e20; color: #fff; }
.fm-veh {
  display: block; width: 100%; text-align: left; border: 0; cursor: pointer;
  padding: 13px 15px; background: #f7f9fa; border-radius: 9px;
  border-left: 4px solid var(--primary, #1b5e20);
}
.fm-veh b {
  display: block; font-family: 'Courier New', monospace; font-size: 15px; color: #1b5e20;
}
.fm-veh small { display: block; font-size: 11px; color: #78909c; margin-top: 3px; }

/* El consumo, en grande: es un número que se mira de un vistazo. */
.fp-dato-grande {
  text-align: center; padding: 16px; background: #f7f9fa; border-radius: 10px;
  margin: 12px 0;
}
.fp-dato-grande b { display: block; font-size: 30px; color: #1b5e20; line-height: 1.1; }
.fp-dato-grande small { display: block; font-size: 11px; color: #78909c; margin-top: 6px; }

/* Cuando hay un departamento filtrado se dice CUÁL y se puede quitar. Un filtro puesto
   que no se ve es la forma más rápida de que alguien crea que le faltan furgonetas. */
.filtro-activo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  padding: 9px 14px; border-radius: 9px; background: #e8f5e9; color: #1b5e20;
  font-size: 13px; border-left: 4px solid #1b5e20;
}
.filtro-activo b { font-weight: 700; }
.filtro-activo button {
  margin-left: auto; border: 0; background: #1b5e20; color: #fff;
  padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer;
}

/* Lo que solo puede hacer un encargado se esconde en la tablet del almacén.
   Es comodidad, no seguridad: el servidor responde 403 igualmente. */
body.rol-almacen .solo-encargado { display: none !important; }
