/* ============================================================
   Control de Flota GEP — interfaz moderna (barra lateral)
   Paleta corporativa: celeste oscuro
   ============================================================ */
:root {
  --azul-900: #06283d;
  --azul-800: #082c44;      /* celeste oscuro GEP */
  --azul-700: #0b3d5c;
  --azul-600: #14557d;
  --celeste: #2e9fd4;
  --celeste-claro: #7fd0f5;
  --fondo: #eef4f8;
  --tarjeta: #ffffff;
  --texto: #162b36;
  --gris: #64798a;
  --borde: #dbe6ee;
  --ok: #17925022;
  --ok-txt: #128a4a;
  --alerta-bg: #ffb02e22;
  --alerta-txt: #b07c00;
  --peligro-bg: #e2484822;
  --peligro-txt: #c73838;
  --radio: 14px;
  --sombra: 0 1px 3px rgba(8, 44, 68, .08), 0 8px 24px -12px rgba(8, 44, 68, .18);
  --sombra-hover: 0 4px 8px rgba(8, 44, 68, .10), 0 16px 32px -12px rgba(8, 44, 68, .25);
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--texto);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.45;
  background: var(--fondo);
}

/* ================= barra superior horizontal ================= */
header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(100deg, var(--azul-900) 0%, var(--azul-700) 55%, var(--azul-600) 100%);
  color: #fff; display: flex; align-items: center; gap: 20px;
  padding: 10px 26px; flex-wrap: wrap;
  box-shadow: 0 2px 18px rgba(6, 40, 61, .45);
  border-bottom: 2px solid var(--celeste);
}
header .marca a {
  color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px;
  font-size: 1.08em; letter-spacing: .2px; white-space: nowrap;
}
header .marca strong { color: var(--celeste-claro); font-weight: 700; }
/* ===== branding GEP Desarrollo / Innovación ===== */
header .marca .marca-txt { display: inline-flex; flex-direction: column; line-height: 1.08; }
header .marca .marca-tag {
  font-size: .60rem; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--celeste-claro); font-weight: 600; margin-top: 2px; opacity: .95;
}
header .marca .marca-tag b { color: var(--celeste); font-weight: 800; }
footer.gep-pie {
  margin-top: 36px;
  background: linear-gradient(100deg, var(--azul-900) 0%, var(--azul-800) 45%, var(--azul-600) 100%);
  border-top: 2px solid var(--celeste);
  color: #cfe6f6; text-align: center; padding: 16px 20px;
}
footer.gep-pie .marca-gep { font-size: 1.05rem; letter-spacing: 1px; display: block; }
footer.gep-pie .marca-gep strong {
  color: var(--celeste-claro); font-weight: 800;
  text-shadow: 0 0 12px rgba(127, 208, 245, .6);
}
footer.gep-pie .marca-gep .sep { color: var(--celeste); margin: 0 5px; }
footer.gep-pie .gep-sub { display: block; font-size: .78rem; color: #8fb6cf; margin-top: 3px; letter-spacing: .3px; }
header .marca .logo {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--celeste), #1a6f9e);
  box-shadow: 0 2px 8px rgba(46, 159, 212, .5); font-size: 18px;
}
header nav { display: flex; align-items: stretch; flex-wrap: wrap; flex: 1; row-gap: 4px; }
.menu-item { position: relative; }
/* el item con el mouse encima (y su desplegable) siempre por sobre las demas
   pestañas, incluso cuando el menu se parte en dos filas */
.menu-item:hover, .menu-item:focus-within { z-index: 300; }
.menu-item > a.top {
  display: flex; align-items: center; gap: 5px; height: 100%;
  color: #d9edf8; text-decoration: none; padding: 10px 15px; border-radius: 10px;
  font-weight: 500; transition: background .15s, color .15s; white-space: nowrap;
}
.menu-item > a.top:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.menu-item > a.top.activa {
  background: linear-gradient(120deg, rgba(46, 159, 212, .4), rgba(46, 159, 212, .2));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(127, 208, 245, .35);
}
.menu-item .caret { font-size: .7em; opacity: .7; transition: transform .18s; }
.menu-item:hover .caret { transform: rotate(180deg); }

