/* ============================================================
   GYM Pro Manager – Complete Stylesheet
   MJ Systems | Inter Font | Light Theme + Dark Blue Sidebar
   ============================================================ */

:root {
  --primary:        #1a3a6b;
  --primary-dk:     #0f2040;
  --primary-lt:     #dce6f4;
  --primary-dim:    #dce6f4;

  --sidebar-bg:     #1a2b4a;
  --sidebar-hover:  #243659;
  --sidebar-active: #2f4575;
  --sidebar-w:      260px;
  --sidebar-border: rgba(255,255,255,.08);

  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --border-dk:      #cbd5e1;

  --text:           #1e293b;
  --text-light:     #334155;
  --text-muted:     #64748b;
  --text-placeholder: #94a3b8;

  --input-bg:       #ffffff;
  --input-border:   #cbd5e1;

  --success:        #16a34a;
  --success-lt:     #dcfce7;
  --warning:        #d97706;
  --warning-lt:     #fef3c7;
  --danger:         #dc2626;
  --danger-lt:      #fee2e2;
  --info:           #2563eb;
  --info-lt:        #dbeafe;

  --radius:         10px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:         0 4px 16px rgba(0,0,0,.07);
  --shadow-lg:      0 10px 40px rgba(0,0,0,.12);
  --transition:     .18s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dk); border-radius: 3px; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 1.3rem 1.2rem 1.1rem;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.brand-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(26,43,74,.3);
}

.gym-name  { font-size: .95rem; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.gym-tagline { font-size: .65rem; color: rgba(255,255,255,.4); margin-top: .1rem; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }

.nav-section {
  padding: .85rem 1.2rem .25rem;
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .58rem 1rem;
  margin: 1px .5rem;
  border-radius: 7px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .855rem;
  font-weight: 400;
  transition: all var(--transition);
  cursor: pointer;
}

.nav-item i { width: 17px; font-size: .88rem; flex-shrink: 0; opacity: .7; transition: opacity var(--transition); }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item:hover i { opacity: 1; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }
.nav-item.active i { opacity: 1; color: var(--primary); }

.sidebar-footer {
  padding: .9rem 1.2rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-user { display: flex; align-items: center; gap: .65rem; }
.s-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem; color: #fff;
  flex-shrink: 0;
}
.s-name { font-size: .82rem; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-role { font-size: .68rem; color: rgba(255,255,255,.4); }

/* ══════════════════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: .75rem; }
.topbar-title { font-size: .93rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.topbar-right { display: flex; align-items: center; gap: .6rem; }

.topbar-user {
  display: flex; align-items: center; gap: .55rem;
  font-size: .845rem; color: var(--text-light);
}

.topbar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem; color: #fff;
}

.topbar-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: .88rem;
  transition: all var(--transition);
}
.topbar-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-dk); }

/* ── Page Content ──────────────────────────────────────── */
.page-content { padding: 1.5rem; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.page-header h1 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.page-header h1 i { color: var(--primary); font-size: 1.1rem; }
.page-header p, .page-header .breadcrumb { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: -1.25rem -1.25rem 1.25rem;
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-header h3, .card-header h4 {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.card-footer {
  margin: 1.25rem -1.25rem -1.25rem;
  padding: .8rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent, var(--primary));
}

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  background: var(--accent-lt, var(--primary-lt));
  color: var(--accent, var(--primary));
  flex-shrink: 0;
}

.stat-info .stat-value, .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -.04em;
}

.stat-info .stat-label, .stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .25rem;
  font-weight: 500;
}

.stat-info .stat-sub, .stat-sub {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* ══════════════════════════════════════════════════════════
   BUTTONS  – complete set, no quirks
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .52rem 1.1rem;
  border-radius: 8px;
  font-size: .845rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}

.btn:focus-visible { outline: 3px solid rgba(26,43,74,.35); outline-offset: 2px; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* Sizes */
.btn-xs  { padding: .22rem .55rem; font-size: .72rem; border-radius: 5px; }
.btn-sm  { padding: .32rem .7rem;  font-size: .775rem; border-radius: 6px; }
.btn-lg  { padding: .68rem 1.5rem; font-size: .95rem; border-radius: 10px; }

/* Variants */
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,43,74,.2);
}
.btn-primary:hover { background: var(--primary-dk); box-shadow: 0 4px 14px rgba(26,43,74,.3); color: #fff; }

.btn-secondary {
  background: #ffffff;
  color: #475569;
  border: 1.5px solid #cbd5e1;
  font-weight: 500;
}
.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}
.btn-secondary:active { background: #e2e8f0; }

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22,163,74,.2);
}
.btn-success:hover { background: #15803d; box-shadow: 0 4px 12px rgba(22,163,74,.3); color: #fff; }

.btn-warning {
  background: var(--warning);
  color: #fff;
  box-shadow: 0 2px 8px rgba(217,119,6,.2);
}
.btn-warning:hover { background: #b45309; color: #fff; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,.2);
}
.btn-danger:hover { background: #b91c1c; box-shadow: 0 4px 12px rgba(220,38,38,.3); color: #fff; }

.btn-info {
  background: var(--info);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.2);
}
.btn-info:hover { background: #1d4ed8; color: #fff; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-dk);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lt); }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-light {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-light:hover { background: var(--border); color: var(--text); }

/* Icon-only square buttons */
.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 8px;
}
.btn-icon.btn-sm { width: 28px; height: 28px; border-radius: 6px; }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1rem; }

