/* ============================================================
   Gym Access Control System — Premium Admin Dashboard CSS
   Dark-first SaaS design inspired by Linear / Stripe / Vercel
   ============================================================ */

/* ----- 1. GOOGLE FONTS + BASE RESET ------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Inter+Tight:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
}

code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ----- 2. CSS CUSTOM PROPERTIES ---------------------------- */

:root {
  /* ---- Common ---- */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.3);
  --font-display: 'Inter Tight', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* ---- Accents ---- */
  --accent: #6366f1;
  --accent-hover: #5558e6;
  --accent-light: rgba(99, 102, 241, 0.12);
  --accent-glow: rgba(99, 102, 241, 0.35);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.12);
  --purple: #a855f7;
  --orange: #f97316;
}

/* ----- Dark Mode (default) ----- */

body.dark-mode,
body:not(.light-mode) {
  --bg-primary: #0a0b14;
  --bg-secondary: #121420;
  --bg-tertiary: #191b2a;
  --bg-card: rgba(255, 255, 255, 0.045);
  --bg-card-hover: rgba(255, 255, 255, 0.075);
  --bg-elevated: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-hover: rgba(255, 255, 255, 0.09);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-inverse: #0f172a;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.03);
  --border-accent: rgba(99, 102, 241, 0.4);
  --frost: rgba(255, 255, 255, 0.08);
  --frost-heavy: rgba(255, 255, 255, 0.12);
  --sidebar-bg: rgba(18, 20, 32, 0.85);
  --sidebar-border: rgba(255, 255, 255, 0.05);
  --header-bg: rgba(10, 11, 20, 0.82);
  --modal-overlay: rgba(0, 0, 0, 0.6);
  --skeleton-from: rgba(255, 255, 255, 0.06);
  --skeleton-to: rgba(255, 255, 255, 0.12);
  --scrollbar-bg: rgba(255, 255, 255, 0.04);
  --scrollbar-thumb: rgba(255, 255, 255, 0.12);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.2);
  --toast-bg: rgba(18, 20, 32, 0.95);
  --table-stripe: rgba(255, 255, 255, 0.02);
  --table-hover: rgba(255, 255, 255, 0.04);
  --chart-grid: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  --nav-active-bg: rgba(99, 102, 241, 0.12);
  --nav-active-border: #6366f1;
  --nav-hover-bg: rgba(255, 255, 255, 0.06);
}

/* ----- Light Mode ----- */

body.light-mode {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-elevated: #ffffff;
  --bg-input: #f1f5f9;
  --bg-input-hover: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --text-inverse: #f1f5f9;
  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.04);
  --border-accent: rgba(99, 102, 241, 0.5);
  --frost: rgba(0, 0, 0, 0.05);
  --frost-heavy: rgba(0, 0, 0, 0.1);
  --sidebar-bg: rgba(255, 255, 255, 0.9);
  --sidebar-border: rgba(0, 0, 0, 0.06);
  --header-bg: rgba(248, 250, 252, 0.88);
  --modal-overlay: rgba(0, 0, 0, 0.4);
  --skeleton-from: rgba(0, 0, 0, 0.06);
  --skeleton-to: rgba(0, 0, 0, 0.12);
  --scrollbar-bg: transparent;
  --scrollbar-thumb: rgba(0, 0, 0, 0.15);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);
  --toast-bg: rgba(255, 255, 255, 0.98);
  --table-stripe: rgba(0, 0, 0, 0.02);
  --table-hover: rgba(0, 0, 0, 0.04);
  --chart-grid: rgba(0, 0, 0, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --nav-active-bg: rgba(99, 102, 241, 0.10);
  --nav-active-border: #6366f1;
  --nav-hover-bg: rgba(0, 0, 0, 0.04);
}

/* ----- 3. LAYOUT ------------------------------------------- */

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}

/* ---- Sidebar ---- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 100;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

/* ---- Sidebar Logo ---- */

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 24px;
  flex-shrink: 0;
  transition: padding var(--transition);
}

.sidebar-logo .logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition);
  color: var(--text-primary);
}

