:root {
    /* Core Colors */
    --primary: #f97316;
    --primary-hover: #ea580c;
    --primary-glow: rgba(249, 115, 22, 0.4);
    --primary-subtle: rgba(249, 115, 22, 0.15);

    /* Background Layers */
    --bg-base: #0f0f0f;
    --bg-elevated: #141414;
    --bg-surface: #1a1a1a;

    /* Legacy Glass (keep for compatibility) */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);

    /* Glass System - Tiered */
    --glass-bg-1: rgba(255, 255, 255, 0.02);
    --glass-bg-2: rgba(255, 255, 255, 0.04);
    --glass-bg-3: rgba(255, 255, 255, 0.06);
    --glass-border-1: rgba(255, 255, 255, 0.06);
    --glass-border-2: rgba(255, 255, 255, 0.10);
    --glass-border-3: rgba(255, 255, 255, 0.15);

    /* Shadows - Layered */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6), 0 8px 16px rgba(0, 0, 0, 0.4);

    /* Inner Glow for Glass */
    --glass-inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --glass-inner-glow-strong: inset 0 1px 0 rgba(255, 255, 255, 0.1);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    color-scheme: dark;
}


html {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #0f0f0f;
    color: white;
    width: 100%;
    max-width: 100vw;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Safe area padding for notched phones */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.bg-primary {
    background-color: var(--primary);
}

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

/* ============ GLASS CARD SYSTEM ============ */

/* Base Glass Card - Enhanced */
.glass-card {
    background: var(--glass-bg-2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-2xl);
    box-shadow: none;
    transition: all var(--transition-base);
}

/* Primary Card - Featured content */
.glass-card-primary {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.06) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border-3);
    border-radius: var(--radius-2xl);
    box-shadow: none;
}

/* Secondary Card - Supporting content */
.glass-card-secondary {
    background: var(--glass-bg-1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border-1);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

/* Interactive Card States */
.glass-card-interactive {
    cursor: pointer;
    transition: all var(--transition-base);
}

.glass-card-interactive:hover {
    background: var(--glass-bg-3);
    border-color: var(--glass-border-3);
    box-shadow: var(--shadow-lg), var(--glass-inner-glow-strong);
    transform: translateY(-2px);
}

.glass-card-interactive:active {
    transform: translateY(0) scale(0.98);
}

/* Accent Card - Orange glow */
.glass-card-accent {
    background: linear-gradient(
        135deg,
        rgba(249, 115, 22, 0.08) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    border: 1px solid rgba(249, 115, 22, 0.2);
    box-shadow: var(--shadow-md), 0 0 30px rgba(249, 115, 22, 0.1);
}

/* ============ STAT CARDS ============ */

.stat-card {
    background: var(--glass-bg-2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md), var(--glass-inner-glow);
    transition: all var(--transition-base);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--glass-inner-glow-strong);
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

/* Stat Card Variants */
.stat-card-primary .stat-value { color: var(--primary); }
.stat-card-danger .stat-value { color: #f87171; }
.stat-card-success .stat-value { color: #4ade80; }
.stat-card-purple .stat-value { color: #a78bfa; }

.stat-card-danger {
    border-color: rgba(239, 68, 68, 0.2);
    background: linear-gradient(
        135deg,
        rgba(239, 68, 68, 0.05) 0%,
        var(--glass-bg-2) 100%
    );
}

/* ============ TRAINER SIDEBAR ============ */

.trainer-sidebar {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.5) 100%
    );
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border-right: 1px solid var(--glass-border-2);
    box-shadow:
        4px 0 24px rgba(0, 0, 0, 0.4),
        inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.trainer-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border-1);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.02) 0%,
        transparent 100%
    );
}

.sidebar-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    border: 1px solid transparent;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    width: 100%;
    text-align: left;
}

.sidebar-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform var(--transition-base);
    border-radius: 0 2px 2px 0;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.9);
    border-color: var(--glass-border-1);
}

.sidebar-nav-item.active {
    background: linear-gradient(
        90deg,
        rgba(249, 115, 22, 0.15) 0%,
        rgba(249, 115, 22, 0.05) 100%
    );
    color: var(--primary);
    border-color: rgba(249, 115, 22, 0.2);
    box-shadow:
        inset 0 1px 0 rgba(249, 115, 22, 0.1),
        0 0 20px rgba(249, 115, 22, 0.05);
}

.sidebar-nav-item.active::before {
    transform: scaleY(1);
}

.nav-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
    transition: transform var(--transition-base);
}

.sidebar-nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.nav-label {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.trainer-sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border-1);
    background: linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.3) 0%,
        transparent 100%
    );
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    color: #f87171;
    transition: all var(--transition-base);
    width: 100%;
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

/* ============ FORM ELEMENTS ============ */

.input-glass {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-lg);
    color: white;
    font-size: 0.875rem;
    transition: all var(--transition-base);
    outline: none;
}

.input-glass::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.input-glass:hover {
    border-color: var(--glass-border-3);
    background: rgba(0, 0, 0, 0.4);
}

.input-glass:focus {
    border-color: rgba(249, 115, 22, 0.5);
    background: rgba(0, 0, 0, 0.4);
    box-shadow:
        0 0 0 3px rgba(249, 115, 22, 0.1),
        var(--shadow-sm);
}

.input-search-wrapper {
    position: relative;
}

.input-search-wrapper .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.875rem;
    transition: color var(--transition-base);
    pointer-events: none;
}

.input-search-wrapper .input-glass {
    padding-left: 2.5rem;
}

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

/* Button Variants */
.btn-glass {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-glass:hover {
    background: var(--glass-bg-3);
    border-color: var(--glass-border-3);
    color: white;
}

.btn-glass-accent {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.3);
    color: var(--primary);
}

.btn-glass-accent:hover {
    background: rgba(249, 115, 22, 0.25);
    border-color: rgba(249, 115, 22, 0.4);
}

/* ============ TYPOGRAPHY UTILITIES ============ */

.heading-page {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
}

.heading-card {
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.label-uppercase {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.text-muted {
    color: rgba(255, 255, 255, 0.5);
}

/* ============ DESKTOP LAYOUT UTILITIES ============ */

.card-fixed-height {
    height: 420px;
    display: flex;
    flex-direction: column;
}

.card-fixed-height-sm {
    height: 320px;
    display: flex;
    flex-direction: column;
}

.card-scroll-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Custom Scrollbar for Desktop */
@media (min-width: 1024px) {
    .card-scroll-content::-webkit-scrollbar {
        width: 6px;
    }

    .card-scroll-content::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.02);
        border-radius: 3px;
    }

    .card-scroll-content::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
    }

    .card-scroll-content::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

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

