:root {
  --fondo: #060908;
  --texto: #f2f6f3;
  --texto-suave: #a7b3ab;
  --texto-tenue: #7d8a81;
  --acento: #a5e05c;
  --acento-texto: #0b1a06;
  --ok: #7ee08a;
  --mal: #ff8a7a;
  --vidrio: rgba(255, 255, 255, 0.055);
  --vidrio-hover: rgba(255, 255, 255, 0.09);
  --borde: rgba(255, 255, 255, 0.13);
  --brillo: rgba(255, 255, 255, 0.28);
  --radio: 22px;
  --sombra: 0 24px 60px -24px rgba(0, 0, 0, 0.65);
  --facil: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  background: var(--fondo);
  color: var(--texto);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.solo-lector {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- Fondo: luz difusa que el vidrio refracta ---- */
.fondo { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.fondo::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 120% 90% at 50% 40%, rgba(6, 9, 8, 0) 35%, rgba(6, 9, 8, 0.75) 100%);
}
.orbe { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.8; will-change: transform; }
.o1 { width: 52vmax; height: 52vmax; left: -14vmax; top: -18vmax; background: #3f8f2a; animation: deriva 26s ease-in-out infinite alternate; }
.o2 { width: 40vmax; height: 40vmax; right: -12vmax; top: 10vh; background: #127a6b; animation: deriva 32s ease-in-out infinite alternate-reverse; }
.o3 { width: 30vmax; height: 30vmax; left: 30vw; bottom: -14vmax; background: #a5e05c; opacity: 0.4; animation: deriva 22s ease-in-out infinite alternate; }
@keyframes deriva {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
}

/* ---- Material de vidrio líquido ---- */
.vidrio {
  position: relative;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.025) 55%), var(--vidrio);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: inset 0 1px 0 var(--brillo), inset 0 -1px 0 rgba(255, 255, 255, 0.04), var(--sombra);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
}
.vidrio::before {
  /* reflejo especular en el borde superior izquierdo */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, 0.14), transparent 45%);
}

@media (prefers-reduced-transparency: reduce) {
  .vidrio { background: #121a15; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

.logo { display: block; height: auto; }

/* ---- Acceso ---- */
.acceso { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.panel-acceso {
  width: min(400px, 100%);
  padding: 36px 32px 32px;
  display: flex; flex-direction: column; gap: 20px;
  animation: entrar 600ms var(--facil) both;
}
.panel-acceso .logo { width: 112px; }
.encabezado-acceso h1 { margin: 8px 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.encabezado-acceso p { margin: 0; color: var(--texto-suave); font-size: 15px; }

.campo { display: flex; flex-direction: column; gap: 8px; }
.campo label { font-size: 14px; font-weight: 500; color: var(--texto-suave); }
.campo input {
  width: 100%; height: 48px; padding: 0 16px;
  font: inherit; color: var(--texto);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--borde);
  border-radius: 14px;
  transition: border-color 180ms, background 180ms, box-shadow 180ms;
}
.campo input:hover { border-color: rgba(255, 255, 255, 0.22); }
.campo input:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px rgba(165, 224, 92, 0.22); background: rgba(0, 0, 0, 0.36); }
.campo input[aria-invalid="true"] { border-color: var(--mal); }
.con-boton { position: relative; }
.con-boton input { padding-right: 52px; }
.boton-icono {
  position: absolute; right: 4px; top: 4px; width: 40px; height: 40px;
  display: grid; place-items: center; border: 0; border-radius: 10px;
  background: transparent; color: var(--texto-suave); cursor: pointer;
  transition: color 160ms, background 160ms;
}
.boton-icono:hover { color: var(--texto); background: rgba(255, 255, 255, 0.07); }
.boton-icono[aria-pressed="true"] { color: var(--acento); }

.error { margin: -6px 0 0; min-height: 21px; font-size: 14px; color: var(--mal); }

.boton-primario {
  position: relative; height: 50px; border: 0; border-radius: 14px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 16px;
  color: var(--acento-texto);
  background: linear-gradient(180deg, #b9ec78, var(--acento));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 10px 30px -10px rgba(165, 224, 92, 0.6);
  transition: transform 160ms var(--facil), filter 160ms, box-shadow 160ms;
}
.boton-primario:hover { filter: brightness(1.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 14px 36px -10px rgba(165, 224, 92, 0.75); }
.boton-primario:active { transform: scale(0.985); }
.boton-primario:disabled { cursor: progress; }
.boton-primario .girando {
  position: absolute; inset: 0; margin: auto; width: 20px; height: 20px;
  border: 2px solid rgba(11, 26, 6, 0.25); border-top-color: var(--acento-texto); border-radius: 50%;
  opacity: 0; animation: girar 700ms linear infinite;
}
.boton-primario.cargando .texto { opacity: 0; }
.boton-primario.cargando .girando { opacity: 1; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---- Barra superior ---- */
.barra {
  position: sticky; top: 16px; z-index: 5;
  width: min(1180px, calc(100% - 32px)); margin: 16px auto 0;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 10px 10px 22px; border-radius: 999px;
}
.barra .logo { width: 84px; }
.buscador {
  flex: 1; max-width: 420px; margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 16px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--borde);
  color: var(--texto-tenue);
  transition: border-color 180ms, box-shadow 180ms;
}
.buscador:focus-within { border-color: var(--acento); box-shadow: 0 0 0 3px rgba(165, 224, 92, 0.2); color: var(--texto-suave); }
.buscador input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font: inherit; font-size: 15px; color: var(--texto); }
.buscador input:focus { outline: none; }
.buscador input::placeholder { color: var(--texto-tenue); }

.boton-sutil {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--texto-suave);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--borde);
  transition: color 160ms, background 160ms;
}
.boton-sutil:hover { color: var(--texto); background: rgba(255, 255, 255, 0.11); }

/* ---- Listado ---- */
.contenido { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 80px; }
.titulo-seccion { margin-bottom: 28px; }
.titulo-seccion h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.titulo-seccion p { margin: 8px 0 0; color: var(--texto-suave); }

.rejilla {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.tarjeta {
  height: 100%; min-height: 196px;
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; color: inherit; text-decoration: none;
  transition: transform 260ms var(--facil), background 260ms, border-color 260ms, box-shadow 260ms;
  animation: entrar 500ms var(--facil) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
.tarjeta:hover {
  transform: translateY(-3px);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04) 55%), var(--vidrio-hover);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 var(--brillo), 0 30px 70px -26px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(165, 224, 92, 0.12);
}
.tarjeta:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; }

