  /* ==========================================================================
     GYM PRO SaaS - AIRBNB DESIGN SYSTEM (DLS STYLED)
     Ultra-clean, modern, addictive aesthetic inspired by Airbnb
     ========================================================================== */

  :root {
    /* Airbnb Light Palette (Default) */
    --bg-base: #f7f7f7;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-inp: #ffffff;
    --border: #ebebeb;
    --border-light: #f2f2f2;
    --border-focus: #222222;
    --pri: #ff385c;
    --pri-dark: #e00b41;
    --pri-hover: #d90b3e;
    --sec: #222222;
    --ok: #008a05;
    --ok-bg: #ecfdf5;
    --warn: #c13515;
    --warn-bg: #fffbeb;
    --err: #c13515;
    --err-bg: #fef2f2;
    --t1: #222222;
    --t2: #717171;
    --t-mut: #9ca3af;
    --r: 12px;
    --r-lg: 18px;
    --r-xl: 24px;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
    --tr: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  * { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    background: var(--bg-base);
    color: var(--t1);
    min-height: 100vh;
    overflow-x: hidden;
  }

  .app {
    display: flex;
    min-height: 100vh;
  }
  
  /* ==========================================================================
     SIDEBAR
     ========================================================================== */
  .sidebar {
    width: 275px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.03);
  }

  /* ==========================================================================
     BANNER DE MARCA NITSOFT DINÁMICO (MODO CLARO Y OSCURO)
     ========================================================================== */
  .brand-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 2px 2px 2px;
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
    background: transparent;
  }
  .brand-banner-box {
    width: 100%;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0;
  }
  .brand-banner-img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center;
    display: block;
    transition: opacity 0.2s ease;
  }

  /* Visibilidad y Escala en Modo Claro */
  .brand-banner-light {
    display: block !important;
    transform: scale(0.96) !important;
  }
  .brand-banner-dark {
    display: none !important;
  }

  /* Visibilidad y Escala en Modo Oscuro (Ratio 3.00:1) */
  body.dark-mode .brand-banner-light {
    display: none !important;
  }
  body.dark-mode .brand-banner-dark {
    display: block !important;
    transform: scale(1.32) !important;
  }
  body.dark-mode .brand-logo-container {
    border-bottom: 1px solid #243452 !important;
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 18px;
    border-bottom: 1px solid var(--border);
  }
  .logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff385c 0%, #e00b41 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 6px 16px rgba(255, 56, 92, 0.28);
  }
  .logo-text { display: flex; flex-direction: column; }
  .logo-text span:first-child { font-size: 16.5px; font-weight: 900; letter-spacing: -0.4px; color: var(--t1); }
  .logo-text span:last-child { font-size: 11px; font-weight: 700; letter-spacing: 0.1px; color: var(--t-mut); }

  .user-badge {
    padding: 12px 14px;
    margin: 12px 14px 6px 14px;
    background: #f7f7f7;
    border: 1px solid var(--border);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--pri);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  }
  .user-info { display: flex; flex-direction: column; overflow: hidden; }
  .user-name { font-size: 13px; font-weight: 700; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-role-tag { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--pri); }

  .nav { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; flex: 1; overflow-y: auto; }
  .nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--t2);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: var(--tr);
    background: transparent;
  }
  .nav a:hover {
    background: #f7f7f7;
    color: var(--t1);
    transform: translateX(3px);
  }
  .nav a.active {
    background: #f7f7f7;
    color: var(--pri);
    font-weight: 800;
    border-left: 3.5px solid var(--pri);
    border-radius: 3px 10px 10px 3px;
  }
  .nav-icon { font-size: 17px; width: 22px; text-align: center; display: inline-flex; justify-content: center; align-items: center; }

  .sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
  }

  /* ==========================================================================
     MAIN CONTENT & TOPBAR
     ========================================================================== */
  .main {
    flex: 1;
    margin-left: 275px;
    padding: 24px 28px;
    min-width: 0;
  }
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: var(--r);
    box-shadow: var(--shadow-card);
    flex-wrap: wrap;
    gap: 12px;
  }
  .topbar-title { font-size: 13.5px; font-weight: 600; color: var(--t2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .topbar-title span:first-child { font-weight: 700; color: var(--t1); }
  .topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  
  /* Audit Selector */
  .audit-select {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--t1);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    outline: none;
    cursor: pointer;
  }

  /* ==========================================================================
     CARDS & LAYOUT
     ========================================================================== */
  .card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: var(--tr);
  }
  .card:hover {
    box-shadow: var(--shadow-lg);
  }
  .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .card-title {
    font-size: 16.5px;
    font-weight: 800;
    color: var(--t1);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.3px;
  }
  .title-page { 
    font-size: 24px; 
    font-weight: 800; 
    margin-bottom: 20px; 
    letter-spacing: -0.6px; 
    color: var(--t1);
  }

  .grid { display: grid; gap: 18px; margin-bottom: 20px; }
  .g4 { grid-template-columns: repeat(4, 1fr); }
  .g3 { grid-template-columns: repeat(3, 1fr); }
  .g2 { grid-template-columns: repeat(2, 1fr); }

  /* Stat Card (KPI) */
  .stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow);
    transition: var(--tr);
  }
  .stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
  }
  .stat-label { font-size: 11.5px; font-weight: 700; color: var(--t2); text-transform: uppercase; letter-spacing: 0.6px; }
  .stat-value { font-size: 26px; font-weight: 800; color: var(--t1); letter-spacing: -0.5px; }
  .stat-sub { font-size: 12px; color: var(--t2); display: flex; align-items: center; gap: 6px; }

  /* Alert Card (Deuda) */
  .debt-banner {
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #991b1b;
  }

  /* Membership Digital Card */
  .membership-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1.5px solid #334155;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    color: #fff;
  }

  /* ==========================================================================
     BUTTONS (AIRBNB SIGNATURE STYLING)
     ========================================================================== */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    transition: var(--tr);
    text-decoration: none;
    line-height: 1.2;
  }
  .btn:hover { 
    transform: translateY(-1px); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
  .btn:active {
    transform: scale(0.98);
  }
  
  .btn-primary { 
    background: linear-gradient(90deg, #ff385c 0%, #e00b41 100%); 
    color: #ffffff !important; 
    border: none;
    box-shadow: 0 4px 14px rgba(255, 56, 92, 0.28); 
  }
  .btn-primary:hover {
    background: linear-gradient(90deg, #d90b3e 0%, #c10836 100%);
    box-shadow: 0 6px 18px rgba(255, 56, 92, 0.38);
    filter: none;
  }

  .btn-secondary { 
    background: #ffffff; 
    color: #222222; 
    border: 1.5px solid #222222; 
  }
  .btn-secondary:hover {
    background: #f7f7f7;
    color: #000000;
    border-color: #000000;
  }

  .btn-success { 
    background: #008a05; 
    color: #ffffff; 
    border: none;
    box-shadow: 0 3px 10px rgba(0, 138, 5, 0.25);
  }
  .btn-success:hover {
    background: #007004;
  }

  .btn-danger { 
    background: #fff1f2; 
    color: #e11d48; 
    border: 1px solid #fecdd3; 
  }
  .btn-danger:hover {
    background: #e11d48;
    color: #ffffff;
  }

  .btn-warn { 
    background: #fffbeb; 
    color: #92400e; 
    border: 1px solid #fde68a;
  }

  .btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
  .btn-xs { padding: 5px 10px; font-size: 11.5px; border-radius: 6px; gap: 4px; font-weight: 700; }

  /* ==========================================================================
     TABLES (CLEAN AIRBNB LISTS)
     ========================================================================== */
  .tbl-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: #ffffff;
    box-shadow: var(--shadow-card);
  }
  .tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  .tbl th {
    background: #fafafa;
    text-align: left;
    padding: 13px 16px;
    border-bottom: 1.5px solid var(--border);
    color: var(--t2);
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.4px;
    font-size: 11.5px;
    text-transform: uppercase;
  }
  .tbl td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--t1);
    vertical-align: middle;
  }
  .tbl tbody tr {
    transition: background 0.15s ease;
  }
  .tbl tbody tr:hover { background: #fcfcfc; }
  
  /* ==========================================================================
     INPUTS & SELECTS
     ========================================================================== */
  .inp, textarea.inp {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #b0b0b0;
    border-radius: 10px;
    color: var(--t1);
    font-size: 13.5px;
    font-weight: 500;
    outline: none;
    transition: var(--tr);
  }
  select.inp {
    width: 100%;
    padding: 10px 38px 10px 14px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23222222'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    border: 1px solid #b0b0b0;
    border-radius: 10px;
    color: var(--t1);
    font-size: 13.5px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: var(--tr);
  }
  select.inp:hover {
    border-color: #222222;
  }
  select.inp option {
    background-color: #ffffff;
    color: #222222;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 500;
  }
  .inp:focus, select.inp:focus { 
    border-color: #222222; 
    box-shadow: 0 0 0 2px rgba(34, 34, 34, 0.12); 
    background: #ffffff; 
  }
  .inp.inp-error, select.inp.inp-error, textarea.inp.inp-error {
    border-color: #e11d48 !important;
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.15) !important;
    background: #fff1f2 !important;
  }
  .field-error {
    color: #e11d48;
    font-size: 11.5px;
    margin-top: 5px;
    display: none;
    font-weight: 700;
    line-height: 1.35;
  }
  .form-group { margin-bottom: 14px; }
  .form-label { display: block; font-size: 12px; font-weight: 700; color: var(--t1); margin-bottom: 6px; }
  .form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

  /* ==========================================================================
     BADGES (AIRBNB PILLS)
     ========================================================================== */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 700;
    border: 1px solid transparent;
  }
  .b-ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
  .b-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
  .b-bad { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
  .b-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
  .b-purple { background: #f5f3ff; color: #5b21b6; border-color: #ddd6fe; }
  
  /* Muscle Groups */
  .badge-grupo-pecho { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
  .badge-grupo-espalda { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
  .badge-grupo-piernas { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
  .badge-grupo-hombros { background: #fffbeb; color: #92400e; border-color: #fde68a; }
  .badge-grupo-biceps { background: #faf5ff; color: #6b21a8; border-color: #e9d5ff; }
  .badge-grupo-triceps { background: #fdf2f8; color: #9d174d; border-color: #fbcfe8; }
  .badge-grupo-core { background: #f0fdfa; color: #115e59; border-color: #99f6e4; }
  .badge-grupo-cardio { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
  .badge-grupo-cuerpo_completo { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
  
  .pulse { animation: pulseAnim 1.5s infinite; }
  @keyframes pulseAnim {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  }

  /* Pagination */
  .pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    background: #fafafa;
    border-top: 1px solid var(--border);
    border-bottom-left-radius: var(--r);
    border-bottom-right-radius: var(--r);
  }
  .pagination-info {
    font-size: 12.5px;
    color: var(--t2);
    font-weight: 600;
  }
  .pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }
  .page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--t1);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--tr);
  }
  .page-btn:hover:not(:disabled) {
    background: #f7f7f7;
    border-color: #222222;
    color: #222222;
  }
  .page-btn.active {
    background: #222222;
    border-color: #222222;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }
  .page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  .page-size-sel {
    height: 34px !important;
    padding: 4px 28px 4px 10px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    background-color: #ffffff !important;
    border: 1px solid var(--border) !important;
    color: var(--t1) !important;
    cursor: pointer;
  }

  /* ==========================================================================
     MODALS (AIRBNB FLOATING SHEET)
     ========================================================================== */
  .modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
  }
  .modal-box {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    max-width: 600px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18);
    margin: auto;
    color: var(--t1);
  }
  .modal-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 20px 24px; 
    border-bottom: 1px solid var(--border); 
  }
  .modal-body { padding: 24px; }
  .modal-footer { 
    display: flex; 
    align-items: center; 
    justify-content: flex-end; 
    gap: 10px; 
    padding: 16px 24px; 
    border-top: 1px solid var(--border); 
    background: #fafafa; 
  }
  .btn-close { 
    background: #f7f7f7; 
    border: none; 
    color: var(--t2); 
    font-size: 16px; 
    cursor: pointer; 
    width: 32px; 
    height: 32px; 
    border-radius: 50%; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    transition: var(--tr);
  }
  .btn-close:hover {
    background: #ebebeb;
    color: #000;
  }

  /* Ficha 360 Tabs */
  .tab-ficha {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--t2);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--tr);
  }
  .tab-ficha:hover {
    color: var(--t1);
    background: #f7f7f7;
  }
  .tab-ficha.active {
    color: var(--pri);
    border-bottom-color: var(--pri);
    background: #fff1f2;
  }

  /* Charts */
  .chart { width: 100%; height: 260px; border-radius: var(--r); }

  /* Toast */
  #toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #222222;
    border: 1px solid #333333;
    color: #ffffff;
    padding: 14px 22px;
    border-radius: var(--r);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 20000;
    font-size: 13.5px;
    font-weight: 600;
  }
  #toast.toast-ok { border-color: #008a05; background: #064e3b; color: #a7f3d0; }
  
  /* Responsive Off-Canvas Sidebar & Backdrop */
  .sidebar-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: none;
    opacity: 0;
    transition: opacity 0.28s ease;
  }
  .sidebar-backdrop.active {
    display: block;
    opacity: 1;
  }
  .mobile-only { display: none !important; }

  /* ==========================================================================
     RESPONSIVE BREAKPOINTS & LAYOUT ENHANCEMENTS
     ========================================================================== */

  .desk-table-container { display: block; width: 100%; }
  .mobile-cards-container { display: none; width: 100%; }

  .saas-sub-card-mobile {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: var(--shadow-card);
  }
  .saas-sub-card-mobile:last-child {
    margin-bottom: 0;
  }
  .saas-sub-card-mobile:hover {
    border-color: #222222;
    box-shadow: var(--shadow);
  }
  .saas-sub-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
  }
  .saas-sub-card-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 13px;
  }
  .saas-sub-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
  }
  .saas-sub-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--t2);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .saas-sub-val {
    font-weight: 600;
    color: var(--t1);
    text-align: right;
  }
  .saas-sub-card-footer {
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
  }
  .saas-sub-card-footer .btn {
    width: 100%;
    min-height: 44px;
    font-size: 13.5px;
    font-weight: 800;
    justify-content: center;
  }

  /* 1. Desktop Grande (>= 1200px) */
  @media(min-width: 1200px) {
    .main { padding: 24px 32px; }
    .g4 { grid-template-columns: repeat(4, 1fr); }
    .g3 { grid-template-columns: repeat(3, 1fr); }
    .g2 { grid-template-columns: repeat(2, 1fr); }
    #dash-saas-chart-box { flex-direction: row; align-items: center; gap: 20px; }
  }

  /* 2. Notebook (1024px - 1199px) */
  @media(max-width: 1199px) and (min-width: 1024px) {
    .main { padding: 20px 24px; }
    .g4 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .g3 { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .g2 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    #dash-saas-chart-box { flex-direction: row; align-items: center; gap: 16px; }
  }

  /* 3. Tablet (768px - 1023px) */
  @media(max-width: 1023px) and (min-width: 768px) {
    .mobile-only { display: inline-flex !important; }
    .sidebar {
      position: fixed;
      top: 0; left: 0; bottom: 0;
      width: 290px;
      max-width: 85vw;
      height: 100vh;
      z-index: 1200;
      transform: translateX(-100%);
      transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    }
    .sidebar.open { transform: translateX(0); }
    .main {
      margin-left: 0 !important;
      width: 100% !important;
      padding: 18px 16px;
    }
    .g4 { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .g3 { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .g2 { grid-template-columns: 1fr; gap: 16px; }
    #dash-saas-chart-box { flex-direction: column; align-items: center; text-align: center; gap: 14px; }
    #dash-saas-chart-legend { width: 100%; text-align: left; }
    #dash-charts-container { grid-template-columns: 1fr 1fr; gap: 14px; }
  }

  /* 4. Teléfono (< 768px) */
  @media(max-width: 767px) {
    .mobile-only { display: inline-flex !important; }
    .sidebar {
      position: fixed;
      top: 0; left: 0; bottom: 0;
      width: 290px;
      max-width: 85vw;
      height: 100vh;
      z-index: 1200;
      transform: translateX(-100%);
      transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    }
    .sidebar.open { transform: translateX(0); }
    .main {
      margin-left: 0 !important;
      width: 100% !important;
      padding: 14px 12px;
    }
    .topbar {
      flex-direction: column;
      align-items: stretch;
      gap: 12px;
      padding: 12px 14px;
    }
    .topbar-title {
      font-size: 12.5px;
      gap: 6px;
      line-height: 1.4;
    }
    .topbar-actions {
      width: 100%;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }
    .topbar-actions .btn {
      width: 100%;
      min-height: 40px;
      justify-content: center;
    }
    .title-page { font-size: 19px; margin-bottom: 14px; }
    .grid.g4, .grid.g3, .grid.g2 { grid-template-columns: 1fr; gap: 12px; }
    .card { padding: 16px 14px; border-radius: 14px; margin-bottom: 14px; }
    .card-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
    }
    .card-title { font-size: 15px; }
    .stat-card { padding: 16px 14px; gap: 8px; }
    .stat-value { font-size: 22px; }
    .debt-banner { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px; }
    .membership-card { padding: 18px 14px; border-radius: 16px; }

    #dash-saas-chart-box {
      flex-direction: column !important;
      align-items: center !important;
      gap: 14px !important;
      width: 100% !important;
    }
    #dash-saas-chart-box canvas {
      width: 130px !important;
      height: 130px !important;
      max-width: 130px !important;
      max-height: 130px !important;
    }
    #dash-saas-chart-legend {
      width: 100% !important;
    }
    #dash-charts-container { grid-template-columns: 1fr !important; gap: 12px; }

    /* Switch from Table to Mobile Cards */
    .desk-table-container { display: none !important; }
    .mobile-cards-container { display: flex !important; flex-direction: column; gap: 12px; width: 100%; }

    .tbl-wrap {
      border-radius: 10px;
      -webkit-overflow-scrolling: touch;
      margin-bottom: 12px;
    }
    .tbl th, .tbl td {
      padding: 10px 12px;
      font-size: 12.5px;
    }

    /* Modals */
    .modal-backdrop { padding: 8px; }
    .modal-box {
      width: 100% !important;
      max-width: 100% !important;
      max-height: 94vh;
      border-radius: 16px;
    }
    .modal-header { padding: 14px 16px; }
    .modal-body { padding: 16px 14px; }
    .modal-footer {
      padding: 12px 14px;
      flex-direction: column-reverse;
      gap: 8px;
    }
    .modal-footer .btn { width: 100%; min-height: 44px; justify-content: center; }
    .form-row { grid-template-columns: 1fr !important; gap: 10px; }

    .tab-ficha {
      padding: 10px 12px;
      font-size: 12px;
    }

    #toast {
      left: 14px;
      right: 14px;
      bottom: 14px;
      justify-content: center;
      text-align: center;
      font-size: 13px;
      padding: 12px 16px;
    }
  }

  /* Buscadores Dinámicos en Modales */
  .search-dropdown-menu {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 56, 92, 0.5) transparent;
    background: #ffffff;
    border: 1px solid #ebebeb;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
  }
  .search-dropdown-menu::-webkit-scrollbar {
    width: 6px;
  }
  .search-dropdown-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 56, 92, 0.4);
    border-radius: 4px;
  }
  .search-dropdown-item {
    transition: background 0.15s ease;
    border-bottom: 1px solid #f2f2f2;
    padding: 10px 14px;
    cursor: pointer;
  }
  .search-dropdown-item:hover {
    background: #f7f7f7 !important;
  }
  .search-dropdown-item div div:first-child {
    color: #222222 !important;
  }

  /* Simulation Banner */
  .simulation-banner {
    background: #222222;
    color: #ffffff;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    border-bottom: 2px solid var(--pri);
  }
  .sim-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
  }
  .sim-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
  }

  /* Theme Switch Buttons in Sidebar */
  .theme-switch-group {
    background: #f7f7f7;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 10px;
    display: flex;
    gap: 2px;
  }
  .theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 8px;
    border: none;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--t2);
    background: transparent;
  }
  .theme-btn.active {
    background: #ffffff;
    color: var(--pri);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .btn-sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #e11d48;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s ease;
  }
  .btn-sidebar-logout:hover {
    background: #e11d48;
    color: #ffffff;
    transform: translateX(3px);
  }

  /* ==========================================================================
     MODO NOCTURNO ORIGINAL (DARK GLASS NEON THEME)
     ========================================================================== */
  body.dark-mode {
    --bg-base: #090d16;
    --bg-card: #131b2e;
    --bg-card-hover: #18233c;
    --bg-inp: #1b2640;
    --border: #243452;
    --border-light: rgba(255, 255, 255, 0.08);
    --pri: #3b82f6;
    --sec: #8b5cf6;
    --ok: #10b981;
    --warn: #f59e0b;
    --err: #ef4444;
    --t1: #f8fafc;
    --t2: #cbd5e1;
    --t-mut: #64748b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    background: radial-gradient(circle at 10% 0%, #1e1b4b 0%, #090d16 60%) !important;
    color: #f8fafc !important;
  }

  body.dark-mode .sidebar {
    background: rgba(10, 15, 29, 0.95) !important;
    border-right: 1px solid #243452 !important;
    backdrop-filter: blur(12px) !important;
  }

  body.dark-mode .brand-logo-container {
    border-bottom: 1px solid #243452 !important;
  }
  body.dark-mode .brand-title {
    color: #f8fafc !important;
  }
  body.dark-mode .brand-slogan {
    color: #94a3b8 !important;
  }
  body.dark-mode .brand-logo-box {
    background: #0f172a !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4) !important;
  }

  body.dark-mode .logo {
    border-bottom: 1px solid #243452 !important;
  }

  body.dark-mode .logo-icon {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.35) !important;
  }

  body.dark-mode .logo-text span:first-child {
    color: #f8fafc !important;
  }
  body.dark-mode .logo-text span:last-child {
    color: #94a3b8 !important;
  }

  body.dark-mode .user-badge {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: #243452 !important;
  }

  body.dark-mode .user-avatar {
    background: #1e293b !important;
    border-color: #243452 !important;
    color: #3b82f6 !important;
  }

  body.dark-mode .user-name {
    color: #f8fafc !important;
  }
  body.dark-mode .user-role-tag {
    color: #3b82f6 !important;
  }

  body.dark-mode .nav a {
    color: #cbd5e1 !important;
  }

  body.dark-mode .nav a:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
  }

  body.dark-mode .nav a.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35) !important;
    border-left: none !important;
  }

  body.dark-mode .sidebar-footer {
    background: transparent !important;
    border-top: 1px solid #243452 !important;
  }

  body.dark-mode .topbar {
    background: rgba(19, 27, 46, 0.6) !important;
    border-color: #243452 !important;
    backdrop-filter: blur(8px) !important;
  }

  body.dark-mode .topbar-title {
    color: #cbd5e1 !important;
  }
  body.dark-mode .topbar-title span:first-child {
    color: #cbd5e1 !important;
  }

  body.dark-mode .audit-select {
    background: #1e1b4b !important;
    border-color: #3b82f6 !important;
    color: #93c5fd !important;
  }

  body.dark-mode .card,
  body.dark-mode .stat-card {
    background: #131b2e !important;
    border-color: #243452 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
    color: #f8fafc !important;
  }

  body.dark-mode .card-title,
  body.dark-mode .title-page,
  body.dark-mode .stat-value {
    color: #f8fafc !important;
  }

  body.dark-mode .stat-label {
    color: #64748b !important;
  }
  body.dark-mode .stat-sub {
    color: #cbd5e1 !important;
  }

  body.dark-mode .debt-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(185, 28, 28, 0.4)) !important;
    border-color: #ef4444 !important;
    color: #fff !important;
  }

  /* Dark mode buttons */
  body.dark-mode .btn-primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
    border: none !important;
  }
  body.dark-mode .btn-primary:hover {
    filter: brightness(1.1) !important;
    transform: translateY(-1px) !important;
  }

  body.dark-mode .btn-secondary {
    background: #1b2640 !important;
    color: #f8fafc !important;
    border: 1px solid #243452 !important;
  }
  body.dark-mode .btn-secondary:hover {
    background: #243452 !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
  }

  body.dark-mode .btn-info {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
  }
  body.dark-mode .btn-info:hover {
    background: rgba(59, 130, 246, 0.28) !important;
  }

  body.dark-mode .btn-success {
    background: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
  }
  body.dark-mode .btn-success:hover {
    background: #059669 !important;
  }

  body.dark-mode .btn-danger {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
  }
  body.dark-mode .btn-danger:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
  }

  body.dark-mode .btn-warn {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
  }
  body.dark-mode .btn-warn:hover {
    background: #f59e0b !important;
    color: #000000 !important;
  }

  body.dark-mode .btn-purple {
    background: linear-gradient(135deg, #8b5cf6, #ec4899) !important;
    color: #ffffff !important;
  }

  /* Dark mode pagination */
  body.dark-mode .pagination-wrap {
    background: rgba(255, 255, 255, 0.02) !important;
    border-top: 1px solid #243452 !important;
  }
  body.dark-mode .pagination-info {
    color: #cbd5e1 !important;
  }
  body.dark-mode .page-btn {
    background: #1b2640 !important;
    border: 1px solid #243452 !important;
    color: #f8fafc !important;
  }
  body.dark-mode .page-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
  }
  body.dark-mode .page-btn.active {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4) !important;
  }
  body.dark-mode .page-size-sel {
    background-color: #1b2640 !important;
    border: 1px solid #243452 !important;
    color: #f8fafc !important;
  }

  /* Dark mode tables */
  body.dark-mode .tbl-wrap {
    background: rgba(10, 15, 29, 0.4) !important;
    border-color: #243452 !important;
  }

  body.dark-mode .tbl th {
    background: #111827 !important;
    border-bottom-color: #243452 !important;
    color: #cbd5e1 !important;
  }

  body.dark-mode .tbl td {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
  }

  body.dark-mode .tbl tbody tr:hover {
    background: rgba(255, 255, 255, 0.035) !important;
  }

  body.dark-mode .inp,
  body.dark-mode select.inp,
  body.dark-mode textarea.inp {
    background: #1b2640 !important;
    color: #ffffff !important;
    border-color: #243452 !important;
  }

  body.dark-mode .inp:focus,
  body.dark-mode select.inp:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
    background: #202d4b !important;
  }

  body.dark-mode select.inp option {
    background: #0f172a !important;
    color: #f8fafc !important;
  }

  body.dark-mode .modal-box {
    background: #131b2e !important;
    border-color: #243452 !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8) !important;
    color: #f8fafc !important;
  }

  body.dark-mode .modal-header {
    border-bottom-color: #243452 !important;
  }

  body.dark-mode .modal-footer {
    border-top-color: #243452 !important;
    background: rgba(10, 15, 29, 0.4) !important;
  }

  body.dark-mode .btn-close {
    background: transparent !important;
    color: #cbd5e1 !important;
  }
  body.dark-mode .btn-close:hover {
    color: #ffffff !important;
  }

  body.dark-mode .tab-ficha {
    color: #cbd5e1 !important;
  }
  body.dark-mode .tab-ficha:hover {
    color: #f8fafc !important;
    background: rgba(255, 255, 255, 0.03) !important;
  }
  body.dark-mode .tab-ficha.active {
    color: #60a5fa !important;
    border-bottom-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.08) !important;
  }

  body.dark-mode .theme-switch-group {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: #243452 !important;
  }

  body.dark-mode .theme-btn {
    color: #64748b !important;
    background: transparent !important;
  }

  body.dark-mode .theme-btn.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4) !important;
  }

  body.dark-mode .b-ok { background: rgba(16, 185, 129, 0.15) !important; color: #34d399 !important; border-color: rgba(16, 185, 129, 0.35) !important; }
  body.dark-mode .b-warn { background: rgba(245, 158, 11, 0.15) !important; color: #fbbf24 !important; border-color: rgba(245, 158, 11, 0.35) !important; }
  body.dark-mode .b-bad { background: rgba(239, 68, 68, 0.15) !important; color: #f87171 !important; border-color: rgba(239, 68, 68, 0.35) !important; }
  body.dark-mode .b-info { background: rgba(59, 130, 246, 0.15) !important; color: #60a5fa !important; border-color: rgba(59, 130, 246, 0.35) !important; }
  body.dark-mode .b-purple { background: rgba(139, 92, 246, 0.15) !important; color: #c084fc !important; border-color: rgba(139, 92, 246, 0.35) !important; }

  body.dark-mode .search-dropdown-menu {
    background: #0f172a !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7) !important;
  }

  body.dark-mode .search-dropdown-item {
    border-bottom-color: rgba(255, 255, 255, 0.06) !important;
  }

  body.dark-mode .search-dropdown-item:hover {
    background: rgba(59, 130, 246, 0.22) !important;
  }

  body.dark-mode .search-dropdown-item div div:first-child {
    color: #f8fafc !important;
  }

  body.dark-mode .saas-sub-card-mobile {
    background: rgba(255, 255, 255, 0.025) !important;
    border-color: #243452 !important;
    color: #f8fafc !important;
  }
  body.dark-mode .saas-sub-card-mobile:hover {
    border-color: rgba(59, 130, 246, 0.4) !important;
    background: rgba(255, 255, 255, 0.04) !important;
  }
  body.dark-mode .saas-sub-card-header,
  body.dark-mode .saas-sub-card-footer {
    border-color: rgba(255, 255, 255, 0.06) !important;
  }

  /* ==========================================================================
     TARJETA / CARNET DIGITAL VIP DEL SOCIO (RESPONSIVE WALLET PASS)
     ========================================================================== */
  .student-vip-card-wrapper {
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
  }

  .student-vip-card {
    background: linear-gradient(145deg, #090d16 0%, #151a30 50%, #0d1222 100%);
    border: 1.5px solid rgba(59, 130, 246, 0.4);
    border-radius: 24px;
    padding: 26px 30px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 25px rgba(59, 130, 246, 0.12);
    position: relative;
    overflow: hidden;
    color: #f8fafc;
  }

  .student-vip-card.vencido {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 25px rgba(239, 68, 68, 0.15);
  }

  .student-vip-card::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -40%;
    width: 70%;
    height: 70%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.18), transparent 70%);
    pointer-events: none;
  }

  .student-vip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 16px;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
  }

  .student-vip-gym-name {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  .student-vip-gym-sub {
    font-size: 11px;
    color: #94a3b8;
    letter-spacing: 1.2px;
    text-transform: uppercase;
  }

  /* Grid 2 Columnas en PC (Horizontal Rectangular) */
  .student-vip-body-grid {
    display: grid;
    grid-template-columns: 1fr 210px;
    gap: 28px;
    align-items: center;
    position: relative;
    z-index: 2;
  }

  .student-vip-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
  }

  .student-vip-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    flex-shrink: 0;
  }

  .student-vip-name {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .student-vip-socio-id {
    font-size: 12.5px;
    color: #38bdf8;
    font-weight: 700;
    margin-top: 3px;
    font-family: monospace;
    letter-spacing: 0.5px;
  }

  .student-vip-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .student-vip-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .student-vip-pill .pill-label {
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .student-vip-pill .pill-val {
    color: #f8fafc;
    font-size: 13.5px;
  }

  .student-vip-pill .pill-sub {
    font-size: 10.5px;
    color: #94a3b8;
    font-weight: 700;
  }

  .student-vip-qr-col {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .student-vip-qr-container {
    background: #ffffff;
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }

  .student-vip-qr-label {
    font-size: 10px;
    color: #334155;
    font-weight: 800;
    margin-top: 8px;
    letter-spacing: 1px;
  }

  .student-vip-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 16px;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    position: relative;
    z-index: 2;
  }

  /* Adaptación Responsive para Móviles (< 768px) */
  /* ==========================================================================
     GRILLA DE MÉTRICAS DEL ALUMNO (VENCIMIENTO + ESTADO DE CUOTA) - SIEMPRE 2 COLUMNAS
     ========================================================================== */
  .student-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .student-stats-grid .stat-card {
    min-width: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    height: 100% !important;
  }

  @media (orientation: landscape) {
    .student-stats-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 12px !important;
    }
    .student-stats-grid .stat-card {
      padding: 12px 14px !important;
    }
  }

  @media (max-width: 767px) {
    .student-vip-card-wrapper {
      max-width: 100%;
    }

    .student-vip-card {
      padding: 18px 14px;
      border-radius: 20px;
    }

    .student-vip-body-grid {
      grid-template-columns: 1fr;
      gap: 16px;
    }

    .student-vip-name {
      font-size: 18px !important;
    }

    .student-vip-pills {
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .student-vip-pill {
      padding: 8px 10px;
      font-size: 11px;
    }

    .student-vip-qr-container {
      padding: 12px;
      margin-top: 8px;
    }

    .student-vip-footer {
      flex-direction: row;
      justify-content: space-between;
      text-align: left;
    }

    .student-stats-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 10px !important;
      width: 100% !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
    }
    .student-stats-grid .stat-card {
      padding: 12px 10px !important;
      min-width: 0 !important;
      box-sizing: border-box !important;
      display: flex !important;
      flex-direction: column !important;
      justify-content: space-between !important;
      min-height: 100px !important;
      height: 100% !important;
      margin: 0 !important;
    }
    .student-stats-grid .stat-label {
      font-size: 10.5px !important;
      white-space: nowrap !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
    }
    .student-stats-grid .stat-value {
      font-size: 14.5px !important;
      line-height: 1.25 !important;
      word-break: break-word !important;
      overflow-wrap: break-word !important;
      white-space: normal !important;
    }
    .student-stats-grid .stat-sub {
      font-size: 11px !important;
      margin-top: 4px !important;
      display: flex !important;
      align-items: center !important;
      gap: 4px !important;
      flex-wrap: wrap !important;
    }
    .student-stats-grid .stat-sub .badge {
      font-size: 9.5px !important;
      padding: 2px 6px !important;
      white-space: nowrap !important;
    }
    .student-hero-banner {
      padding: 18px 16px !important;
      border-radius: 20px !important;
    }
    .student-hero-banner h2 {
      font-size: 20px !important;
    }
    .student-hero-actions {
      width: 100%;
    }
    .student-hero-actions .btn {
      flex: 1 1 100%;
      justify-content: center;
    }

    /* Rutina del Alumno en Móvil: Centrado de Encabezado y Aprovechamiento de Ancho Lateral */
    .student-routine-header {
      flex-direction: column !important;
      text-align: center !important;
      align-items: center !important;
      justify-content: center !important;
    }
    .student-routine-badges {
      justify-content: center !important;
      width: 100% !important;
      margin: 0 auto 6px auto !important;
    }
    .student-routine-badges .badge {
      font-size: 10px !important;
      padding: 3px 8px !important;
    }
    .student-routine-title {
      font-size: 18px !important;
      text-align: center !important;
    }
    .student-routine-sub {
      text-align: center !important;
    }
    .student-routine-actions {
      justify-content: center !important;
      width: 100% !important;
    }
    .student-routine-card {
      padding: 12px 6px !important;
    }
    .student-dia-pane {
      padding: 0 !important;
    }
    .student-block-body-calentamiento,
    .student-block-body-principal,
    .student-block-body-cardio,
    .student-block-body-vuelta_calma {
      padding: 10px 6px !important;
    }
    .student-ej-card {
      padding: 10px 10px !important;
      gap: 10px !important;
      margin-bottom: 6px !important;
      width: 100% !important;
      box-sizing: border-box !important;
    }

    .btn-day-tab {
      min-width: 70px;
      width: 70px;
      height: 56px;
      padding: 6px 4px;
      border-radius: 12px;
    }
    .btn-day-tab .day-tab-title {
      font-size: 13px;
    }
    .btn-day-tab .day-tab-badge {
      font-size: 10px;
    }
    .btn-routine-toggle {
      flex: 1 1 auto;
      justify-content: center;
      font-size: 12.5px !important;
      padding: 8px 12px !important;
    }
  }

  /* ==========================================================================
     CAROUSEL DE DÍAS (CUADRADITOS RESPONSIVOS) & BOTONES DE CONTROL
     ========================================================================== */
  .days-carousel-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 10px 2px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .days-carousel-container::-webkit-scrollbar {
    height: 5px;
  }
  .days-carousel-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
  }

  .btn-day-tab {
    min-width: 78px;
    width: 78px;
    height: 60px;
    padding: 7px 6px;
    border-radius: 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    cursor: pointer;
    flex-shrink: 0;
    scroll-snap-align: start;
    transition: all 0.22s ease;
    user-select: none;
    color: var(--t2);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  }

  .btn-day-tab:hover {
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
    color: var(--t1);
  }

  .btn-day-tab.active {
    background: linear-gradient(145deg, #2563eb, #1d4ed8) !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45) !important;
    transform: scale(1.02);
  }

  .btn-day-tab .day-tab-title {
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .btn-day-tab .day-tab-badge {
    font-size: 10.5px;
    opacity: 0.85;
    font-weight: 700;
  }

  .btn-day-tab.active .day-tab-badge {
    color: #bfdbfe;
    opacity: 1;
  }

  .routine-toggle-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

    .btn-routine-toggle {
    font-size: 12.5px !important;
    padding: 7px 14px !important;
    font-weight: 800 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-height: 36px !important;
  }

  /* ==========================================================================
     ESTILOS DE RECIBO / COMPROBANTE DE PAGO (PANTALLA E IMPRESIÓN NITSOFT)
     ========================================================================== */
  .recibo-ticket-box {
    max-width: 460px;
    width: 100%;
    border-radius: 20px;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25) !important;
    overflow: hidden;
    position: relative;
    color: #0f172a !important;
  }

  .recibo-header {
    background: #0f172a !important;
    padding: 22px 24px 16px;
    text-align: center;
    border-bottom: 2px dashed #cbd5e1;
  }

  .recibo-header h3 {
    font-size: 18px;
    font-weight: 900;
    color: #ffffff !important;
    margin: 0;
  }

  .recibo-header #recibo-gym-nombre {
    font-size: 13.5px;
    color: #38bdf8 !important;
    font-weight: 800;
    margin-top: 3px;
  }

  .recibo-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13.5px;
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .recibo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0 !important;
    padding-bottom: 8px;
  }

  .recibo-row span {
    color: #334155 !important;
    font-weight: 700 !important;
    font-size: 13px !important;
  }

  .recibo-row b {
    color: #000000 !important;
    font-weight: 900 !important;
    font-size: 13.5px !important;
    text-align: right;
  }

  .recibo-total-box {
    background: #f0fdf4 !important;
    border: 2px solid #16a34a !important;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
  }

  .recibo-total-lbl {
    font-weight: 900 !important;
    color: #0f172a !important;
    font-size: 14px !important;
  }

  .recibo-total-val {
    font-size: 22px !important;
    font-weight: 900 !important;
    color: #15803d !important;
  }

  .recibo-footer-info {
    text-align: center;
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
  }

  /* ==========================================================================
     REGLAS DE IMPRESIÓN (@media print) PARA COMPROBANTES Y RECIBOS
     ========================================================================== */
  @media print {
    /* Ocultar todo el sistema de fondo */
    body * {
      visibility: hidden !important;
    }

    /* Mostrar exclusivamente el comprobante de pago */
    #modal-recibo-alumno,
    #modal-recibo-alumno .recibo-ticket-box,
    #modal-recibo-alumno .recibo-ticket-box * {
      visibility: visible !important;
    }

    #modal-recibo-alumno {
      position: absolute !important;
      left: 0 !important;
      top: 0 !important;
      width: 100% !important;
      height: auto !important;
      background: transparent !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      padding: 0 !important;
      margin: 0 !important;
      box-shadow: none !important;
    }

    #modal-recibo-alumno .recibo-ticket-box {
      position: relative !important;
      max-width: 480px !important;
      width: 100% !important;
      margin: 20px auto !important;
      border: 2px solid #000000 !important;
      border-radius: 12px !important;
      box-shadow: none !important;
      background: #ffffff !important;
      color: #000000 !important;
      page-break-inside: avoid !important;
      -webkit-print-color-adjust: exact !important;
      print-color-adjust: exact !important;
    }

    #modal-recibo-alumno .recibo-header {
      background: #ffffff !important;
      border-bottom: 2px solid #000000 !important;
      padding: 16px 20px 12px !important;
    }

    #modal-recibo-alumno .recibo-header h3 {
      color: #000000 !important;
      font-size: 20px !important;
      font-weight: 900 !important;
    }

    #modal-recibo-alumno .recibo-header #recibo-gym-nombre {
      color: #000000 !important;
      font-size: 15px !important;
      font-weight: 800 !important;
    }

    #modal-recibo-alumno .recibo-body {
      background: #ffffff !important;
      color: #000000 !important;
      padding: 16px 20px !important;
      gap: 10px !important;
    }

    #modal-recibo-alumno .recibo-row {
      border-bottom: 1px dashed #000000 !important;
      padding-bottom: 6px !important;
    }

    #modal-recibo-alumno .recibo-row span {
      color: #000000 !important;
      font-weight: 700 !important;
      font-size: 13.5px !important;
    }

    #modal-recibo-alumno .recibo-row b {
      color: #000000 !important;
      font-weight: 900 !important;
      font-size: 14px !important;
    }

    #modal-recibo-alumno .recibo-total-box {
      background: #ffffff !important;
      border: 2px solid #000000 !important;
      padding: 12px 14px !important;
    }

    #modal-recibo-alumno .recibo-total-lbl {
      color: #000000 !important;
      font-size: 15px !important;
      font-weight: 900 !important;
    }

    #modal-recibo-alumno .recibo-total-val {
      color: #000000 !important;
      font-size: 22px !important;
      font-weight: 900 !important;
    }

    #modal-recibo-alumno .recibo-footer-info {
      color: #000000 !important;
      font-size: 11px !important;
      font-weight: 600 !important;
    }

    /* Ocultar botones de acción en impresión */
    .no-print,
    .btn-close,
    .modal-footer {
      display: none !important;
      visibility: hidden !important;
    }
  }

