/* BNI Alianza Web — style.css */
:root {
  --r: #C41E3A; --r-osc: #9B1530; --r-clr: #FFF0F2;
  --dorado: #D4AF37; --verde: #27AE60; --naranj: #E67E22;
  --azul: #2980B9; --morado: #8E44AD;
  --fondo: #F7F7F9; --borde: #E0E0E0;
  --texto: #1A1A2E; --texto2: #666;
  --f: 'Segoe UI', system-ui, sans-serif;
  --radius: 10px; --shadow: 0 2px 8px rgba(0,0,0,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--f); background: var(--fondo); color: var(--texto); }

/* ── Header ── */
.header {
  background: white; border-bottom: 4px solid var(--r);
  padding: 0 20px; height: 64px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow);
}
.header .logo img { height: 40px; }
.header .logo span { color: var(--r); font-size: 26px; font-weight: 900; letter-spacing: 4px; }
.header .divider { width: 1px; height: 32px; background: var(--borde); }
.header .info { flex: 1; text-align: center; }
.header .info h1 { font-size: 14px; font-weight: 700; letter-spacing: 2px; }
.header .info p  { font-size: 12px; color: var(--verde); font-weight: 600; }
.header .info p.sin-reunion { color: var(--naranj); }
.header .reloj { font-size: 16px; font-weight: 700; color: var(--texto2); white-space: nowrap; }
.header .btn-cerrar {
  background: white; color: var(--naranj); border: 1.5px solid var(--naranj);
  border-radius: 6px; padding: 6px 14px; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.header .btn-cerrar:hover { background: var(--naranj); color: white; }

/* ── Leyenda ── */
.leyenda {
  background: white; border-bottom: 1px solid var(--borde);
  padding: 6px 20px; display: flex; gap: 16px; justify-content: center;
  flex-wrap: wrap;
}
.leyenda-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--texto2); }
.badge {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: white; flex-shrink: 0;
}

/* ── Scroll área ── */
.scroll-area { overflow-y: auto; padding: 16px 20px; }