.tarjeta-arriba { display: flex; align-items: center; justify-content: space-between; }
.inicial {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px; color: var(--acento);
  background: rgba(165, 224, 92, 0.1);
  border: 1px solid rgba(165, 224, 92, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.estado { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--texto-tenue); }
.punto { width: 8px; height: 8px; border-radius: 50%; background: var(--texto-tenue); }
.estado[data-estado="en_linea"] .punto { background: var(--ok); box-shadow: 0 0 0 4px rgba(126, 224, 138, 0.14); }
.estado[data-estado="caido"] { color: var(--mal); }
.estado[data-estado="caido"] .punto { background: var(--mal); box-shadow: 0 0 0 4px rgba(255, 138, 122, 0.14); }

.tarjeta-cuerpo { flex: 1; }
.nombre { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.descripcion { margin: 4px 0 0; font-size: 14px; color: var(--texto-suave); line-height: 1.45; }
.descripcion:empty { display: none; }

.tarjeta-pie { display: flex; align-items: center; gap: 10px; min-height: 40px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.cliente {
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  color: var(--texto); background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1);
}
.cliente:empty { display: none; }
.ruta { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; color: var(--texto-tenue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.flecha { margin-left: auto; color: var(--texto-tenue); transition: transform 260ms var(--facil), color 260ms; }
.tarjeta:hover .flecha { color: var(--acento); transform: translate(2px, -2px); }

.esqueleto { min-height: 196px; border-radius: var(--radio); background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); animation: latir 1.4s ease-in-out infinite; }
@keyframes latir { 50% { opacity: 0.5; } }

.vacio { color: var(--texto-suave); text-align: center; padding: 48px 0; }

@keyframes entrar { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .barra { flex-wrap: wrap; border-radius: 22px; padding: 12px; gap: 10px; }
  .barra .logo { margin-left: 8px; }
  .buscador { order: 3; flex-basis: 100%; max-width: none; }
  .boton-sutil { margin-left: auto; }
  .boton-sutil span { display: none; }
  .boton-sutil { width: 44px; padding: 0; justify-content: center; }
  .contenido { padding-top: 36px; }
  .panel-acceso { padding: 28px 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