.bento-span-2 {
    grid-column: span 2;
}

.tap-effect {
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.tap-effect:active {
    transform: scale(0.96);
}

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

/* Fullscreen modal slide from bottom */
.modal-slide-panel {
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-slide-panel.modal-slide-visible {
    transform: translateY(0);
}
.modal-slide-backdrop {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-slide-backdrop.modal-slide-visible {
    opacity: 1;
}

/* League tier badge glow */
.league-tier-active {
    box-shadow: 0 0 18px var(--tier-glow, rgba(255, 215, 0, 0.3));
    animation: tierPulse 2.5s ease-in-out infinite;
}

@keyframes tierPulse {
    0%, 100% { box-shadow: 0 0 14px var(--tier-glow); }
    50% { box-shadow: 0 0 24px var(--tier-glow); }
}

/* Quest section collapse */
#quest-section {
    max-height: 600px;
    transition: max-height 0.3s ease-out;
}

#quest-chevron.rotate-180 {
    transform: rotate(180deg);
}

/* Trainer card expand/collapse */
/* Trainer card avatar animation */
.trainer-avatar-box {
    transition: width 0.3s ease, height 0.3s ease;
}
.trainer-avatar-box.avatar-expanded {
    width: 3.5rem;
    height: 3.5rem;
}
.trainer-avatar-box.avatar-expanded img {
    width: 100%;
    height: 100%;
}

#trainer-expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out, opacity 0.25s ease-out;
    opacity: 0;
}
#trainer-expand-content.expanded {
    max-height: 800px;
    opacity: 1;
}
#trainer-chevron {
    transition: transform 0.3s ease;
}
#trainer-chevron.rotate-180 {
    transform: rotate(180deg);
}
#nutritionist-expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out, opacity 0.25s ease-out;
    opacity: 0;
}
#nutritionist-expand-content.expanded {
    max-height: 800px;
    opacity: 1;
}
#nutritionist-chevron {
    transition: transform 0.3s ease;
}
#nutritionist-chevron.rotate-180 {
    transform: rotate(180deg);
}

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

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

/* Macro Rings */
.macro-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.macro-ring::before {
    content: '';
    position: absolute;
    inset: 4px;
    background: #0f0f0f;
    border-radius: 50%;
    z-index: 1;
}

.macro-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

/* Hydration Wave */
.wave-container {
    position: relative;
    overflow: hidden;
    background: rgba(59, 130, 246, 0.2);
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: rgba(59, 130, 246, 0.6);
    transform-origin: 50% 100%;
    animation: wave 4s cubic-bezier(0.36, 0.45, 0.63, 0.53) infinite;
}

@keyframes wave {
    0% {
        transform: translateX(0) translateZ(0) scaleY(1);
    }

    50% {
        transform: translateX(-25%) translateZ(0) scaleY(0.8);
    }

    100% {
        transform: translateX(-50%) translateZ(0) scaleY(1);
    }
}

/* Confetti */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    animation: fall linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(720deg);
    }
}

::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* Fix for Select Options */
select option {
    background-color: #1a1a1a;
    color: white;
}


.native-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
}

/* Stats Carousel */
#stats-carousel {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#stats-carousel::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Chat Modal Animations */
.slide-in-right {
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-out-right {
    animation: slideOutRight 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

@keyframes wiggle {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Fire / Flame animation for streak icon */
@keyframes fireFlicker {
    0%, 100% {
        transform: scaleY(1) scaleX(1) rotate(0deg);
        filter: brightness(1) drop-shadow(0 0 4px rgba(249, 115, 22, 0.6));
    }
    15% {
        transform: scaleY(1.08) scaleX(0.95) rotate(-2deg);
        filter: brightness(1.15) drop-shadow(0 0 8px rgba(249, 115, 22, 0.8));
    }
    30% {
        transform: scaleY(0.95) scaleX(1.02) rotate(1deg);
        filter: brightness(0.95) drop-shadow(0 0 3px rgba(239, 68, 68, 0.5));
    }
    50% {
        transform: scaleY(1.12) scaleX(0.97) rotate(-1deg);
        filter: brightness(1.2) drop-shadow(0 0 10px rgba(249, 115, 22, 0.9));
    }
    70% {
        transform: scaleY(0.97) scaleX(1.01) rotate(2deg);
        filter: brightness(1.05) drop-shadow(0 0 6px rgba(234, 88, 12, 0.7));
    }
    85% {
        transform: scaleY(1.05) scaleX(0.98) rotate(-1.5deg);
        filter: brightness(1.1) drop-shadow(0 0 7px rgba(249, 115, 22, 0.75));
    }
}

.flame-animate {
    animation: fireFlicker 1.5s ease-in-out infinite;
    transform-origin: bottom center;
    color: #f97316;
}

/* Bottom Navigation Bar */
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    padding: 6px 0;
    color: #555555;
    text-decoration: none;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i,
.bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

.bottom-nav-item span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.bottom-nav-item.active {
    color: white;
}

.bottom-nav-item.active i,
.bottom-nav-item.active svg {
    color: var(--primary, #f97316);
}

/* Quick Action FAB in bottom nav */
.quick-action-fab {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Safe area for notched phones */
.h-safe-bottom {
    height: env(safe-area-inset-bottom, 0px);
}
/* Barcode Scanner Styles */
#barcode-scanner-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#barcode-scanner-container video,
#barcode-scanner-container canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: absolute;
    top: 0;
    left: 0;
}

#barcode-scanner-container canvas.drawingBuffer {
    display: none;
}

/* ============ TRAINER SIDEBAR ============ */
.sidebar-nav-item {
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-nav-item.active {
    background: rgba(249, 115, 22, 0.15);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    margin-left: -3px;
}

/* Section visibility */
.trainer-section {
    animation: sectionFadeIn 0.3s ease-out;
}

.trainer-section.hidden {
    display: none !important;
}

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

/* ============ STAFF DESKTOP LAYOUT ============ */

/* Override body padding/nav when staff layout is active */
body:has(.staff-layout) {
    padding-bottom: 0 !important;
    overflow: hidden;
}

body:has(.staff-layout) > nav {
    display: none !important;
}

.staff-layout {
    display: grid;
    grid-template-columns: 200px 1fr 340px;
    height: 100vh;
    background: var(--bg-base);
    overflow: hidden;
}

.staff-sidebar {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.4) 100%);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border-right: 1px solid var(--glass-border-1);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.5rem 0.75rem;
}

.staff-sidebar-logo {
    padding: 0 0.5rem;
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

/* SVG logo image */
.staff-logo-img {
    height: 36px;
    width: auto;
}

.staff-logo-img--sidebar {
    height: 32px;
}

/* Role label (Staff / Trainer / Owner) */
.staff-role-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    letter-spacing: 0;
    color: rgba(255, 255, 255, 0.4);
    background: none;
    padding: 0;
    border-radius: 0;
    border: none;
}

.staff-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.staff-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    text-decoration: none;
    border: 1px solid transparent;
}

.staff-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
}

