/* Gestión de Transportes — estilos base
   Paleta y aspecto alineados con la presentación al cliente. */

:root {
  --azul-noche: #14213D;
  --azul: #2F6FB3;
  --azul-oscuro: #1F4E85;
  --azul-claro: #DCE8F7;
  --ambar: #F0A35E;
  --ambar-oscuro: #8A420C;
  --ambar-claro: #FBE3CF;
  --verde: #1E6B3A;
  --verde-claro: #DDEFE3;
  --rojo: #9B2222;
  --rojo-medio: #D25555;
  --rojo-claro: #F8DCDC;
  --gris-texto: #4A5568;
  --gris-suave: #5A6472;
  --gris-borde: #DCDFE4;
  --gris-campo: #C9D0D9;
  --fondo: #E9ECF1;
  --fondo-lateral: #F1F3F6;
  --superficie: #FDFDFB;
  --texto: #14213D;

  --radio: 10px;
  --sombra: 0 8px 24px rgba(20, 33, 61, 0.10);
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ancho-lateral: 230px;
  --alto-barra: 56px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* que ningún display:flex/grid anule el atributo hidden */
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--fuente);
  color: var(--texto);
  background: var(--fondo);
  line-height: 1.45;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
a { color: var(--azul-oscuro); }
code { background: var(--fondo-lateral); padding: .1em .35em; border-radius: 4px; }

/* --- Barra superior --- */
.barra-superior {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  height: var(--alto-barra); padding: 0 1.25rem;
  background: var(--azul-noche); color: #F6F5F1;
}
.marca { color: #F6F5F1; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.usuario { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.usuario small { color: #BFC9DA; }
.enlace-claro { color: #BFC9DA; }
.en-linea { display: inline; margin: 0; }
.boton-menu {
  display: none; background: none; border: 0; padding: .4rem; cursor: pointer;
  flex-direction: column; gap: 4px;
}
.boton-menu span { display: block; width: 22px; height: 2px; background: #F6F5F1; border-radius: 2px; }

/* --- Estructura --- */
.contenedor { display: flex; min-height: calc(100vh - var(--alto-barra)); }
.lateral {
  width: var(--ancho-lateral); flex: none;
  background: var(--fondo-lateral); border-right: 1px solid var(--gris-borde);
  padding: 1rem .75rem;
}
.lateral ul { list-style: none; margin: 0 0 .75rem; padding: 0; }
.lateral-seccion {
  margin: .75rem .75rem .35rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--gris-suave);
}
.lateral a, .lateral .desactivado {
  display: block; padding: .5rem .75rem; border-radius: 8px;
  color: #3A4250; text-decoration: none;
}
.lateral a:hover { background: #E4E8EE; }
.lateral a.activo { background: var(--azul-claro); color: var(--azul-oscuro); font-weight: 700; }
.lateral .desactivado { color: #9AA3AF; cursor: default; }
.lateral .desactivado em {
  font-style: normal; font-size: .68rem; margin-left: .3rem; padding: .05rem .4rem;
  border-radius: 999px; background: #E4E8EE; color: var(--gris-suave);
}
.velo { display: none; }
.contenido { flex: 1; min-width: 0; padding: 1.75rem 2rem 3rem; }

.cabecera-pagina { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1.25rem; }
.cabecera-pagina h1 { margin: 0; }
.texto-suave { color: var(--gris-suave); margin: 0; }

/* --- Tarjetas --- */
.tarjeta {
  background: var(--superficie); border: 1px solid var(--gris-borde);
  border-radius: var(--radio); padding: 1.25rem 1.4rem; box-shadow: var(--sombra);
}
.tarjeta + .tarjeta { margin-top: 1rem; }
.tarjeta-estrecha { max-width: 460px; }
.tarjeta.nota { margin-top: 1rem; border-left: 4px solid var(--azul); }
.vacio { color: var(--gris-suave); margin: .25rem 0 0; }

/* --- Panel --- */
.cifras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.cifra {
  background: #fff; border: 1px solid var(--gris-borde); border-radius: var(--radio);
  padding: 1rem 1.2rem; display: flex; flex-direction: column;
}
.cifra strong { font-size: 2.1rem; line-height: 1.1; }
.cifra span { color: var(--gris-suave); font-size: .92rem; }
.cifra-ambar { border-left: 5px solid var(--ambar); } .cifra-ambar strong { color: var(--ambar-oscuro); }
.cifra-gris { border-left: 5px solid #8E9BB3; } .cifra-gris strong { color: #3A4250; }
.cifra-roja { border-left: 5px solid var(--rojo-medio); } .cifra-roja strong { color: var(--rojo); }

.rejilla-panel { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; align-items: start; }
.rejilla-panel > .tarjeta { margin-top: 0; }
.lista-filas, .lista-avisos { list-style: none; margin: 0; padding: 0; }
.lista-filas li {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 0; border-bottom: 1px solid #E6E9EE;
}
.lista-filas li:last-child { border-bottom: 0; }
.lista-avisos li { display: flex; gap: .6rem; align-items: baseline; padding: .45rem 0; }
.aviso-marca {
  flex: none; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: .1rem .45rem; border-radius: 4px;
}
.aviso-proximo .aviso-marca { background: var(--ambar-claro); color: var(--ambar-oscuro); }
.aviso-caducado .aviso-marca { background: var(--rojo-claro); color: var(--rojo); }

/* --- Distintivos de estado --- */
.distintivo {
  display: inline-block; white-space: nowrap; font-size: .82rem; font-weight: 700;
  padding: .15rem .6rem; border-radius: 999px;
}
.estado-pendiente { background: #EEF0F3; color: #3A4250; }
.estado-asignado { background: var(--azul-claro); color: var(--azul-oscuro); }
.estado-en-ruta { background: var(--ambar-claro); color: var(--ambar-oscuro); }
.estado-entregado { background: var(--verde-claro); color: var(--verde); }
.estado-incidencia { background: var(--rojo-claro); color: var(--rojo); }
.estado-cancelado { background: #EEF0F3; color: #6B7280; text-decoration: line-through; }

/* --- Formularios --- */
.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.campo label { font-size: .9rem; color: var(--gris-suave); }
/* Todos los campos de texto (tel, email, url, search...) salvo casillas y botones */
.campo input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=file]),
.bloque-entrega input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=file]),
.campo-en-linea input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=file]),
.fila-prueba-correo input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=file]),
.campo select, .campo textarea, .bloque-entrega textarea {
  font: inherit; color: var(--texto); background: #fff;
  border: 1px solid var(--gris-campo); border-radius: 8px; padding: .55rem .75rem;
}
.campo input:focus, .campo select:focus, .campo textarea:focus,
.bloque-entrega input:focus, .bloque-entrega textarea:focus, .campo-en-linea input:focus, .fila-prueba-correo input:focus {
  outline: 2px solid var(--azul); outline-offset: 0; border-color: var(--azul);
}
.campo .casilla { display: flex; gap: .5rem; align-items: center; color: var(--texto); }
.campo .ayuda { color: var(--gris-suave); }
.campo .error { color: var(--rojo); }
.con-error input, .con-error select, .con-error textarea { border-color: var(--rojo-medio); }
.acciones { display: flex; gap: .75rem; justify-content: flex-end; margin-top: .5rem; }