.sidebar-logo .logo-text span {
  color: var(--accent);
}

/* ---- Sidebar Nav ---- */

.sidebar-nav {
  flex: 1;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group {
  padding: 20px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--nav-active-border);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0.85;
}

.nav-item .nav-label {
  opacity: 1;
  transition: opacity var(--transition);
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ---- Sidebar User ---- */

.sidebar-user {
  padding: 16px 12px 20px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  overflow: hidden;
  flex: 1;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Sidebar Collapsed ---- */

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-logo {
  padding: 20px 16px 24px;
  justify-content: center;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-info {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .nav-item .nav-icon {
  margin: 0;
}

.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding: 16px 0 20px;
}

.sidebar.collapsed .nav-item.active::before {
  left: 0;
}

/* ---- Main Content ---- */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.main-content.expanded {
  margin-left: var(--sidebar-collapsed-width);
}

/* ---- Header ---- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left .page-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-left .page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.header-left .page-breadcrumb span {
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all var(--transition);
}

.mobile-menu-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* ---- Header Actions ---- */

.header-search,
.search-box {
  position: relative;
  width: 240px;
}

.header-search .search-icon,
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 16px;
  pointer-events: none;
  transition: color var(--transition);
}

.search-box .search-icon {
  z-index: 1;
}

.header-search input,
.search-box .search-input {
  width: 100%;
  padding: 8px 12px 8px 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--transition);
  box-sizing: border-box;
}

.header-search input::placeholder,
.search-box .search-input::placeholder {
  color: var(--text-tertiary);
}

.header-search input:focus,
.search-box .search-input:focus {
  border-color: var(--border-accent);
  background: var(--bg-input-hover);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-box .search-input:focus ~ .search-icon {
  color: var(--accent);
}

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  position: relative;
  transition: all var(--transition);
}

.header-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--frost-heavy);
}

.header-btn .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--header-bg);
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}

.header-avatar:hover {
  border-color: var(--accent);
}

/* ---- Page Container ---- */

.page-container {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
}

/* ----- 4. CARDS -------------------------------------------- */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--frost-heavy);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.card-header h2,
.card-header h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
}

.card-header h3 {
  font-size: 16px;
}

.card-header .card-action {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition);
}

.card-header .card-action:hover {
  opacity: 0.8;
}

.card-body {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ---- Stat Cards ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--frost-heavy);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card .stat-icon.indigo {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-card .stat-icon.emerald {
  background: var(--success-light);
  color: var(--success);
}

.stat-card .stat-icon.amber {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-card .stat-icon.red {
  background: var(--danger-light);
  color: var(--danger);
}

.stat-card .stat-icon.blue {
  background: var(--info-light);
  color: var(--info);
}

.stat-card .stat-icon.purple {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple);
}

.stat-card .stat-content {
  flex: 1;
  min-width: 0;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.stat-card .stat-change.up {
  color: var(--success);
}

.stat-card .stat-change.down {
  color: var(--danger);
}

/* ---- Dashboard Grids ---- */

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.dashboard-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.chart-container {
  grid-column: 1 / -1;
  min-height: 320px;
}

/* ---- Activity Feed ---- */

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-dot.green { background: var(--success); }
.activity-dot.yellow { background: var(--warning); }
.activity-dot.red { background: var(--danger); }
.activity-dot.blue { background: var(--info); }

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.activity-text strong {
  font-weight: 600;
}

.activity-time {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ----- 5. TABLES ------------------------------------------- */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  background: var(--frost);
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--table-hover);
}

.data-table tbody tr:nth-child(even) {
  background: var(--table-stripe);
}

.data-table tbody tr:nth-child(even):hover {
  background: var(--table-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .table-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-table .table-user img,
.data-table .table-user .table-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.data-table .table-user .table-name {
  font-weight: 500;
  color: var(--text-primary);
}

.data-table .table-user .table-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

.table-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}

.table-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.table-empty .empty-text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.table-empty .empty-sub {
  font-size: 13px;
}

/* ----- 6. BADGES ------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: all var(--transition);
}

.badge-active {
  background: var(--success-light);
  color: var(--success);
}

.badge-expiring {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-expired {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-suspended {
  background: rgba(249, 115, 22, 0.12);
  color: var(--orange);
}

.badge-unpaid {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple);
}

.badge-frozen {
  background: var(--info-light);
  color: var(--info);
}

.badge-granted {
  background: var(--success-light);
  color: var(--success);
}

.badge-denied {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-pending {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  padding: 0;
}

.badge-dot.badge-active { background: var(--success); }
.badge-dot.badge-expired { background: var(--danger); }
.badge-dot.badge-expiring { background: var(--warning); }
.badge-dot.badge-suspended { background: var(--orange); }

/* ----- 7. FORMS -------------------------------------------- */

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row > .form-group {
  flex: 1;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  background: var(--bg-input-hover);
  border-color: var(--frost-heavy);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  background: var(--bg-input-hover);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-light);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-light);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ----- 8. BUTTONS ------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ---- Variants ---- */

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  border-color: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}