.staff-nav-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: white;
    border-color: var(--glass-border-1);
}

.staff-nav-item i,
.staff-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.staff-main {
    padding: 2.5rem 2.5rem 2rem;
    overflow-y: auto;
    max-height: 100vh;
}

.staff-right-panel {
    border-left: 1px solid var(--glass-border-1);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

/* Staff page header */
.staff-page-header {
    margin-bottom: 2rem;
}

.staff-page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
}

.staff-page-header p {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
}

/* Staff stats bar */
.staff-stats-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.staff-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-right: 1px solid var(--glass-border-1);
}

.staff-stat-item:last-child {
    border-right: none;
}

.staff-stat-value {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.staff-stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

/* Staff actions bar */
.staff-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.staff-actions-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.staff-actions-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.staff-btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.staff-btn-action:hover {
    background: var(--glass-bg-3);
    border-color: var(--glass-border-3);
    color: white;
}

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

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

/* Staff search bar */
.staff-search-bar {
    position: relative;
    margin-bottom: 1.25rem;
}

.staff-search-bar input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    background: var(--glass-bg-1);
    border: 1px solid var(--glass-border-1);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition-base);
}

.staff-search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.staff-search-bar input:focus {
    border-color: rgba(249, 115, 22, 0.4);
    background: var(--glass-bg-2);
}

.staff-search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

/* Staff table */
.staff-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.staff-table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--glass-border-1);
}

.staff-table thead th:first-child {
    padding-left: 1rem;
}

.staff-table tbody tr {
    transition: background var(--transition-fast);
    cursor: pointer;
}

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

.staff-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid var(--glass-border-1);
    vertical-align: middle;
}

.staff-table tbody td:first-child {
    padding-left: 1rem;
}

.staff-table .member-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.staff-table .member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.staff-table .member-name {
    font-weight: 600;
    color: white;
}

.staff-table .member-email {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
}

/* Table card wrapper */
.staff-table-card {
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

/* Badge styles for table */
.staff-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.staff-badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.staff-badge-inactive {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
}

.staff-badge-warning {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
}

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

.staff-badge-valid {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.staff-badge-expired {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.staff-badge-none {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
}

/* Skeleton loading rows */
.staff-skeleton-row td {
    padding: 0.85rem 1rem;
}

.staff-skeleton {
    height: 14px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

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

/* Right panel messages */
.staff-messages-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--glass-border-1);
}

.staff-messages-search {
    padding: 0.75rem 1.25rem;
}

.staff-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
}

.staff-message-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.staff-message-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.staff-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

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

.staff-message-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.staff-message-preview {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.staff-message-time {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.staff-message-unread {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* ============ STAFF DESKTOP/MOBILE VISIBILITY ============ */
.staff-mobile-only {
    display: none !important;
}

.staff-desktop-only {
    display: block;
}

/* ============ STAFF MOBILE CARDS ============ */
.staff-mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.staff-mobile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-1);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.staff-mobile-card:hover,
.staff-mobile-card:active {
    background: var(--glass-bg-3);
    border-color: var(--glass-border-2);
}

.staff-mobile-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.staff-mobile-card-info {
    flex: 1;
    min-width: 0;
}

.staff-mobile-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.staff-mobile-card-badges {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.staff-mobile-card-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 0.15rem;
}

.staff-skeleton-card {
    pointer-events: none;
}

/* ============ STAFF MOBILE HEADER ============ */
.staff-mobile-header {
    display: none; /* hidden on desktop */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: transparent;
    padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1.25rem 0.75rem;
    align-items: flex-end;
    justify-content: space-between;
}

.staff-mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.staff-mobile-header-logo {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 0.15rem;
}

.staff-mobile-msg-btn {
    position: relative;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.staff-mobile-msg-btn i,
.staff-mobile-msg-btn svg {
    width: 24px;
    height: 24px;
}

.staff-mobile-msg-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.staff-mobile-msg-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

/* ============ STAFF MOBILE BOTTOM NAV ============ */
.staff-mobile-nav {
    display: none; /* hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 64px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--glass-border-1);
    align-items: center;
    justify-content: space-around;
    padding: 0 0.5rem;
}

.staff-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    transition: color var(--transition-fast);
    border-radius: var(--radius-md);
}

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

.staff-mobile-nav-item:hover {
    color: rgba(255, 255, 255, 0.7);
}

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

/* ============ STAFF MOBILE MESSAGES OVERLAY ============ */
.staff-mobile-messages-overlay {
    display: none; /* hidden by default */
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.staff-mobile-messages-overlay.open {
    display: flex;
    opacity: 1;
    justify-content: flex-end;
}

.staff-mobile-messages-panel {
    width: 85%;
    max-width: 380px;
    height: 100%;
    background: var(--bg-base);
    border-left: 1px solid var(--glass-border-1);
    display: flex;
    flex-direction: column;
    animation: slideInFromRight 0.25s ease;
}

@keyframes slideInFromRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* ============ STAFF MOBILE RESPONSIVE ============ */
@media (max-width: 1024px) {
    /* Show mobile header and bottom nav */
    .staff-mobile-header {
        display: flex;
    }

    .staff-mobile-nav {
        display: flex;
    }

    /* Hide desktop sidebar and right panel */
    .staff-sidebar {
        display: none !important;
    }

    .staff-right-panel {
        display: none !important;
    }

    /* Swap table (desktop) for cards (mobile) */
    .staff-desktop-only {
        display: none !important;
    }

    .staff-mobile-only {
        display: flex !important;
    }

    /* Make layout single column */
    .staff-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    /* Main content full width with mobile header/nav spacing */
    .staff-main {
        padding: 72px 1rem 80px;
        max-height: none;
        overflow: visible;
    }

    /* Page header smaller on mobile */
    .staff-page-header h1 {
        font-size: 1.5rem;
    }

    /* Stats bar scroll horizontally */
    .staff-stats-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .staff-stat-item {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.6rem 1rem;
    }

    /* Actions bar stack on small screens */
    .staff-actions-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .staff-actions-left,
    .staff-actions-right {
        justify-content: flex-start;
    }

    /* Search bar full width */
    .staff-search-bar {
        max-width: 100% !important;
    }

    /* Override body for staff mobile */
    body:has(.staff-layout) {
        overflow: auto;
    }
}

@media (max-width: 640px) {
    .staff-main {
        padding: 64px 0.75rem 72px;
    }

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

    .staff-page-header p {
        font-size: 0.8rem;
    }

    .staff-stats-bar {
        border-radius: var(--radius-xl);
    }

    .staff-stat-value {
        font-size: 1.1rem;
    }

    .staff-stat-label {
        font-size: 0.7rem;
    }

    .staff-btn-action,
    .staff-btn-primary {
        font-size: 0.75rem;
        padding: 0.45rem 0.75rem;
    }

    .staff-search-bar input {
        font-size: 0.8rem;
    }

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

    .staff-table thead th,
    .staff-table tbody td {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }

    .staff-mobile-messages-panel {
        width: 92%;
    }
}

/* ============ TRAINER LAYOUT (reuses staff- classes) ============ */

/* --- Trainer Color Scheme --- */
.trainer-layout {
    --primary: #F74100;
    --primary-hover: #d93800;
    --primary-glow: rgba(247, 65, 0, 0.4);
    --primary-subtle: rgba(247, 65, 0, 0.15);
    --bg-base: #1E1E1E;
    --bg-elevated: #232323;
    --bg-surface: #282828;
    --glass-bg-1: #2a2a2a;
    --glass-bg-2: #252525;
    --glass-bg-3: #2f2f2f;
    --glass-border-1: rgba(255, 255, 255, 0.06);
    --glass-border-2: rgba(255, 255, 255, 0.08);
}

/* --- Trainer Modal Card --- */
.trainer-modal-card {
    background: #1E1E1E;
    border-radius: 20px;
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
}
.trainer-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    background: #252525;
}
.trainer-modal-header h3 {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: white;
    margin: 0;
}
.trainer-modal-header button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}
.trainer-modal-header button:hover {
    color: white;
}
.trainer-modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.trainer-modal-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}
.trainer-modal-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: #252525;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.8rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}
input[type="time"].trainer-modal-input {
    color-scheme: dark;
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
    line-height: 1.2;
}
input[type="time"].trainer-modal-input::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
}
input[type="time"].trainer-modal-input::-webkit-datetime-edit {
    padding: 0;
}
input[type="time"].trainer-modal-input::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}
.trainer-modal-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}
.trainer-modal-input:focus {
    box-shadow: 0 0 0 1px var(--primary, #F74100);
}
select.trainer-modal-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}
select.trainer-modal-input option {
    background: #252525;
    color: white;
}
.trainer-modal-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary, #F74100);
    color: white;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 0.35rem;
    transition: opacity 0.15s;
}
.trainer-modal-btn:active {
    opacity: 0.85;
}
/* Border-radius for workout wizard modal */
#create-workout-modal .trainer-modal-card { border-radius: 0; }
@media (min-width: 768px) {
    #create-workout-modal .trainer-modal-card { border-radius: 20px; }
}