/* cascada hacia abajo */
.submenu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 240px; z-index: 320;
  background: #fff; border-radius: 13px; padding: 8px;
  box-shadow: 0 14px 40px -8px rgba(6, 40, 61, .45), 0 2px 8px rgba(6, 40, 61, .15);
  border: 1px solid var(--borde);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.menu-item:hover .submenu, .menu-item:focus-within .submenu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.submenu::before {           /* puente para no perder el hover */
  content: ""; position: absolute; top: -8px; left: 0; right: 0; height: 8px;
}
.submenu a {
  display: block; color: var(--texto); text-decoration: none;
  padding: 9px 13px; border-radius: 9px; font-size: .95em;
  transition: background .12s, color .12s;
}
.submenu a:hover { background: #eaf4fb; color: var(--azul-600); }
.submenu .vacio { display: block; padding: 9px 13px; color: var(--gris); font-size: .9em; }
.submenu .sep { height: 1px; background: var(--borde); margin: 6px 8px; }
.submenu a.agregar { color: var(--celeste); font-weight: 600; }
.submenu a.agregar:hover { background: #e0f2fc; }

header .sesion { display: flex; align-items: center; gap: 12px; margin-left: auto; }
header .quien {
  color: var(--celeste-claro); font-size: .88em; padding: 5px 13px;
  background: rgba(255, 255, 255, .08); border-radius: 20px; white-space: nowrap;
}
header .salir { color: #ffb9b9; text-decoration: none; padding: 6px 10px; border-radius: 8px; }
header .salir:hover { background: rgba(255, 255, 255, .1); color: #fff; }
/* boton discreto de desarrollador (acceso a la bitacora de control) */
header .dev-btn { text-decoration: none; font-size: .95em; opacity: .35; padding: 4px 6px;
  border-radius: 8px; transition: opacity .15s, background .15s; }
header .dev-btn:hover { opacity: 1; background: rgba(255, 255, 255, .12); }

main {
  max-width: 1180px; margin: 0 auto; padding: 28px 24px 70px;
}
body {
  background:
    radial-gradient(1000px 340px at 85% -60px, #d5e9f5 0%, transparent 60%),
    var(--fondo);
}
main.solo { min-height: 100vh; max-width: none; padding: 0 20px;
  background: linear-gradient(140deg, var(--azul-900) 0%, var(--azul-700) 55%, var(--azul-600) 100%); }

/* ================= avisos ================= */
.aviso { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; box-shadow: var(--sombra); }
.aviso.ok { background: #e5f7ec; color: var(--ok-txt); border-left: 4px solid var(--ok-txt); }
.aviso.error { background: #fdecec; color: var(--peligro-txt); border-left: 4px solid var(--peligro-txt); }
.nota-ocr {
  background: #fff7e2; border-left: 4px solid #e5b93c; color: #7c6511;
  padding: 12px 16px; border-radius: 12px; font-size: .92em; margin-bottom: 16px;
  box-shadow: var(--sombra);
}

h1 { color: var(--azul-700); font-size: 1.62em; margin: 4px 0 16px; font-weight: 650; letter-spacing: -.3px; }
h2 { color: var(--azul-600); font-size: 1.12em; margin: 28px 0 12px; font-weight: 650; }

/* ================= KPIs del inicio ================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 4px 0 26px; }
.kpi {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 14px 18px; box-shadow: var(--sombra); position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.kpi.azul::before   { background: linear-gradient(180deg, var(--celeste), var(--azul-600)); }
.kpi.verde::before  { background: linear-gradient(180deg, #35c877, #1e9a55); }
.kpi.ambar::before  { background: linear-gradient(180deg, #f4c14b, #d99a06); }
.kpi.rojo::before   { background: linear-gradient(180deg, #ee6a6a, #c73838); }
.kpi.gris::before   { background: linear-gradient(180deg, #c2d0da, #9aacb9); }
.kpi .v { font-size: 1.75em; font-weight: 750; color: var(--azul-700); line-height: 1.1; }
.kpi .k { font-size: .8em; color: var(--gris); font-weight: 600; letter-spacing: .3px; }

/* ================= tarjetas ================= */
.tarjeta {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--sombra);
}
.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* --- banner GEP Innovacion --- */
.banner-gep {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background:
    radial-gradient(420px 130px at 12% 120%, rgba(46, 159, 212, .45) 0%, transparent 65%),
    radial-gradient(360px 150px at 88% -30%, rgba(127, 208, 245, .28) 0%, transparent 60%),
    linear-gradient(110deg, var(--azul-900) 0%, var(--azul-700) 58%, var(--azul-600) 100%);
  color: #fff; border-radius: 16px; padding: 20px 26px; margin: 2px 0 20px;
  box-shadow: 0 10px 30px -10px rgba(6, 40, 61, .55);
  border: 1px solid rgba(127, 208, 245, .25);
}
.banner-gep .texto { display: flex; flex-direction: column; gap: 3px; }
.banner-gep .titulo { font-size: 1.5em; letter-spacing: .5px; font-weight: 400; }
.banner-gep .titulo strong { color: var(--celeste-claro); font-weight: 750; }
.banner-gep .lema { color: #bcdcee; font-size: .9em; letter-spacing: .3px; }

/* --- boton gatoo.cl en la barra --- */
.btn-gatoo {
  color: #fff; text-decoration: none; font-size: .88em; font-weight: 600;
  padding: 6px 14px; border-radius: 20px; white-space: nowrap;
  background: linear-gradient(120deg, var(--celeste), #1a6f9e);
  box-shadow: 0 2px 8px rgba(46, 159, 212, .45);
  transition: filter .12s, transform .12s;
}
.btn-gatoo:hover { filter: brightness(1.15); transform: translateY(-1px); }

/* --- inicio: encabezado con buscador --- */
.encabezado-flota { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.encabezado-flota h1 { margin: 4px 0; flex: 0 0 auto; }
.encabezado-flota #buscador {
  flex: 1 1 260px; max-width: 430px; margin-left: auto;
  padding: 10px 16px; border-radius: 999px; border: 1.5px solid var(--borde);
  background: #fff; box-shadow: var(--sombra); font-size: .95em;
}
.encabezado-flota #buscador:focus { border-color: var(--celeste); box-shadow: 0 0 0 3px rgba(46,159,212,.18); }

/* --- inicio: lista compacta de unidades --- */
.lista { display: flex; flex-direction: column; gap: 8px; }
.fila {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--texto);
  background: #fff; border: 1px solid var(--borde); border-radius: 12px;
  padding: 8px 14px 8px 10px; box-shadow: var(--sombra);
  border-left: 5px solid var(--borde);
  transition: transform .12s ease, box-shadow .12s ease;
}
.fila:hover { transform: translateX(3px); box-shadow: var(--sombra-hover); }
.fila.vigente    { border-left-color: #2bb56a; }
.fila.por_vencer { border-left-color: #eab52c; }
.fila.vencido    { border-left-color: #d64545; }
.fila.falta      { border-left-color: #a9bac6; }
.fila .thumb {
  width: 54px; height: 44px; border-radius: 9px; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(160deg, #e7f2fa, #cfe4f2); display: grid; place-items: center;
}
.fila .thumb img.real { width: 100%; height: 100%; object-fit: cover; }
.fila .thumb img.ilus { width: 86%; height: 82%; object-fit: contain; }
.fila .quien-es { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fila .nombre { font-weight: 650; color: var(--azul-700); }
.fila .nombre small { color: var(--alerta-txt); font-weight: 600; }
.fila .detalle { color: var(--gris); font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila .docs-dots { display: flex; gap: 5px; flex-shrink: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.dot.vigente    { background: #2bb56a; }
.dot.por_vencer { background: #eab52c; }
.dot.vencido    { background: #d64545; }
.dot.falta      { background: #ccd8e0; }
.fila .resumen { flex-shrink: 0; min-width: 92px; text-align: center; }
.fila .ir { color: #b9c9d4; font-size: 1.4em; flex-shrink: 0; }
@media (max-width: 700px) {
  .fila .docs-dots { display: none; }
  .fila .detalle { white-space: normal; }
}

/* --- tarjetas de unidades (inicio) --- */
.unidad-tarjeta { padding: 0; overflow: hidden; transition: transform .16s ease, box-shadow .16s ease; }
.unidad-tarjeta:hover { transform: translateY(-3px); box-shadow: var(--sombra-hover); }
.unidad-tarjeta .foto {
  height: 150px; position: relative;
  background: linear-gradient(160deg, #e7f2fa 0%, #cfe4f2 100%);
  display: grid; place-items: center;
}
.unidad-tarjeta .foto img.real { width: 100%; height: 100%; object-fit: cover; }
.unidad-tarjeta .foto img.ilus { width: 72%; height: 82%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(11,61,92,.18)); }
.unidad-tarjeta .franja { height: 5px; }
.franja.vigente   { background: linear-gradient(90deg, #1e9a55, #35c877); }
.franja.por_vencer{ background: linear-gradient(90deg, #d99a06, #f4c14b); }
.franja.vencido   { background: linear-gradient(90deg, #c73838, #ee6a6a); }
.franja.falta     { background: linear-gradient(90deg, #9aacb9, #c2d0da); }
.unidad-tarjeta .cuerpo { padding: 14px 18px 16px; }
.unidad-tarjeta a.titulo { font-size: 1.12em; color: var(--azul-700); text-decoration: none; font-weight: 650; }
.unidad-tarjeta a.titulo:hover { color: var(--celeste); }
.unidad-tarjeta .sub { color: var(--gris); font-size: .88em; margin: 3px 0 10px; }
.estados { font-size: .9em; line-height: 1.85; color: #3d5261; }

/* ================= chips ================= */
.chip {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: .8em; font-weight: 600; letter-spacing: .2px; vertical-align: middle;
}
.chip.categoria { background: #e0eff9; color: var(--azul-600); }
.chip.vigente { background: var(--ok); color: var(--ok-txt); }
.chip.por_vencer { background: var(--alerta-bg); color: var(--alerta-txt); }
.chip.vencido { background: var(--peligro-bg); color: var(--peligro-txt); }
.chip.falta { background: #edf1f5; color: var(--gris); }

/* ================= HERO de la unidad ================= */
.hero {
  border-radius: 18px; overflow: hidden; margin-bottom: 20px;
  background: linear-gradient(115deg, var(--azul-900) 0%, var(--azul-700) 60%, var(--azul-600) 100%);
  color: #fff; box-shadow: 0 10px 34px -10px rgba(6, 40, 61, .55);
  display: flex; flex-wrap: wrap;
}
.hero .foto {
  flex: 0 0 320px; min-height: 230px; max-height: 300px; position: relative;
  background: rgba(255, 255, 255, .07); display: grid; place-items: center;
}
.hero .foto img.real { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.hero .foto img.ilus { width: 74%; height: 74%; object-fit: contain; opacity: .95;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.35)); }
.hero .foto form { position: absolute; bottom: 10px; right: 10px; z-index: 2; }
.hero .datos { flex: 1 1 380px; padding: 24px 28px; }
.hero h1 { color: #fff; margin: 0 0 4px; font-size: 1.7em; }
.hero .sub { color: var(--celeste-claro); margin-bottom: 16px; font-size: .95em; }
.hero .stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.stat {
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px; padding: 10px 16px; min-width: 120px; backdrop-filter: blur(4px);
}
.stat .v { font-size: 1.25em; font-weight: 700; color: #fff; }
.stat .k { font-size: .72em; color: var(--celeste-claro); text-transform: uppercase; letter-spacing: .8px; }
.stat.amarillo {
  background: linear-gradient(120deg, #ffce4b, #ffb02e); border-color: #ffce4b;
  box-shadow: 0 4px 16px rgba(255, 176, 46, .45);
}
.stat.amarillo .v { color: #4d3800; }
.stat.amarillo .k { color: #7a5c00; }
.stat.rojo { background: linear-gradient(120deg, #ff7a7a, #e24848); border-color: #ff9c9c; }
.stat.rojo .k { color: #ffd7d7; }

/* ================= formularios ================= */
form.ficha { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 14px; }
form.ficha .ancho { grid-column: 1 / -1; }
label { display: block; font-size: .82em; color: var(--gris); margin-bottom: 4px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--borde); border-radius: 10px;
  font: inherit; background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--celeste); box-shadow: 0 0 0 3px rgba(46, 159, 212, .18);
}
.detectado { background: #eaf6fd; border-color: var(--celeste); }
.faltante { background: #fff8e8; border-color: #e5b93c; }
.consejos ul { margin: 6px 0 0; padding-left: 20px; color: #3d5261; line-height: 1.75; }
.consejos li { margin-bottom: 3px; }

.boton {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(120deg, var(--azul-600), var(--azul-700));
  color: #fff; border: 0; padding: 10px 22px; border-radius: 11px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: 0 3px 10px -2px rgba(11, 61, 92, .4);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.boton:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 6px 16px -4px rgba(11, 61, 92, .5); }
.boton.secundario { background: #e4eef6; color: var(--azul-600); box-shadow: none; }
.boton.secundario:hover { background: #d3e4f0; filter: none; }
.boton.chico { padding: 6px 14px; font-size: .85em; border-radius: 9px; }
.boton.peligro { background: #fdecec; color: var(--peligro-txt); }
.boton.peligro:hover { background: #f8d7d7; }

/* ================= tablas ================= */
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: #fff; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--borde);
}
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #e9f0f5; }
tr:last-child td { border-bottom: none; }
th {
  background: linear-gradient(180deg, #f0f6fa, #e6eff6); color: var(--azul-600);
  font-size: .82em; text-transform: uppercase; letter-spacing: .6px;
}
tr:hover td { background: #f4f9fc; }
/* separador grueso al cambiar de equipo (mejor lectura del informe) */
tr.sep-equipo td { border-top: 3px solid var(--azul-600); }

/* ================= documentos ================= */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.doc-tarjeta { transition: transform .14s, box-shadow .14s; }
.doc-tarjeta:hover { transform: translateY(-2px); box-shadow: var(--sombra-hover); }
.doc-tarjeta h3 { margin: 0 0 8px; font-size: 1em; color: var(--azul-700); font-weight: 650; }
.doc-tarjeta .estado { margin: 4px 0 10px; }

.acciones { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ================= login ================= */
.login-caja {
  max-width: 400px; margin: 11vh auto 0; background: #fff; border-radius: 18px;
  padding: 34px 34px 30px; box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .5);
}
.login-caja h1 { text-align: center; margin-top: 0; }
.login-caja .logo-login {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px;
  display: grid; place-items: center; font-size: 30px;
  background: linear-gradient(135deg, var(--celeste), #1a6f9e);
  box-shadow: 0 6px 18px rgba(46, 159, 212, .5);
}
.login-caja .boton { width: 100%; justify-content: center; margin-top: 6px; }
.muted { color: var(--gris); font-size: .88em; }

@media (max-width: 860px) {
  header { padding: 10px 14px; gap: 10px; }
  header nav { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  main { padding: 18px 16px 60px; }
  .hero .foto { flex-basis: 100%; }
}
