/* Panel de administración del sistema de accesos: los estilos del panel original (encabezado, pestañas,
   tarjetas, tablas, modales, formularios de configuración) con la paleta y la tipografía de Ganda Software.
   Verde, ámbar y rojo quedan solo como estados (dentro, pendiente, fuera / revocado). */
@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/geist-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}
:root {
  --brand-blue: #0E4D82;
  --brand-blue-light: #0A3B66;
  --brand-accent: #5D8AA8;
  --surface-alt: #F2EEE4;
  --success-color: #157540;
  --error-color: #B0392B;
  --surface: #ffffff;
  --bg: #ffffff;
  --text-primary: #171717;
  --text-secondary: #55524B;
  --border: rgba(23, 23, 23, 0.12);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text-primary); font: 400 0.95rem/1.5 "Geist", system-ui, sans-serif; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #D9784D; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.admin-header { background: #fff; padding: 18px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.logo-badge { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-blue); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.admin-header-title { flex: 1; text-align: center; }
.admin-header-title h1 { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; }
.user-info { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.user-info > .bi { font-size: 1.2rem; color: var(--text-secondary); }

.btn-outline, .btn-primary, .btn-secondary, .btn-danger, .btn-success {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 0.85rem; cursor: pointer; border: none;
  transition: background-color .2s; white-space: nowrap;
}
.btn-outline { background: transparent; border: 1px solid var(--brand-blue); color: var(--brand-blue); }
.btn-outline:hover { background: rgba(14, 77, 130, .08); }
.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-light); }
.btn-secondary { background: #EFEBE2; color: var(--text-primary); }
.btn-secondary:hover { background: #E3DDD0; }
.btn-secondary[disabled] { opacity: .45; cursor: not-allowed; }
.btn-danger { background: var(--error-color); color: #fff; }
.btn-success { background: var(--brand-blue); color: #fff; }
.btn-icon { background: transparent; border: 1px solid var(--border); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; line-height: 1; }
.btn-icon:hover { background: rgba(23, 23, 23, .06); }
.spin { display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.admin-container { max-width: 1400px; margin: 0 auto; padding: 32px 20px; }
.tabs-nav { display: flex; gap: 12px; margin-bottom: 5px; overflow-x: auto; scrollbar-width: none; }
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn { flex-shrink: 0; text-decoration: none; padding: 14px 24px; background: none; border: none; font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; border-bottom: 3px solid transparent; display: inline-flex; gap: 8px; align-items: center; }
.tab-btn.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }
.tab-content { display: none; padding-top: 16px; }
.tab-content.active { display: block; }

.card { --card-pad: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: var(--card-pad); margin-bottom: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 1.1rem; font-weight: 600; }
.card-help { color: var(--text-secondary); margin: 0 0 16px; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 16px; }
.metric-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.metric-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.metric-value { font-size: 1.9rem; font-weight: 700; color: var(--brand-blue); margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }
.rank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px; }

table { width: 100%; border-collapse: collapse; }
thead { border-bottom: 2px solid var(--border); }
th { padding: 14px; text-align: left; font-weight: 600; font-size: 0.85rem; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
td { padding: 14px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: rgba(23, 23, 23, .02); }
tr.clickable { cursor: pointer; }
.table-scroll { overflow-x: auto; margin: 0 calc(var(--card-pad) * -1); }
.table-scroll th:first-child, .table-scroll td:first-child { padding-left: var(--card-pad); }
.table-scroll th:last-child, .table-scroll td:last-child { padding-right: var(--card-pad); }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.empty { text-align: center; padding: 40px; color: var(--text-secondary); }

.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.badge-in { background: rgba(21, 117, 64, .14); color: #13703c; }
.badge-out { background: rgba(176, 57, 43, .13); color: #A5311F; }
.badge-warn { background: rgba(212, 160, 23, .2); color: #7a5b00; }
.badge-auto { background: var(--border); color: var(--text-secondary); }
.badge-role { padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; }
.badge-admin { background: rgba(14, 77, 130, .12); color: var(--brand-blue); }
.badge-kiosk { background: rgba(212, 160, 23, .18); color: #7a5b00; }
.badge-current { background: rgba(14, 77, 130, .12); color: var(--brand-blue); padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; }
.muted-italic { color: var(--text-secondary); font-style: italic; }
.ua { font-size: 0.85rem; color: var(--text-secondary); }

/* Modal de accesos del empleado */
.modal { border: 0; padding: 0; background: transparent; width: min(720px, calc(100vw - 32px)); max-width: none; max-height: 90vh; }
.modal::backdrop { background: rgba(0, 0, 0, .5); }
.modal-content { --card-pad: 32px; background: var(--surface); border-radius: 16px; padding: var(--card-pad); max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-header h2 { font-size: 1.3rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.15rem; cursor: pointer; color: var(--text-secondary); width: 32px; height: 32px; border-radius: 8px; }
.modal-close:hover { background: rgba(23, 23, 23, .06); }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.pager-info { font-size: 0.85rem; color: var(--text-secondary); }

/* Configuración */
.config-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.config-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.config-nav a:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.config-group-title { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin: 28px 0 12px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.form-group { display: flex; flex-direction: column; }
.form-group label { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group select, .inline-input { padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px; font-size: 0.9rem; background: #fff; }
.form-group input:disabled, .form-group select:disabled, .inline-input:disabled { background: #FAF8F3; color: var(--text-primary); opacity: 1; cursor: not-allowed; }
.btn-line { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.state-badge { margin-left: 8px; vertical-align: 2px; }
.area-add { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.area-add .inline-input { flex: 1; min-width: 200px; }

@media (max-width: 768px) {
  .admin-header { flex-wrap: wrap; gap: 12px; padding: 16px 20px; }
  .admin-header-title { flex: 1 100%; order: 3; text-align: left; }
  .admin-header-title h1 { font-size: 1.1rem; }
  .admin-container { padding: 20px 20px 40px; }
  .card { --card-pad: 18px; }
  .tab-btn { padding: 12px 16px; font-size: 0.9rem; }
  table { font-size: 0.8rem; }
  th, td { padding: 10px; }
  .modal-content { --card-pad: 20px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .user-info span { display: none; }
}
#view:focus { outline: none; }

@media (max-width: 480px) { .btn-outline, .btn-primary, .btn-secondary, .btn-danger, .btn-success { white-space: normal; } }
