/* ═══════════════════════════════════════════════
   ROOT VARIABLES & DESIGN TOKENS
═══════════════════════════════════════════════ */
:root {
  /* Dynamic Background Colors */
  --bg-primary: #f0f4f8;
  --bg-secondary: #e2e8f0;
  
  /* Glassmorphism Tokens */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-bg-hover: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-border-bright: rgba(255, 255, 255, 1);
  --glass-blur: blur(20px);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --glass-shadow-lg: 0 12px 48px 0 rgba(31, 38, 135, 0.12);

  /* Solid Colors */
  --primary: #4f46e5;      /* Indigo 600 */
  --primary-hover: #4338ca;/* Indigo 700 */
  --secondary: #0ea5e9;    /* Light Blue 500 */
  --accent: #8b5cf6;       /* Violet 500 */
  --success: #10b981;      /* Emerald 500 */
  --danger: #ef4444;       /* Red 500 */
  --warning: #f59e0b;      /* Amber 500 */

  /* Text Colors */
  --text-dark: #0f172a;    /* Slate 900 */
  --text-muted: #475569;   /* Slate 600 */
  --text-light: #94a3b8;   /* Slate 400 */
  --text-white: #ffffff;

  /* Typography */
  --font-primary: 'Plus Jakarta Sans', sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════════
   GLOBAL RESET & BASE
═══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  color: var(--text-dark);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Stunning Animated Background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: 
    linear-gradient(125deg, #f0f4f8 0%, #e0e7ff 40%, #f3e8ff 80%, #f0fdfa 100%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite alternate;
}

@keyframes bgFloat {
  0% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(1.05) translate(2%, -2%); }
  100% { transform: scale(1.1) translate(-1%, 3%); }
}

/* ═══════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════ */
.hidden { display: none !important; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-6 { margin-bottom: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.flex { display: flex; }
.justify-end { justify-content: flex-end; }
.align-items-start { align-items: flex-start; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.pt-4 { padding-top: 1rem; }
.border-t { border-top: 1px solid var(--glass-border); }
.border-glass { border-color: rgba(255, 255, 255, 0.4); }
.ml-2 { margin-left: 0.5rem; }

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); }

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

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .col-span-3 { grid-column: span 1 !important; }
}

.col-span-3 { grid-column: span 3; }
@media(max-width: 1024px) { .lg-col-span-1 { grid-column: span 1 !important; } }

/* Animations */
.fade-up {
  animation: fadeUp var(--transition-slow);
}

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

.slide-up {
  animation: slideUp var(--transition-normal);
}

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

/* ═══════════════════════════════════════════════
   GLASS PRIMITIVES
═══════════════════════════════════════════════ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-normal);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.glass-button {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  border: none;
  text-decoration: none;
}

.btn i { font-size: 1.1em; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-dark);
  border: 1px solid var(--glass-border-bright);
}

.btn-outline:hover {
  background: white;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-text {
  background: transparent;
  color: var(--text-muted);
}

.btn-text:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }
#toggle-adv-filters.active { color: var(--primary); background: rgba(79, 70, 229, 0.05); }

.btn-dashed {
  background: transparent;
  border: 2px dashed rgba(79, 70, 229, 0.3);
  color: var(--primary);
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
}

.btn-dashed:hover {
  background: rgba(79, 70, 229, 0.05);
  border-color: var(--primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1.2rem;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.8);
  color: var(--primary);
  border-color: var(--glass-border);
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.required { color: var(--danger); }

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: 1rem;
  color: var(--text-light);
  font-size: 1.1rem;
  transition: color var(--transition-fast);
}

.input-wrapper input {
  padding-left: 2.6rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  color: var(--text-dark);
  background: #eef2ff; /* Very light indigo background so users know where to type */
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input:focus, select:focus, textarea:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.3;
}

.input-wrapper:focus-within i { color: var(--primary); }

.custom-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
  padding-right: 2.5rem;
  cursor: pointer;
}

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

/* ═══════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════ */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 3rem 2.5rem;
  background: rgba(255, 255, 255, 0.85);
}

.login-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.logo span { color: var(--primary); }

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.login-subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-err {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
}
.login-err.show { display: flex; }

/* ═══════════════════════════════════════════════
   APP LAYOUT & HEADER
═══════════════════════════════════════════════ */
.app-layout {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 70px;
}

.header-container .logo { font-size: 1.5rem; justify-content: flex-start; }
.header-container .logo-icon { width: 32px; height: 32px; font-size: 1.2rem; }

.desktop-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--primary);
}

.nav-item.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 1rem 0.35rem 0.35rem;
  border-radius: var(--radius-full);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.hamburger { display: none; }

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  z-index: 99;
  padding: 1rem;
}

.mobile-nav.open { display: block; }
.mobile-nav .nav-container { display: flex; flex-direction: column; gap: 0.5rem; }
.mobile-nav .nav-item { width: 100%; justify-content: flex-start; padding: 0.8rem 1rem; }
.nav-danger { color: var(--danger) !important; }

/* ═══════════════════════════════════════════════
   MAIN SECTIONS
═══════════════════════════════════════════════ */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 2rem 8rem;
}

