/* Flota — hoja de estilos */
:root {
  --fondo:      #0f172a;
  --fondo-2:    #1e293b;
  --tarjeta:    #1e293b;
  --borde:      #334155;
  --texto:      #e2e8f0;
  --apagado:    #94a3b8;
  --primario:   #38bdf8;
  --primario-t: #0284c7;
  --rojo:       #f87171;
  --ambar:      #fbbf24;
  --verde:      #4ade80;
  --radio:      14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --fondo:   #f1f5f9;
    --fondo-2: #ffffff;
    --tarjeta: #ffffff;
    --borde:   #e2e8f0;
    --texto:   #0f172a;
    --apagado: #64748b;
    --primario:#0284c7;
    --primario-t:#0369a1;
    --rojo:    #dc2626;
    --ambar:   #b45309;
    --verde:   #15803d;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; font-weight: 650; }
p { margin: 0 0 8px; }
.apagado { color: var(--apagado); font-size: 14px; }
.error { color: var(--rojo); font-size: 14px; }
.centro { text-align: center; }

/* ---------------------------------------------------------------- acceso */
.acceso {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.tarjeta-acceso {
  width: 100%;
  max-width: 380px;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: 20px;
  padding: 28px 22px;
  text-align: center;
}
.tarjeta-acceso .logo { font-size: 44px; }
.tarjeta-acceso h1 { font-size: 26px; margin-bottom: 4px; }
.tarjeta-acceso .campo { text-align: left; margin-top: 16px; }

/* -------------------------------------------------------------- estructura */
.cabecera {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--fondo) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borde);
}
.cabecera h1 { font-size: 20px; }

main { padding: 16px 16px 96px; max-width: 820px; margin: 0 auto; }

.menu {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--fondo-2);
  border-top: 1px solid var(--borde);
  padding-bottom: env(safe-area-inset-bottom);
}
.menu button {
  background: none; border: 0; color: var(--apagado);
  font: inherit; font-size: 11px; padding: 8px 4px 10px;
  display: grid; gap: 2px; justify-items: center; cursor: pointer;
}
.menu button span { font-size: 20px; line-height: 1.1; }
.menu button.activo { color: var(--primario); }

/* ---------------------------------------------------------------- tarjetas */
.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 14px;
  margin-bottom: 12px;
}
.tarjeta.pulsable { cursor: pointer; }
.tarjeta.pulsable:active { transform: scale(0.995); }

.fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fila-inicio { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fila-inicio > .col { flex: 1 1 auto; min-width: 0; }
.fila-inicio > .etiqueta { flex: 0 0 auto; }
.col-derecha { flex: 0 0 auto; text-align: right; white-space: nowrap; justify-items: end; }
.fila-botones { display: inline-flex; gap: 2px; }
.col { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.titulo-fila { font-weight: 600; }
.mini { font-size: 13px; color: var(--apagado); }

.borde-rojo  { border-left: 4px solid var(--rojo); }
.borde-ambar { border-left: 4px solid var(--ambar); }
.borde-verde { border-left: 4px solid var(--verde); }

.etiqueta {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--borde); color: var(--apagado);
}
.et-rojo  { color: var(--rojo);   border-color: var(--rojo);   background: color-mix(in srgb, var(--rojo) 12%, transparent); }
.et-ambar { color: var(--ambar);  border-color: var(--ambar);  background: color-mix(in srgb, var(--ambar) 12%, transparent); }
.et-verde { color: var(--verde);  border-color: var(--verde);  background: color-mix(in srgb, var(--verde) 12%, transparent); }

.seccion { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--apagado); }
.vacio { text-align: center; color: var(--apagado); padding: 36px 12px; }
.vacio .icono-grande { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------------------------------------------------------------- botones */
.btn {
  font: inherit; font-size: 15px; font-weight: 600;
  border: 1px solid var(--borde); background: var(--fondo-2); color: var(--texto);
  border-radius: 10px; padding: 10px 14px; cursor: pointer;
}
.btn:active { opacity: .8; }
.btn.primario { background: var(--primario-t); border-color: var(--primario-t); color: #fff; }
.btn.peligro  { color: var(--rojo); border-color: color-mix(in srgb, var(--rojo) 50%, var(--borde)); }
.btn.ancho    { width: 100%; margin-top: 18px; }
.btn.chico    { font-size: 13px; padding: 6px 10px; border-radius: 8px; }
.btn.icono    { padding: 6px 10px; font-size: 18px; background: none; border: 0; color: var(--apagado); }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.fab {
  position: fixed; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 25;
  width: 56px; height: 56px; border-radius: 50%;
  font-size: 28px; line-height: 1; color: #fff;
  background: var(--primario-t); border: 0; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}

/* --------------------------------------------------------------- formularios */
.campo { display: grid; gap: 6px; margin-bottom: 12px; }
.campo > span { font-size: 13px; color: var(--apagado); }
input, select, textarea {
  font: inherit; width: 100%;
  background: var(--fondo); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 10px;
  padding: 11px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primario); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 15px; }
.check input { width: 20px; height: 20px; }

/* -------------------------------------------------------------------- modal */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-caja {
  background: var(--fondo-2);
  width: 100%; max-width: 560px;
  max-height: 92dvh; overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 4px 16px calc(20px + env(safe-area-inset-bottom));
  animation: subir .18s ease-out;
}
@keyframes subir { from { transform: translateY(24px); opacity: .4 } to { transform: none; opacity: 1 } }
.modal-cab {
  position: sticky; top: 0; background: var(--fondo-2);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 10px; margin-bottom: 4px;
}
.modal-cab h2 { font-size: 18px; }
@media (min-width: 640px) {
  .modal { align-items: center; }
  .modal-caja { border-radius: 20px; }
}

/* -------------------------------------------------------------------- aviso */
.aviso {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 80;
  background: #0f172a; color: #f8fafc;
  border: 1px solid var(--borde);
  padding: 10px 16px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  max-width: 90vw; text-align: center;
}

/* ------------------------------------------------------------------ detalle */
.cabecera-veh { display: grid; gap: 6px; margin-bottom: 6px; }
.km-grande { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.lista-limpia { list-style: none; padding: 0; margin: 0; }
.lista-limpia li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--borde);
}
.lista-limpia li:last-child { border-bottom: 0; }
/* --------------------------------------------------------------- documentos */
.doc-enlace {
  display: flex; align-items: flex-start; gap: 10px;
  color: inherit; text-decoration: none; min-width: 0; flex: 1 1 auto;
}
.doc-enlace:active { opacity: .7; }
.doc-enlace .col > span:first-child { font-weight: 600; overflow-wrap: anywhere; }
.doc-icono { font-size: 20px; line-height: 1.2; flex: 0 0 auto; }
.lista-adjuntos {
  margin-top: 10px; padding-top: 6px;
  border-top: 1px dashed var(--borde);
}
.lista-adjuntos li { padding: 8px 0; border-bottom: 0; }
input[type=file] { padding: 9px 10px; font-size: 14px; }

.volver { background: none; border: 0; color: var(--primario); font: inherit; font-weight: 600; cursor: pointer; padding: 0 0 10px; }
.resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-bottom: 14px; }
.resumen div { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; min-width: 0; }
.resumen b { display: block; font-size: clamp(16px, 5.2vw, 22px); overflow-wrap: anywhere; }
