/*************************************************************
 * MENÚ LATERAL
 *************************************************************/
.menu {
  padding: 16px 8px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 4px 8px;
  border-radius: 8px;
  color: #010102;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.menu-item .icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}
.menu-item:hover .icon {
  transform: scale(1.1);
}
.menu-item:hover {
  background: #f3f4f6;
  transform: translateX(4px);
}
.menu-item.active {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 600;
}
.sidebar-logo {
  height: 28px;
  width: auto;
  margin: 16px auto;
  object-fit: contain;
  display: block;
}

/* Dropdown */
.menu-dropdown {
  display: block;
}
.menu-parent {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.menu-dropdown .submenu {
  display: none;
  margin-left: 44px;
}
.menu-dropdown.open .submenu {
  display: block;
}
.sub-item {
  font-size: 0.9rem;
  opacity: 0.9;
}

/*************************************************************
 * HEADER USUARIO
 *************************************************************/
.user-dropdown {
  position: absolute;
  top: 60px;
  right: 20px;
  width: 360px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.15);
  padding: 16px;
  z-index: 2000;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.2s ease;
}
.user-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.dropdown-item {
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.dropdown-item:hover {
  background: #f3f4f6;
}
.dropdown-item.danger {
  color: #dc2626;
}

/*************************************************************
 * SISTEMA DE BOTONES (ÚNICO)
 *************************************************************/
.btn-saul {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, transform 0.1s ease;
}
/* =========================
   btones header top
========================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background-color 0.15s ease,
    transform 0.12s ease,
    box-shadow 0.12s ease;
}
.user-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 8px;
}
.user-box:hover {
  background: #f3f4f6;
}
.user-box:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}
/* =========================
   SIDEBAR
========================= */
.user-dropdown {
  position: absolute;
  top: 60px;
  right: 20px;
  width: 360px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.15);
  padding: 16px;
  z-index: 2000;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.2s ease;
}
.user-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.user-dropdown-header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #6b7280;
}
.dropdown-item {
  display: block;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.dropdown-item:hover {
  background: #f3f4f6;
}
.dropdown-item.danger {
  color: #dc2626;
}
/* Tamaños */
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.85rem; }
.btn-md { height: 44px; padding: 0 20px; font-size: 0.95rem; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 1.05rem; }

/* Tipos */
.btn-primary   { background:#2563eb; color:#fff; }
.btn-secondary { background:#e5e7eb; color:#111827; }
.btn-success   { background:#16a34a; color:#fff; }
.btn-warning   { background:#facc15; color:#111827; }
.btn-danger    { background:#dc2626; color:#fff; }

.btn-saul:hover:not(:disabled) {
  transform: translateY(-1px);
}
.btn-saul:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(40%);
  transform: none;
  pointer-events: none;
}
/* =========================
   Botones centrales
========================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.card {
  background: #1c8dd896;
  padding: 18px 20px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  min-height: 80px;       
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}
.card-number {
  font-size: 28px;
  font-weight: 700;
  color: rgb(2, 0, 0);
  line-height: 1;
}
.card-title{
  font-size: 15px;
  color: #ffffff;
  font-weight: bold;


}
/*************************************************************
 * MODAL BASE (GLOBAL)
 *************************************************************/
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
}
.modal.oculto {
  display: none;
}
.modal-contenido {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
}
/*************************************************************
 * Tablas
 *************************************************************/
.tabla-wrapper {
  width: 100%;
  overflow-x: auto;
  background: #ffffff;
  border-radius: 10px;
}
.tabla {
  border-collapse: collapse;
  width: 100%;
  background: #ffffff;
}
.tabla th, .tabla td {
  border: none;
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 14px;
  text-align: left;
}
.tabla th {
  background: #ffffff;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid #e2e8f0;
}
.tabla td {
  font-size: 0.83rem;
  color: #334155;
  vertical-align: middle;
}
.tabla tbody tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover td { background: #f8fafc; }
/*************************************************************
 * LOADER GLOBAL (generado por ui.js — aplica a todas las páginas)
 *************************************************************/
#globalLoader {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}
#globalLoader.hidden {
  display: none;
}
.loader-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
  min-width: 260px;
}
.loader-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: loaderSpin 0.8s linear infinite;
  margin: 0 auto 16px;
}
.loader-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px;
}
.loader-message {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0;
}
@keyframes loaderSpin {
  to { transform: rotate(360deg); }
}