/* --- Button Wiggle --- */
@keyframes wiggle {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-6px); }
    30% { transform: translateX(5px); }
    45% { transform: translateX(-4px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    90% { transform: translateX(1px); }
}
.wiggle {
    animation: wiggle 0.5s ease;
}

/* --- Settings Page --- */
.settings-wrapper {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.settings-card {
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
}
.settings-profile-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.settings-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #e04e1a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.settings-avatar img { width: 100%; height: 100%; object-fit: cover; }
.settings-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}
.settings-role {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.35);
    margin: 0.1rem 0 0;
}
.settings-photo-btn {
    background: #252525;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.settings-photo-btn:hover { background: #303030; color: #fff; }
.settings-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.85rem;
}
.settings-field {
    margin-bottom: 0.75rem;
}
.settings-field:last-of-type {
    margin-bottom: 0;
}
.settings-save-btn {
    display: inline-block;
    margin-top: 0.85rem;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.settings-save-btn:hover { opacity: 0.85; }
.settings-chip {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    font-size: 0.65rem;
    border-radius: 8px;
    background: #252525;
    color: rgba(255,255,255,0.5);
    border: 1.5px solid transparent;
    transition: all 0.15s;
    cursor: pointer;
}
.specialty-checkbox:checked + .settings-chip {
    background: rgba(241, 90, 36, 0.15);
    color: var(--primary);
    border-color: var(--primary);
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.settings-row-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    display: block;
}
.settings-row-sub {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.25);
    display: block;
    margin-top: 0.1rem;
}
.settings-action-btn {
    background: #252525;
    border: none;
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.settings-action-btn:hover { background: #303030; }
.settings-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.settings-logout-btn:hover { background: rgba(239, 68, 68, 0.2); }

/* --- Chat Panel (Trainer) --- */
.chat-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 200;
    background: #141414;
    display: flex;
    flex-direction: column;
}
@media (min-width: 768px) {
    .chat-panel {
        width: 380px;
        border-left: 1px solid rgba(255,255,255,0.06);
    }
}
.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: #1a1a1a;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.chat-panel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #e04e1a);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.chat-panel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-panel-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}
.chat-panel-status {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.3);
    margin: 0;
}
.chat-panel-back,
.chat-panel-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
.chat-panel-back:hover,
.chat-panel-close:hover { color: #fff; }
.chat-panel-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #1a1a1a;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.chat-send-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.chat-send-btn:hover { opacity: 0.85; }

/* Chat footer icon buttons (attach / mic / send) */
.chat-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: rgba(255,255,255,0.6);
    transition: background 0.15s, color 0.15s;
}
.chat-icon-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.chat-icon-btn.chat-send-mode { background: var(--primary); color: #fff; }
.chat-icon-btn.chat-send-mode:hover { opacity: 0.85; }

/* Voice recording bar */
.chat-recording-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    background: #1a1a1a;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.chat-rec-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #f55;
    flex-shrink: 0;
    animation: chatRecPulse 1.2s ease-in-out infinite;
}
@keyframes chatRecPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.6); }
}

