:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, .08);
  --shadow: 0 10px 25px rgba(15, 23, 42, .06);
  --shadow-sm: 0 6px 16px rgba(15, 23, 42, .06);
  --primary: #2563eb;
  --success: #16a34a;
  --warning: #f59e0b;
  --radius: 18px;
  --sidebarW: 270px;
  --sidebarBg: rgba(255, 255, 255, .85);
}

body {
  background:
    radial-gradient(1200px 500px at 10% 0%, rgba(37, 99, 235, .10), transparent 55%),
    radial-gradient(1000px 500px at 90% 0%, rgba(245, 158, 11, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container-xxl {
  max-width: 1320px;
}

/* Layout */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  height: 100vh;
  position: sticky;
  /* Reverted to sticky to fix overlap */
  top: 0;
  left: 0;
  z-index: 100;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  padding: 1rem;
  /* Kept reduced padding */
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.content {
  flex: 1;
  padding: 18px;
}

.mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Sidebar brand */
.sidebar-brand {
  margin-bottom: 1.5rem;
  /* Reduced from 2rem */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-title {
  font-weight: 800;
  font-size: 1.25rem;
  /* Reduced */
  color: var(--primary);
  letter-spacing: -0.5px;
}

.brand-sub {
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
}

.brand-chip {
  background: rgba(37, 99, 235, .10);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, .18);
  font-weight: 900;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .72rem;
}

.nav-section {
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: .72rem;
  letter-spacing: .08em;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.nav-itemx {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: #0f172a;
  border: 1px solid transparent;
  transition: .15s ease;
  font-weight: 700;
}

.nav-itemx:hover {
  background: rgba(15, 23, 42, .04);
  border-color: rgba(15, 23, 42, .06);
  color: #0f172a;
}

.nav-itemx.active {
  background: rgba(37, 99, 235, .10);
  border-color: rgba(37, 99, 235, .22);
  color: #1d4ed8;
}

.nav-ico {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .05);
  border: 1px solid rgba(15, 23, 42, .06);
}

.nav-itemx.active .nav-ico {
  background: rgba(37, 99, 235, .12);
  border-color: rgba(37, 99, 235, .25);
}

/* Dashboard */
.dashboard-title {
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
  line-height: 1.1;
  font-size: 1.65rem;
}

.dashboard-subtitle {
  margin: .35rem 0 0;
  color: var(--muted);
}

.dashboard-topbar {
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  padding: 18px 18px;
}

.badge-soft {
  background: rgba(37, 99, 235, .08);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, .18);
  font-weight: 900;
  border-radius: 999px;
  padding: .35rem .6rem;
  font-size: .75rem;
}

.dashboard-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px;
  position: relative;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 120px;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .10);
}

.dashboard-card .kpi-label {
  font-size: .85rem;
  color: rgba(255, 255, 255, .82);
  margin: 0 0 .25rem;
}

.dashboard-card .kpi-value {
  font-size: 2.15rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1;
}

.dashboard-card .kpi-hint {
  margin-top: .6rem;
  font-size: .85rem;
  color: rgba(255, 255, 255, .82);
}

.card-primary {
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
}

.card-success {
  background: linear-gradient(135deg, #15803d, #34d399);
}

.card-warning {
  background: linear-gradient(135deg, #b45309, #fbbf24);
}

.dashboard-card:before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -120px;
  top: -120px;
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
}

.dashboard-card:after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -80px;
  bottom: -90px;
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
}

.icon-circle {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 1.25rem;
  border: 1px solid rgba(255, 255, 255, .20);
}

.card.shadow-md {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  border-bottom: 1px solid var(--border) !important;
  border-top-left-radius: var(--radius) !important;
  border-top-right-radius: var(--radius) !important;
  background: rgba(255, 255, 255, .9) !important;
}

.btn {
  border-radius: 14px;
  font-weight: 700;
}

/* Activity */
.list-group-item {
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 14px 16px;
  transition: background .15s ease;
}

.list-group-item:hover {
  background: rgba(15, 23, 42, .03);
}

.activity-chip {
  font-size: .75rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, .75);
}

.activity-time {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Skeleton */
.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(15, 23, 42, .06);
  border-radius: 12px;
}