/* --- Botones --- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border-radius: 8px; padding: .55rem 1.1rem; border: 1px solid transparent;
}
.boton-primario { background: var(--ambar); color: var(--azul-noche); }
.boton-primario:hover { background: #E8934A; }
.boton-contorno { background: #fff; color: var(--texto); border-color: var(--gris-campo); }
.boton-contorno-claro { background: transparent; color: #F6F5F1; border-color: #5B6B8C; padding: .3rem .8rem; }
.boton-ancho { width: 100%; }

/* --- Mensajes --- */
.mensajes { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.mensaje { padding: .7rem 1rem; border-radius: 8px; border-left: 4px solid; background: #fff; }
.mensaje-info { border-color: var(--azul); }
.mensaje-exito { border-color: var(--verde); background: #F1F8F3; }
.mensaje-aviso { border-color: var(--ambar); background: #FFF8F1; }
.mensaje-error { border-color: var(--rojo-medio); background: #FDF3F3; }

/* --- Login y errores --- */
.contenido-publico { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; }
.pagina-login { background: var(--azul-noche); }
.pagina-login .mensajes { width: 100%; max-width: 380px; }
.tarjeta-login {
  width: 100%; max-width: 380px; background: var(--superficie);
  border-radius: 14px; padding: 2rem 1.75rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.tarjeta-login h1 { font-size: 1.4rem; margin-top: .75rem; }
.login-icono { display: block; }
.subtitulo { color: var(--gris-suave); margin: 0 0 1.25rem; }
.pagina-error { text-align: center; padding: 3rem 1rem; }
.error-codigo { font-size: 3.5rem; font-weight: 800; color: var(--azul-oscuro); margin: 0; }

/* --- Listados --- */
.miga { margin: 0 0 .25rem; font-size: .88rem; color: var(--gris-suave); }
.miga a { color: var(--gris-suave); }
.barra-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: 1rem; }
.barra-filtros .casilla { display: flex; align-items: center; gap: .4rem; font-size: .92rem; color: var(--gris-suave); }
.buscador {
  flex: 1 1 280px; max-width: 460px; font: inherit; background: #fff;
  border: 1px solid var(--gris-campo); border-radius: 8px; padding: .55rem .8rem;
}
.enlace-suave { color: var(--gris-suave); font-size: .92rem; }
.tarjeta-tabla { padding: .25rem 0; overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabla th {
  text-align: left; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--gris-suave); padding: .7rem 1rem; border-bottom: 1px solid var(--gris-borde); white-space: nowrap;
}
.tabla td { padding: .7rem 1rem; border-bottom: 1px solid #EEF0F3; vertical-align: top; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: #F7F9FB; }
.tabla .num { text-align: right; white-space: nowrap; }
.tarjeta > .tabla { margin: .25rem 0 1rem; }
.tarjeta > .tabla th:first-child, .tarjeta > .tabla td:first-child { padding-left: 0; }
.tarjeta-tabla > .tabla th:first-child, .tarjeta-tabla > .tabla td:first-child { padding-left: 1.4rem; }
.tarjeta-tabla .vacio { padding: 1rem 1.4rem; }
.enlace-fila { text-decoration: none; }
.enlace-fila:hover { text-decoration: underline; }
.fila-baja td { color: #8A929E; }
.fila-caducado td:first-child { box-shadow: inset 3px 0 0 var(--rojo-medio); }
.fila-proximo td:first-child { box-shadow: inset 3px 0 0 var(--ambar); }
.tarjeta > .tabla tr.fila-caducado td:first-child,
.tarjeta > .tabla tr.fila-proximo td:first-child { padding-left: .8rem; }
.matricula { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.acciones-fila { white-space: nowrap; text-align: right; }
.acciones-fila .en-linea + .boton, .acciones-fila .boton + .en-linea { margin-left: .35rem; }
.paginacion { display: flex; justify-content: center; align-items: center; gap: 1.25rem; margin-top: 1rem; color: var(--gris-suave); }
.pie-tabla { margin-top: .6rem; text-align: right; font-size: .88rem; }

/* --- Distintivos de documentación y disponibilidad --- */
.doc-vigente { background: var(--verde-claro); color: var(--verde); }
.doc-proximo { background: var(--ambar-claro); color: var(--ambar-oscuro); }
.doc-caducado { background: var(--rojo-claro); color: var(--rojo); }
.doc-sin { background: #EEF0F3; color: var(--gris-suave); }
.disp-disponible { background: var(--verde-claro); color: var(--verde); }
.disp-vacaciones { background: var(--azul-claro); color: var(--azul-oscuro); }
.disp-baja, .disp-no_disponible { background: #EEF0F3; color: var(--gris-suave); }
h1 .distintivo { vertical-align: middle; font-size: .8rem; }

/* --- Fichas --- */
.botonera { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.rejilla-ficha { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; align-items: start; }
.rejilla-ficha > .tarjeta { margin-top: 0; }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: .5rem 0 0; }
.datos dt { color: var(--gris-suave); }
.datos dd { margin: 0; }
.observaciones { white-space: pre-line; margin: 1rem 0 0; padding: .75rem 1rem; background: var(--fondo-lateral); border-radius: 8px; }
.cabecera-seccion { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; }
.desplegable { margin-top: .75rem; }
.desplegable > summary { list-style: none; display: inline-flex; }
.desplegable > summary::-webkit-details-marker { display: none; }
.desplegable[open] > summary { margin-bottom: 1rem; }
.desplegable > .formulario { border-top: 1px solid var(--gris-borde); padding-top: 1rem; }

/* --- Formularios largos --- */
.formulario fieldset { border: 0; padding: 0; margin: 0 0 .75rem; }
.formulario legend { font-weight: 700; font-size: 1.02rem; margin-bottom: .75rem; }
.formulario fieldset + fieldset { border-top: 1px solid var(--gris-borde); padding-top: 1rem; }
.rejilla-campos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1rem; }
.rejilla-campos .ancho-2 { grid-column: span 2; }
.rejilla-campos .ancho-3 { grid-column: span 3; }
.rejilla-campos .ancho-4 { grid-column: 1 / -1; }
.tarjeta-media { max-width: 820px; }
.campo select { appearance: auto; }
.boton-pequeno { padding: .3rem .7rem; font-size: .85rem; }
.boton-peligro { background: #fff; color: var(--rojo); border-color: #E7B4B4; }
.boton-peligro:hover { background: #FDF3F3; }
p.ayuda { color: var(--gris-suave); font-size: .9rem; }

/* --- Transportes: listado --- */
.filtros-transportes { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.periodos { display: flex; flex-wrap: wrap; gap: .35rem; }
.periodo {
  display: inline-flex; align-items: center; cursor: pointer; font-size: .92rem;
  padding: .35rem .85rem; border-radius: 999px; background: #fff; border: 1px solid var(--gris-campo);
}
.periodo input { position: absolute; opacity: 0; pointer-events: none; }
.periodo.activo { background: var(--azul-noche); border-color: var(--azul-noche); color: #F6F5F1; font-weight: 600; }
.periodo:focus-within { outline: 2px solid var(--azul); outline-offset: 2px; }
.rango { display: flex; align-items: center; gap: .5rem; }
.rango input, .filtros-linea select {
  font: inherit; background: #fff; border: 1px solid var(--gris-campo); border-radius: 8px; padding: .5rem .6rem;
}
.filtros-linea { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filtros-linea .buscador { flex: 1 1 220px; }
.filtros-linea select { max-width: 200px; }
.tabla-transportes .fila-nuevo-dia td { border-top: 2px solid var(--gris-borde); }
.sin-salto { white-space: nowrap; }
.falta { color: #A0A8B4; }

/* --- Transportes: formulario --- */
.rejilla-transporte { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.columna-principal > .tarjeta + .tarjeta, .columna-lateral > * + * { margin-top: 1rem; }
.columna-lateral { position: sticky; top: calc(var(--alto-barra) + 1rem); }
.form-transporte h2 { margin-bottom: .9rem; }
.buscador-caja { position: relative; }
.buscador-caja input { width: 100%; }
.sugerencias {
  position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .3rem;
  list-style: none; background: #fff; border: 1px solid var(--gris-campo); border-radius: 10px;
  box-shadow: var(--sombra); max-height: 320px; overflow-y: auto;
}
.sugerencias li { padding: .5rem .7rem; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; }
.sugerencias li small { color: var(--gris-suave); }
.sugerencias li.marcado, .sugerencias li:hover { background: var(--azul-claro); }
.sugerencias li.sin-resultados { color: var(--gris-suave); cursor: default; background: none; }
.rejilla-ruta { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0 .75rem; align-items: start; }
.flecha-ruta { font-size: 1.6rem; color: var(--gris-suave); padding-top: 1.7rem; }
.bloque-direccion .campo-otra .campo { margin-top: -.4rem; }
.bloque-direccion .campo select, .campo select { width: 100%; }
.avisos-vivo {
  background: #FFF8F1; border: 1px solid #F3D3B4; border-left: 4px solid var(--ambar);
  border-radius: var(--radio); padding: 1rem 1.2rem;
}
.avisos-vivo h3 { font-size: 1rem; color: var(--ambar-oscuro); margin-bottom: .4rem; }
.avisos-vivo ul { margin: 0; padding-left: 1.1rem; }
.avisos-vivo li + li { margin-top: .3rem; }
.avisos-vivo .ayuda { margin: .5rem 0 0; }
.avisos-ficha { margin-bottom: 1rem; }
.resaltado { outline: 3px solid var(--ambar) !important; transition: outline .3s; }
.acciones-fijas {
  position: sticky; bottom: 0; z-index: 10; margin: 1rem -2rem -3rem; padding: .9rem 2rem;
  background: rgba(233, 236, 241, .94); border-top: 1px solid var(--gris-borde);
}

/* --- Transportes: ficha --- */
.barra-estados { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; padding: .9rem 1.2rem; }
.accion-estado { position: relative; }
.accion-estado > summary { list-style: none; }
.accion-estado > summary::-webkit-details-marker { display: none; }
.form-motivo {
  position: absolute; z-index: 12; top: calc(100% + 6px); left: 0; width: 340px;
  display: flex; flex-direction: column; gap: .5rem; padding: 1rem;
  background: #fff; border: 1px solid var(--gris-campo); border-radius: 10px; box-shadow: var(--sombra);
}
.form-motivo label { font-size: .9rem; color: var(--gris-suave); }
.form-motivo input { font: inherit; border: 1px solid var(--gris-campo); border-radius: 8px; padding: .5rem .7rem; }
.boton-exito { background: var(--verde); color: #fff; }
.boton-exito:hover { background: #185A30; }
.boton:disabled { opacity: .5; cursor: not-allowed; }
.historial { list-style: none; margin: 0; padding: 0; }
.historial li { padding: .55rem 0 .55rem 1rem; border-left: 2px solid var(--gris-borde); position: relative; }
.historial li::before {
  content: ""; position: absolute; left: -6px; top: .9rem; width: 10px; height: 10px;
  border-radius: 50%; background: var(--gris-campo);
}
.historial li:first-child::before { background: var(--azul); }
.historial p { margin: .25rem 0 0; }
.pie-historial { font-size: .85rem; margin: .75rem 0 0; }
.rejilla-ficha > div > .tarjeta + .tarjeta { margin-top: 1rem; }

/* --- Agenda --- */
.titulo-semana { font-size: 1.05rem; font-weight: 500; margin-left: .4rem; }
.selector-vista { display: inline-flex; border: 1px solid var(--gris-campo); border-radius: 8px; overflow: hidden; margin-right: .5rem; }
.selector-vista a { padding: .5rem .9rem; text-decoration: none; color: var(--texto); background: #fff; font-weight: 600; font-size: .92rem; }
.selector-vista a + a { border-left: 1px solid var(--gris-campo); }
.selector-vista a.activo { background: var(--azul-noche); color: #F6F5F1; }
.leyenda { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .9rem; }
.leyenda-ayuda { font-size: .88rem; margin-left: .4rem; }
.agenda-marco { padding: 0; overflow-x: auto; }
.agenda { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.agenda.con-finde { min-width: 1150px; }
.agenda th, .agenda td { border-bottom: 1px solid #E6E9EE; border-right: 1px solid #EEF0F3; vertical-align: top; }
.agenda thead th {
  position: sticky; top: 0; z-index: 2; background: var(--superficie); padding: .7rem .6rem;
  text-align: left; font-size: .9rem; font-weight: 700; color: var(--gris-suave);
}
.agenda thead th.hoy { color: var(--azul-oscuro); }
.agenda thead th small { font-weight: 500; margin-left: .3rem; }
.agenda thead th .contador-dia { float: right; color: #9AA3AF; }
.agenda .col-fila { width: 170px; }
.agenda tbody th {
  text-align: left; padding: .7rem .8rem; background: #FAFBFC; font-weight: 400;
  display: table-cell;
}
.agenda tbody th > * { display: block; }
.fila-titulo { font-weight: 700; text-decoration: none; color: var(--texto); }
a.fila-titulo:hover { text-decoration: underline; }
.nota-fila { color: var(--ambar-oscuro); font-weight: 600; }
.doc-fila { margin-top: .25rem; }
.doc-fila .distintivo { font-size: .72rem; }
.agenda td.celda { padding: .4rem .4rem 1.9rem; height: 92px; position: relative; transition: background .1s; }
.agenda td.hoy { background: #F5F9FE; }
.agenda td.finde, .agenda th.finde { background: #F7F7F5; }
.fila-sin-asignar th, .fila-sin-asignar td.celda { background: #FFFBF6; border-top: 2px dashed #E9C9A6; }
.fila-sin-asignar .fila-titulo { color: var(--rojo); }
.agenda .fila-baja th, .agenda .fila-baja td { opacity: .6; }
.en-arrastre td.celda:not([data-bloqueada]) { background-image: linear-gradient(rgba(47,111,179,.03), rgba(47,111,179,.03)); }
td.celda.destino { background: var(--azul-claro) !important; box-shadow: inset 0 0 0 2px var(--azul); }

.tarjeta-agenda {
  display: flex; flex-direction: column; gap: 1px; margin-bottom: .35rem; padding: .4rem .55rem;
  border-radius: 7px; text-decoration: none; color: var(--texto); font-size: .82rem; line-height: 1.3;
  border-left: 4px solid transparent; position: relative;
}
.tarjeta-agenda.movible { cursor: grab; }
.tarjeta-agenda.movible:active { cursor: grabbing; }
.tarjeta-agenda:hover { box-shadow: 0 2px 8px rgba(20,33,61,.15); }
.ta-cabecera { display: flex; justify-content: space-between; gap: .4rem; }
.ta-cabecera span { font-weight: 600; }
.ta-cliente { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ta-ruta, .ta-extra { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ta-falta { color: var(--rojo); opacity: 1; }
.ta-estado { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }  /* solo lectores de pantalla */
.tarjeta-agenda.estado-pendiente { background: #fff; border: 1px dashed #B9C0CA; border-left: 4px solid #8E9BB3; }
.tarjeta-agenda.estado-asignado { border-left-color: var(--azul); }
.tarjeta-agenda.estado-en-ruta { border-left-color: var(--ambar); }
.tarjeta-agenda.estado-entregado { border-left-color: var(--verde); }
.tarjeta-agenda.estado-incidencia { border-left-color: var(--rojo-medio); }
.tarjeta-agenda.estado-entregado .ta-cabecera b::after { content: " ✓"; }
.tarjeta-agenda.arrastrando { opacity: .4; }
.tarjeta-agenda.guardando { opacity: .6; pointer-events: none; }
.tarjeta-agenda.recien-movida { animation: resalto 1.2s ease; }
@keyframes resalto { 0% { box-shadow: 0 0 0 3px var(--ambar); } 100% { box-shadow: 0 0 0 0 transparent; } }
.celda-nuevo {
  display: none; position: absolute; right: .3rem; bottom: .25rem; width: 24px; height: 24px; line-height: 22px;
  text-align: center; border-radius: 6px; text-decoration: none; color: var(--gris-suave); border: 1px solid var(--gris-campo); background: #fff;
}
td.celda:hover .celda-nuevo, .celda-nuevo:focus { display: block; }
.en-arrastre .celda-nuevo { display: none !important; }

.aviso-flotante {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40; max-width: 420px; cursor: pointer;
  background: #fff; border-radius: 10px; padding: .9rem 1.1rem; box-shadow: 0 12px 30px rgba(20,33,61,.22);
  border-left: 5px solid var(--azul);
}
.aviso-flotante p { margin: 0; font-weight: 600; }
.aviso-flotante ul { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .92rem; }
.aviso-flotante.aviso-exito { border-left-color: var(--verde); }
.aviso-flotante.aviso-aviso { border-left-color: var(--ambar); }
.aviso-flotante.aviso-error { border-left-color: var(--rojo-medio); }

/* --- Móvil --- */
@media (max-width: 900px) {
  .boton-menu { display: flex; }
  .usuario-nombre, .usuario .enlace-claro { display: none; }
  .barra-superior { padding: 0 .75rem; gap: .5rem; }
  .marca { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .lateral {
    position: fixed; top: var(--alto-barra); bottom: 0; left: 0; z-index: 25;
    transform: translateX(-100%); transition: transform .2s ease; overflow-y: auto;
  }
  body.menu-abierto .lateral { transform: none; }
  body.menu-abierto .velo {
    display: block; position: fixed; inset: var(--alto-barra) 0 0 0; z-index: 20;
    background: rgba(20, 33, 61, .35);
  }
  .contenido { padding: 1.25rem 1rem 2rem; }
  .cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rejilla-panel { grid-template-columns: minmax(0, 1fr); }
  .grafico-semana { gap: .25rem; }
  .grafico-semana > * { min-width: 0; }
  .lista-filas li { flex-direction: column; align-items: flex-start; gap: .3rem; }
  .rejilla-ficha { grid-template-columns: minmax(0, 1fr); }
  .rejilla-campos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rejilla-campos .ancho-2, .rejilla-campos .ancho-3 { grid-column: 1 / -1; }
  .cabecera-pagina { align-items: flex-start; }
  .tabla { font-size: .9rem; }
  .tarjeta > .tabla { display: block; overflow-x: auto; }
  .rejilla-transporte { grid-template-columns: 1fr; }
  .columna-lateral { position: static; }
  .rejilla-ruta { grid-template-columns: 1fr; }
  .flecha-ruta { display: none; }
  .acciones-fijas { margin: 1rem -1rem -2rem; padding: .75rem 1rem; }
  .filtros-linea select { max-width: none; flex: 1 1 45%; }
  .form-motivo { width: min(340px, calc(100vw - 2rem)); }
  .tarjeta { min-width: 0; }
  .tabla th, .tabla td { padding: .6rem .6rem; }
}

/* Cifras del panel enlazadas */
a.cifra { text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
a.cifra:hover { box-shadow: var(--sombra); transform: translateY(-1px); }

/* Agenda: número sin partir y primera columna fija al desplazar en horizontal */
.ta-cabecera b { white-space: nowrap; }
.agenda tbody th { position: sticky; left: 0; z-index: 1; }
.agenda thead th.col-fila { left: 0; z-index: 3; }

/* --- Panel (bloque 6) --- */
.cifras-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.columna-principal > .tarjeta + .tarjeta, .columna-lateral-panel > .tarjeta + .tarjeta { margin-top: 1rem; }
.titulo-dia { font-size: .95rem; font-weight: 500; margin-left: .3rem; }
.lista-panel { list-style: none; margin: .25rem 0 0; padding: 0; }
.lista-panel li + li { border-top: 1px solid #EEF0F3; }
.fila-panel {
  display: grid; grid-template-columns: 3.4rem 1fr auto; gap: .75rem; align-items: center;
  padding: .6rem .4rem; color: var(--texto); text-decoration: none; border-radius: 8px;
}
.fila-panel:hover { background: #F4F6F9; }
.fp-hora { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gris-suave); }
.fp-cuerpo { display: flex; flex-direction: column; min-width: 0; }
.fp-cuerpo small { color: var(--gris-suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.falta-texto { color: var(--rojo); font-weight: 600; }
.lista-avisos li { align-items: flex-start; }
.lista-avisos a { color: var(--texto); text-decoration: none; }
.lista-avisos a:hover { text-decoration: underline; }
.aviso-alto .aviso-marca { background: var(--rojo-claro); color: var(--rojo); }
.aviso-medio .aviso-marca { background: var(--ambar-claro); color: var(--ambar-oscuro); }
.aviso-categoria { flex: none; font-size: .78rem; color: var(--gris-suave); min-width: 7.5rem; padding-top: .1rem; }
.lista-avisos-completa li { padding: .65rem 0; border-bottom: 1px solid #EEF0F3; }
.lista-avisos-completa li:last-child { border-bottom: 0; }
.todo-bien { color: var(--verde); font-weight: 600; }
.filtro-avisos { margin-bottom: 1rem; }
.filtro-avisos .periodo { text-decoration: none; color: var(--texto); }
.filtro-avisos .periodo.activo { color: #F6F5F1; }

.grafico-semana { display: flex; gap: .5rem; align-items: stretch; margin: .75rem 0 .5rem; }
.barra-dia {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .25rem;
  text-decoration: none; color: var(--texto); padding: .25rem 0; border-radius: 8px;
}
.barra-dia:hover { background: #F4F6F9; }
.barra-valor { font-weight: 700; font-size: .9rem; min-height: 1.2em; }
.barra-pista { width: 60%; max-width: 34px; height: 96px; background: #EEF0F3; border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.barra-relleno { width: 100%; background: var(--azul); border-radius: 6px 6px 0 0; }
.barra-relleno.con-pendientes { background: linear-gradient(var(--ambar) 0 30%, var(--azul) 30%); }
.barra-dia.hoy .barra-dia-nombre { color: var(--azul-oscuro); font-weight: 700; }
.barra-dia-nombre { font-size: .82rem; color: var(--gris-suave); white-space: nowrap; }
.barra-falta { font-size: .7rem; color: var(--ambar-oscuro); text-align: center; line-height: 1.1; }
.h0 { height: 0; } .h1 { height: 10%; } .h2 { height: 20%; } .h3 { height: 30%; } .h4 { height: 40%; }
.h5 { height: 50%; } .h6 { height: 60%; } .h7 { height: 70%; } .h8 { height: 80%; } .h9 { height: 90%; } .h10 { height: 100%; }
.resumen-estados { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .5rem 0 0; color: var(--gris-suave); font-size: .9rem; }
.campo-casilla { align-self: end; }
.roles-ayuda { margin: .5rem 0 0; box-shadow: none; }
@media (max-width: 1200px) { .cifras-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .cifras-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fila-panel { grid-template-columns: 3rem 1fr; }
  .fila-panel .distintivo { grid-column: 2; justify-self: start; }
  .aviso-categoria { display: none; }
}
.fp-titulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Informes --- */
.filtros-informe { margin-bottom: 1rem; }
.atajos { margin-bottom: .8rem; }
.atajos .periodo { text-decoration: none; color: var(--texto); }
.atajos .periodo.activo { color: #F6F5F1; }
.rejilla-filtros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem 1rem; align-items: end; }
.rejilla-filtros label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--gris-suave); }
.rejilla-filtros input, .rejilla-filtros select {
  font: inherit; color: var(--texto); background: #fff; border: 1px solid var(--gris-campo); border-radius: 8px; padding: .5rem .6rem;
}
.acciones-filtro { display: flex; gap: .75rem; align-items: center; }
.cabecera-informe { padding: 1rem 1.4rem .25rem; }
.cabecera-informe p { margin: 0; }
.tabla-informe tfoot td { font-weight: 700; background: #F1F3F6; border-top: 2px solid var(--gris-borde); padding: .7rem 1rem; }
.tabla-informe tfoot td:first-child { padding-left: 1.4rem; }
.col-barra { width: 18%; }
.barra-h { display: block; height: 10px; border-radius: 5px; background: var(--azul); margin-top: .35rem; }
.w0 { width: 0; } .w1 { width: 10%; } .w2 { width: 20%; } .w3 { width: 30%; } .w4 { width: 40%; } .w5 { width: 50%; }
.w6 { width: 60%; } .w7 { width: 70%; } .w8 { width: 80%; } .w9 { width: 90%; } .w10 { width: 100%; }
.cifra-alerta { color: var(--rojo); font-weight: 700; }
.seccion-detalle { margin-top: 1rem; }
@media (max-width: 900px) {
  .rejilla-filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acciones-filtro { grid-column: 1 / -1; }
  .col-barra { display: none; }
}

/* Misma altura para todos los campos de una línea (los navegadores dan alturas distintas a
   desplegables, fechas y horas) */
.campo input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not([type=button]),
.campo select { height: 2.75rem; }

/* Logo de la empresa (ajustes) */
.bloque-logo { margin-bottom: 1rem; }
.logo-fila { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.logo-vista {
  width: 260px; height: 130px; display: flex; align-items: center; justify-content: center; padding: 1rem;
  border: 1px solid var(--gris-borde); border-radius: 10px;
  background: repeating-conic-gradient(#F1F3F6 0% 25%, #fff 0% 50%) 50% / 16px 16px;  /* damero: se ve la transparencia */
}
.logo-vista img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-vista.sin-logo { background: var(--fondo-lateral); color: var(--gris-suave); }
.logo-acciones { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.logo-acciones .campo input[type=file] { height: auto; padding: .45rem; }

/* ===================== Vista móvil del conductor ===================== */
body.movil { background: var(--fondo); }
.movil-barra {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 56px; padding: env(safe-area-inset-top) 1rem 0; background: var(--azul-noche); color: #F6F5F1;
}
.movil-titulo { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movil-volver { color: #F6F5F1; text-decoration: none; font-weight: 700; font-size: 1.05rem; padding: .5rem 0; }
.movil-menu { position: relative; }
.movil-menu > summary { list-style: none; cursor: pointer; padding: .5rem .25rem; color: #F6F5F1; font-weight: 600; }
.movil-menu > summary::-webkit-details-marker { display: none; }
.movil-menu-panel {
  position: absolute; right: 0; top: calc(100% + 4px); min-width: 210px; display: flex; flex-direction: column;
  background: #fff; border-radius: 10px; box-shadow: var(--sombra); overflow: hidden;
}
.movil-menu-panel a, .movil-menu-panel button {
  display: block; width: 100%; text-align: left; padding: .9rem 1rem; color: var(--texto); text-decoration: none;
  font: inherit; background: none; border: 0; border-bottom: 1px solid #EEF0F3; cursor: pointer;
}
.movil-menu-panel form { margin: 0; }
.aviso-sin-red { background: var(--ambar-claro); color: var(--ambar-oscuro); text-align: center; padding: .5rem 1rem; font-weight: 600; font-size: .92rem; }
.movil-contenido { max-width: 640px; margin: 0 auto; padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom)); }
.movil-cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.movil-cabecera h1 { font-size: 1.45rem; margin: 0 0 .2rem; }
.movil-cabecera p { margin: 0; }

.bloque-dia { margin-bottom: 1.4rem; }
.bloque-dia h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.bloque-atrasado { background: #FDF3F3; border: 1px solid #F0C6C6; border-radius: var(--radio); padding: .9rem; }
.bloque-atrasado h2 { color: var(--rojo); }
.fecha-atrasada { margin: .6rem 0 .3rem; font-size: .85rem; font-weight: 700; color: var(--gris-suave); text-transform: uppercase; letter-spacing: .04em; }

.servicio {
  display: grid; grid-template-columns: 3.3rem 1fr; gap: .2rem .8rem; align-items: start;
  background: #fff; border: 1px solid var(--gris-borde); border-left: 5px solid #8E9BB3; border-radius: 12px;
  padding: .85rem .9rem; margin-bottom: .6rem; color: var(--texto); text-decoration: none;
}
.servicio:active { background: #F4F6F9; }
.servicio.estado-asignado { border-left-color: var(--azul); }
.servicio.estado-en-ruta { border-left-color: var(--ambar); background: #FFFBF6; }
.servicio.estado-entregado { border-left-color: var(--verde); opacity: .75; }
.servicio.estado-incidencia { border-left-color: var(--rojo-medio); }
.servicio-hora { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; grid-row: span 2; }
.servicio-cuerpo { display: flex; flex-direction: column; min-width: 0; }
.servicio-cuerpo b { font-size: 1.05rem; }
.servicio-ruta { font-weight: 600; color: #3A4250; }
.servicio-cuerpo small { color: var(--gris-suave); }
.servicio .distintivo { grid-column: 2; justify-self: start; }

.servicio-cabecera h1 { font-size: 1.6rem; margin: .1rem 0 .4rem; }
.servicio-cabecera p { margin: 0; }
.distintivo-grande { font-size: .95rem; padding: .3rem .8rem; }
.acciones-conductor { display: flex; flex-direction: column; gap: .6rem; margin: 1.1rem 0; }
.accion-principal { display: flex; flex-direction: column; gap: .4rem; }
.accion-principal label, .accion-secundaria label { font-size: .9rem; color: var(--gris-suave); }
.accion-principal input, .accion-secundaria textarea {
  font: inherit; font-size: 1.05rem; padding: .7rem .8rem; border: 1px solid var(--gris-campo); border-radius: 10px; background: #fff;
}
.boton-grande { padding: 1rem; font-size: 1.15rem; border-radius: 12px; }
.accion-secundaria > summary { list-style: none; }
.accion-secundaria > summary::-webkit-details-marker { display: none; }
.accion-secundaria form { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.aviso-servicio { background: #fff; border-left: 4px solid var(--azul); border-radius: 10px; padding: .8rem 1rem; margin: 1rem 0; }
.aviso-ok { border-left-color: var(--verde); }
.aviso-incidencia { border-left-color: var(--rojo-medio); background: #FDF3F3; }

.lugar { background: #fff; border: 1px solid var(--gris-borde); border-radius: 12px; padding: .9rem 1rem; margin-bottom: .7rem; }
.lugar p { margin: 0 0 .25rem; }
.lugar-titulo { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gris-suave); }
.lugar-nombre { font-weight: 700; font-size: 1.05rem; }
.lugar-direccion { font-size: 1.02rem; }
.lugar-nota { background: var(--ambar-claro); color: var(--ambar-oscuro); padding: .4rem .6rem; border-radius: 6px; margin-top: .4rem !important; }
.lugar-botones { display: flex; gap: .5rem; margin-top: .6rem; }
.lugar-botones .boton { flex: 1; padding: .7rem; }
.datos-servicio { background: #fff; border: 1px solid var(--gris-borde); border-radius: 12px; padding: .9rem 1rem; }

/* Aviso de cambios hechos por otros */
.aviso-cambios {
  position: fixed; top: calc(var(--alto-barra) + .75rem); left: 50%; transform: translateX(-50%); z-index: 45;
  display: flex; align-items: center; gap: .9rem; padding: .6rem .7rem .6rem 1.1rem; border-radius: 999px;
  background: var(--azul-noche); color: #F6F5F1; box-shadow: 0 10px 28px rgba(20,33,61,.3); font-weight: 600; white-space: nowrap;
}
@media (max-width: 600px) { .aviso-cambios { white-space: normal; border-radius: 12px; width: calc(100% - 2rem); } }
.acceso-app { margin-bottom: 1rem; } .acceso-app p { margin: .25rem 0 .75rem; }

/* ===================== Entrega firmada (móvil) ===================== */
.oculto-accesible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.form-entrega { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
.bloque-entrega { background: #fff; border: 1px solid var(--gris-borde); border-radius: 12px; padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; }
.bloque-entrega h2 { font-size: 1.05rem; margin: 0 0 .3rem; }
.bloque-entrega label:not(.boton):not(.casilla) { font-size: .9rem; color: var(--gris-suave); margin-top: .35rem; }
.bloque-entrega input:not([type=checkbox]):not([type=file]), .bloque-entrega textarea { width: 100%; font-size: 1.05rem; padding: .65rem .8rem; border-radius: 10px; }
.nota-campo { margin: .1rem 0 0; font-size: .85rem; }
.boton-fotos { position: relative; margin-top: .4rem; }
.boton-fotos.cargando { opacity: .6; pointer-events: none; }
.fotos-entrega { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.fotos-entrega:empty { display: none; }
.foto-entrega { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #EEF0F3; }
.foto-entrega img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-quitar {
  position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(20,33,61,.8); color: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.firma-caja {
  position: relative; height: 190px; border: 2px dashed var(--gris-campo); border-radius: 10px; background: #FCFCFA;
  touch-action: none; overscroll-behavior: contain;
}
.firma-caja canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.firma-caja::after { content: ""; position: absolute; left: 1rem; right: 1rem; bottom: 2.2rem; border-bottom: 1px solid #D5DAE1; pointer-events: none; }
.firma-guia { position: absolute; left: 0; right: 0; bottom: .6rem; text-align: center; color: #98A1AE; font-size: .9rem; pointer-events: none; }
.firma-caja.desactivada { background: #F1F3F6; border-style: solid; }
.firma-botones { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.firma-botones .casilla { display: flex; align-items: center; gap: .45rem; font-size: .95rem; }
.firma-botones .casilla input { width: 1.25rem; height: 1.25rem; }
.errores-entrega { background: var(--rojo-claro); color: var(--rojo); border-radius: 10px; padding: .6rem 1rem; margin-top: 1rem; font-weight: 600; }
.errores-entrega ul { margin: 0; padding-left: 1.1rem; }
.enlace-albaran { display: inline-block; margin-top: .4rem; font-weight: 600; }

/* ===================== Entrega en la ficha (oficina) ===================== */
.entrega-ficha .entrega-rejilla { display: grid; grid-template-columns: 1fr minmax(180px, 280px); gap: 1rem 1.5rem; align-items: start; }
@media (max-width: 700px) { .entrega-ficha .entrega-rejilla { grid-template-columns: 1fr; } }
.firma-imagen { background: #FCFCFA; border: 1px solid var(--gris-borde); border-radius: 8px; padding: .5rem; text-align: center; }
.firma-imagen img { max-width: 100%; max-height: 120px; }
.firma-imagen p { margin: .3rem 0 0; font-size: .8rem; color: var(--gris-suave); }
.fotos-ficha { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-top: .8rem; }
.fotos-ficha a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #EEF0F3; }
.fotos-ficha img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entrega-acciones { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--gris-borde); }
.entrega-acciones form { display: flex; gap: .5rem; align-items: flex-end; flex: 1 1 320px; }
.entrega-acciones form input { flex: 1; min-width: 0; }
.estado-envio { font-size: .88rem; margin: .5rem 0 0; }
.estado-envio.error { color: var(--rojo); }
.estado-envio.ok { color: var(--verde); }
.campo-en-linea { display: flex; flex-direction: column; gap: .25rem; flex: 1; min-width: 0; }
.campo-en-linea label { font-size: .85rem; }
.entrega-ficha { margin-bottom: 1rem; }
.fila-prueba-correo { display: flex; gap: .5rem; flex-wrap: wrap; }
.fila-prueba-correo input { flex: 1 1 220px; }

/* ===================== Incidencias ===================== */
.tipos-incidencia { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; margin-bottom: .4rem; }
.tipo-incidencia { position: relative; }
.tipo-incidencia input { position: absolute; opacity: 0; inset: 0; }
.tipo-incidencia span {
  display: flex; align-items: center; min-height: 3rem; height: 100%; padding: .5rem .7rem; border: 1px solid var(--gris-campo);
  border-radius: 10px; background: #fff; font-size: .95rem; line-height: 1.2; cursor: pointer;
}
.tipo-incidencia input:checked + span { border-color: var(--rojo-medio); background: var(--rojo-claro); color: var(--rojo); font-weight: 700; }
.tipo-incidencia input:focus-visible + span { outline: 2px solid var(--azul); outline-offset: 1px; }
.aviso-incidencia .fotos-entrega { margin-top: .5rem; }
.aviso-incidencia .foto-entrega { display: block; }
.incidencia-texto { margin: .35rem 0 0; white-space: pre-line; }

.lista-incidencias { display: flex; flex-direction: column; gap: .7rem; }
.incidencia { background: #fff; border: 1px solid var(--gris-borde); border-left: 4px solid var(--rojo-medio); border-radius: var(--radio); padding: .85rem 1rem; }
.incidencia-resuelta { border-left-color: var(--verde); }
.incidencias-ficha .incidencia { margin-top: .7rem; }
.incidencia-cabecera { display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: baseline; }
.incidencia-fecha { margin-left: auto; font-size: .88rem; }
.incidencia-pie { margin: .5rem 0 0; font-size: .9rem; }
.incidencia-resolucion { color: var(--verde); }
.fotos-incidencia { grid-template-columns: repeat(auto-fill, minmax(90px, 110px)); }
.incidencias-ficha { margin-bottom: 1rem; }

/* ===================== Gastos de la flota ===================== */
.cifras-gastos { margin-bottom: 1rem; }
.cifras-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .cifras-3 { grid-template-columns: 1fr; } }
div.cifra { cursor: default; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla tfoot th { border-top: 2px solid var(--gris-borde); background: #F4F6F9; }
.tabla-desplazable { overflow-x: auto; }
.ticket-mini img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; display: block; border: 1px solid var(--gris-borde); }
.bloque-ticket { display: flex; gap: 1rem; align-items: flex-start; }
.bloque-ticket-campos { display: flex; flex-direction: column; gap: .35rem; }
.ticket-actual img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--gris-borde); }
.periodo-texto { align-self: center; margin-left: .5rem; font-size: .9rem; }
.nota-costes { max-width: 70ch; }
.gastos-vehiculo .cifras { margin: .5rem 0 1rem; }
.gastos-vehiculo .cifra { padding: .7rem .9rem; }
.gastos-vehiculo .cifra strong { font-size: 1.25rem; }
.lista-gastos-movil { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: .5rem; }
.lista-gastos-movil li { display: flex; align-items: center; gap: .7rem; background: #fff; border: 1px solid var(--gris-borde); border-radius: 12px; padding: .6rem .7rem; }
.lista-gastos-movil .ticket-mini img, .sin-ticket { width: 44px; height: 44px; border-radius: 8px; }
.sin-ticket { display: block; background: #EEF0F3; }
.gasto-movil-cuerpo { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.gasto-movil-cuerpo small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gasto-movil-importe { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gasto-movil-borrar { margin: 0; }
.boton-icono { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--gris-campo); background: #fff; color: var(--rojo); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.tipos-gasto { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tipos-gasto .tipo-incidencia span { font-size: .86rem; min-height: 2.8rem; justify-content: center; text-align: center; padding: .4rem .35rem; hyphens: auto; overflow-wrap: anywhere; }
.tipos-gasto .tipo-incidencia input:checked + span { border-color: var(--azul); background: var(--azul-claro); color: var(--azul-oscuro); }
.bloque-entrega select { width: 100%; font: inherit; font-size: 1.05rem; padding: .65rem .8rem; border: 1px solid var(--gris-campo); border-radius: 10px; background: #fff; color: var(--texto); }
.enlace-gasto-servicio { margin-top: 1rem; }
.movil-contenido > .boton-ancho:last-child { margin-top: .5rem; }

/* ===================== Documentos del transporte ===================== */
.documentos-ficha { margin-bottom: 1rem; }
.lista-documentos { list-style: none; padding: 0; margin: .5rem 0 1rem; }
.lista-documentos li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; padding: .55rem 0; border-bottom: 1px solid #EEF0F3; }
.doc-nombre { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; word-break: break-word; }
.doc-icono { flex: none; font-size: .68rem; font-weight: 800; letter-spacing: .03em; padding: .25rem .35rem; border-radius: 4px; color: #fff; background: var(--gris-suave); }
.doc-pdf { background: var(--rojo); }
.doc-img { background: var(--azul); }
.doc-meta { font-size: .88rem; }
.doc-acciones { margin-left: auto; display: inline-flex; align-items: center; gap: .6rem; }
.subir-documento { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; }
.subir-documento select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--gris-campo); border-radius: 8px; background: #fff; }
.subir-documento .casilla { display: flex; gap: .4rem; align-items: center; }
.docs-movil { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-direction: column; gap: .4rem; }
.docs-movil a { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; border: 1px solid var(--gris-borde); border-radius: 10px; background: #fff; text-decoration: none; color: var(--texto); font-weight: 600; }
.viaje-continua { display: block; margin-bottom: .3rem; padding: .25rem .45rem; border-radius: 6px; font-size: .78rem; text-decoration: none; color: var(--texto); background: repeating-linear-gradient(135deg, #EEF1F6, #EEF1F6 6px, #E4E8EF 6px, #E4E8EF 12px); border-left: 3px solid #8E9BB3; }
.viaje-continua.estado-en-ruta { border-left-color: var(--ambar); }
.viaje-continua.estado-asignado { border-left-color: var(--azul); }
.servicio-descarga { color: var(--gris-suave); }
.docs-servicio { margin-bottom: .7rem; }
.negativo { color: var(--rojo); }

/* ===================== Ayuda / manual ===================== */
.boton-ayuda {
  display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%;
  border: 1.5px solid rgba(246,245,241,.7); color: #F6F5F1; font-weight: 800; font-size: 1.05rem; text-decoration: none; line-height: 1;
}
.boton-ayuda:hover, .boton-ayuda:focus-visible { background: rgba(255,255,255,.15); outline: none; }
.boton-ayuda-texto { width: 1.5rem; height: 1.5rem; font-size: .85rem; background: var(--azul-noche); border-color: var(--azul-noche); vertical-align: middle; }
.movil-derecha { display: flex; align-items: center; gap: .6rem; }

.manual { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.manual-indice { position: sticky; top: calc(var(--alto-barra) + 1rem); max-height: calc(100vh - var(--alto-barra) - 2rem); overflow: auto; padding: 1rem 1.1rem; font-size: .92rem; }
.manual-indice-titulo { font-weight: 800; margin: 0 0 .5rem; }
.manual-indice ol { margin: 0; padding-left: 1.1rem; }
.manual-indice ol ol { padding-left: .9rem; margin: .2rem 0 .5rem; font-size: .88rem; }
.manual-indice li { margin: .15rem 0; }
.manual-indice a { color: var(--texto); text-decoration: none; }
.manual-indice a:hover { color: var(--azul); text-decoration: underline; }
.manual-cuerpo { min-width: 0; }
.manual-seccion { background: var(--superficie); border: 1px solid var(--gris-borde); border-radius: var(--radio); padding: 1.4rem 1.6rem; margin-bottom: 1.5rem; line-height: 1.6; }
.manual-seccion h2 { font-size: 1.5rem; margin: 0 0 .8rem; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.manual-seccion h3 { font-size: 1.15rem; margin: 2rem 0 .7rem; padding-top: .3rem; border-top: 1px solid #EEF0F3; }
.manual-seccion h2 + h3, .manual-seccion h2 + p + h3 { border-top: 0; }
.manual-seccion [id] { scroll-margin-top: calc(var(--alto-barra) + 1rem); }
.manual-seccion { scroll-margin-top: calc(var(--alto-barra) + 1rem); }
.manual-seccion ul, .manual-seccion ol { padding-left: 1.3rem; }
.manual-seccion li { margin: .3rem 0; }
.pasos li::marker { font-weight: 800; color: var(--azul); }
.nota { background: var(--azul-claro); border-left: 4px solid var(--azul); border-radius: 8px; padding: .7rem 1rem; }
.rol-chip { font-size: .75rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; letter-spacing: .02em; }
.rol-todos { background: #EEF0F3; color: var(--gris-texto); }
.rol-oficina { background: var(--azul-claro); color: var(--azul-oscuro); }
.rol-admin { background: var(--ambar-claro); color: var(--ambar-oscuro); }
.rol-conductor { background: var(--verde-claro); color: var(--verde); }
.captura { margin: 1rem 0 1.2rem; }
.captura img { display: block; max-width: 100%; height: auto; border: 1px solid var(--gris-borde); border-radius: 8px; box-shadow: 0 6px 18px rgba(20,33,61,.10); background: #fff; }
.captura-movil img { max-width: 320px; border-radius: 18px; border: 6px solid #1B2433; }
.captura-detalle img { box-shadow: none; }
.captura figcaption { font-size: .86rem; color: var(--gris-suave); margin-top: .45rem; }
.dos-columnas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; align-items: start; }
.tabla-manual { margin: .6rem 0 1rem; }
.tabla-manual td { line-height: 1.45; }
.pregunta { border-bottom: 1px solid #EEF0F3; padding: .6rem 0; }
.pregunta summary { cursor: pointer; font-weight: 700; }
.pregunta p { margin: .5rem 0 .2rem; }
@media (max-width: 1100px) {
  .manual { grid-template-columns: 1fr; }
  .manual-indice { position: static; max-height: none; }
}
@media (max-width: 800px) { .dos-columnas { grid-template-columns: 1fr; } .manual-seccion { padding: 1.1rem; } }

/* Ayuda en el móvil */
.manual-movil { display: block; }
.manual-movil h1 { font-size: 1.5rem; margin: .2rem 0 .8rem; }
.manual-indice-movil { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.manual-indice-movil a { padding: .4rem .7rem; border-radius: 999px; background: #fff; border: 1px solid var(--gris-borde); color: var(--texto); text-decoration: none; font-size: .9rem; }
.manual-movil .manual-seccion { padding: 1rem; }
.manual-movil .manual-seccion h2 { font-size: 1.3rem; }
.manual-movil .dos-columnas { grid-template-columns: 1fr; }
.manual-movil .captura-movil img { max-width: 100%; }

@media print {
  .barra-superior, .lateral, .velo, .manual-indice, .solo-pantalla, .aviso-cambios, .mensajes { display: none !important; }
  .contenedor, .contenido { display: block; margin: 0; padding: 0; }
  .manual { display: block; }
  html, body, .contenedor, .contenido, .manual-seccion { background: #fff !important; }
  .manual-seccion { border: 0; padding: 0; }
  .manual-seccion + .manual-seccion { break-before: page; }
  .captura, .dos-columnas > * { break-inside: avoid; }
  .captura-movil img { max-width: 220px; }
  .captura a::after { content: none; }
  .pregunta { break-inside: avoid; }
}

/* ===================== Costes (bloque 12) ===================== */
.base-calculada { justify-content: flex-end; }
.base-calculada b { font-size: 1.15rem; padding: .55rem 0; }
.nota-ambito { background: var(--azul-claro); border-radius: 8px; padding: .5rem .8rem; color: var(--azul-oscuro); margin: 0 0 1rem; }
.doc-grande { display: inline-flex; align-items: center; justify-content: center; width: 120px; height: 120px; font-size: 1.4rem; border-radius: 8px; }
.costes-ficha { margin-bottom: 1rem; }
.tabla-costes-transporte { margin: .4rem 0 .8rem; }
.margen { border-top: 1px solid var(--gris-borde); padding-top: .8rem; }
.margen-lineas { display: grid; grid-template-columns: auto auto; justify-content: end; gap: .3rem 2rem; margin: 0 0 .6rem; }
.margen-lineas dt { color: var(--gris-suave); text-align: right; }
.margen-lineas dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.margen-lineas .margen-total { font-weight: 800; color: var(--texto); font-size: 1.05rem; border-top: 1px solid #EEF0F3; padding-top: .3rem; }
.margen-lineas dd small { display: block; font-weight: 400; }
.margen-lineas dd.margen-total small { display: inline; color: var(--gris-suave); }
.margen-lineas .negativo { color: var(--rojo); }
.margen .ayuda { text-align: right; }
.nota-informe { padding: .4rem 1rem .8rem; margin: 0; }

/* --- Hoja del transporte en PDF (menú en la ficha) --- */
.menu-pdf { position: relative; }
.menu-pdf > summary { list-style: none; }
.menu-pdf > summary::-webkit-details-marker { display: none; }
.menu-pdf > summary::after { content: " ▾"; font-size: .8em; }
.menu-pdf-opciones {
  position: absolute; z-index: 12; top: calc(100% + 6px); right: 0; width: 290px;
  display: flex; flex-direction: column; padding: .35rem;
  background: #fff; border: 1px solid var(--gris-campo); border-radius: 10px; box-shadow: var(--sombra);
}
.menu-pdf-opciones a { display: block; padding: .55rem .75rem; border-radius: 8px; color: var(--texto); text-decoration: none; font-weight: 600; }
.menu-pdf-opciones a:hover, .menu-pdf-opciones a:focus-visible { background: var(--azul-claro); }
.menu-pdf-opciones small { display: block; font-weight: 400; color: var(--gris-suave); font-size: .82rem; }
@media (max-width: 640px) { .menu-pdf-opciones { right: auto; left: 0; } }
.menu-pdf-opciones { width: 320px; }
.menu-pdf-envio { display: flex; flex-direction: column; gap: .3rem; margin-top: .35rem; padding: .7rem .75rem .5rem; border-top: 1px solid var(--gris-borde); }
.menu-pdf-titulo { margin: 0 0 .2rem; font-weight: 700; }
.menu-pdf-envio label { font-size: .85rem; color: var(--gris-suave); margin-top: .2rem; }
.menu-pdf-envio input, .menu-pdf-envio select, .menu-pdf-envio textarea { font: inherit; border: 1px solid var(--gris-campo); border-radius: 8px; padding: .45rem .6rem; width: 100%; box-sizing: border-box; }
.menu-pdf-envio small { color: var(--gris-suave); font-size: .8rem; }
.menu-pdf-envio .boton { margin-top: .4rem; align-self: flex-end; }
@media (max-width: 640px) { .menu-pdf-opciones { width: min(320px, calc(100vw - 32px)); } }

/* --- Correo de la empresa (Datos de la empresa) --- */
.estado-correo { padding: .6rem .8rem; border-radius: 8px; margin: .5rem 0 1rem; }
.estado-correo.ok { background: var(--verde-claro); color: var(--verde); }
.estado-correo.falta { background: var(--ambar-claro); color: var(--ambar-oscuro); }
.quitar-correo { margin-top: .5rem; }
#correo h3 { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--gris-borde); }
@media (max-width: 480px) {
  .barra-dia-nombre { white-space: normal; text-align: center; line-height: 1.15; font-size: .74rem; }
  .barra-falta { font-size: .64rem; }
}
