:root { --azul: #1a3a6c; --fondo: #f3f5f9; --error: #b3261e; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--fondo); color: #1c1c1c; }
.barra { background: var(--azul); color: #fff; padding: 14px 18px; }
.marca { font-weight: 700; font-size: 1.15rem; letter-spacing: .5px; }
.contenedor { max-width: 560px; margin: 0 auto; padding: 16px; }
.tarjeta { background: #fff; border-radius: 12px; padding: 20px;
           box-shadow: 0 2px 8px rgba(0,0,0,.08); }
h1 { font-size: 1.35rem; color: var(--azul); margin-top: 0; }
.nota { color: #5a6270; }
.campo { margin-bottom: 14px; }
.campo label { display: block; font-weight: 600; margin-bottom: 4px; }
.campo input[type=text], .campo input[type=email], .campo input:not([type]), .campo select {
  width: 100%; padding: 12px; font-size: 16px; border: 1px solid #c5cbd6; border-radius: 8px; }
.casilla label { display: inline; font-weight: 400; }
.casilla a { display: block; margin-top: 6px; color: var(--azul); }
.error { color: var(--error); margin: 4px 0 0; font-size: .92rem; }
button { width: 100%; padding: 14px; font-size: 1.05rem; font-weight: 700; color: #fff;
         background: var(--azul); border: 0; border-radius: 8px; cursor: pointer; }
.texto p { line-height: 1.5; }

/* ---- Panel ---- */
.barra { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.menu { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.usuario { font-size: .95rem; opacity: .9; }
.en-linea { display: inline; margin: 0; }
.boton-chico { width: auto; padding: 6px 12px; font-size: .9rem; background: #fff; color: var(--azul); }
.ancho { max-width: 1100px; }
.campo input[type=password] { width: 100%; padding: 12px; font-size: 16px;
                              border: 1px solid #c5cbd6; border-radius: 8px; }

/* ---- Visitantes dentro ---- */
h2 { font-size: 1.15rem; color: var(--azul); margin-top: 0; }
.tarjeta + .tarjeta, .resumen + .tarjeta { margin-top: 16px; }
.angosta { max-width: 560px; margin: 0 auto; }
.centrado { text-align: center; }
.resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.dato { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
        display: flex; flex-direction: column; }
.cifra { font-size: 2rem; font-weight: 700; color: var(--azul); }
.tabla-scroll { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabla th { text-align: left; color: #5a6270; font-weight: 600; border-bottom: 2px solid #e3e7ee; padding: 8px; }
.tabla td { border-bottom: 1px solid #eef1f5; padding: 8px; vertical-align: middle; }
.tabla tr.alerta td { background: #fff4e5; }
.boton-tabla { display: inline-block; padding: 6px 10px; border-radius: 6px; background: var(--azul);
               color: #fff; text-decoration: none; font-size: .88rem; white-space: nowrap; }
.gafetes { display: flex; flex-wrap: wrap; gap: 8px; }
.gafete { display: inline-block; padding: 6px 10px; border-radius: 6px; font-weight: 700; font-size: .9rem; }
.gafete.disponible { background: #e6f4ea; color: #1e6b34; }
.gafete.asignado { background: #fde8e8; color: #9b1c1c; }
.gafete.perdido { background: #fff4e5; color: #8a4b00; }
.gafete.baja { background: #eceff3; color: #5a6270; text-decoration: line-through; }
.leyenda { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- Menú e historial ---- */
.enlace-menu { color: #fff; text-decoration: none; font-weight: 600; padding: 4px 6px; border-radius: 6px; }
.enlace-menu:hover { background: rgba(255,255,255,.15); }
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; align-items: end; }
.filtros .doble { grid-column: span 2; }
.campo input[type=date] { width: 100%; padding: 11px; font-size: 16px; border: 1px solid #c5cbd6; border-radius: 8px; }
.acciones { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.acciones a, .nota a, .tabla a, .paginacion a { color: var(--azul); }
.boton-auto { width: auto; padding: 11px 22px; }
.etiqueta { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .85rem; font-weight: 600; }
.etiqueta.dentro { background: #fde8e8; color: #9b1c1c; }
.etiqueta.sin-salida { background: #fff4e5; color: #8a4b00; }
.aviso { color: #8a4b00; margin-left: 4px; cursor: help; }
.paginacion { display: flex; justify-content: space-between; margin-top: 14px; }
@media (max-width: 600px) { .filtros .doble { grid-column: span 1; } }

/* ---- Administración ---- */
.form-linea { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.form-linea .crece { flex: 1 1 280px; margin-bottom: 0; }
.form-linea .boton-auto { margin-top: 26px; }
button.boton-tabla { width: auto; border: 0; cursor: pointer; font-weight: 400; }
.boton-tabla.peligro { background: #9b1c1c; }
.acciones-fila { white-space: nowrap; }
.acciones-fila > * + * { margin-left: 6px; }
.etiqueta.activa { background: #e6f4ea; color: #1e6b34; }
.etiqueta.inactiva { background: #eceff3; color: #5a6270; }
.tabla tr.inactiva td { color: #8a919c; }

/* Corrección: texto blanco en los botones que son enlaces dentro de tablas */
.tabla a.boton-tabla { color: #fff; }

/* ---- Pestañas y gafetes ---- */
.pestanas { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.pestanas a { padding: 8px 16px; border-radius: 8px; background: #fff; color: var(--azul);
              text-decoration: none; font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.pestanas a.activa { background: var(--azul); color: #fff; }
.pestanas + .resumen, .pestanas + .tarjeta { margin-top: 0; }
.campo input[type=number] { width: 100%; padding: 12px; font-size: 16px; border: 1px solid #c5cbd6; border-radius: 8px; }
.ok { color: #1e6b34; font-weight: 600; }
.boton-peligro { background: #9b1c1c; }

.encabezado-lista { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.encabezado-lista a { color: var(--azul); }

.separado { margin-top: 28px; padding-top: 18px; border-top: 1px solid #e3e7ee; }

.acciones a { white-space: nowrap; }

/* ---- Credenciales para imprimir ---- */
.enlaces-lista { display: flex; gap: 18px; flex-wrap: wrap; }
.hoja-gafetes { display: grid; grid-template-columns: repeat(auto-fill, 54mm); gap: 4mm;
                justify-content: center; margin-top: 16px; }
.credencial { width: 54mm; height: 86mm; box-sizing: border-box; border: 1px dashed #9aa3b2;
              border-radius: 3mm; background: #fff; padding: 4mm 3mm; display: flex;
              flex-direction: column; align-items: center; text-align: center; break-inside: avoid; }
.cred-centro { font-weight: 700; color: var(--azul); font-size: 11pt; }
.cred-tipo { margin-top: 1.5mm; background: var(--azul); color: #fff; font-weight: 700; font-size: 9pt;
             letter-spacing: 2px; padding: 1mm 4mm; border-radius: 2mm; }
.cred-qr { width: 40mm; height: 40mm; margin: 4mm 0 2mm; }
.cred-numero { font-size: 20pt; font-weight: 800; color: #1c1c1c; }
.cred-instr { margin-top: auto; font-size: 7.5pt; color: #5a6270; line-height: 1.3; }

@page { size: letter; margin: 8mm; }
@media print {
  body { background: #fff; }
  .barra, .no-imprimir { display: none !important; }
  .contenedor { max-width: none; padding: 0; }
  .hoja-gafetes { grid-template-columns: repeat(3, 54mm); gap: 2mm; margin: 0; }
  .credencial { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.volver { display: inline-block; margin-bottom: 10px; color: var(--azul); font-weight: 600; text-decoration: none; }
.volver:hover { text-decoration: underline; }

.alerta-sistema { background: #fde8e8; border-left: 5px solid #9b1c1c; color: #5c1111;
                  padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; }
.alerta-sistema p { margin: 6px 0 0; }
.alerta-sistema code { background: #fff; padding: 1px 6px; border-radius: 4px; }

/* ===== Tema de la ferretería: azul marino y naranja ===== */
:root { --azul: #1c3a70; --naranja: #e8590c; --naranja-hover: #c94c0a; }

.barra { background: var(--azul); border-bottom: 4px solid var(--naranja); }

button:not(.boton-chico):not(.boton-peligro):not(.boton-tabla) { background: var(--naranja); }
button:not(.boton-chico):not(.boton-peligro):not(.boton-tabla):hover { background: var(--naranja-hover); }

.pestanas a.activa { background: var(--naranja); color: #fff; }
.cifra { color: var(--naranja); }
.cred-tipo { background: var(--naranja); }

.campo input:focus, .campo select:focus {
  outline: none; border-color: var(--naranja); box-shadow: 0 0 0 3px rgba(232, 89, 12, .18);
}

/* Aviso de privacidad desplegable en el formulario */
.aviso-desplegable { margin-top: 8px; }
.aviso-desplegable summary { cursor: pointer; color: var(--azul); font-weight: 600; }
.aviso-contenido { max-height: 55vh; overflow-y: auto; margin-top: 8px; padding: 12px 14px;
                   border: 1px solid #e3e7ee; border-radius: 8px; background: #fafbfc; font-size: .92rem; }
.aviso-contenido h2 { font-size: 1rem; margin: 14px 0 4px; }

/* Nombre largo del centro en la credencial */
.cred-centro { font-size: 9.5pt; line-height: 1.2; }

/* ---- Rentas de oficinas ---- */
.form-rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: start; margin-bottom: 12px; }
.gafete.oficina small { display: block; font-weight: 400; font-size: .78rem; margin-top: 2px; }
.gafete.libre { background: #e6f4ea; color: #1e6b34; }
.gafete.rentada { background: #fde8e8; color: #9b1c1c; }
.gafete.reservada { background: #fff4e5; color: #8a4b00; }

/* Campo de fecha y hora (reservaciones) */
.campo input[type=datetime-local] { width: 100%; box-sizing: border-box; padding: 11px; font-size: 16px;
  font-family: inherit; border: 1px solid #c5cbd6; border-radius: 8px; background: #fff; }

/* Botón de descarga de QR */
.boton-descarga { display: inline-flex; align-items: center; gap: 6px; margin: 4px 6px 4px 0;
  padding: 7px 14px; border-radius: 8px; background: #1c3a70; color: #fff !important;
  font-weight: 600; text-decoration: none; }
.boton-descarga:hover { background: #e8590c; }

/* Gafetes dentro de cada oficina */
.gafete.oficina small.dentro { font-weight: 700; margin-top: 4px; padding-top: 3px; border-top: 1px solid currentColor; }

/* ================= Diseño 2026-11 ================= */
/* Barra superior */
.barra { min-height: 72px; box-sizing: border-box; padding: 12px 28px; border-bottom: 4px solid var(--naranja); }
.barra:not(:has(.menu)) { justify-content: center; }
.marca { display: inline-flex; align-items: center; gap: 12px; }
.marca-logo { width: 42px; height: 42px; flex: none; border-radius: 10px; }
.marca-texto { display: flex; flex-direction: column; line-height: 1.1; }
.marca-sup { font-size: .8rem; font-weight: 600; color: #dbe4f3; letter-spacing: .2px; }
.marca-inf { font-size: 1.2rem; font-weight: 800; color: #fff; }
.menu { gap: 18px; }
.enlace-menu { border-radius: 0; padding: 6px 2px; border-bottom: 3px solid transparent; }
.enlace-menu:hover { background: none; border-bottom-color: rgba(255,255,255,.45); }
.enlace-menu.activo { border-bottom-color: var(--naranja); }

/* Actividad de visitas */
.encabezado-pagina { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.encabezado-pagina h1 { margin: 0; color: var(--azul); }
.encabezado-pagina .fecha { margin: 4px 0 0; color: #4b5563; }
.dato { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 16px; }
.dato-icono { width: 52px; height: 52px; flex: none; border-radius: 14px; background: #e8eef8; color: var(--azul);
  display: flex; align-items: center; justify-content: center; }
.dato-texto { display: flex; flex-direction: column; }
.dato .cifra { line-height: 1.1; }
.vacio { border: 2px dashed #d7dde8; border-radius: 14px; padding: 36px 16px; margin-top: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: #4b5563; }
.vacio strong { color: var(--azul); font-size: 1.05rem; }
.vacio-icono { width: 64px; height: 64px; border-radius: 50%; background: #e8eef8; color: var(--azul);
  display: flex; align-items: center; justify-content: center; }
.rejilla-doble { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.rejilla-doble > .tarjeta { margin-top: 0; }
@media (max-width: 860px) { .rejilla-doble { grid-template-columns: 1fr; } }

/* Inicio de sesión */
.login-pagina { position: relative; min-height: 100vh; box-sizing: border-box; padding: 0 16px 28px;
  display: flex; flex-direction: column; align-items: center; background: #f3f4f6; overflow: hidden; }
.login-banda { position: absolute; left: 0; top: 0; width: 100%; height: 340px; background: var(--azul);
  border-bottom: 5px solid var(--naranja); overflow: hidden; }
.login-banda::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, transparent 55%, rgba(255,255,255,.06) 55%); }
.login-banda::after { content: ""; position: absolute; right: -150px; bottom: -190px; width: 380px; height: 380px;
  border-radius: 50%; background: var(--naranja); }
.login-marca { position: relative; z-index: 1; margin-top: 56px; display: flex; align-items: center; gap: 18px; }
.login-marca img { width: 76px; height: 76px; border-radius: 18px; }
.login-marca-texto { display: flex; flex-direction: column; line-height: 1.1; }
.login-marca-texto .marca-sup { font-size: 1.2rem; }
.login-marca-texto .marca-inf { font-size: 2.1rem; }
.login-tarjeta { position: relative; z-index: 1; width: 100%; max-width: 440px; box-sizing: border-box; margin-top: 44px;
  padding: 34px; background: #fff; border-radius: 18px; box-shadow: 0 18px 40px rgba(15, 35, 71, .18); }
.login-tarjeta h1 { margin: 0 0 4px; color: var(--azul); }
.login-tarjeta > .nota { margin: 0 0 14px; }
.login-pie { position: relative; z-index: 1; margin: auto 0 0; padding-top: 28px; font-size: .85rem; color: #4b5563; text-align: center; }
@media (max-width: 520px) {
  .login-banda { height: 300px; }
  .login-marca { margin-top: 40px; gap: 12px; }
  .login-marca img { width: 60px; height: 60px; }
  .login-marca-texto .marca-inf { font-size: 1.6rem; }
  .login-tarjeta { padding: 24px; }
}