.btn-warning:hover:not(:disabled) {
  background: #d97706;
  border-color: #d97706;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--frost-heavy);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover:not(:disabled) {
  background: var(--accent-light);
}

/* ---- Sizes ---- */

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 18px;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
  font-size: 14px;
}

/* ----- 9. MODALS ------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--modal-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-lg {
  max-width: 700px;
}

.modal-sm {
  max-width: 380px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px 0;
  gap: 16px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 20px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--frost);
  color: var(--text-primary);
}

.modal-body {
  padding: 16px 28px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 20px;
  border-top: 1px solid var(--border-light);
}

/* ----- 10. TOAST NOTIFICATIONS ----------------------------- */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--toast-bg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  min-width: 320px;
  max-width: 420px;
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all var(--transition);
}

.toast.removing {
  animation: slideOutRight 0.3s ease forwards;
}

.toast .toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.toast .toast-content {
  flex: 1;
  min-width: 0;
}

.toast .toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.toast .toast-message {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.toast .toast-dismiss {
  color: var(--text-tertiary);
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
  transition: color var(--transition);
}

.toast .toast-dismiss:hover {
  color: var(--text-primary);
}

.toast.success .toast-icon {
  background: var(--success-light);
  color: var(--success);
}

.toast.error .toast-icon {
  background: var(--danger-light);
  color: var(--danger);
}

.toast.warning .toast-icon {
  background: var(--warning-light);
  color: var(--warning);
}

.toast.info .toast-icon {
  background: var(--info-light);
  color: var(--info);
}

/* ----- 11. LOADING SKELETONS ------------------------------- */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--skeleton-from) 25%,
    var(--skeleton-to) 50%,
    var(--skeleton-from) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-xs);
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-text-sm {
  height: 12px;
  width: 70%;
}

.skeleton-text-lg {
  height: 20px;
  width: 50%;
  margin-bottom: 12px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 140px;
  border-radius: var(--radius);
}

.skeleton-badge {
  width: 60px;
  height: 22px;
  border-radius: var(--radius-full);
}

.skeleton-button {
  width: 80px;
  height: 34px;
  border-radius: var(--radius-sm);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.loading-spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

/* ----- 12. LOGIN PAGE -------------------------------------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
  bottom: -200px;
  left: -200px;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.login-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 6px;
}

.login-card .form-group:last-child {
  margin-bottom: 0;
}

.login-card .btn {
  width: 100%;
  margin-top: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.login-footer a {
  color: var(--accent);
  font-weight: 500;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ----- 13. MEMBER PROFILE ---------------------------------- */

.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.profile-header .profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
  border: 3px solid var(--border);
}

.profile-header .profile-info {
  flex: 1;
  min-width: 0;
}

.profile-header .profile-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-header .profile-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-header .profile-meta span {
  font-size: 13px;
  color: var(--text-tertiary);
}

.profile-header .profile-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.profile-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.profile-section {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.profile-section .section-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.profile-field {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}

.profile-field:last-child {
  border-bottom: none;
}

.profile-field .field-label {
  color: var(--text-tertiary);
  font-weight: 500;
}

.profile-field .field-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

.qr-code-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  gap: 16px;
}

