/* ==============================================================================
   AR GYM · TRAINER & ADMIN WEB DASHBOARD
   Design System: Bento Grid, Dark Minimalism, Subtle Glassmorphism
   Brand Identity: Charcoal (#0d110f, #121814) with Neon/Dark Green (#2ecc71)
   ============================================================================== */

:root {
  /* Surface & Background Colors */
  --bg-dark: #0a0e0c;
  --bg-surface: #101613;
  --bg-card: #151d18;
  --bg-card-hover: #19241e;
  --bg-input: #1a231e;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(46, 204, 113, 0.18);
  --border-card-hover: rgba(46, 204, 113, 0.45);

  /* Brand Colors */
  --accent-green: #2ecc71;
  --accent-green-dark: #27ae60;
  --accent-green-glow: rgba(46, 204, 113, 0.25);
  --accent-amber: #f39c12;
  --accent-red: #e74c3c;
  --accent-blue: #3498db;

  /* Typography */
  --text-main: #ffffff;
  --text-muted: #8e9e96;
  --text-dim: #5c6c64;

  /* Dimensions */
  --sidebar-width: 260px;
  --top-nav-height: 72px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset & Base Styles ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: #25332c;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-green-dark);
}

/* ── Layout Shell ── */
.app-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 16px var(--accent-green-glow);
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-green);
  letter-spacing: 0.8px;
}

.sidebar-nav {
  flex: 1;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.16), rgba(46, 204, 113, 0.05));
  border-color: var(--border-card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.nav-item.active svg {
  stroke: var(--accent-green);
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border-subtle);
}

.trainer-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.trainer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1b3a28, #2ecc71);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #ffffff;
}

.trainer-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.trainer-role {
  font-size: 11px;
  color: var(--accent-green);
  font-weight: 600;
}