.app-section { display: none; }
.app-section.active { display: block; }

.section-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.8);
}

.stat-card:hover {
  transform: translateY(-5px);
  background: white;
  box-shadow: var(--glass-shadow-lg);
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  font-size: 1.8rem;
}

.sc-1 .stat-icon { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.sc-2 .stat-icon { background: rgba(14, 165, 233, 0.1); color: var(--secondary); }
.sc-3 .stat-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.sc-4 .stat-icon { background: rgba(16, 185, 129, 0.1); color: var(--success); }

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ═══════════════════════════════════════════════
   FORMS & CARDS
═══════════════════════════════════════════════ */
.form-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.form-card {
  padding: 2rem;
}

/* Coloured Sub-Panels for Form Sections */
.sub-panel {
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255,255,255,0.6);
}

.bg-panel-blue { background-color: rgba(79, 70, 229, 0.12); border-left: 4px solid var(--primary); }
.bg-panel-cyan { background-color: rgba(14, 165, 233, 0.12); border-left: 4px solid var(--secondary); }
.bg-panel-green { background-color: rgba(16, 185, 129, 0.12); border-left: 4px solid var(--success); }
.bg-panel-purple { background-color: rgba(139, 92, 246, 0.12); border-left: 4px solid var(--accent); }

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.15), rgba(139, 92, 246, 0.15));
  color: var(--primary);
  font-size: 1.5rem;
}

.icon-box.ib-alt {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(16, 185, 129, 0.15));
  color: var(--secondary);
}

.card-header h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

.form-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  border-bottom: 1px dashed rgba(79, 70, 229, 0.2);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  margin-top: 0 !important; /* Overrides any trailing mt-6 if inside a sub-panel */
}

/* Dynamic Members List */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.member-form-card {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  position: relative;
  transition: all var(--transition-normal);
}

.member-form-card:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.member-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.member-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.btn-remove {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: none;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.btn-remove:hover { background: rgba(239, 68, 68, 0.2); }

.empty-members {
  text-align: center;
  padding: 3rem 1rem;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-md);
  border: 1px dashed var(--glass-border);
  margin-bottom: 1.5rem;
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.empty-members p {
  color: var(--text-muted);
  font-weight: 500;
}

/* Sticky Action Bar */
.sticky-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 1rem 0;
}

.container-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.btn.lg {
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
}

/* ═══════════════════════════════════════════════
   TABLES & FILTER
═══════════════════════════════════════════════ */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
  gap: 1rem;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 250px;
  max-width: 400px;
}

.search-box i {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
}

.search-box input {
  padding-left: 2.5rem;
  border-radius: var(--radius-full);
  background: white;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.search-box .badge {
  position: absolute;
  right: 0.5rem;
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.badge-primary { background: var(--primary); color: white; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #059669; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.badge-secondary { background: rgba(71, 85, 105, 0.15); color: var(--text-muted); }

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th {
  background: rgba(248, 250, 252, 0.5);
  padding: 1rem 1.5rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}

.data-table td {
  padding: 1rem 1.5rem;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  color: var(--text-muted);
}

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

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.6);
}

.data-table strong {
  color: var(--text-dark);
  font-weight: 600;
}

.sub-text {
  display: block;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* Filter Panel */
.filter-panel {
  padding: 1.5rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  align-items: end;
}

.filter-actions-group {
  display: flex;
  gap: 0.5rem;
}

/* Toggle Advanced Filters Button Text */
#toggle-adv-filters .hide-text { display: none; }
#toggle-adv-filters.active .show-text { display: none; }
#toggle-adv-filters.active .hide-text { display: inline; }

/* ═══════════════════════════════════════════════
   MODAL & OVERLAYS
═══════════════════════════════════════════════ */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(240, 244, 248, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}

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

.spinner-box {
  padding: 2.5rem 3.5rem;
  text-align: center;
  background: white;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(79, 70, 229, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.spinner-box p {
  font-weight: 600;
  color: var(--text-muted);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

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

.modal {
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(248, 250, 252, 0.8);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
}

.modal-sub { color: var(--text-muted); font-size: 0.9rem; }

.modal-body {
  padding: 2rem;
  overflow-y: auto;
}

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

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
}

.detail-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.modal-section-title {
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--glass-border);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.member-detail-card {
  background: rgba(248, 250, 252, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  font-weight: 600;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.error i { color: var(--danger); }

/* ═══════════════════════════════════════════════
   RESPONSIVE DESIGN ADAPTATIONS
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .header-container { padding: 0 1rem; }
  .desktop-nav, .user-name { display: none; }
  .hamburger { display: flex; }
  
  .main-content { padding: 1.5rem 1rem 6rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .stat-card { padding: 1rem; }
  .stat-icon { width: 44px; height: 44px; font-size: 1.4rem; }
  .stat-value { font-size: 1.6rem; }
  
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  
  .detail-grid { grid-template-columns: 1fr; gap: 1rem; }
  .toast { right: 1rem; left: 1rem; bottom: 1rem; justify-content: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 2rem 1.5rem; }
  .form-card { padding: 1.5rem 1rem; }
}