/* Media message bubbles */
.chat-media-img {
    max-width: 220px;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
    display: block;
    object-fit: cover;
}
.chat-media-video {
    max-width: 220px;
    border-radius: 12px;
    display: block;
    outline: none;
}

/* Voice message bubble */
.chat-voice-bubble {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 170px;
}
.chat-voice-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: inherit;
    transition: background 0.15s;
}
.chat-voice-play-btn:hover { background: rgba(255,255,255,0.3); }
.chat-voice-waveform {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    overflow: hidden;
}
.chat-voice-progress {
    height: 100%;
    width: 0%;
    background: rgba(255,255,255,0.85);
    border-radius: 2px;
    transition: width 0.1s linear;
}
.chat-voice-duration {
    font-size: 0.65rem;
    opacity: 0.7;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    min-width: 2rem;
    text-align: right;
}

/* --- Drag & Drop Client to Agenda --- */
.dragging-client {
    opacity: 0.4;
}
.drag-over-highlight {
    border: 2px dashed var(--primary) !important;
    border-radius: 12px;
    background: rgba(241, 90, 36, 0.06);
    transition: all 0.2s ease;
}

/* --- Workout Wizard --- */
.workout-wizard-steps {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.1rem 0 0.2rem;
}
.workout-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}
.workout-step-dot.active {
    background: #F15A24;
    width: 24px;
    border-radius: 4px;
}
.workout-step-dot.completed {
    background: #22c55e;
}
.workout-wizard-content {
    animation: wizardFadeIn 0.25s ease;
}
@keyframes wizardFadeIn {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}
.workout-wizard-content.wizard-back {
    animation: wizardFadeInReverse 0.25s ease;
}
@keyframes wizardFadeInReverse {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Compact exercise list item (Step 2) */
.workout-ex-compact {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    background: #252525;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid transparent;
}
.workout-ex-compact:active {
    transform: scale(0.98);
}
.workout-ex-compact.selected {
    border-color: #F15A24;
    background: rgba(241, 90, 36, 0.08);
}
.workout-ex-compact .ex-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.workout-ex-compact .ex-info {
    flex: 1;
    min-width: 0;
}
.workout-ex-compact .ex-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.workout-ex-compact .ex-meta {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.workout-ex-compact .ex-add-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #F15A24;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 800;
    color: white;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.workout-ex-compact:hover .ex-add-indicator {
    opacity: 1;
}

/* Selected count badge */
.workout-wizard-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.5rem;
    background: rgba(241, 90, 36, 0.1);
    border: 1px solid rgba(241, 90, 36, 0.2);
    border-radius: 10px;
    color: #F15A24;
    font-size: 0.72rem;
    font-weight: 700;
}
.workout-wizard-badge span {
    font-size: 0.85rem;
    font-weight: 800;
}

/* Step 3: Exercise config card */
.workout-config-card {
    background: #252525;
    border-radius: 12px;
    padding: 0.75rem;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.15s, box-shadow 0.15s;
}
.workout-config-card .drag-handle {
    cursor: grab;
    color: rgba(255, 255, 255, 0.2);
    padding: 0 0.3rem;
    display: flex;
    align-items: center;
    font-size: 1rem;
    user-select: none;
    touch-action: none;
}
.workout-config-card .drag-handle:active { cursor: grabbing; }
.workout-config-card.sortable-ghost {
    opacity: 0.4;
    border: 1px dashed rgba(255,255,255,0.3);
}
.workout-config-card.sortable-chosen {
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    transform: scale(1.02);
}
.course-exercise-item {
    transition: transform 0.15s, box-shadow 0.15s;
}
.course-exercise-item .drag-handle {
    cursor: grab;
    color: rgba(255, 255, 255, 0.2);
    padding: 0 0.2rem;
    display: flex;
    align-items: center;
    font-size: 1rem;
    user-select: none;
    touch-action: none;
}
.course-exercise-item .drag-handle:active { cursor: grabbing; }
.course-exercise-item.sortable-ghost {
    opacity: 0.4;
    border: 1px dashed rgba(255,255,255,0.3);
}
.course-exercise-item.sortable-chosen {
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    transform: scale(1.02);
}
.workout-config-card .config-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 0.2rem;
    font-size: 0.8rem;
}
.workout-config-card .config-remove:hover {
    color: #ef4444;
}
.workout-config-card .config-header {
    padding-right: 1.5rem;
    margin-bottom: 0.6rem;
}
.workout-config-card .config-name {
    font-size: 0.8rem;
    font-weight: 800;
    color: white;
}
.workout-config-card .config-meta {
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.workout-config-card .config-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}
.workout-config-card .config-inputs label {
    display: block;
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 0.25rem;
}
.workout-config-card .config-inputs .trainer-modal-input {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.5rem 0.4rem;
}

/* --- Trainer Client Modal --- */
.trainer-client-status-card {
    background: #252525;
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.trainer-client-status-card:hover {
    background: #2a2a2a;
}
.trainer-client-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem;
    background: #252525;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.trainer-client-action-btn:hover {
    background: #2a2a2a;
}
.trainer-client-action-btn--accent {
    background: rgba(247, 65, 0, 0.12);
    color: #F74100;
    border-color: rgba(247, 65, 0, 0.2);
}
.trainer-client-action-btn--accent:hover {
    background: rgba(247, 65, 0, 0.2);
}
.trainer-client-action-btn--primary {
    background: #F15A24;
    color: white;
    border-color: transparent;
}
.trainer-client-action-btn--primary:hover {
    background: #d94e1f;
}

/* Trainer: search bars match card background exactly */
.trainer-layout .staff-search-bar input {
    background: #252525;
    border: none;
}
.trainer-layout .staff-search-bar input:focus {
    background: #252525;
    border: none;
}

/* Trainer: integrated search (inside cards) */
.trainer-integrated-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.trainer-integrated-search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: white;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0;
}
.trainer-integrated-search input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* Inactive clients modal rows */
.trainer-inactive-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}
.trainer-inactive-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Override body when trainer layout is active */
body:has(.trainer-layout) {
    padding-bottom: 0 !important;
    overflow: hidden;
    background-color: #1E1E1E !important;
}

