/* ========================================
   VETOR — Design System
   ======================================== */

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

/* --- CSS Variables --- */
:root {
  color-scheme: dark;
  
  /* Colors */
  --side:   #0C1119;   /* SIDEBAR — um pouco mais clara que hoje */
  --bg:     #070A11;   /* FUNDO DO CONTEÚDO — mais ESCURO que os cards */
  --panel:  #131A26;   /* CARDS — os mais CLAROS, "sobem" da superfície */
  --line:   rgba(255,255,255,.08);   /* bordas um pouco mais visíveis */

  --bg-primary: var(--bg);
  --bg-secondary: var(--panel);
  --bg-tertiary: var(--bg);
  --bg-card: var(--panel);
  --bg-card-hover: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(19, 26, 38, 0.8);
  --border-color: var(--line);
  --border-active: rgba(16, 185, 129, 0.4);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0a0e17;

  --primary: #10b981;
  --primary-light: #34d399;
  --primary-dark: #059669;
  --primary-glow: rgba(16, 185, 129, 0.15);

  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --accent-glow: rgba(6, 182, 212, 0.15);

  --gradient-primary: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-bg: var(--bg);
  --gradient-card: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(6, 182, 212, 0.05));

  --danger: #ef4444;
  --danger-light: #fca5a5;
  --warning: #f59e0b;
  --warning-light: #fcd34d;
  --success: #10b981;
  --info: #3b82f6;

  /* Spacing */
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;
  --space-3xl: 96px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.15);
  --shadow-card: 0 10px 40px -10px rgba(0, 0, 0, 0.6);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-index */
  --z-sidebar: 100;
  --z-modal-overlay: 200;
  --z-modal: 201;
  --z-toast: 300;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-light);
}

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

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.1rem;
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-muted {
  color: var(--text-secondary);
}

.text-center {
  text-align: center;
}

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

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-xl);
  transition: margin-left var(--transition-normal);
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.page-header h1 {
  margin: 0;
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: var(--space-xs);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
}

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

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: var(--space-md);
  background: var(--primary-glow);
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-card .stat-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: var(--space-sm);
}

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

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

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

.form-input::placeholder {
  color: var(--text-muted);
}

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

.form-select {
  cursor: pointer;
}

.form-select optgroup {
  background: var(--bg-tertiary);
  color: var(--primary);
  font-weight: 700;
  font-style: normal;
}

.form-select option {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: normal;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* --- Tables --- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-size: 0.875rem;
}

.data-table th {
  background: transparent !important;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 16px;
  text-align: left;
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 16px 20px;
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom: none;
  transition: background var(--transition-fast);
}

.data-table td:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.data-table td:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
  cursor: pointer;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
}

