:root {
  --naranja: #e87722; --naranja-osc: #c45f12; --gris: #2b2b2b; --gris-claro: #f3f4f6;
  --borde: #d8dbe0; --rojo: #c00000; --verde: #1e7b34; --texto: #1f2328; --radio: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; color: var(--texto); background: #eef0f3; font-size: 15px; }
.oculto { display: none !important; }

.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 18px; background: #fff; border-bottom: 3px solid var(--naranja); position: sticky; top: 0; z-index: 20; }
.logo { height: 38px; }
.titulo-app { font-weight: 700; font-size: 18px; color: var(--gris); }
.usuario { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 14px; }
.rol { background: var(--gris-claro); border: 1px solid var(--borde); border-radius: 20px; padding: 2px 10px; font-size: 12px; text-transform: capitalize; }
.rol.dev { background: #fff4e5; border-color: var(--naranja); color: var(--naranja-osc); font-weight: 600; }

.tabs { display: flex; gap: 4px; padding: 0 18px; background: var(--gris); overflow-x: auto; position: sticky; top: 57px; z-index: 19; }
.tab { background: none; border: 0; color: #cfd3d8; padding: 12px 14px; font-size: 14px; cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; }
.tab.activa { color: #fff; border-bottom-color: var(--naranja); font-weight: 600; }
.tab:disabled { opacity: .45; cursor: not-allowed; }

main { max-width: 1240px; margin: 0 auto; padding: 18px 14px 60px; }
.encabezado-pantalla { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
h1 { margin: 0; font-size: 22px; }
.sub { margin: 2px 0 0; color: #666; font-size: 13px; }

.tarjeta { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; margin: 0 0 14px; }
fieldset.tarjeta legend { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 14px; padding: 4px 10px; background: var(--gris); color: #fff; border-radius: 6px; }
fieldset.tarjeta legend .btn { background: #fff; color: var(--gris); }
.centro { max-width: 420px; margin: 60px auto; text-align: center; }
h4 { margin: 14px 0 6px; font-size: 14px; color: #555; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.sel-entrega { font-weight: 600; }
.aviso-rol { border-left: 4px solid var(--naranja); color: #444; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.categoria { display: inline-block; min-width: 34px; text-align: center; background: var(--gris); color: #fff; border-radius: 5px; padding: 2px 6px; font-weight: 700; font-size: 12.5px; }
.fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #444; }
.campo.falta input { border-color: var(--rojo); background: #fff5f5; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 7px; background: #fff; width: 100%; font-weight: 400; color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 2px solid #f6c69c; border-color: var(--naranja); }
textarea { resize: vertical; }
.mayus { text-transform: uppercase; }
label { font-size: 13px; }
.ayuda { color: #666; font-size: 12.5px; font-weight: 400; margin: 4px 0; display: block; }
.ayuda.alerta, .alerta { color: var(--rojo); font-weight: 600; }
.ayuda.ok, .ok { color: var(--verde); font-weight: 600; }

.item { display: grid; grid-template-columns: minmax(200px, 1.3fr) auto minmax(200px, 1.2fr); gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid #eef0f3; }
.item:last-child { border-bottom: 0; }
.item.falta { background: #fff1f1; border-left: 3px solid var(--rojo); }
.item-texto { font-size: 14px; }
.item-valor { justify-self: start; }
.item.solo-obs .item-obs { grid-column: 2 / 4; }
/* Aviso de "no apto" debajo de la fila (ocupa todo el ancho) */
.item-alerta { grid-column: 1 / -1; background: #fde2e2; color: var(--rojo); border: 1px solid #f0b4b4; border-radius: 7px; padding: 8px 12px; font-weight: 700; font-size: 13.5px; }
.item-alerta::before { content: "\26A0  "; }
input.valor-alerta { border-color: var(--rojo); background: #fff5f5; color: var(--rojo); font-weight: 700; }
.item-obs { display: flex; gap: 6px; flex-wrap: wrap; }
.item-obs .obs { flex: 1 1 160px; padding: 6px 8px; font-size: 13px; }
.extra { display: flex; flex-direction: column; font-size: 11.5px; color: #555; flex: 0 1 150px; }
.extra input { padding: 5px 6px; font-size: 13px; }
.resp-libre { max-width: 160px; }

.segmentado { display: inline-flex; border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.segmentado .op { position: relative; cursor: pointer; }
.segmentado .op input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmentado .op span { display: block; min-width: 44px; text-align: center; padding: 7px 8px; font-weight: 700; font-size: 13px; border-left: 1px solid var(--borde); user-select: none; }
.segmentado .op:first-child span { border-left: 0; }
.op-B input:checked + span, .op-C input:checked + span, .op-NO input:checked + span { background: var(--verde); color: #fff; }
.op-M input:checked + span, .op-NC input:checked + span, .op-SI input:checked + span { background: var(--rojo); color: #fff; }
.op-NA input:checked + span { background: #6b7280; color: #fff; }
/* Ítems donde SI es lo bueno (ej. curso de manejo defensivo): colores al revés */
.item.invertido .op-SI input:checked + span { background: var(--verde); }
.item.invertido .op-NO input:checked + span { background: var(--rojo); }
.op input:focus-visible + span { outline: 2px solid var(--naranja); }
.seg { border: 0; background: #fff; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.seg.activo { background: var(--gris); color: #fff; }

/* Nivel de combustible: estilos en css/nivel-combustible.css. Espacio para su título */
.bloque-combustible { margin: 26px 0 14px; }

.diagrama { width: 100%; max-width: 760px; display: block; margin: 0 auto; }

.acciones-fila { display: flex; gap: 8px; flex-wrap: wrap; }
.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 8px; }
.foto { border: 1px solid var(--borde); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.foto img { width: 100%; height: 140px; object-fit: cover; border-radius: 5px; background: #eee; }
.foto input { padding: 6px; font-size: 13px; }

.plan-fila { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr auto auto auto; gap: 6px; align-items: end; margin-bottom: 8px; }
.plan-fila label { display: flex; flex-direction: column; font-size: 11.5px; color: #555; }

.firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.firma { border: 1px solid var(--borde); border-radius: 8px; padding: 10px; }
.firma-cab { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.firma-cab strong { flex: 1 1 100%; font-size: 13.5px; }
.firma-canvas { width: 100%; height: 150px; border: 1px dashed #9aa1ab; border-radius: 6px; touch-action: none; background: #fff; cursor: crosshair; }
.firma-vista { max-width: 100%; max-height: 150px; display: block; margin-top: 8px; border: 1px dashed #9aa1ab; }

.btn { font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--borde); background: #fff; cursor: pointer; }
.btn:hover { border-color: #aaa; }
.btn.primario { background: var(--naranja); border-color: var(--naranja); color: #fff; font-weight: 600; }
.btn.primario:hover { background: var(--naranja-osc); }
.btn.peligro { color: var(--rojo); border-color: #f0b4b4; }
.btn.chico { padding: 4px 10px; font-size: 12.5px; }
.btn.grande { padding: 14px 26px; font-size: 16px; }
.acciones-final { display: flex; justify-content: flex-end; margin-top: 8px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 14px; }
.modal-caja { background: #fff; border-radius: 12px; max-width: 520px; width: 100%; padding: 18px 20px; max-height: 85vh; overflow: auto; }
.modal-caja { position: relative; }
.modal-cerrar { position: absolute; top: 8px; right: 10px; z-index: 3; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: #6b7280; font-size: 26px; line-height: 1; cursor: pointer; }
.modal-cerrar:hover { background: #f3f4f6; color: #111; }
.modal-cerrar:focus-visible { outline: 2px solid var(--naranja); }
.modal-caja h3 { padding-right: 44px !important; }
.modal-caja h3 { margin: -18px -20px 10px; padding: 14px 20px 10px; position: sticky; top: -18px; background: #fff; z-index: 2; border-bottom: 1px solid #eee; }
.modal-caja ul { padding-left: 20px; }
.modal-acciones { position: sticky; bottom: -18px; background: #fff; padding: 10px 0 4px; display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.cargando { position: fixed; inset: 0; background: rgba(255,255,255,.8); z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.spinner { width: 44px; height: 44px; border: 4px solid #f3d3b8; border-top-color: var(--naranja); border-radius: 50%; animation: giro 0.9s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }

/* ---------- Pantalla de ingreso (Propuesta 3 · Mapa de flota en vivo) ---------- */
body.sin-sesion .topbar, body.sin-sesion .tabs { display: none; }
.login { position: fixed; inset: 0; z-index: 40; overflow-y: auto; display: flex; flex-wrap: wrap; background: #0F141C; font-family: Inter, system-ui, sans-serif; }
.login-mapa { position: relative; flex: 999 1 640px; min-width: 0; min-height: 100vh; overflow: hidden; background: #0F141C; }
.login-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ruta { fill: none; stroke: #F08A3C; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 10 14; animation: fluye 1.6s linear infinite; }
.ruta-base { fill: none; stroke: rgba(240,138,60,.22); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
/* Velo oscuro a la izquierda para que el texto se lea sobre el mapa */
.login-velo { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15,20,28,.92) 0%, rgba(15,20,28,.55) 42%, rgba(15,20,28,.05) 75%); }
.login-contenido { position: relative; z-index: 2; min-height: 100vh; box-sizing: border-box; padding: 64px 72px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-lema { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; max-width: 520px; }
.login-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid rgba(240,138,60,.6); border-radius: 999px; color: #F6A666; font-size: 12px; font-weight: 700; letter-spacing: .14em; }
.login-chip .punto { width: 7px; height: 7px; border-radius: 50%; background: #34D399; animation: latido 1.8s ease-in-out infinite; }
.login-lema h2 { margin: 0; font-weight: 800; font-size: 60px; line-height: 1.04; letter-spacing: -.02em; color: #fff; }
.login-lema p { margin: 0; font-size: 18px; line-height: 1.5; color: #B8C1CE; }
.login-modulos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: 760px; }
.vidrio { background: rgba(17,22,31,.72); border: 1px solid rgba(255,255,255,.09); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.vidrio strong { font-weight: 700; font-size: 15px; color: #fff; }
.vidrio small { font-size: 13px; line-height: 1.4; color: #9AA5B4; }
.vidrio .icono { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.icono.naranja { background: rgba(240,138,60,.16); color: #F6A666; }
.icono.azul { background: rgba(56,189,248,.14); color: #7DD3FC; }
.icono.verde { background: rgba(52,211,153,.14); color: #6EE7B7; }
.icono.amarillo { background: rgba(250,204,21,.14); color: #FDE047; }
.login-panel { flex: 1 1 400px; max-width: 100%; min-height: 100vh; background: #fff; display: flex; flex-direction: column; box-sizing: border-box; }
.login-caja { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; width: 100%; max-width: 320px; margin: 0 auto; padding: 48px 0; }
.login-logo { width: 170px; height: auto; margin-bottom: 14px; }
.login-caja h1 { margin: 0; font-weight: 800; font-size: 28px; letter-spacing: -.01em; color: #111827; }
.login-texto { margin: 0; font-size: 15px; line-height: 1.5; color: #4B5563; }
.login-btn { width: 100%; height: 52px; margin-top: 12px; border: 0; border-radius: 10px; background: #C2410C; color: #fff; font: inherit; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 6px 16px rgba(194,65,12,.25); cursor: pointer; transition: background .15s, transform .05s; }
.login-btn:hover { background: #9A3412; }
.login-btn:active { transform: translateY(1px); }
.login-btn:focus-visible { outline: 3px solid #FDBA74; outline-offset: 2px; }
.login-pie { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: #6B7280; }
.login-ayuda { padding: 18px 40px; border-top: 1px solid #EEF0F3; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 13px; color: #6B7280; }
.login-ayuda a { color: #C2410C; font-weight: 600; } .login-ayuda a:hover { color: #9A3412; }
@keyframes fluye { to { stroke-dashoffset: -48; } }
@keyframes latido { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
/* Pantallas medianas: las 4 tarjetas pasan a 2 columnas */
@media (max-width: 1180px) { .login-modulos { grid-template-columns: repeat(2, minmax(0, 1fr)); } .login-lema h2 { font-size: 48px; } }
/* Celular: el mapa queda arriba (más bajo) y el panel de ingreso debajo */
@media (max-width: 760px) {
  .login-mapa, .login-contenido { min-height: 0; }
  .login-contenido { padding: 32px 22px 26px; gap: 22px; }
  .login-lema h2 { font-size: 38px; }
  .login-lema p { font-size: 15px; }
  /* En celular se ocultan las tarjetas para que el botón de ingreso se vea sin bajar */
  .login-modulos { display: none; }
  .login-panel { min-height: 0; }
  .login-caja { padding: 32px 22px; max-width: 380px; }
  .login-btn { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .ruta, .login-chip .punto { animation: none; } .vehiculo-mov { display: none; } }

/* ---------- Sin acceso (conductor sin vehículo) ---------- */
.sin-acceso { position: fixed; inset: 0; z-index: 40; background: #0F141C; display: flex; align-items: center; justify-content: center; padding: 20px; font-family: Inter, system-ui, sans-serif; }
.sin-acceso-caja { background: #fff; border-radius: 16px; max-width: 440px; width: 100%; padding: 36px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; border-top: 4px solid #C2410C; }
.sin-acceso-caja .login-logo { width: 130px; margin-bottom: 4px; }
.sin-acceso-caja h1 { margin: 0; font-size: 26px; }
.icono-candado { width: 58px; height: 58px; border-radius: 50%; background: #fde2e2; color: var(--rojo); display: flex; align-items: center; justify-content: center; }
.sin-acceso-usuario { margin: 0; color: #6B7280; font-size: 13.5px; }
.sin-acceso-caja .login-btn { margin-top: 8px; }

/* ---------- Campos bloqueados y buscador de personas ---------- */
input.bloqueado { background: #f3f4f6; color: #333; cursor: not-allowed; border-style: dashed; }
.autocompletar { position: relative; }
.sugerencias { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: 2px 0 0; padding: 4px 0; list-style: none; background: #fff; border: 1px solid var(--borde); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; }
.sug { padding: 7px 12px; cursor: pointer; display: flex; flex-direction: column; font-weight: 400; }
.sug strong { font-size: 14px; } .sug small { color: #666; font-size: 12px; }
.sug:hover, .sug.activa { background: #fff1e5; }
.sug { position: relative; }
.sug-bloqueado strong, .sug-bloqueado small { color: #9ca3af; }
.sug-etiqueta { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: #fde2e2; color: var(--rojo); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.sug-msg { padding: 8px 12px; color: #666; font-size: 13px; font-weight: 400; }

/* ---------- Registro fotográfico por secciones ---------- */
.grupo-fotos { margin-top: 14px; }
.grupo-fotos h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 15px; color: var(--gris); border-bottom: 2px solid var(--naranja); padding-bottom: 4px; }
.cuenta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #fde2e2; color: var(--rojo); }
.cuenta.completo { background: #e7f5ea; color: var(--verde); }
.parte-foto { margin-bottom: 12px; }
.parte-titulo { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.casillas { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.casilla-foto { border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.casilla-foto img { width: 100%; height: 120px; object-fit: cover; display: block; }
.casilla-vacia { height: 120px; border: 0; background: #f7f8fa; border-bottom: 2px dashed #c9cdd4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #6b7280; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.casilla-vacia:hover { background: #fff4eb; color: var(--naranja-osc); }
.icono-camara { font-size: 26px; }
.casilla-pie { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; padding: 5px 8px; font-size: 12px; color: #555; min-height: 34px; }
.casilla-acciones { display: flex; gap: 4px; flex-wrap: wrap; }
.casilla-acciones .btn.chico { padding: 2px 7px; font-size: 11.5px; }
.casilla-foto.con-foto { border-color: #9fd3ab; }
.casilla-foto.falta-foto { border: 2px solid var(--rojo); }
.casilla-foto.falta-foto .casilla-vacia { background: #fff5f5; }
.lienzo-foto { width: 100%; max-height: 52vh; object-fit: contain; display: block; border-radius: 8px; background: #111; touch-action: none; cursor: crosshair; }
.barra-lapiz { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.barra-lapiz .ayuda { flex: 1 1 200px; margin: 0; }
.nota-foto { margin-top: 2px; }
.confirmar-foto .campo { margin-top: 10px; }
.marca-chip { margin-left: 4px; font-size: 12px; }
.casilla-nota { padding: 0 8px 6px; font-size: 11.5px; color: #a33; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.confirmar-foto img { width: 100%; max-height: 55vh; object-fit: contain; border-radius: 8px; background: #111; }
.confirmar-foto p { margin: 0 0 8px; }

/* ---------- Vehículos ---------- */
.modal-caja.ancho { max-width: 860px; }
.resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px 14px; display: flex; flex-direction: column; }
.kpi strong { font-size: 24px; }
.kpi span { font-size: 12.5px; color: #666; }
.kpi.mal { border-color: #f0b4b4; background: #fff5f5; } .kpi.mal strong { color: var(--rojo); }
.kpi.aviso { border-color: #f6d28b; background: #fffaf0; } .kpi.aviso strong { color: #a66300; }
.filtros { display: flex; gap: 8px; margin-bottom: 10px; }
.filtros input { flex: 1; } .filtros select { width: 160px; }
.tabla-cont { padding: 0; overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabla th { text-align: left; background: var(--gris); color: #fff; padding: 9px 8px; font-weight: 600; font-size: 12.5px; }
.tabla td { padding: 7px 8px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
.tabla tbody tr:hover { background: #fafbfc; }
.tabla .num { text-align: right; }
.tabla .vacio { text-align: center; color: #777; padding: 24px; }
.placa { display: inline-block; background: #ffd400; border: 2px solid #222; border-radius: 4px; padding: 1px 7px; font-weight: 800; letter-spacing: 1px; font-family: Consolas, monospace; }
.badge { display: inline-flex; flex-direction: column; line-height: 1.2; padding: 3px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge small { font-weight: 400; font-size: 11px; }
.badge.vigente { background: #e7f5ea; color: var(--verde); }
.badge.porvencer { background: #fff4dc; color: #a66300; }
.badge.vencido { background: #fde2e2; color: var(--rojo); }
.badge.sin { background: #f0f1f3; color: #6b7280; }
.badge.entregado { background: #e6effc; color: #1d4f9c; }
.acciones-celda { display: flex; gap: 4px; }
.doc-fila { border: 1px solid var(--borde); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.doc-fila strong { font-size: 13.5px; display: block; margin-bottom: 6px; }
.errores { background: #fff1f1; border: 1px solid #f0b4b4; color: var(--rojo); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13.5px; }
.errores ul { margin: 4px 0 0; }
input:disabled, textarea:disabled { background: #f6f7f9; color: #444; }

@media (max-width: 760px) {
  .resumen { grid-template-columns: repeat(2, 1fr); }
  .tabla thead { display: none; }
  .tabla, .tabla tbody, .tabla tr, .tabla td { display: block; width: 100%; }
  .tabla tr { border-bottom: 6px solid #eef0f3; padding: 6px 0; }
  .tabla td { border: 0; padding: 4px 12px; display: flex; justify-content: space-between; gap: 8px; }
  .tabla td[data-t]::before { content: attr(data-t); color: #666; font-size: 12px; }
  .tabla .num { text-align: left; }
  .grid3, .grid2, .firmas, .fila2 { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; gap: 6px; }
  .item.solo-obs .item-obs { grid-column: auto; }
  .casillas { grid-template-columns: repeat(2, 1fr); }
  .casilla-foto img, .casilla-vacia { height: 100px; }
  .plan-fila { grid-template-columns: 1fr 1fr; }
  .encabezado-pantalla { flex-direction: column; }
  .titulo-app { display: none; }
  .topbar { padding: 6px 10px; }
  .usuario { font-size: 12px; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .tabs { position: static; }
}

/* ===== Mantenimiento ===== */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 14px; }
.titulo-bloque { margin: 18px 0 8px; font-size: 16px; }
.tipos-mto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tipo-mto { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px; border: 2px solid var(--borde); border-radius: var(--radio); background: #fff; cursor: pointer; font: inherit; }
.tipo-mto strong { font-size: 15px; }
.tipo-mto small { color: #666; }
.tipo-mto:hover { border-color: var(--naranja); }
.tipo-mto.activo { border-color: var(--naranja); background: #fff6ee; box-shadow: inset 0 0 0 1px var(--naranja); }
.seccion-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.op-R input:checked + span { background: var(--verde); color: #fff; }
.op-NR input:checked + span { background: var(--rojo); color: #fff; }
.elementos-mto { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.elemento-mto { border: 1px solid var(--borde); border-left: 4px solid var(--naranja); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.elemento-cab { display: flex; justify-content: space-between; align-items: center; }
.elemento-mto textarea, .form-mto textarea { width: 100%; }
.elemento-mto select { width: 100%; }
@media (max-width: 760px) {
  .grid4, .tipos-mto { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid4, .tipos-mto { grid-template-columns: 1fr; }
}

/* ===== Novedades ===== */
.tipos-nov { grid-template-columns: repeat(4, 1fr); }
.tipos-nov .tipo-mto strong { font-size: 14px; }
.span2 { grid-column: span 2; }
.pregunta-sino { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid #eef0f3; font-size: 14px; }
.pregunta-sino + .campo, .pregunta-sino + div { margin: 8px 0 4px; }
.segmentado .op-SI span, .segmentado .op-NO span { min-width: 56px; }
.sino-inv .op-SI input:checked + span { background: var(--verde); color: #fff; }
.sino-inv .op-NO input:checked + span { background: var(--rojo); color: #fff; }
.terceros { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.tercero { align-items: end; background: #fafbfc; border: 1px solid var(--borde); border-radius: 8px; padding: 8px; }
.agregar-foto { margin-top: 8px; }
.resumen-novedad, .aviso-novedad { border-left: 4px solid var(--naranja); }
.resumen-novedad p { margin: 6px 0; }
@media (max-width: 760px) {
  .tipos-nov { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: auto; }
  .pregunta-sino { flex-wrap: wrap; }
}
.cuenta:empty { display: none; }
.tercero .campo .btn { align-self: flex-start; }

/* ===== Usuarios ===== */
.perfiles-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.perfil-card { background: #fff; border: 1px solid var(--borde); border-left: 4px solid #999; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.perfil-card span { color: #555; }
.rol-admin { border-left-color: var(--naranja) !important; }
.rol-gestion { border-left-color: #1d4ed8 !important; }
.rol-conductor { border-left-color: #6b7280 !important; }
.badge-rol { display: inline-block; padding: 3px 9px; border-radius: 6px; font-weight: 700; font-size: 12.5px; color: #fff; background: #6b7280; }
.badge-rol.rol-admin { background: var(--naranja); }
.badge-rol.rol-gestion { background: #1d4ed8; }
.chip-yo { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 700; background: #fff6ee; color: var(--naranja); border: 1px solid var(--naranja); border-radius: 10px; padding: 0 7px; }
.selector-perfil { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.opcion-perfil { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--borde); border-left: 4px solid #999; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.opcion-perfil input { margin-top: 3px; }
.opcion-perfil small { display: block; color: #555; font-weight: 400; }
.opcion-perfil:has(input:checked) { background: #fff6ee; box-shadow: inset 0 0 0 1px var(--naranja); }
.tabla .placa + .placa { margin-left: 4px; }
@media (max-width: 760px) { .perfiles-info { grid-template-columns: 1fr; } }

/* ===== Hoja de vida del vehículo ===== */
.placa-grande { font-size: 20px; vertical-align: middle; margin-left: 6px; }
.hv-ficha { display: flex; flex-direction: column; gap: 12px; }
.hv-estado { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hv-datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; }
.hv-dato { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.hv-dato > span:first-child { font-size: 12px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.hv-dato .badge { align-self: flex-start; }
.hv-conductores { margin: -4px 0 12px; }
.hv-cab-linea { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.hv-cab-linea h3 { margin: 0; }
.hv-filtros { display: flex; flex-wrap: wrap; gap: 6px; }
.hv-chip { border: 1px solid var(--borde); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; }
.hv-chip b { color: #6b7280; }
.hv-chip.activo { background: var(--naranja); border-color: var(--naranja); color: #fff; }
.hv-chip.activo b { color: #fff; }
.hv-linea { position: relative; padding-left: 8px; }
.hv-mes { margin: 14px 0 6px 44px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #c2410c; }
.hv-evento { position: relative; display: flex; gap: 12px; padding: 0 0 14px; }
.hv-evento::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: #e5e7eb; }
.hv-punto { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; background: #f3f4f6; color: #374151; border: 2px solid #e5e7eb; z-index: 1; }
.hv-cuerpo { flex: 1; min-width: 0; border: 1px solid #eef0f3; border-radius: 10px; padding: 9px 12px; background: #fff; }
.hv-cab { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hv-cab strong { font-size: 14.5px; }
.hv-fecha { margin-left: auto; font-size: 13px; color: #6b7280; white-space: nowrap; }
.hv-cuerpo p { margin: 4px 0 0; font-size: 13.5px; color: #374151; }
.hv-alerta { color: #b91c1c !important; font-weight: 600; }
.hv-pie { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: #6b7280; }
.hv-consec { font-weight: 700; color: #374151; }
.hv-pie .btn { margin-left: auto; }
.hv-entrega .hv-punto { background: #fff1e6; color: #c2410c; border-color: #f7c9a5; }
.hv-devolucion .hv-punto { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.hv-preventivo .hv-punto { background: #e6f4f1; color: #0f766e; border-color: #a7d8cf; }
.hv-correctivo .hv-punto { background: #fef3c7; color: #b45309; border-color: #f5d58a; }
.hv-novedad .hv-punto { background: #fee2e2; color: #b91c1c; border-color: #f5b5b5; }
.hv-solucion .hv-punto { background: #dcfce7; color: #15803d; border-color: #a7e3b9; }
.hv-ingreso .hv-punto { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.hv-entrega .hv-cuerpo { border-left: 3px solid #e8772e; }
.hv-novedad .hv-cuerpo { border-left: 3px solid #dc2626; }
.hv-correctivo .hv-cuerpo { border-left: 3px solid #ca8a04; }
.hv-preventivo .hv-cuerpo { border-left: 3px solid #0f766e; }
@media (max-width: 640px) { .hv-fecha { margin-left: 0; width: 100%; } .hv-mes { margin-left: 0; } }

/* ===== Modo sin internet ===== */
.estado-red { border: 1px solid #f5d58a; background: #fef3c7; color: #92400e; border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.estado-red.sin-red { border-color: #f5b5b5; background: #fee2e2; color: #991b1b; }
.estado-red.con-error { border-color: #f5b5b5; background: #fff1f1; color: #b91c1c; }
.pendiente { border: 1px solid var(--borde); border-left: 4px solid #ca8a04; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; display: grid; gap: 4px; }
.pendiente.error { border-left-color: #dc2626; background: #fff8f8; }
.pendiente p { margin: 0; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; transition: opacity .3s, transform .3s; z-index: 9999; max-width: calc(100vw - 32px); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.estado-red.lista { border-color: #a7e3b9; background: #ecfdf3; color: #15803d; }