/* On desktop, hide the base.html bottom nav for trainer */
@media (min-width: 1025px) {
    body:has(.trainer-layout) > nav {
        display: none !important;
    }

    /* Conversations & chat modals: side panel on desktop */
    body:has(.trainer-layout) #conversations-modal,
    body:has(.trainer-layout) #chat-modal {
        width: 380px;
    }

    body:has(.trainer-layout) #conversations-list > div {
        background: #252525;
        border: none;
        border-radius: 10px;
    }

    body:has(.trainer-layout) #conversations-list > div:hover {
        background: var(--glass-bg-3);
        border-color: var(--glass-border-2);
    }
}

.trainer-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    height: 100vh;
    background: var(--bg-base);
    overflow: hidden;
}

/* Desktop: modals only cover the main content area, not the sidebar */
@media (min-width: 1025px) {
    body:has(.trainer-layout) .fixed.inset-0 {
        left: 200px !important;
    }
}

.trainer-main-new {
    padding: 2rem 2.5rem;
    overflow-y: auto;
    max-height: 100vh;
}

/* Trainer sections: remove max-width constraint when inside new layout */
.trainer-layout .trainer-section {
    max-width: 1400px;
}

/* Trainer Utenti page grid */
/* Make sections flex columns filling viewport (desktop) */
@media (min-width: 769px) {
    #section-dashboard,
    #section-workouts {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 3rem);
        overflow: hidden;
    }
}
.trainer-utenti-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

/* Both columns: fill grid height */
.trainer-utenti-grid > .trainer-panel-content {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Client table card: fill parent and scroll */
.trainer-utenti-grid .staff-table-card {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.trainer-utenti-grid .staff-table-card .staff-table {
    width: 100%;
}

/* Agenda glass-card: fill available space */
.trainer-utenti-grid #utenti-panel-agenda > .glass-card:first-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: none;
}

/* Appointments schedule list: flexible */
#d-schedule-container {
    flex: 1;
    overflow-y: auto;
}

.trainer-stats-compact {
    display: inline-flex;
    background: none;
    border: none;
    width: auto;
}

/* --- Trainer Weekly Overview Stats --- */
.trainer-weekly-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.trainer-overview-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--glass-bg-2, #252525);
    border: 1px solid var(--glass-border-1, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 0.85rem 1rem;
}
.trainer-overview-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.trainer-overview-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.trainer-overview-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: white;
    line-height: 1.2;
}
.trainer-overview-label {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Trainer Needs Attention --- */
.trainer-needs-attention {
    margin-bottom: 0.5rem;
}
.trainer-needs-attention-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    margin-bottom: 0.6rem;
}
.trainer-needs-attention-list {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
}
.trainer-needs-attention-list::-webkit-scrollbar {
    display: none;
}
.trainer-attention-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--glass-bg-2, #252525);
    border: 1px solid var(--glass-border-1, rgba(255,255,255,0.06));
    border-radius: 12px;
    padding: 0.6rem 0.85rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s;
}
.trainer-attention-card:hover {
    background: var(--glass-bg-3, #2f2f2f);
}
.trainer-attention-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.trainer-attention-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.trainer-attention-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}
.trainer-attention-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    white-space: nowrap;
    margin-top: 0.15rem;
    display: inline-block;
    width: fit-content;
}
.trainer-attention-badge.badge-inactive {
    background: rgba(239,68,68,0.15);
    color: #f87171;
}
.trainer-attention-badge.badge-expiring {
    background: rgba(251,191,36,0.15);
    color: #fbbf24;
}
.trainer-attention-badge.badge-unread {
    background: rgba(59,130,246,0.15);
    color: #60a5fa;
}

/* Trainer mobile panel tabs (hidden on desktop) */
.trainer-panel-tabs {
    display: none;
}

.trainer-panel-tab {
    flex: 1;
    padding: 0.55rem 0.75rem;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

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

/* Trainer Corsi page */
.trainer-courses-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Trainer Allenamenti page */
.trainer-workouts-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.allenamenti-column {
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-xl);
    padding: 1rem;
    overflow-y: auto;
}


.allenamenti-sticky-header {
    position: sticky;
    top: -1rem;
    z-index: 5;
    background: var(--glass-bg-2);
    padding-top: 1rem;
    margin-top: -1rem;
    padding-bottom: 0.25rem;
}

.allenamenti-col-header {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.allenamenti-ex-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid transparent;
}
.allenamenti-ex-row:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.08);
}
.allenamenti-ex-row.selected-ex {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.3);
}
.allenamenti-ex-muscle {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Accordion expand per exercise row */
.allenamenti-ex-item {
    margin-bottom: 2px;
}
.allenamenti-ex-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.36s cubic-bezier(0.4, 0, 0.2, 1);
}
.allenamenti-ex-expand.open {
    max-height: 560px;
    overflow-y: auto;
}
.allenamenti-ex-expand-inner {
    background: rgba(255,255,255,0.025);
    border-top: 1px solid rgba(255,255,255,0.07);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 0.6rem 0.65rem 0.65rem;
    margin-bottom: 0.15rem;
}
.allenamenti-ex-row .allenamenti-ex-chevron {
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.allenamenti-ex-row.selected-ex .allenamenti-ex-chevron {
    transform: rotate(180deg);
}

/* Exercise drag-to-workout */
.allenamenti-ex-row[draggable="true"] {
    cursor: grab;
}
.allenamenti-ex-row.ex-dragging {
    opacity: 0.4;
}
.workout-drag-card.ex-drop-hover {
    background: rgba(var(--primary-rgb), 0.12) !important;
    outline: 1px dashed rgba(var(--primary-rgb), 0.5);
    outline-offset: -2px;
}

.trainer-tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-2);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.trainer-tab {
    flex: 1;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
}

.trainer-tab:hover {
    color: rgba(255, 255, 255, 0.7);
}