/* ── Main Content Area ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
  background-color: var(--bg-dark);
}

/* ── Top Navigation Header ── */
.top-nav {
  height: var(--top-nav-height);
  background: rgba(16, 22, 19, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  margin-right: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.top-nav-actions,
.top-nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.search-input-wrapper {
  position: relative;
  width: 280px;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input,
.top-search-input {
  width: 100%;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0 16px 0 38px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.search-input:focus,
.top-search-input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 12px var(--accent-green-glow);
  background: rgba(26, 36, 30, 0.95);
}

.live-pill,
.live-indicator-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.25);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.live-dot,
.status-dot-pulse {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* ── Tab Content Container ── */
.tab-content {
  display: none;
  padding: 32px;
  animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
  display: block;
}

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

/* ── Key Metrics Cards Row ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: var(--transition);
}

.metric-card:hover {
  border-color: var(--border-card-hover);
  transform: translateY(-2px);
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.metric-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(46, 204, 113, 0.12);
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-value {
  font-size: 34px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.1;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 8px;
}

.metric-delta {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.delta-up { color: var(--accent-green); }
.delta-down { color: #ff7675; }

/* ── Bento Grid System ── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.col-span-4 { grid-column: span 4; }
.col-span-5 { grid-column: span 5; }
.col-span-6 { grid-column: span 6; }
.col-span-7 { grid-column: span 7; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.bento-card:hover {
  border-color: var(--border-card-hover);
}

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

.card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.chart-container {
  position: relative;
  width: 100%;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-green);
  color: #0a0e0c;
  box-shadow: 0 4px 14px var(--accent-green-glow);
}

.btn-primary:hover {
  background: #38e07f;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-reminder {
  background: rgba(231, 76, 60, 0.18);
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: #ff7675;
  font-weight: 800;
  padding: 6px 14px;
}

.btn-reminder:hover {
  background: rgba(231, 76, 60, 0.3);
}

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

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.status-paid {
  background: rgba(46, 204, 113, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.status-due {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.status-overdue {
  background: rgba(231, 76, 60, 0.18);
  color: #ff7675;
  border: 1px solid rgba(231, 76, 60, 0.35);
}

.plan-gold {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.3);
}

.plan-silver {
  background: rgba(189, 195, 199, 0.15);
  color: #bdc3c7;
  border: 1px solid rgba(189, 195, 199, 0.3);
}

.plan-basic {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

/* ── Filter Pills Row ── */
.filter-pills-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.filter-pill.active {
  background: var(--accent-green);
  color: #0a0e0c;
  border-color: var(--accent-green);
}

/* ── Tables ── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: rgba(46, 204, 113, 0.04);
}

.member-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #182e22, #2ecc71);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #ffffff;
}

.member-name {
  font-weight: 700;
  color: var(--text-main);
}

.member-email {
  font-size: 11px;
  color: var(--text-muted);
}

.streak-pill {
  font-weight: 800;
  color: var(--accent-green);
  font-size: 12px;
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Form Inputs ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  flex: 1;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green-glow);
}

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

/* Preset Chips */
.preset-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-chip-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.preset-chip-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.preset-chip-btn.active {
  background: rgba(46, 204, 113, 0.16);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

/* Meal Item Card */
.meal-item-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.meal-item-top {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.btn-remove-meal {
  background: none;
  border: none;
  color: #ff7675;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.btn-remove-meal:hover {
  background: rgba(231, 76, 60, 0.2);
}

/* ── Modals ── */
.modal-backdrop,
.modal-overlay {
  display: none !important;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active,
.modal-overlay.active {
  display: flex !important;
}

.modal-card,
.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: modalScale 0.22s ease-out;
  overflow: hidden;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.reminder-banner {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

/* ── Toasts ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--accent-green);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlide 0.3s ease;
}

.toast.toast-error {
  border-left-color: #ff7675;
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Login Screen Overlay ── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, #15221b 0%, #080d0a 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-overlay.hidden {
  display: none !important;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  padding: 36px 32px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7), 0 0 40px rgba(46, 204, 113, 0.08);
  animation: modalScale 0.3s ease-out;
}

.login-brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px var(--accent-green-glow);
  margin-bottom: 12px;
  color: #fff;
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.trainer-select-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
}

.trainer-select-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(46, 204, 113, 0.3);
  color: #fff;
}

.trainer-select-btn.active {
  border-color: var(--accent-green);
  background: rgba(46, 204, 113, 0.12);
  color: #fff;
}

.trainer-select-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  margin: 0 auto 8px;
  background: linear-gradient(135deg, #1d3326, #2ecc71);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
}

.trainer-select-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.trainer-select-role {
  font-size: 10px;
  color: var(--accent-green);
  margin-top: 3px;
  font-weight: 600;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  color: #ff7675;
  border-color: rgba(231, 76, 60, 0.4);
  background: rgba(231, 76, 60, 0.1);
}

.empty-state-box {
  text-align: center;
  padding: 48px 24px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.food-items-textarea {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.2px;
  background: #111814;
  border: 1px solid var(--border-card);
  color: #2ecc71;
  padding: 14px;
  border-radius: var(--radius-md);
  min-height: 160px;
  width: 100%;
}

.diet-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ── Fees & Details Tab Styles ── */
.fees-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.fees-sidebar-col {
  display: flex;
  flex-direction: column;
}

.fees-main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fees-search-wrap {
  margin-bottom: 12px;
}

.fees-member-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.fees-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.fees-member-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card-hover);
}

.fees-member-item.active {
  background: rgba(46, 204, 113, 0.12);
  border-color: var(--accent-green);
}

.fees-athlete-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.fees-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.fees-kpi-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.fees-kpi-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.fees-kpi-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.fees-payment-box {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 14px;
}

.fees-expiring-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fees-expiring-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(243, 156, 18, 0.05);
  border: 1px solid rgba(243, 156, 18, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.fees-expiring-item:hover {
  background: rgba(243, 156, 18, 0.12);
  border-color: var(--accent-amber);
}

.login-error-msg {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: #ff7675;
  font-size: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  line-height: 1.4;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s ease-in-out infinite;
}

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

/* ── Responsive Mobile & Tablet Breakpoints ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.25s ease;
}

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .col-span-8, .col-span-7, .col-span-5, .col-span-4 {
    grid-column: span 12;
  }
  .diet-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --top-nav-height: 60px;
  }

  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
  }

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

  .sidebar-backdrop.active {
    display: block;
    opacity: 1;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }

  .menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
  }

  .top-nav {
    padding: 0 14px;
    gap: 10px;
  }

  .page-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-subtitle {
    display: none;
  }

  .top-nav-actions .live-indicator-pill span:not(.status-dot-pulse) {
    display: none;
  }

  .top-nav-actions .live-indicator-pill {
    padding: 6px 8px;
  }

  .top-nav .search-input-wrapper {
    display: none;
  }

  .tab-content {
    padding: 14px 12px;
  }

  .bento-card {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }

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

  .metric-card {
    padding: 16px;
  }

  .metric-value {
    font-size: 24px;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .fees-athlete-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-bar .search-input-wrapper {
    max-width: 100% !important;
    width: 100%;
  }

  .filter-group {
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: nowrap;
  }

  .filter-pill {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .table-responsive {
    border-radius: var(--radius-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .modal-box {
    max-width: 95vw;
    margin: 12px;
    max-height: 90vh;
    padding: 18px 14px;
  }

  .modal-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .login-card {
    max-width: 92vw;
    padding: 24px 18px;
    margin: 16px;
  }
}