/* ── Sección de avatares ── */
.seccion { margin-bottom: 16px; }
.seccion-titulo {
  font-size: 11px; font-weight: 700; letter-spacing: 3px;
  margin-bottom: 10px;
}
.flow-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Avatar botón ── */
.avatar-btn {
  width: 108px; background: white; border: 2px solid var(--borde);
  border-radius: var(--radius); cursor: pointer;
  padding: 6px 4px 5px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; transition: border-color .15s, background .15s;
  position: relative; user-select: none; -webkit-tap-highlight-color: transparent;
}
.avatar-btn:hover { border-color: var(--r); background: #FFF8F8; }
.avatar-btn:active { transform: scale(.97); }
.avatar-btn.ya-dentro {
  background: #F0FAF4; border-color: var(--verde);
}
.avatar-img {
  width: 95px; height: 66px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: white; overflow: hidden;
}
.avatar-img img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.avatar-nombre {
  font-size: 8px; font-weight: 500; color: var(--texto);
  text-align: center; line-height: 1.3; max-width: 100px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.avatar-btn.ya-dentro .avatar-nombre { color: var(--verde); font-weight: 700; }
.avatar-badge-wrap { display: flex; justify-content: center; }

/* ── Franja inferior fija ── */
.franja-inferior {
  background: var(--fondo); border-top: 1px solid var(--borde);
  overflow-x: auto; overflow-y: hidden;
  display: flex; flex-shrink: 0;
}
.bloque-inline {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 14px; flex-shrink: 0;
}
.bloque-inline .bloque-titulo {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
}
.bloque-avatares { display: flex; gap: 6px; }
.franja-sep { width: 1px; background: var(--borde); flex-shrink: 0; margin: 8px 0; }

/* Sustituto botón en franja */
.btn-sustituto {
  width: 108px; height: 118px; background: white;
  border: 2px solid var(--morado); border-radius: var(--radius);
  color: var(--morado); font-size: 11px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px; text-align: center;
  transition: background .15s;
}
.btn-sustituto:hover { background: #F5EEF8; }

/* ── Pie ── */
.pie {
  background: white; border-top: 1px solid var(--borde);
  text-align: center; padding: 8px; font-size: 11px; color: var(--texto2);
}

/* ── Modales ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: white; border-radius: 14px; padding: 28px 28px 24px;
  width: 100%; max-width: 400px; position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-bar { height: 5px; border-radius: 3px; margin-bottom: 16px; }
.modal-logo { text-align: center; margin-bottom: 4px; }
.modal-logo img { height: 36px; }
.modal-logo span { color: var(--r); font-size: 22px; font-weight: 900; letter-spacing: 6px; }
.modal h2 { text-align: center; font-size: 14px; color: var(--texto); margin-bottom: 12px; }
.modal-avatar {
  width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: white;
}
.modal-nombre { text-align: center; font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.modal-tipo { text-align: center; font-size: 10px; color: var(--texto2); letter-spacing: 2px; margin-bottom: 10px; }
.modal-sep { border: none; border-top: 1px solid var(--borde); margin: 10px 0; }

/* Teclado PIN */
.pin-display {
  background: var(--fondo); border-radius: 10px; padding: 12px;
  text-align: center; font-size: 22px; letter-spacing: 8px;
  color: var(--texto2); margin-bottom: 8px;
}
.teclado {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 8px;
}
.key {
  padding: 13px; font-size: 17px; font-weight: 700; border-radius: 10px;
  border: 1px solid var(--borde); background: var(--fondo); cursor: pointer;
  transition: background .1s;
}
.key:hover, .key:active { background: var(--r); color: white; border-color: var(--r); }
.key.key-ok  { background: var(--verde); color: white; border-color: var(--verde); }
.key.key-del { background: var(--naranj); color: white; border-color: var(--naranj); }
.key.key-ok:hover  { background: #1e8449; }
.key.key-del:hover { background: #c0671b; }
.pin-error { color: var(--r); font-size: 12px; text-align: center; min-height: 18px; }

/* Bienvenida */
.welcome-hora { color: var(--r); font-size: 13px; font-weight: 700; text-align: center; }
.welcome-msg {
  border-radius: 8px; padding: 10px; text-align: center;
  font-size: 13px; font-weight: 700; margin: 6px 0;
}
.cuota-box {
  border-radius: 8px; padding: 10px; text-align: center;
  font-size: 14px; font-weight: 700; margin: 8px 0;
}
.cuota-pagada { background: #EBF9F1; color: var(--verde); }
.cuota-pendiente { background: #FEF5EA; color: var(--naranj); }
.cuota-visitante { background: #EBF5FB; color: var(--azul); }
.cuota-pregunta { text-align: center; font-size: 12px; color: var(--texto2); margin-bottom: 6px; }

/* Botones */
.btn { 
  padding: 12px; border-radius: 10px; border: none; font-size: 14px;
  font-weight: 700; cursor: pointer; width: 100%; transition: background .15s;
}
.btn-verde { background: var(--verde); color: white; }
.btn-verde:hover { background: #1e8449; }
.btn-rojo  { background: var(--r); color: white; }
.btn-rojo:hover { background: var(--r-osc); }
.btn-gris  { background: #999; color: white; }
.btn-gris:hover { background: #777; }
.btn-azul  { background: var(--azul); color: white; }
.btn-azul:hover { background: #1f6a9a; }
.btn-row   { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn-sm { padding: 8px 14px; font-size: 12px; border-radius: 8px; border: none; cursor: pointer; font-weight: 700; }
.btn-sm.verde { background: var(--verde); color: white; }
.btn-sm.rojo  { background: var(--r); color: white; }
.btn-sm.azul  { background: var(--azul); color: white; }
.btn-sm.gris  { background: #6c757d; color: white; }
.btn-sm.naranj { background: var(--naranj); color: white; }
.btn-cancelar {
  background: #CCC; color: var(--texto); border-radius: 10px;
  border: none; padding: 9px 14px; font-size: 12px; font-weight: 700; cursor: pointer;
  flex: 1;
}

/* ── Index / Landing ── */
.landing {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 24px; padding: 40px 20px;
}
.landing img { height: 80px; }
.landing h1 { font-size: 32px; font-weight: 900; }
.landing p  { color: var(--texto2); font-size: 14px; }
.landing-btns { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 360px; }
.landing-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; border-radius: 14px; border: none; cursor: pointer;
  font-weight: 700; font-size: 16px; color: white; gap: 4px;
  text-decoration: none; transition: opacity .15s;
}
.landing-btn:hover { opacity: .88; }
.landing-btn small { font-size: 12px; font-weight: 400; opacity: .85; }
.landing-btn.checkin  { background: var(--r); }
.landing-btn.admin    { background: var(--azul); }

/* ── Login ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box {
  background: white; border-radius: 16px; padding: 40px 40px 32px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow);
}
.login-box .bar { height: 6px; background: var(--r); border-radius: 3px; margin-bottom: 24px; }
.login-box .logo-wrap { text-align: center; margin-bottom: 8px; }
.login-box .logo-wrap img { height: 64px; }
.login-box .sub { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 3px; color: var(--texto2); margin-bottom: 20px; }
.form-group { margin-bottom: 14px; }
.form-group input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--borde);
  border-radius: 8px; font-size: 14px; font-family: var(--f);
}
.form-group input:focus { outline: none; border-color: var(--r); border-width: 2px; }
.login-error { color: var(--r); font-size: 12px; text-align: center; margin-bottom: 10px; min-height: 18px; }
.login-hint { text-align: center; font-size: 11px; color: #BBB; margin-top: 10px; }

/* ── Backoffice ── */
.bo-layout { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.bo-tabs {
  background: white; display: flex; border-bottom: 1px solid var(--borde);
  overflow-x: auto; flex-shrink: 0;
}
.bo-tab {
  padding: 14px 18px; font-size: 13px; font-weight: 700; white-space: nowrap;
  border: none; background: none; cursor: pointer; color: var(--texto2);
  border-bottom: 3px solid transparent; transition: color .15s;
}
.bo-tab:hover { color: var(--r); }
.bo-tab.active { color: var(--r); border-bottom-color: var(--r); }
.bo-content { flex: 1; overflow-y: auto; padding: 20px; }
.bo-panel { display: none; }
.bo-panel.active { display: block; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 12px; margin-bottom: 20px; }
.kpi {
  background: white; border-radius: 12px; border: 1px solid var(--borde);
  padding: 14px 18px; border-left-width: 5px;
}
.kpi-label { font-size: 11px; font-weight: 700; color: var(--texto2); letter-spacing: 1px; margin-bottom: 6px; }
.kpi-value { font-size: 24px; font-weight: 700; }

/* Tablas */
.tbl-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--borde); }
table { width: 100%; border-collapse: collapse; background: white; font-size: 13px; }
thead th {
  background: var(--r); color: white; padding: 10px 12px;
  text-align: left; font-weight: 700; white-space: nowrap;
}
tbody tr:nth-child(even) { background: #FEF9F9; }
tbody tr:hover { background: rgba(196,30,58,.06); }
tbody td { padding: 10px 12px; border-top: 1px solid var(--borde); }
td .acciones { display: flex; gap: 6px; }

/* Formularios backoffice */
.bo-form {
  background: white; border: 1px solid var(--borde); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.bo-form-title { font-size: 13px; font-weight: 700; color: var(--r); margin-bottom: 12px; }
.bo-form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.bo-form-row input, .bo-form-row select, .bo-form-row textarea {
  flex: 1; min-width: 140px; padding: 8px 12px; border: 1px solid var(--borde);
  border-radius: 8px; font-size: 13px; font-family: var(--f);
}
.bo-form-row input:focus, .bo-form-row select:focus { outline: none; border-color: var(--r); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid label { font-size: 12px; color: var(--texto2); display: flex; flex-direction: column; gap: 4px; }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 8px 12px; border: 1px solid var(--borde); border-radius: 8px;
  font-size: 13px; font-family: var(--f);
}
.form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--r); }
.form-full { grid-column: 1/-1; }

/* Filtros */
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filtros label { font-size: 12px; color: var(--texto2); }
.filtros select, .filtros input[type=date] {
  padding: 7px 12px; border: 1px solid var(--borde); border-radius: 8px;
  font-size: 13px; font-family: var(--f);
}

/* Zona peligrosa */
.danger-zone {
  border: 2px solid #E74C3C; border-radius: 12px; padding: 16px; margin-top: 16px;
}
.danger-zone h3 { color: #8B0000; margin-bottom: 8px; font-size: 14px; }
.danger-zone p  { color: var(--naranj); font-size: 12px; margin-bottom: 12px; }
.danger-zone .btns { display: flex; flex-wrap: wrap; gap: 10px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1a1a2e; color: white; padding: 12px 24px; border-radius: 10px;
  font-size: 14px; font-weight: 600; z-index: 999;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.ok    { background: var(--verde); }
.toast.error { background: var(--r); }

/* Responsive */
@media (max-width: 640px) {
  .header { height: 56px; padding: 0 12px; gap: 10px; }
  .header .reloj { font-size: 13px; }
  .header .info h1 { font-size: 12px; }
  .avatar-btn { width: 90px; }
  .avatar-img { width: 78px; height: 56px; }
  .scroll-area { padding: 12px; }
  .bo-content { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2,1fr); }
  .modal { padding: 20px; }
  .landing h1 { font-size: 24px; }
}
@media (max-width: 380px) {
  .avatar-btn { width: 82px; }
  .avatar-img { width: 70px; height: 50px; font-size: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
}