.trainer-tab.active {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

/* Draggable workout/split table rows */
tr.workout-drag-card {
    cursor: grab;
    user-select: none;
    transition: background var(--transition-base), opacity 0.2s;
}

tr.workout-drag-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

tr.workout-drag-card:active {
    cursor: grabbing;
}

tr.workout-drag-card.dragging {
    opacity: 0.35;
}

tr.workout-drag-card.selected {
    background: var(--primary-subtle);
    border-left: 3px solid var(--primary);
}

/* Workout/split accordion chevron */
.workout-card-chevron {
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
/* Expand row */
tr.workout-expand-tr td {
    padding: 0 !important;
    border: none !important;
}
.workout-expand-inner {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid transparent;
}
.workout-expand-inner.open {
    max-height: 600px;
    border-bottom-color: rgba(255,255,255,0.06);
    overflow-y: auto;
}

/* Client drop targets */
.client-drop-target {
    background: var(--glass-bg-2);
    border: 2px solid var(--glass-border-1);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.client-drop-target:hover {
    background: var(--glass-bg-3);
}

.client-drop-target.drag-over {
    border-color: var(--primary);
    background: var(--primary-subtle);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* ============ TRAINER MOBILE RESPONSIVE ============ */
@media (max-width: 1024px) {
    /* Show mobile header and bottom nav for trainer */
    body:has(.trainer-layout) .staff-mobile-header {
        display: flex;
        background: #1E1E1E;
    }

    /* Trainer bottom nav background */
    body:has(.trainer-layout) nav > div:first-child {
        background: #252525 !important;
        border-color: rgba(255, 255, 255, 0.06) !important;
    }

    /* Hide desktop sidebar */
    .trainer-layout .trainer-sidebar-new {
        display: none !important;
    }

    /* Single column */
    .trainer-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .trainer-main-new {
        padding: 80px 0 72px;
        max-height: none;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
    }

    /* Stats bar full width with equal columns */
    .trainer-layout .staff-stats-bar {
        width: 100%;
        padding: 0.6rem 0;
        gap: 0;
    }
    .trainer-layout .staff-stat-item {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.2rem;
        padding: 0.5rem 0.25rem;
    }
    .trainer-layout .staff-stat-value {
        font-size: 1.35rem;
    }
    .trainer-layout .staff-stat-label {
        font-size: 0.8rem;
    }

    /* Trainer sections: override Tailwind padding, prevent overflow */
    .trainer-layout .trainer-section {
        padding: 1rem !important;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Tighter spacing on mobile */
    .trainer-layout .staff-page-header {
        margin-bottom: 0.75rem;
    }

    body:has(.trainer-layout) {
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* Utenti page: single panel at a time on mobile */
    .trainer-utenti-grid {
        display: block;
    }
    .trainer-utenti-grid .trainer-panel-hidden {
        display: none !important;
    }

    /* Show mobile panel tabs — fused with the card below */
    .trainer-panel-tabs {
        display: flex;
        background: var(--glass-bg-2);
        border: 1px solid var(--glass-border-2);
        border-bottom: none;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin-bottom: 0;
        overflow: hidden;
    }

    /* Card below tabs: fuse top border with tabs */
    .trainer-panel-tabs + .trainer-utenti-grid > .trainer-panel-content:not(.trainer-panel-hidden) > .glass-card:first-child {
        border-top: none !important;
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
    }

    /* UTENTI panel: wrap in matching card style */
    .trainer-panel-tabs + .trainer-utenti-grid > #utenti-panel-clients:not(.trainer-panel-hidden) {
        background: var(--glass-bg-2);
        border: 1px solid var(--glass-border-2);
        border-top: none;
        border-radius: 0 0 var(--radius-xl) var(--radius-xl);
        padding: 0;
    }

    /* UTENTI search bar: seamless inside card */
    .trainer-utenti-search {
        display: flex !important;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .trainer-utenti-search input {
        flex: 1;
        background: transparent;
        border: none;
        color: white;
        font-size: 0.9rem;
        outline: none;
        min-width: 0;
    }
    .trainer-utenti-search input::placeholder {
        color: rgba(255, 255, 255, 0.3);
    }

    /* Allenamenti page: single panel visible at a time, fused with tabs */
    .trainer-workouts-grid {
        display: block;
    }
    .trainer-workouts-grid .trainer-panel-hidden {
        display: none !important;
    }
    .trainer-workouts-grid > .allenamenti-column:not(.trainer-panel-hidden) {
        border-top: none !important;
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
    }

    /* Corsi page: single panel visible at a time, fused with tabs */
    .trainer-courses-grid {
        display: block;
    }
    .trainer-courses-grid .trainer-panel-hidden {
        display: none !important;
    }
    .trainer-courses-grid > .trainer-panel-content:not(.trainer-panel-hidden) {
        background: var(--glass-bg-2);
        border: 1px solid var(--glass-border-2);
        border-top: none;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: var(--radius-xl);
        border-bottom-right-radius: var(--radius-xl);
        padding: 1rem;
        margin-bottom: 1rem;
    }

    /* Fix broken heights on mobile */
    .trainer-utenti-grid {
        height: auto;
        min-height: 0;
    }
    .allenamenti-column {
        max-height: calc(100vh - 220px);
        overflow-y: auto;
    }
    #courses-page-list,
    #shared-courses-list,
    #courses-participants-list,
    #course-exercise-library {
        max-height: none !important;
    }
    #d-schedule-container {
        max-height: none;
    }
}

/* ============ TRAINER MOBILE HOMEPAGE (FIGMA DESIGN) ============ */

/* Trainer mobile-only utility (no !important so inline style="display:none" can override until JS removes it) */
.trainer-mobile-only { display: none; }

@media (max-width: 1024px) {
    .trainer-mobile-only { display: block; }
}

/* --- Latest Message Card --- */
.trainer-msg-card {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-1);
    border-radius: var(--radius-xl);
    padding: 1.1rem 1.25rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.trainer-msg-card::before {
    content: '';
    width: 3px;
    border-radius: 3px;
    background: var(--primary);
    flex-shrink: 0;
}
.trainer-msg-card:active {
    background: var(--glass-bg-3);
}
.trainer-msg-card-content {
    flex: 1;
    min-width: 0;
}
.trainer-msg-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.2rem;
}
.trainer-msg-card-preview {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.trainer-msg-card-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.4rem;
}

/* --- Dashboard Calendar Strip --- */
.trainer-cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: opacity 0.15s;
}
.trainer-cal-dayname {
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.04em;
}
.trainer-cal-daynum {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transition: all 0.2s;
}
.trainer-cal-daynum--active {
    border: 2px solid var(--primary);
    color: white;
    font-weight: 700;
}
.trainer-cal-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
}

/* --- Dashboard Schedule Items --- */
.trainer-schedule-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.trainer-schedule-time {
    flex-shrink: 0;
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-md);
    min-width: 52px;
    text-align: center;
}
.trainer-schedule-title {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Nuovo PR Card --- */
.trainer-pr-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--glass-bg-2);
    border: 1px solid var(--glass-border-1);
    border-radius: var(--radius-xl);
    padding: 1rem 1.25rem;
}
.trainer-pr-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-subtle);
    border-radius: var(--radius-lg);
}
.trainer-pr-content {
    flex: 1;
    min-width: 0;
}
.trainer-pr-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.1rem;
}
.trainer-pr-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}
.trainer-pr-desc strong, .trainer-pr-desc b {
    color: white;
    font-weight: 700;
}