.qr-code-display .qr-placeholder {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.qr-code-display .qr-placeholder::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(90deg, transparent 46%, #ddd 46%, #ddd 54%, transparent 54%),
    linear-gradient(0deg, transparent 46%, #ddd 46%, #ddd 54%, transparent 54%);
  background-size: 20px 20px;
  opacity: 0.5;
}

.qr-code-display .qr-placeholder .qr-center {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 4px;
  z-index: 1;
  opacity: 0.8;
}

.qr-code-display .qr-label {
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
}

/* ----- 14. NOTIFICATION PANEL ------------------------------ */

.notification-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.notification-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.notification-panel .panel-header h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: opacity var(--transition);
}

.notification-item:hover {
  opacity: 0.8;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item .notif-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.notification-item .notif-icon.access {
  background: var(--success-light);
  color: var(--success);
}

.notification-item .notif-icon.alert {
  background: var(--danger-light);
  color: var(--danger);
}

.notification-item .notif-icon.info {
  background: var(--info-light);
  color: var(--info);
}

.notification-item .notif-body {
  flex: 1;
  min-width: 0;
}

.notification-item .notif-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.notification-item .notif-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.notification-item .notif-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

/* ----- 15. ACCESS DENIED PAGE ------------------------------ */

.access-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
  min-height: 50vh;
}

.access-denied .denied-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--danger-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--danger);
  margin-bottom: 24px;
}

.access-denied .denied-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.access-denied .denied-message {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.7;
}

.access-denied .denied-reason {
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--frost);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
}

.access-denied .btn {
  margin-top: 24px;
}

/* ----- 16. GLASSMORPHISM UTILITIES ------------------------- */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}

.glass-dark {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
}

.glass-card {
  composes: glass;
  padding: 24px;
}

/* ----- 17. SCROLLBAR STYLING ------------------------------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ----- 18. ANIMATIONS -------------------------------------- */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ---- Animation Classes ---- */