.skeleton:after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-line {
  height: 14px;
  margin: 10px 0;
}

.skeleton-line.w60 {
  width: 60%;
}

.skeleton-line.w80 {
  width: 80%;
}

.skeleton-line.w40 {
  width: 40%;
}

/* ============================
   Members Toolbar & Pagination
   ============================ */
.members-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.toolbar-select {
  width: auto !important;
  min-width: 130px;
  border-radius: 12px !important;
  font-size: .9rem;
  font-weight: 600;
}

/* Search box */
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-box .form-control {
  padding-left: 38px;
  border-radius: 12px;
  font-size: .9rem;
  border: 1px solid rgba(15, 23, 42, .12);
  transition: border-color .2s, box-shadow .2s;
}

.search-box .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: .9rem;
  pointer-events: none;
}

/* Role badges */
.role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: capitalize;
}

.role-badge.role-miembro {
  background: rgba(37, 99, 235, .10);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, .20);
}

.role-badge.role-supervisor {
  background: rgba(245, 158, 11, .12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, .25);
}

.role-badge.role-administrador {
  background: rgba(220, 38, 38, .10);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, .20);
}

/* Pagination bar */
.members-pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  margin-top: 4px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.pagination-info {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
}

.pagination .page-link {
  border-radius: 10px !important;
  margin: 0 2px;
  font-weight: 700;
  font-size: .85rem;
  border: 1px solid rgba(15, 23, 42, .08);
  color: var(--text);
  transition: all .15s ease;
}

.pagination .page-link:hover {
  background: rgba(37, 99, 235, .08);
  border-color: rgba(37, 99, 235, .18);
  color: #1d4ed8;
}

.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}

.pagination .page-item.disabled .page-link {
  color: #ccc;
  background: transparent;
}

/* Table improvements */
#membersTable {
  border-radius: 14px;
  overflow: hidden;
}

#membersTable thead th {
  font-size: .82rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 12px 14px;
}

#membersTable tbody td {
  vertical-align: middle;
  padding: 10px 14px;
  font-size: .9rem;
}

#membersTable tbody tr {
  transition: background .15s ease;
}

#membersTable tbody tr:hover {
  background: rgba(37, 99, 235, .04) !important;
}

.row-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(15, 23, 42, .06);
  font-weight: 700;
  font-size: .8rem;
  color: var(--muted);
}

/* Action buttons with icons */
#membersTable .btn-sm {
  padding: 4px 10px;
  font-size: .78rem;
  border-radius: 10px;
}

/* Empty state */
.members-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.members-empty i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: .4;
}

.members-empty p {
  font-size: 1rem;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .members-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left,
  .toolbar-right {
    justify-content: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .toolbar-select {
    min-width: 100px;
  }

  .members-pagination-bar {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================
   Categories Styles
   ============================ */
.cat-form-card {
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.cat-form-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .5);
}

.cat-form-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}

.cat-form-body {
  padding: 20px;
}

.cat-form-body .form-control-lg {
  border-radius: 12px;
  font-size: .95rem;
  border: 1px solid rgba(15, 23, 42, .12);
  transition: border-color .2s, box-shadow .2s;
}

.cat-form-body .form-control-lg:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.cat-form-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: rgba(15, 23, 42, .02);
}

/* Categories table */
.cat-table thead th {
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  background: rgba(15, 23, 42, .02);
}

.cat-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  font-size: .9rem;
}

.cat-table tbody tr {
  transition: background .15s ease;
}

.cat-table tbody tr:hover {
  background: rgba(37, 99, 235, .04) !important;
}

/* Category icon dot */
.cat-icon-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(37, 99, 235, .35);
}

/* Categories empty state */
.cat-empty-state {
  text-align: center;
  padding: 50px 20px;
}

.cat-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .05);
  color: var(--muted);
  font-size: 1.5rem;
}

/* Improved alerts */
.alert {
  border-radius: 14px;
  border: none;
  font-weight: 600;
  font-size: .9rem;
}

.alert-success {
  background: rgba(22, 163, 74, .08);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, .15);
}

.alert-danger {
  background: rgba(220, 38, 38, .08);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, .15);
}