/* ==========================================================================
   OPTIMIZACIÓN DE RENDIMIENTO EN CELULARES
   ========================================================================== */
@media (max-width: 767px) {
  /* Evita filtros GPU costosos en teléfonos. */
  .sidebar,
  body.dark-mode .sidebar,
  .topbar,
  body.dark-mode .topbar,
  .modal-backdrop,
  .sidebar-backdrop {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* En táctil los hover/transforms no aportan y sí fuerzan repaints. */
  .card,
  .stat-card,
  .btn,
  .nav a,
  .saas-sub-card-mobile,
  .btn-day-tab,
  .student-ej-card {
    transition-duration: 0.08s !important;
  }

  .card:hover,
  .stat-card:hover,
  .btn:hover,
  .nav a:hover,
  .saas-sub-card-mobile:hover,
  .btn-day-tab:hover {
    transform: none !important;
  }

  /* Las sombras grandes son caras en GPUs móviles. */
  .card,
  .stat-card,
  .saas-sub-card-mobile,
  .topbar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  }

  body.dark-mode .card,
  body.dark-mode .stat-card {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28) !important;
  }

  /* Fondo oscuro simplificado: evita repintar un radial grande al hacer scroll. */
  body.dark-mode {
    background: #090d16 !important;
  }

  /* Pulsos constantes generan repaints; en móvil se muestra el estado sin animación. */
  .pulse {
    animation: none !important;
  }

  /* Reduce trabajo de render de contenido fuera de pantalla. */
  main > section {
    content-visibility: auto;
    contain-intrinsic-size: 700px;
  }

  .days-carousel-container,
  .tbl-wrap,
  .modal-box,
  .nav {
    overscroll-behavior: contain;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