.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-up {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-transition {
  animation: fadeIn 0.25s ease, slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ----- 19. UTILITY CLASSES --------------------------------- */

/* Flex/Grid */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-tertiary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-2xl { font-size: 28px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Spacing */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.px-20 { padding-left: 20px; padding-right: 20px; }
.py-8 { padding-top: 8px; padding-bottom: 8px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.py-16 { padding-top: 16px; padding-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }
.block { display: block; }

/* Borders & colors */
.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* Dividers */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.divider-light { height: 1px; background: var(--border-light); margin: 12px 0; }

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.empty-state p { font-size: 14px; color: var(--text-tertiary); max-width: 300px; }

/* ---- Tooltip ---- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ----- 20. RESPONSIVE BREAKPOINTS -------------------------- */

/* ---- Tablet Landscape / Small Desktop ---- */

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-details {
    grid-template-columns: 1fr;
  }
}

/* ---- Tablet Portrait ---- */

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 72px;
  }

  .sidebar .logo-text,
  .sidebar .nav-label,
  .sidebar .nav-group,
  .sidebar .nav-badge,
  .sidebar .user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .sidebar .sidebar-logo {
    justify-content: center;
    padding: 20px 16px 24px;
  }

  .sidebar .nav-item {
    justify-content: center;
    padding: 10px 0;
  }

  .sidebar .nav-item.active::before {
    left: 0;
  }

  .sidebar .sidebar-user {
    justify-content: center;
    padding: 16px 0 20px;
  }

  .main-content {
    margin-left: 72px;
  }

  .main-content.expanded {
    margin-left: 72px;
  }

  .header-search,
  .search-box {
    width: 180px;
  }

  .page-container {
    padding: 24px;
  }
}

/* ---- Mobile ---- */

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar .logo-text,
  .sidebar .nav-label,
  .sidebar .nav-group,
  .sidebar .nav-badge,
  .sidebar .user-info {
    opacity: 1;
    width: auto;
    overflow: visible;
    pointer-events: auto;
  }

  .sidebar .nav-item {
    justify-content: flex-start;
    padding: 12px 16px;
    min-height: 44px;
    border-radius: 10px;
    margin: 2px 10px;
    font-size: 15px;
  }

  .sidebar .nav-item.active::before {
    left: -10px;
  }

  .sidebar .nav-item .nav-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .sidebar .sidebar-logo {
    justify-content: flex-start;
    padding: 18px 18px 20px;
  }

  .sidebar .sidebar-user {
    justify-content: flex-start;
    padding: 14px 16px 18px;
  }

  .sidebar .user-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .sidebar-footer {
    padding: 0;
  }

  /* Overlay when sidebar is open */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .main-content {
    margin-left: 0;
  }

  .main-content.expanded {
    margin-left: 0;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-xs);
    background: var(--bg-card);
    border: 1px solid var(--border);
  }

  .header {
    padding: 0 20px;
    height: 56px;
  }

  .header-left {
    gap: 10px;
  }

  .header-title {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .header-title h1 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
  }

  .header-title .header-subtitle {
    font-size: 11px;
  }

  .search-box {
    display: none;
  }

  .search-box.mobile-visible {
    display: flex;
    position: absolute;
    top: 56px;
    left: 12px;
    right: 12px;
    width: auto;
    z-index: 50;
  }

  .header-right {
    gap: 8px;
  }

  .header-right .btn-icon {
    width: 38px;
    height: 38px;
  }

  .user-avatar-sm {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .notification-btn .notif-dot {
    width: 8px;
    height: 8px;
    top: 6px;
    right: 6px;
  }

  .page-container {
    padding: 20px;
  }

  .content-wrapper {
    min-height: calc(100vh - 56px - 24px);
  }

  .dashboard-grid-3 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 18px;
    min-height: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

  .stat-card .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
  }

  .stat-card .stat-label {
    font-size: 12px;
    margin-bottom: 2px;
  }

  .card {
    padding: 20px;
    border-radius: var(--radius);
  }

  .card-header {
    padding-bottom: 14px;
    margin-bottom: 14px;
  }

  .card-header h2 {
    font-size: 17px;
  }

  .card-header h3 {
    font-size: 15px;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    margin: 0;
  }

  .table-container table {
    min-width: 520px;
  }

  .data-table {
    font-size: 13px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
    white-space: nowrap;
  }

  .data-table th {
    font-size: 10px;
    letter-spacing: 0.05em;
  }

  .data-table .table-user .table-name {
    font-size: 13px;
  }

  .data-table .table-user .table-sub {
    font-size: 11px;
  }

  .login-card {
    padding: 28px 22px;
    max-width: 360px;
    margin: 0 12px;
  }

  .login-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
  }

  .login-title {
    font-size: 22px;
  }

  .login-subtitle {
    font-size: 13px;
  }

  /* Shrink background blobs on tablet */
  .login-page::before {
    width: 350px;
    height: 350px;
    top: -120px;
    right: -120px;
  }

  .login-page::after {
    width: 300px;
    height: 300px;
    bottom: -100px;
    left: -100px;
  }

  /* Profile page */
  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    gap: 12px;
  }

  .profile-header .profile-avatar {
    width: 72px;
    height: 72px;
    font-size: 28px;
    margin: 0 auto;
  }

  .profile-header .profile-info {
    text-align: center;
    align-items: center;
  }

  .profile-header .profile-name {
    font-size: 20px;
  }

  .profile-header .profile-id {
    font-size: 12px;
  }

  .profile-header .profile-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .profile-header .profile-actions .btn {
    font-size: 13px;
    padding: 8px 16px;
  }

  .profile-details {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .profile-section {
    padding: 16px;
  }

  .profile-section h3 {
    font-size: 14px;
  }

  .profile-info-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .info-item .info-label {
    font-size: 11px;
  }

  .info-item .info-value {
    font-size: 14px;
  }

  /* Modal full-width on mobile */
  .modal-overlay .modal {
    max-width: calc(100% - 24px);
    margin: 12px;
    max-height: 85vh;
    padding: 20px;
    border-radius: var(--radius);
  }

  .modal-overlay .modal-header h3 {
    font-size: 17px;
  }

  .modal-overlay .modal-body {
    padding: 0;
  }

  .modal-overlay .modal-footer {
    flex-direction: column;
    gap: 8px;
    padding-top: 14px;
  }

  .modal-overlay .modal-footer .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    min-height: 44px;
  }

  /* Forms */
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .form-group label {
    font-size: 14px;
    margin-bottom: 6px;
    font-weight: 600;
  }

  .form-input,
  .form-select,
  .form-textarea {
    padding: 12px 16px;
    font-size: 15px;
    min-height: 46px;
    border-radius: var(--radius-xs);
  }

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

  .form-hint {
    font-size: 11px;
  }

  .form-actions {
    flex-direction: column;
    gap: 8px;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    min-height: 44px;
  }

  /* Page header */
  .page-header {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
  }

  .page-header .page-title-wrap h1 {
    font-size: 20px;
  }

  .page-header .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-header .page-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Filters bar */
  .filters-bar {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }

  .filters-bar .filter-group {
    width: 100%;
  }

  .filters-bar .filter-group input,
  .filters-bar .filter-group select {
    width: 100%;
  }

  .filter-btns {
    flex-wrap: wrap;
    gap: 6px;
  }

  .filter-btn {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 36px;
  }

  /* Toast */
  .toast {
    min-width: 0;
    max-width: 100%;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast .toast-title {
    font-size: 13px;
  }

  /* Notification panel */
  .notification-panel {
    width: calc(100% - 24px);
    max-width: 360px;
    right: 12px;
    top: 62px;
    max-height: 70vh;
  }

  /* Member cards on mobile */
  .member-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .member-card {
    padding: 14px;
  }

  /* Plan cards */
  .plans-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .plan-card {
    padding: 16px;
  }

  /* Device cards */
  .devices-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Reports tabs */
  .reports-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    padding-bottom: 8px;
  }

  .reports-tabs .tab-btn {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }

  /* Badges */
  .badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  /* Empty states */
  .table-empty {
    padding: 40px 20px;
  }

  .table-empty .empty-icon {
    font-size: 36px;
  }

  .table-empty .empty-text {
    font-size: 16px;
  }

  /* Buttons */
  .btn {
    padding: 9px 16px;
    font-size: 13px;
    min-height: 38px;
  }

  .btn-lg {
    padding: 12px 24px;
    font-size: 15px;
  }

  .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
  }

  /* Pagination */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 12px 0;
  }

  .pagination .page-btn {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  /* Summary bars */
  .summary-bar {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }

  .summary-bar .summary-item {
    width: 100%;
    justify-content: space-between;
  }

  /* Access logs filter */
  .logs-filters {
    flex-direction: column;
    gap: 8px;
  }

  .logs-filters input,
  .logs-filters select {
    width: 100%;
  }

  /* Staff page */
  .staff-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Reports page */
  .report-card {
    padding: 14px;
  }

  .report-card .report-value {
    font-size: 22px;
  }

  /* Skeleton loading */
  .skeleton {
    border-radius: 6px;
  }

  .skeleton-text {
    height: 12px;
  }

  .skeleton-card {
    padding: 14px;
  }

  /* Expiring soon alert cards */
  .alert-card {
    padding: 12px 14px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .alert-card .alert-actions {
    width: 100%;
    justify-content: center;
  }

  /* Info grid on member profile */
  .info-grid-2, .info-grid-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Access denied page */
  .access-denied-page {
    padding: 40px 20px;
  }

  .access-denied-page .denied-icon {
    font-size: 64px;
  }

  .access-denied-page h2 {
    font-size: 24px;
  }

  /* Device status */
  .device-status-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .status-indicator {
    min-height: 36px;
  }

  /* Settings page */
  .settings-section {
    padding: 16px;
  }

  .settings-section h3 {
    font-size: 15px;
  }
}

/* ---- Small Mobile ---- */

@media (max-width: 480px) {
  :root {
    --header-height: 56px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card .stat-value {
    font-size: 20px;
  }

  .stat-card .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .stat-card .stat-label {
    font-size: 11px;
  }

  .modal-overlay .modal {
    max-width: calc(100% - 24px);
    margin: 12px;
    max-height: 90vh;
    padding: 20px;
    border-radius: var(--radius);
  }

  .page-container {
    padding: 14px;
  }

  .header {
    height: 56px;
    padding: 0 14px;
  }

  .header-title h1 {
    font-size: 16px;
  }

  .header-title .header-subtitle {
    display: none;
  }

  .header-right .btn-icon {
    width: 32px;
    height: 32px;
  }

  .mobile-menu-toggle {
    width: 34px;
    height: 34px;
  }

  .user-avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .search-box.mobile-visible {
    top: 52px;
    left: 6px;
    right: 6px;
  }

  .card {
    padding: 16px;
    border-radius: 10px;
  }

  .card-header h2 {
    font-size: 16px;
  }

  .card-header h3 {
    font-size: 14px;
  }

  .table-container table {
    min-width: 440px;
  }

  .data-table {
    font-size: 13px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }

  .data-table th {
    font-size: 10px;
  }

  .login-card {
    padding: 32px 28px;
    max-width: 400px;
  }

  .login-page {
    padding: 16px;
  }

  .login-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
  }

  .login-title {
    font-size: 24px;
  }

  .login-subtitle {
    font-size: 14px;
  }

  /* Shrink giant background blobs on small screens */
  .login-page::before {
    width: 250px;
    height: 250px;
    top: -80px;
    right: -80px;
  }

  .login-page::after {
    width: 200px;
    height: 200px;
    bottom: -60px;
    left: -60px;
  }

  .profile-header {
    padding: 16px;
  }

  .profile-header .profile-avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }

  .profile-header .profile-name {
    font-size: 18px;
  }

  .profile-section {
    padding: 12px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 12px;
    min-height: 36px;
  }

  .btn-lg {
    padding: 10px 20px;
    font-size: 14px;
  }

  .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
    min-height: 28px;
  }

  .form-input,
  .form-select,
  .form-textarea {
    padding: 14px 16px;
    font-size: 16px;
    min-height: 50px;
    border-radius: var(--radius);
  }

  .form-group {
    margin-bottom: 20px;
  }

  .form-group label {
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 600;
  }

  .btn-lg {
    padding: 14px 24px;
    font-size: 16px;
    min-height: 50px;
  }

  .page-header .page-title-wrap h1 {
    font-size: 18px;
  }

  .table-empty {
    padding: 30px 16px;
  }

  .table-empty .empty-text {
    font-size: 14px;
  }

  .filters-bar {
    padding: 10px;
  }

  .filter-btn {
    padding: 5px 10px;
    font-size: 11px;
    min-height: 32px;
  }

  .toast {
    padding: 10px 12px;
  }

  .toast-container {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .modal-overlay .modal-header h3 {
    font-size: 16px;
  }

  .modal-overlay .modal-footer .btn {
    padding: 10px;
    min-height: 40px;
    font-size: 13px;
  }

  .notification-panel {
    width: calc(100% - 20px);
    right: 10px;
    top: 62px;
    max-height: 65vh;
    border-radius: var(--radius);
  }

  .plans-grid,
  .devices-grid,
  .member-cards-grid,
  .staff-grid,
  .device-status-grid {
    gap: 8px;
  }

  .plan-card,
  .device-card,
  .member-card {
    padding: 12px;
  }

  .reports-tabs .tab-btn {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 32px;
  }

  .badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .pagination .page-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .report-card .report-value {
    font-size: 20px;
  }

  .access-denied-page .denied-icon {
    font-size: 48px;
  }

  .access-denied-page h2 {
    font-size: 20px;
  }

  .settings-section {
    padding: 12px;
  }
}

/* ---- Print ---- */

@media print {
  .sidebar,
  .header,
  .mobile-menu-toggle,
  .btn,
  .toast-container {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .card,
  .stat-card,
  .profile-header,
  .profile-section {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
  }

  body {
    color: #000;
    background: #fff;
  }
}