.badge-primary {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.badge-purple {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

/* --- Avatar --- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-inverse);
  background: var(--gradient-primary);
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.2rem;
}

.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: 1.8rem;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.tab {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

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

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
}

/* --- Progress Bar --- */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

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

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

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

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

  100% {
    background-position: 200% 0;
  }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.animate-slide-in {
  animation: slideInLeft 0.3s ease forwards;
}

.animate-slide-up {
  animation: slideInUp 0.4s ease forwards;
}

/* Staggered children */
.stagger-children>* {
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}

.stagger-children>*:nth-child(1) {
  animation-delay: 0.05s;
}

.stagger-children>*:nth-child(2) {
  animation-delay: 0.1s;
}

.stagger-children>*:nth-child(3) {
  animation-delay: 0.15s;
}

.stagger-children>*:nth-child(4) {
  animation-delay: 0.2s;
}

.stagger-children>*:nth-child(5) {
  animation-delay: 0.25s;
}

.stagger-children>*:nth-child(6) {
  animation-delay: 0.3s;
}

/* --- Grid Layouts --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

/* --- Utility --- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.hidden {
  display: none !important;
}

/* --- Search Bar --- */
.search-bar {
  position: relative;
  max-width: 360px;
}

.search-bar input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

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

@media (max-width: 768px) {
  body {
    overscroll-behavior-y: none;
    -webkit-user-select: none;
    user-select: none;
  }
  input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
  }
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    padding: var(--space-sm);
    padding-top: 64px;
    padding-bottom: 80px; /* espaço para bottom nav */
  }

  .stats-grid,
  .stats-grid[style] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 1.6rem;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .grid-2[style],
  .grid-3[style],
  .grid-4[style] {
    grid-template-columns: 1fr !important;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .page-header > div:last-child {
    width: 100%;
    flex-wrap: wrap;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* Tabelas scroll horizontal em mobile */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Cards mais compactos */
  .card {
    padding: 12px;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Modal ocupa tela toda em mobile */
  .modal-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  /* Tabs scroll horizontal */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

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

  /* Tracker mobile */
  .tracker-live .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .tracker-live .stat-value {
    font-size: 1rem;
  }

  .tracker-live .grid-2 {
    grid-template-columns: 1fr;
  }

  /* Set rows mais compactos */
  .set-row {
    gap: 5px;
    padding: 6px;
  }

  .set-row input {
    padding: 4px 4px;
    font-size: 0.8rem;
  }

  /* Botões touch-friendly */
  .btn {
    min-height: 40px;
    padding: 8px 14px;
  }

  .btn-sm {
    min-height: 34px;
    padding: 5px 10px;
  }

  /* Formulário de exercício no modal */
  .exercise-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  /* Page header título */
  h1 {
    font-size: 1.4rem;
  }

  /* Sidebar overlay em mobile */
  #sidebarOverlay {
    display: block;
  }

  /* Students grid em mobile */
  .students-grid {
    grid-template-columns: 1fr;
  }
}

/* ── BOTTOM NAV MOBILE ──────────────────────────────────────── */
.mobile-topbar { display: none; }
#mobileBottomNav { display: none; }

@media (max-width: 768px) {
  /* Topbar */
  .mobile-topbar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 150;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  /* Safe area for notch */
  .main-content {
    padding-top: calc(56px + env(safe-area-inset-top, 0px) + 16px) !important;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 8px) !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Sidebar hidden off-screen on mobile */
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 300;
    top: 0 !important;
  }
  #sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }

  /* Bottom nav bar */
  #mobileBottomNav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 200;
    align-items: stretch;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    transition: color 0.15s;
    padding: 4px 2px;
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .mobile-nav-item.active { color: var(--primary); }
  .mobile-nav-item.active svg { stroke: var(--primary); }
  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: stroke 0.15s;
  }

  /* FAB center button (Live Tracker) */
  .mobile-nav-center {
    position: relative;
  }
  .mobile-nav-fab {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(16,185,129,0.4);
    margin-bottom: 2px;
    margin-top: -18px;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .mobile-nav-center:active .mobile-nav-fab,
  .mobile-nav-center.active .mobile-nav-fab {
    transform: scale(0.94);
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
  }
  .mobile-nav-fab svg {
    stroke: #fff;
    width: 22px;
    height: 22px;
  }
  .mobile-nav-center span { color: var(--text-muted); font-size: 0.58rem; }
  .mobile-nav-center.active span { color: var(--primary); }
}


/* ========================================
   LIGHT MODE
   ======================================== */
[data-theme="light"] {
  color-scheme: light;
  
  --bg:      #E9EDF0;
  --panel:   #F6F8FA;
  --line:    #D5DCE2;
  --ink:     #0F1519;
  --dim:     #46525C;
  --faint:   #6E7C86;
  --acc:     #0B8B60;
  --acc-num: #0B8B60;
  
  --side:       #5C6E7A;
  --side-ink:   #FFFFFF;
  --side-dim:   #D3DCE2;
  --side-faint: #B9C4CC;

  /* Mapeando para as variáveis do sistema */
  --bg-primary: var(--bg);
  --bg-secondary: var(--panel);
  --bg-tertiary: var(--bg);
  --bg-card: var(--panel);
  --bg-card-hover: rgba(0, 0, 0, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.9);
  --border-color: var(--line);
  --border-active: var(--acc);

  --text-primary: var(--ink);
  --text-secondary: var(--dim);
  --text-muted: var(--faint);
  --text-inverse: var(--panel);

  --primary: var(--acc);
  --primary-light: var(--acc-num);
  --primary-glow: rgba(14, 158, 110, 0.1);

  --gradient-bg: var(--bg);
  --gradient-card: linear-gradient(135deg, rgba(14, 158, 110, 0.03), rgba(6, 182, 212, 0.03));

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(14, 158, 110, 0.08);
  --shadow-card: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-link.active {
  background: rgba(16, 185, 129, 0.15);
  box-shadow: inset 3px 0 0 #10b981;
}

/* ========================================
   MOBILE RESPONSIVE — Trainer System
   ======================================== */
@media (max-width: 768px) {
  /* Fix dark overlay / background gap */
  body {
    background: var(--bg-primary);
    min-height: 100dvh;
  }

  html, body, #app {
    min-height: 100dvh;
  }

  /* ── Mobile Topbar ── */
  .mobile-topbar {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 150;
    height: 54px;
  }

  /* ── Sidebar hidden by default, slides in ── */
  .sidebar {
    display: flex !important;
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100dvh;
    z-index: 300;
    transform: translateX(-110%);
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border-color);
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  /* ── Main content with top and bottom padding ── */
  .main-content {
    margin-left: 0 !important;
    padding: 68px 12px 80px 12px;
    width: 100%;
    min-height: 100dvh;
  }

  /* ── Mobile Bottom Nav ── */
  #mobileBottomNav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 62px;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-around;
    z-index: 150;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.62rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 10px;
    transition: all 0.2s ease;
    min-width: 48px;
  }

  .mobile-nav-item svg {
    stroke: currentColor;
    transition: stroke 0.2s ease;
  }

  .mobile-nav-item.active {
    color: var(--primary);
  }

  .mobile-nav-item.active svg {
    stroke: var(--primary);
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.5));
  }

  .mobile-nav-item:hover {
    color: var(--primary-light);
    background: var(--primary-glow);
  }

  /* ── FAB (Live button) ── */
  .mobile-nav-center {
    position: relative;
    margin-top: -20px;
  }

  .mobile-nav-fab {
    width: 52px;
    height: 52px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.45);
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-nav-center:hover .mobile-nav-fab,
  .mobile-nav-center.active .mobile-nav-fab {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.6);
  }

  /* ── Page header compact ── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 1.3rem;
  }

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

  /* ── Stats grid ── */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card .stat-value {
    font-size: 1.4rem;
  }

  /* ── Tables ── */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 580px;
  }

  .hide-mobile {
    display: none !important;
  }

  /* ── Forms ── */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* ── Grids collapsed ── */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  /* ── Modals ── */
  .modal {
    width: 95vw;
    max-height: 90dvh;
    margin: 5vw auto;
    overflow-y: auto;
  }

  /* ── Cards ── */
  .card {
    padding: 14px;
    border-radius: 12px;
  }

  /* ── Buttons ── */
  .btn-lg {
    padding: 12px 20px;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
  }

  /* ── Tracker page ── */
  .tracker-layout,
  .tracker-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* ── Sessions table ── */
  .sessions-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Hide mobile nav on desktop */