/* ============================
   Events Styles
   ============================ */
.evt-form-card {
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

/* Events table */
.evt-table {
  border-radius: 14px;
  overflow: hidden;
}

.evt-table thead th {
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  background: rgba(15, 23, 42, .02);
}

.evt-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  font-size: .9rem;
}

.evt-table tbody tr {
  transition: background .15s ease;
}

.evt-table tbody tr:hover {
  background: rgba(245, 158, 11, .04) !important;
}

/* Event status badges */
.evt-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}

.evt-status-pasado {
  background: rgba(100, 116, 139, .10);
  color: #64748b;
}

.evt-status-hoy {
  background: rgba(22, 163, 74, .12);
  color: #15803d;
  box-shadow: 0 0 8px rgba(22, 163, 74, .20);
  animation: pulseGreen 2s ease-in-out infinite;
}

.evt-status-proximo {
  background: rgba(245, 158, 11, .12);
  color: #b45309;
}

/* Calendar Overrides */
.fc {
  font-family: inherit;
  --fc-button-bg-color: var(--primary);
  --fc-button-border-color: var(--primary);
  --fc-button-hover-bg-color: var(--purple-700);
  --fc-button-hover-border-color: var(--purple-700);
  --fc-button-active-bg-color: var(--purple-800);
  --fc-button-active-border-color: var(--purple-800);
  --fc-today-bg-color: rgba(99, 102, 241, 0.05) !important;
}

.fc .fc-toolbar-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-800);
}

.fc .fc-col-header-cell-cushion {
  color: var(--slate-600);
  text-decoration: none;
  font-weight: 600;
  padding: 8px 0;
}

.fc .fc-daygrid-day-number {
  color: var(--slate-600);
  text-decoration: none;
  font-weight: 500;
}

.fc-theme-standard td,
.fc-theme-standard th {
  border-color: var(--slate-200);
}

.fc-event {
  cursor: pointer;
  border: none;
  border-radius: 4px;
  padding: 2px 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-size: 0.85rem;
}

.evt-status-futuro {
  background: rgba(37, 99, 235, .10);
  color: #1d4ed8;
}

.evt-status-sin-fecha {
  background: rgba(100, 116, 139, .06);
  color: #94a3b8;
}

/* Row tint for past events */
.evt-row-pasado {
  opacity: .65;
}

.evt-row-hoy {
  background: rgba(22, 163, 74, .03) !important;
  border-left: 3px solid #16a34a;
}

/* Category badge in events */
.evt-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  background: rgba(37, 99, 235, .08);
  color: #1d4ed8;
}

/* Pulse animation for "Hoy" */
@keyframes pulseGreen {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(22, 163, 74, .20);
  }

  50% {
    box-shadow: 0 0 16px rgba(22, 163, 74, .40);
  }
}

/* ============================
   Attendance Styles
   ============================ */

/* Stat cards */
.att-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.att-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

.att-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.att-stat-label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* Progress bar */
.att-progress-wrap {
  padding: 14px 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.att-progress {
  height: 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, .06);
  overflow: hidden;
}

.att-progress-bar {
  border-radius: 10px;
  transition: width .6s ease;
}

/* QR Reader area */
.att-qr-reader {
  border-radius: 14px;
  overflow: hidden;
  border: 2px dashed rgba(22, 163, 74, .3);
  background: rgba(22, 163, 74, .03);
}

/* Attendance table */
.att-table thead th {
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  background: rgba(15, 23, 42, .02);
}

.att-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  font-size: .9rem;
}

.att-table tbody tr {
  transition: background .15s ease;
}

.att-table tbody tr:hover {
  background: rgba(22, 163, 74, .04) !important;
}

/* Manual List Styles */
.manual-list-wrapper {
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

.manual-list-wrapper::-webkit-scrollbar {
  width: 6px;
}

.manual-list-wrapper::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.manual-list-wrapper::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

.manual-table td {
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.85rem;
}

.manual-table tr:last-child td {
  border-bottom: none;
}

.avatar-sm {
  flex-shrink: 0;
}

/* Fix FullCalendar Active Button Visibility */
.fc-button-active {
  color: #fff !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}