/*************************************************************
 * EMPRESA ACTIVA — dropdown de cambio de empresa
 *************************************************************/
.empresa-activa-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #fff;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  cursor: pointer; transition: all .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.empresa-activa-card:hover { border-color: #3b82f6; box-shadow: 0 2px 8px rgba(59,130,246,.15); }
.empresa-activa-icon {
  width: 34px; height: 34px; background: #eff6ff; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.empresa-activa-nombre {
  font-size: 13px; font-weight: 700; color: #1e293b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 155px;
}
.empresa-db { font-size: 11px; color: #94a3b8; }
.empresa-tag {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 99px; display: inline-block;
}
.empresa-chevron {
  margin-left: auto; color: #94a3b8; font-size: 13px;
  transition: transform .25s; flex-shrink: 0;
  width: 22px; height: 22px; display: flex; align-items: center;
  justify-content: center; border-radius: 50%; background: #f1f5f9;
}
.empresa-chevron.open { transform: rotate(180deg); background: #eff6ff; color: #3b82f6; }
.empresa-pais-header {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; margin-top: 4px;
  background: #f1f5f9; font-size: 12px; font-weight: 700; color: #475569;
  border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0;
}
.empresa-pais-header:first-child { margin-top: 0; border-top: none; }
.empresa-pais-badge {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.empresa-list-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; cursor: pointer; transition: background .15s;
}
.empresa-list-item:hover  { background: #f8fafc; }
.empresa-list-item.activa { background: #eff6ff; }
.empresa-list-nombre {
  font-size: 13px; font-weight: 600; color: #1e293b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 155px;
}
.empresa-list-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.empresa-check {
  margin-left: auto; color: #fff; font-weight: 700; flex-shrink: 0;
  background: #3b82f6; width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}

/*************************************************************
 * SOCIEDAD BADGE — header center (compartido en todas las páginas)
 *************************************************************/
.sociedad-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #15803d;
  letter-spacing: 0.04em;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.sociedad-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: socPulse 2s infinite;
}
@keyframes socPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
#listaEmpresas::-webkit-scrollbar { width: 4px; }
#listaEmpresas::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/*************************************************************
 * CAMPANA DE NOTIFICACIONES (compartido entre páginas)
 *************************************************************/
.notif-bell-wrap { position: relative; }
.notif-bell-btn {
  position: relative; background: none; border: none; cursor: pointer;
  font-size: 1.25rem; padding: 6px 8px; border-radius: 8px;
  transition: background 0.15s; line-height: 1;
}
.notif-bell-btn:hover { background: #f1f5f9; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; background: #e05a5e; color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1; pointer-events: none;
}
.notif-badge.hidden { display: none; }
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 340px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0; z-index: 9999; overflow: hidden;
}
.notif-dropdown.hidden { display: none; }
.notif-dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px; font-size: 0.85rem; font-weight: 700;
  color: #0f172a; border-bottom: 1px solid #f1f5f9;
}
.notif-mark-all {
  background: none; border: none; color: #3b82f6;
  font-size: 0.75rem; cursor: pointer; padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-empty { padding: 24px 16px; text-align: center; color: #94a3b8; font-size: 0.85rem; }
.notif-item {
  display: flex; gap: 10px; padding: 11px 16px;
  border-bottom: 1px solid #f8fafc; cursor: pointer; transition: background 0.12s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #dbeafe; }
.notif-item-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 0.82rem; font-weight: 600; color: #0f172a; margin-bottom: 2px; }
.notif-item-desc { font-size: 0.78rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time { font-size: 0.72rem; color: #94a3b8; flex-shrink: 0; margin-top: 2px; }