@media (min-width: 769px) {
  .mobile-topbar,
  #mobileBottomNav {
    display: none !important;
  }
}

/* Extra small phones */
@media (max-width: 390px) {
  .main-content {
    padding: 64px 8px 72px 8px;
  }

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

/* ============================================================
   CUSTOM SELECT DROPDOWN (PREMIUM UI)
   ============================================================ */
.custom-select-container {
  position: relative;
  width: 100%;
  z-index: 1;
}

.custom-select-container.open {
  z-index: 1000;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  user-select: none;
}

.custom-select-trigger:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.custom-select-container.open .custom-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.custom-select-trigger .arrow {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform var(--transition-normal);
  margin-left: 8px;
}

.custom-select-container.open .custom-select-trigger .arrow {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
  z-index: 9999;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.custom-select-container.open .custom-select-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.custom-select-group-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 12px 6px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.custom-select-group-title:first-child {
  border-top: none;
  margin-top: 0;
}

.custom-select-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}

.custom-select-option:hover {
  background: var(--bg-card-hover);
}

.custom-select-option.selected {
  background: var(--primary-glow);
  border-left: 3px solid var(--primary);
  padding-left: 9px; /* adjust padding for border-left */
}

.custom-select-option .option-icon {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.custom-select-option .option-content {
  flex: 1;
}

.custom-select-option .option-title {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-select-option .option-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Styled scrollbar for the custom select dropdown */
.custom-select-dropdown::-webkit-scrollbar {
  width: 6px;
}
.custom-select-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
.custom-select-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
