:root {
  --azul: #1e3a5f;
  --azul-claro: #2c5282;
  --gris-fondo: #f4f6f8;
  --borde: #dfe3e8;
  --rojo: #c0392b;
  --verde: #1e8449;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--gris-fondo);
  color: #222;
}

/* ---------- Barra superior (siempre visible) ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--azul);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.topbar .marca {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.1rem;
}

.btn-toggle-sidebar {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1;
}
.btn-toggle-sidebar:hover { background: rgba(255,255,255,0.15); }

.topbar .marca .icono {
  width: 34px; height: 34px;
  background: #fff;
  color: var(--azul);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold;
}

.topbar .usuario-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar .usuario-info a.nombre-usuario {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 6px;
}
.topbar .usuario-info a.nombre-usuario:hover {
  background: rgba(255,255,255,0.15);
}

.topbar form.logout-form button {
  background: var(--rojo);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
.topbar form.logout-form button:hover { opacity: 0.9; }

.contenido {
  margin-top: 60px;
  margin-left: 220px;
  padding: 24px;
  max-width: 1100px;
  transition: margin-left 0.2s ease;
}

/* ---------- Sidebar (siempre visible, colapsable) ---------- */
.sidebar {
  position: fixed;
  top: 60px; left: 0; bottom: 0;
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--borde);
  overflow-y: auto;
  z-index: 90;
  transition: width 0.2s ease;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.sidebar-nav a:hover { background: var(--gris-fondo); }
.sidebar-nav .icono-nav { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-separador { height: 1px; background: var(--borde); margin: 10px 14px; }

body.sidebar-colapsado .sidebar { width: 56px; }
body.sidebar-colapsado .sidebar-nav a { justify-content: center; padding: 10px 0; }
body.sidebar-colapsado .sidebar-nav .texto-nav { display: none; }
body.sidebar-colapsado .contenido { margin-left: 56px; }

/* ---------- Login ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--azul), var(--azul-claro));
}
.login-box {
  background: #fff;
  padding: 36px 32px;
  border-radius: 10px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.login-box h1 {
  text-align: center;
  color: var(--azul);
  margin-bottom: 4px;
}
.login-box p.subtitulo {
  text-align: center;
  color: #666;
  font-size: 0.85rem;
  margin-top: 0;
  margin-bottom: 24px;
}

/* ---------- Formularios generales ---------- */
label { display: block; font-size: 0.85rem; margin: 12px 0 4px; color: #333; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=file], select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--borde);
  border-radius: 6px;
  font-size: 0.95rem;
}
button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-block;
  text-decoration: none;
}
.btn-primario { background: var(--azul); color: #fff; width: 100%; margin-top: 18px; }
.btn-primario:hover { background: var(--azul-claro); }
.btn-secundario { background: #e2e8f0; color: #222; }
.btn-peligro { background: var(--rojo); color: #fff; }

.alerta { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 0.9rem; }
.alerta-error { background: #fdecea; color: var(--rojo); border: 1px solid #f5c6c2; }
.alerta-ok { background: #eafaf1; color: var(--verde); border: 1px solid #b7e4c7; }

/* ---------- Tarjetas / cards del dashboard ---------- */
.card { background: #fff; border: 1px solid var(--borde); border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* ---------- Tablas ---------- */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--borde); font-size: 0.9rem; }
th { background: #f0f2f5; }
.badge { padding: 3px 9px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-activo { background: #eafaf1; color: var(--verde); }
.badge-inactivo { background: #fff7e6; color: #b7791f; }
.badge-baja { background: #fdecea; color: var(--rojo); }

.acciones a, .acciones button { margin-right: 6px; font-size: 0.8rem; padding: 6px 10px; }

.top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* ---------- Paginas publicas del checador (reloj QR / liga movil) ---------- */
.kiosco-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--azul), var(--azul-claro));
  color: #fff; text-align: center; padding: 24px;
}
.kiosco-wrap h1 { margin-bottom: 4px; }
.kiosco-wrap .empresa-nombre { font-size: 1.1rem; opacity: 0.9; margin-bottom: 20px; }
.kiosco-qr-caja {
  background: #fff; padding: 20px; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.kiosco-qr-caja img { display: block; width: 280px; height: 280px; }
.kiosco-contador { margin-top: 18px; font-size: 1rem; opacity: 0.9; }
.kiosco-contador span { font-weight: 700; font-size: 1.3rem; }

.movil-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--gris-fondo); padding: 20px;
}
.movil-card {
  background: #fff; border-radius: 12px; padding: 28px 24px; width: 100%; max-width: 380px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
}
.movil-card h2 { color: var(--azul); margin-top: 0; }
.btn-grande {
  width: 100%; padding: 16px; font-size: 1.05rem; border-radius: 10px; margin-top: 12px;
}
.btn-entrada { background: var(--verde); color: #fff; }
.btn-salida { background: var(--rojo); color: #fff; }
.estado-gps { font-size: 0.8rem; color: #666; margin-top: 8px; }

/* ---------- Banner de cookies ---------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: #1a1a1a; color: #eee; padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 0.85rem;
}
.cookie-banner a { color: #9fc5ff; }
.cookie-banner button { background: var(--azul-claro); color: #fff; padding: 8px 14px; }