/* --- Mobile Client List Overrides --- */
@media (max-width: 1024px) {
    #trainer-clients-mobile-list {
        flex-direction: column;
    }
    #trainer-clients-mobile-list {
        padding: 0 0.25rem;
    }
    #trainer-clients-mobile-list .staff-mobile-card {
        padding: 1rem 1rem;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 0;
        background: transparent;
        align-items: center;
    }
    #trainer-clients-mobile-list .staff-mobile-card:last-child {
        border-bottom: none;
    }
    #trainer-clients-mobile-list .staff-mobile-card-avatar {
        width: 50px;
        height: 50px;
        font-size: 1rem;
        background: rgba(255, 255, 255, 0.12);
    }
    /* Hide chevron arrow and secondary info on mobile homepage */
    #trainer-clients-mobile-list .staff-mobile-card > svg {
        display: none;
    }
    #trainer-clients-mobile-list .staff-mobile-card .trainer-mobile-secondary {
        display: none;
    }
}

/* ============ TRAINER SMALL SCREEN REFINEMENTS ============ */
@media (max-width: 640px) {
    .trainer-main-new {
        padding: 80px 0 64px;
    }

    .trainer-layout .trainer-section {
        padding: 0.75rem;
    }

    /* Tighter page headers */
    .trainer-layout .staff-page-header {
        margin-bottom: 0.75rem;
    }
    .trainer-layout .staff-page-header h1 {
        font-size: 1.2rem;
    }
    .trainer-layout .staff-page-header p {
        font-size: 0.75rem;
    }

    /* Smaller stats bar */
    .trainer-layout .staff-stats-bar {
        padding: 0.6rem 0;
        gap: 0;
    }
    .trainer-layout .staff-stat-item {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.2rem;
        padding: 0.5rem 0.25rem;
    }
    .trainer-layout .staff-stat-value {
        font-size: 1.35rem;
    }
    .trainer-layout .staff-stat-label {
        font-size: 0.8rem;
    }

    /* Compact panel tabs */
    .trainer-panel-tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.5rem;
    }

    /* Bottom nav with 5 tabs needs tighter text */
    body:has(.trainer-layout) .bottom-nav-item span {
        font-size: 9px;
    }

    /* Compact search bars */
    .trainer-layout .staff-search-bar input {
        font-size: 0.8rem;
        padding: 0.55rem 0.75rem 0.55rem 2.25rem;
    }

    /* Tighter allenamenti columns */
    .allenamenti-column {
        padding: 0.75rem;
    }
    .allenamenti-col-header {
        font-size: 0.65rem;
    }

    /* Global overflow guard */
    .trainer-layout,
    .trainer-layout * {
        max-width: 100vw;
    }
    .trainer-layout .trainer-section {
        overflow-x: hidden;
        word-break: break-word;
    }
}

/* ============ NUTRITIONIST LAYOUT (matches trainer design) ============ */

/* Override body when nutritionist layout is active */
body:has(.nutritionist-layout) {
    padding-bottom: 0 !important;
    overflow: hidden;
}

/* On desktop, hide the base.html bottom nav for nutritionist */
@media (min-width: 1025px) {
    body:has(.nutritionist-layout) > nav {
        display: none !important;
    }
}

.nutritionist-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    height: 100vh;
    background: var(--bg-base);
    overflow: hidden;
}

.nutritionist-main {
    padding: 2rem 2.5rem;
    overflow-y: auto;
    max-height: 100vh;
    max-width: 1100px;
}

/* Nutritionist sections: remove max-width constraint when inside layout */
.nutritionist-layout .nutritionist-section {
    max-width: 100%;
}

/* ============ NUTRITIONIST MOBILE RESPONSIVE ============ */
@media (max-width: 1024px) {
    /* Show mobile header for nutritionist */
    body:has(.nutritionist-layout) .nutritionist-mobile-header {
        display: flex;
    }

    /* Hide desktop sidebar */
    .nutritionist-layout .nutritionist-sidebar {
        display: none !important;
    }

    /* Single column */
    .nutritionist-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .nutritionist-main {
        padding: 64px 0 72px;
        max-height: none;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
    }

    /* Nutritionist sections get their own padding on mobile */
    .nutritionist-layout .nutritionist-section {
        padding: 1rem;
        max-width: 100vw;
        overflow-x: hidden;
    }

    body:has(.nutritionist-layout) {
        overflow-x: hidden;
        overflow-y: auto;
    }
}

/* ============ OWNER LAYOUT (sidebar, matches trainer design) ============ */

/* Override body when owner layout is active */
body:has(.owner-layout) {
    padding-bottom: 0 !important;
    overflow: hidden;
}

/* On desktop, hide the base.html bottom nav for owner */
@media (min-width: 1025px) {
    body:has(.owner-layout) > nav {
        display: none !important;
    }
}

/* Mobile header for owner */
.owner-mobile-header {
    display: none; /* hidden on desktop */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border-1);
    padding: 0 1rem;
    height: 56px;
    align-items: center;
    justify-content: space-between;
}

.owner-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    height: 100vh;
    background: var(--bg-base);
    overflow: hidden;
}

.owner-main {
    overflow-y: auto;
    max-height: 100vh;
}

/* Owner modals: offset by sidebar on desktop */
.owner-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.owner-modal-overlay.hidden {
    display: none;
}
@media (min-width: 1025px) {
    .owner-modal-overlay {
        left: 200px;
    }
}

/* Owner settings grid: 1 column on mobile */
@media (max-width: 640px) {
    .owner-settings-grid {
        grid-template-columns: 1fr !important;
    }
    .owner-settings-grid .settings-card[style*="grid-column"] {
        grid-column: 1 !important;
    }
}

/* ============ OWNER MOBILE RESPONSIVE ============ */
@media (max-width: 1024px) {
    /* Show mobile header for owner */
    .owner-mobile-header {
        display: flex;
    }

    /* Hide desktop sidebar */
    .owner-layout .owner-sidebar {
        display: none !important;
    }

    /* Single column */
    .owner-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .owner-main {
        padding-top: 64px;
        padding-bottom: 72px;
        max-height: none;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
    }

    body:has(.owner-layout) {
        overflow-x: hidden;
        overflow-y: auto;
    }
}

