/* ─────────────────────────────────────────────────────────────────────
   FaenApp Admin · estilos
   Paleta: oscura, sobria, consistente con la app movil.
   ───────────────────────────────────────────────────────────────────── */

:root {
  --bg: #0F1115;
  --surface: #181B22;
  --surface-2: #232730;
  --surface-3: #2E323C;
  --border: #2E323C;
  --border-soft: #232730;

  --text: #E8E4DA;
  --text-soft: #A0A4AC;
  --text-faint: #5E6470;

  --primary: #B8662B;
  --primary-soft: rgba(184, 102, 43, 0.18);
  --primary-strong: #D4793A;

  --success: #10B981;
  --success-soft: rgba(16, 185, 129, 0.18);
  --danger: #E05D5D;
  --danger-soft: rgba(224, 93, 93, 0.18);
  --warning: #F59E0B;
  --warning-soft: rgba(245, 158, 11, 0.18);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body { font-size: 14px; line-height: 1.4; }

h1, h2, h3, p { margin: 0; }

.oculto { display: none !important; }

/* ─── Vista LOGIN ───────────────────────────────────────────────────── */

#vista-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card-login {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-login .titulo {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--primary);
}

.card-login .sub {
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 12px;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.campo > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-soft);
  font-weight: 600;
}
.campo input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
.campo input:focus {
  border-color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: #FFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  margin-top: 6px;
}
.btn-primary:hover { background: var(--primary-strong); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.divisor {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 4px 0;
}
.divisor::before, .divisor::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  background: #FFFFFF;
  color: #1F1F1F;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.05s ease;
}
.btn-google:hover { background: #F1F1F1; }
.btn-google:active { transform: scale(0.98); }
.btn-google:disabled { opacity: 0.5; cursor: not-allowed; }

.error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  padding: 8px;
  background: var(--danger-soft);
  border-radius: var(--radius-xs);
}

.ayuda {
  color: var(--text-faint);
  font-size: 11px;
  text-align: center;
  margin-top: 8px;
}

/* ─── Vista PANEL ───────────────────────────────────────────────────── */

#vista-panel {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}

.titulo-mini {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.btn-ghost:hover {
  background: var(--surface);
}

/* ─── Resumen (stats) ──────────────────────────────────────────────── */

.resumen {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.stat-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-soft);
  margin-top: 2px;
}

/* ─── Buscador ─────────────────────────────────────────────────────── */

.busqueda {
  margin-bottom: 14px;
}
#buscador {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
#buscador:focus { border-color: var(--primary); }

/* ─── Lista de usuarios ────────────────────────────────────────────── */

.lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.usuario {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.15s ease;
}
.usuario.expandido {
  border-color: var(--primary-soft);
}
.usuario.dirty {
  border-color: var(--warning);
}

.usuario-head {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.usuario-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.usuario-info {
  flex: 1;
  min-width: 0;
}
.usuario-nombre {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.usuario-email {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.usuario-uid {
  font-size: 10px;
  color: var(--text-faint);
  font-family: monospace;
  margin-top: 2px;
}

.chip-estado {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.chip-estado.activa {
  background: var(--success-soft);
  color: var(--success);
}
.chip-estado.inactiva {
  background: var(--danger-soft);
  color: var(--danger);
}
.chip-estado.por-vencer {
  background: var(--warning-soft);
  color: var(--warning);
}

/* Detalle expandible */

.usuario-detalle {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.usuario.expandido .usuario-detalle { display: block; }

.fila-info {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  font-size: 13px;
}
.fila-info .lbl {
  color: var(--text-soft);
  min-width: 80px;
}
.fila-info .val { color: var(--text); }

/* Acciones */

.usuario-acciones {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  flex-direction: column;
  gap: 14px;
}
.usuario.expandido .usuario-acciones { display: flex; }

.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.switch input { display: none; }
.switch .slider {
  width: 42px;
  height: 24px;
  background: var(--surface-3);
  border-radius: 999px;
  position: relative;
  transition: background 0.18s ease;
}
.switch .slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #FFF;
  border-radius: 50%;
  transition: transform 0.18s ease;
}
.switch input:checked + .slider {
  background: var(--success);
}
.switch input:checked + .slider::after {
  transform: translateX(18px);
}
.switch-lbl {
  font-size: 14px;
  font-weight: 600;
}

.fecha-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.campo-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}
.campo-inline > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-soft);
  font-weight: 600;
}
.campo-inline input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color-scheme: dark; /* hace que el date picker se vea oscuro */
}
.campo-inline input:focus { border-color: var(--primary); }

.btn-quick {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.btn-quick:hover { background: var(--surface-3); }

.botonera {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.btn-secundario {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-secundario:hover { background: var(--surface-2); }

.btn-primary-mini {
  background: var(--primary);
  color: #FFF;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-primary-mini:hover { background: var(--primary-strong); }
.btn-primary-mini:disabled { opacity: 0.5; cursor: not-allowed; }

.vacia {
  text-align: center;
  padding: 40px;
  color: var(--text-soft);
  font-style: italic;
}

/* ─── Toast ────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
  animation: slideUp 0.22s ease;
}
.toast.success {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}
.toast.error {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ─── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 600px) {
  #vista-panel { padding: 16px; }
  .resumen { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; gap: 12px; }
}