label, .form-label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-control {
  width: 100%;
  padding: .55rem .85rem;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 8px;
  color: var(--text);
  font-size: .875rem;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,43,74,.08);
}

.form-control::placeholder { color: var(--text-placeholder); }
.form-control:disabled { background: var(--surface-2); opacity: .7; cursor: not-allowed; }

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  padding-right: 2.2rem;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-hint  { font-size: .74rem; color: var(--text-muted); margin-top: .25rem; }
.form-error { font-size: .74rem; color: var(--danger); margin-top: .25rem; font-weight: 500; }

/* Input with icon */
.input-group { position: relative; }
.input-group .input-icon {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  color: var(--text-placeholder); pointer-events: none; font-size: .85rem;
}
.input-group .form-control { padding-left: 2.3rem; }

/* ══════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════ */
.table-responsive { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .865rem;
}

.table th {
  padding: .7rem 1rem;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: .78rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-light);
}

.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .22rem .6rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.badge-success   { background: var(--success-lt); color: #15803d; }
.badge-warning   { background: var(--warning-lt); color: #b45309; }
.badge-danger    { background: var(--danger-lt);  color: #b91c1c; }
.badge-info      { background: var(--info-lt);    color: #1d4ed8; }
.badge-secondary { background: #f1f5f9; color: var(--text-muted); }
.badge-primary   { background: var(--primary-lt); color: var(--primary-dk); }

/* ══════════════════════════════════════════════════════════
   ALERTS / FLASH
   ══════════════════════════════════════════════════════════ */
.alert {
  padding: .8rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  font-size: .855rem;
  font-weight: 500;
  border-width: 1px;
  border-style: solid;
}

.alert i { margin-top: .1rem; flex-shrink: 0; }
.alert-success { background: var(--success-lt); border-color: #bbf7d0; color: #15803d; }
.alert-error   { background: var(--danger-lt);  border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: var(--warning-lt); border-color: #fde68a; color: #b45309; }
.alert-info    { background: var(--info-lt);    border-color: #bfdbfe; color: #1d4ed8; }

/* ══════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-lg  { max-width: 800px; }
.modal-sm  { max-width: 420px; }

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: var(--surface-2);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  display: flex; align-items: center; gap: .45rem;
}

.modal-close {
  width: 32px; height: 32px;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1;
  transition: all .15s ease;
  flex-shrink: 0;
  font-family: inherit;
}
.modal-close:hover {
  background: #dce6f4;
  border-color: #93b5e1;
  color: #1a3a6b;
}
.modal-close:active { transform: scale(.93); }

.modal form,
.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  background: var(--surface-2);
  flex-shrink: 0;
}

/* ── Filter Bar ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .65rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-bar .form-control { width: auto; min-width: 150px; }

.search-box { position: relative; flex: 1; max-width: 300px; }
.search-box .search-icon {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  color: var(--text-placeholder); pointer-events: none; font-size: .82rem;
}
.search-box .form-control { padding-left: 2.3rem; }

/* ── Member Avatar ─────────────────────────────────────── */
.member-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #1a2b4a 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-info { display: flex; align-items: center; gap: .7rem; }
.member-info .name { font-weight: 600; font-size: .875rem; color: var(--text); }
.member-info .code { font-size: .74rem; color: var(--text-muted); }

/* ── Pagination ────────────────────────────────────────── */
.pagination-nav { display: flex; justify-content: center; margin-top: 1.25rem; }
.pagination { display: flex; list-style: none; gap: .3rem; flex-wrap: wrap; }
.pagination li a, .pagination li span {
  display: flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 .5rem;
  border-radius: 7px; font-size: .82rem;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); text-decoration: none;
  transition: all var(--transition); font-weight: 500;
}
.pagination li.active a,
.pagination li.active span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination li:not(.disabled):not(.active) a:hover { background: var(--primary-lt); border-color: var(--primary); color: var(--primary); }
.pagination li.disabled a,
.pagination li.disabled span { opacity: .4; pointer-events: none; }

/* ── Chart Container ───────────────────────────────────── */
.chart-container { position: relative; height: 250px; width: 100%; }

/* ── Progress Bar ──────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .4s ease; }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  gap: .15rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: .6rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .845rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  margin-bottom: -2px;
  transition: all var(--transition);
  display: flex; align-items: center; gap: .35rem;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Empty State ───────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: 1rem; opacity: .2; display: block; color: var(--primary); }
.empty-state h4 { font-size: 1rem; margin-bottom: .4rem; color: var(--text); font-weight: 700; }
.empty-state p { font-size: .85rem; }

/* ── Divider ───────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Utility ───────────────────────────────────────────── */
.d-flex           { display: flex; }
.d-grid           { display: grid; }
.gap-1            { gap: .5rem; }
.gap-2            { gap: 1rem; }
.align-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.text-center      { text-align: center; }
.text-right       { text-align: right; }
.text-muted       { color: var(--text-muted) !important; }
.text-light       { color: var(--text-light) !important; }
.text-danger      { color: var(--danger) !important; }
.text-success     { color: var(--success) !important; }
.text-warning     { color: var(--warning) !important; }
.text-info        { color: var(--info) !important; }
.text-primary     { color: var(--primary) !important; }
.fw-500           { font-weight: 500; }
.fw-600           { font-weight: 600; }
.fw-700           { font-weight: 700; }
.fw-800           { font-weight: 800; }
.fs-xs            { font-size: .72rem; }
.fs-sm            { font-size: .8rem; }
.fs-lg            { font-size: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-0  { padding: 0 !important; }
.w-100 { width: 100%; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR TOGGLE (mobile)
   ══════════════════════════════════════════════════════════ */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: .25rem;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 1rem; }
  .filter-bar { gap: .5rem; }
  .filter-bar .form-control { width: 100%; min-width: unset; }
  .table th, .table td { padding: .6rem .75rem; }
  .topbar { padding: 0 1rem; }
  .modal { max-height: 95vh; }
}

/* ══════════════════════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .filter-bar, .btn, .pagination-nav, .modal-overlay { display: none !important; }
  .main-wrapper { margin-left: 0; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ddd; box-shadow: none; background: #fff; }
}

/* ============================================================
   COMPATIBILITY & MISSING CLASSES FIX
   ============================================================ */

/* Missing CSS variables (old dark theme refs used in PHP files) */
:root {
  --bg-secondary:   var(--surface-2);
  --text-light:     #334155;
  --primary-dim:    #dce6f4;
  --card-bg:        var(--surface);
  --card-border:    var(--border);
  --input-bg:       #ffffff;
}

/* card-body / card-footer used across many pages */
.card-body {
  padding: 1.25rem;
}

.card-body + .card-footer,
.card-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* d-flex utility used in schedules + footer */
.d-flex { display: flex !important; }
.gap-1  { gap: .5rem !important; }
.gap-2  { gap: 1rem !important; }

/* btn-light (used in a few places) */
.btn-light {
  background: var(--surface-2);
  color: var(--text-light);
  border: 1px solid var(--border);
}
.btn-light:hover { background: var(--border); color: var(--text); }

/* Fix btn-warning text color for light theme */
.btn-warning { background: var(--warning); color: #fff !important; }
.btn-warning:hover { background: #b45309; }

/* Fix btn-info */
.btn-info { background: var(--info); color: #fff !important; }
.btn-info:hover { background: #1d4ed8; }

/* Stat card inner wrapper used across dashboard/reports/payments */
.stat-card .stat-info,
.stat-info {
  flex: 1;
}

/* Table inside card with no padding (card-body padding:0) */
.card > .table-responsive,
.card-body.p-0 {
  padding: 0;
}

/* Fix for inline var(--primary-dim) background references */
[style*="var(--primary-dim)"] {
  background: #e8edf5 !important;
}

/* Fix inline var(--bg-secondary) references */
[style*="var(--bg-secondary)"] {
  background: var(--surface-2) !important;
}

/* Fix inline var(--text-light) color references */
[style*="color:var(--text-light)"],
[style*="color: var(--text-light)"] {
  color: #334155 !important;
}

/* Fix select option background for light theme */
select.form-control option {
  background: #ffffff;
  color: #1e293b;
}

/* Ensure modals scroll properly */
.modal form {
  padding: 1.25rem;
  overflow-y: auto;
}

/* Card table — remove double border when card has overflow:hidden */
.card .table thead th:first-child { border-radius: 0; }

/* Topbar date responsive */
@media (max-width: 640px) {
  .topbar .tb-date,
  .topbar span[style*="text-muted"] { display: none; }
}

/* Fix schedules card footer flex */
.card-footer.d-flex {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* Fix badge inside table alignment */
.table td .badge { vertical-align: middle; }

/* Fix form-group inside modal not getting label styles */
.modal .form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* HR color fix */
hr { border-color: var(--border); }

/* Fix card padding when used with inline styles */
.card[style*="padding:0"],
.card[style*="padding: 0"] {
  padding: 0;
}

/* Fix table inside zero-padding card */
.card[style*="padding:0"] .table,
.card[style*="padding: 0"] .table {
  margin: 0;
}

/* Page header subtitle */
.page-header > div > p {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* Ensure buttons in table cells don't wrap badly */
.table td form { display: inline; }
.table td .btn { margin: 0 1px; }

/* Fix alert inside page */
.page-content > .alert { margin-bottom: 1.25rem; }

/* Pagination wrapper */
.pagination-wrap,
div[style*="padding:1rem"][style*="border-top"] {
  border-top: 1px solid var(--border);
}
