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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --bg-gradient-start: #1d140f;
    --bg-gradient-end: #5d331a;
    --container-bg: #f4eee6;
    --text-primary: #241a13;
    --text-secondary: #4f3c2f;
    --text-muted: #3d2f24;
    --card-bg: #fff9f2;
    --border-color: #d7c1aa;
    --input-bg: #fffdf8;
    --input-border: #cbb39a;
    --accent-primary: #a75018;
    --accent-secondary: #5e1f13;
    --hover-bg: rgba(167, 80, 24, 0.06);
    --primary-gradient: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    --accent-glow: 0 8px 24px rgba(124, 36, 20, 0.25);
    --accent-focus-ring: 0 0 0 2px rgba(201, 109, 31, 0.14);
    --accent-bg-subtle: rgba(167, 80, 24, 0.06);
    --accent-bg-hover: rgba(167, 80, 24, 0.1);
    --accent-bg-active: rgba(167, 80, 24, 0.14);
    --accent-bg-light: rgba(167, 80, 24, 0.24);
    --tap-highlight: rgba(167, 80, 24, 0.3);
    --admin-gradient: linear-gradient(135deg, #8b1e16 0%, #c2410c 100%);
    --admin-gradient-hover: linear-gradient(135deg, #9f2418 0%, #d95510 100%);
    --admin-link-text: #fff6ed;
    --header-stripe: rgba(255, 244, 230, 0.06);
    --header-glow: rgba(255, 184, 107, 0.18);
    --font-body: 'Barlow', 'Segoe UI', sans-serif;
    --font-display: 'Barlow Condensed', 'Segoe UI', sans-serif;
    
    /* Rank Colors */
    --rank-r5-bg: linear-gradient(135deg, #ff6b35, #f7931e);
    --rank-r4-bg: var(--primary-gradient);
    --rank-r3-bg: linear-gradient(135deg, #28a745, #20c997);
    --rank-r2-bg: linear-gradient(135deg, #17a2b8, #6610f2);
    --rank-r1-bg: #6c757d;
    
    /* Bootstrap-compat Status Colors */
    --bs-success: #28a745;
    --bs-danger: #dc3545;
    --bs-warning: #ffc107;
    --bs-info: #17a2b8;
    --bs-secondary: #6c757d;
    --bs-warning-bg: #fff3cd;
    --bs-warning-text: #856404;
    --bs-success-bg: #d4edda;
    --bs-success-text: #155724;
    --bs-success-border: #c3e6cb;
    
    /* Misc UI */
    --interactive-hover-bg: #e9ecef;
    --border-subtle: #dee2e6;
    --border-light: #ddd;
    --bg-subtle: #f8f9fa;
    --bg-item-separator: #f0f0f0;
    --text-disabled: #adb5bd;
    --accent-primary-hover: #5568d3;
    --accent-secondary-hover: #653a8b;
    --danger-hover: #c82333;
    --btn-secondary-hover: #5a6268;
    --medal-gold: #ffd700;
    --medal-silver: #c0c0c0;
    --medal-bronze: #cd7f32;
    --color-orange: #fd7e14;
    --color-orange-warning: #ff9800;
    --schedule-gradient: linear-gradient(135deg, #14b8a6 0%, #4ade80 100%);
    --schedule-success-gradient: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    
    /* Accent Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --success-dark: #047857;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-dark: #d97706;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-dark: #dc2626;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --info-dark: #1d4ed8;
    
    /* Elevation System (Box Shadows) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-base: 0 2px 4px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px 0 rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 16px 48px 0 rgba(0, 0, 0, 0.2);
    --shadow-focus: 0 0 0 3px rgba(102, 126, 234, 0.2);
    
    /* Spacing Scale */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Auto theme - respects browser preference */
@media (prefers-color-scheme: dark) {
    html.theme-auto {
        color-scheme: dark;
        --bg-gradient-start: #0e0a08;
        --bg-gradient-end: #26160d;
        --container-bg: #15110e;
        --text-primary: #f4ebe2;
        --text-secondary: #dac7b3;
        --text-muted: #b79f8b;
        --card-bg: #211913;
        --border-color: #4d382a;
        --input-bg: #1a1410;
        --input-border: #5b4332;
        --accent-primary: #df8730;
        --accent-secondary: #9b321a;
        --hover-bg: rgba(255, 174, 95, 0.08);
        --accent-glow: 0 8px 24px rgba(224, 135, 48, 0.18);
        --accent-focus-ring: 0 0 0 2px rgba(223, 135, 48, 0.22);
        --accent-bg-subtle: rgba(223, 135, 48, 0.08);
        --accent-bg-hover: rgba(223, 135, 48, 0.12);
        --accent-bg-active: rgba(223, 135, 48, 0.16);
        --accent-bg-light: rgba(223, 135, 48, 0.24);
        --tap-highlight: rgba(223, 135, 48, 0.3);
        --shadow-focus: 0 0 0 3px rgba(223, 135, 48, 0.24);
        --admin-gradient: linear-gradient(135deg, #8f2318 0%, #c24a12 100%);
        --admin-gradient-hover: linear-gradient(135deg, #a22a1d 0%, #d35c19 100%);
        --admin-link-text: #fff1e6;
        --header-stripe: rgba(255, 244, 230, 0.04);
        --header-glow: rgba(255, 164, 82, 0.16);
        
        /* Dark rank colors - brighter for contrast */
        --rank-r5-bg: linear-gradient(135deg, #ff8a57, #ffb347);
        --rank-r4-bg: linear-gradient(135deg, #7b93f5, #9b6fcc);
        --rank-r3-bg: linear-gradient(135deg, #38d96a, #5de6a0);
        --rank-r2-bg: linear-gradient(135deg, #3bc4d9, #8b5cf6);
        --rank-r1-bg: #8e99a4;
        
        /* Dark mode status colors - brighter */
        --bs-success: #3ddc84;
        --bs-danger: #ff6b6b;
        --bs-warning: #ffd93d;
        --bs-info: #4dd0e1;
        --bs-secondary: #8e99a4;
        --bs-warning-bg: #3d3520;
        --bs-warning-text: #ffd93d;
        --bs-success-bg: #1a3a2a;
        --bs-success-text: #3ddc84;
        --bs-success-border: #2d5a3e;
        
        --interactive-hover-bg: #4a5568;
        --border-subtle: #4a5568;
        --border-light: #4a5568;
        --bg-subtle: #2d3748;
        --bg-item-separator: #3a4556;
        --text-disabled: #718096;
        --accent-primary-hover: #ec9745;
        --accent-secondary-hover: #af3a1f;
        --danger-hover: #e04250;
        --btn-secondary-hover: #6b7b8d;
        --medal-gold: #ffd700;
        --medal-silver: #c0c0c0;
        --medal-bronze: #cd7f32;
        --color-orange: #ff9340;
        --color-orange-warning: #ffb74d;
        --schedule-gradient: linear-gradient(135deg, #14b8a6 0%, #4ade80 100%);
        --schedule-success-gradient: linear-gradient(135deg, #3ddc84 0%, #5de6a0 100%);
        
        /* Darker shadows for dark mode */
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.22);
        --shadow-base: 0 2px 4px 0 rgba(0, 0, 0, 0.28);
        --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.36);
        --shadow-lg: 0 8px 24px 0 rgba(0, 0, 0, 0.44);
        --shadow-xl: 0 16px 48px 0 rgba(0, 0, 0, 0.52);
    }
}

/* Explicit dark theme */
html.theme-dark {
    color-scheme: dark;
    --bg-gradient-start: #0e0a08;
    --bg-gradient-end: #26160d;
    --container-bg: #15110e;
    --text-primary: #f4ebe2;
    --text-secondary: #dac7b3;
    --text-muted: #b79f8b;
    --card-bg: #211913;
    --border-color: #4d382a;
    --input-bg: #1a1410;
    --input-border: #5b4332;
    --accent-primary: #df8730;
    --accent-secondary: #9b321a;
    --hover-bg: rgba(255, 174, 95, 0.08);
    --accent-glow: 0 8px 24px rgba(224, 135, 48, 0.18);
    --accent-focus-ring: 0 0 0 2px rgba(223, 135, 48, 0.22);
    --accent-bg-subtle: rgba(223, 135, 48, 0.08);
    --accent-bg-hover: rgba(223, 135, 48, 0.12);
    --accent-bg-active: rgba(223, 135, 48, 0.16);
    --accent-bg-light: rgba(223, 135, 48, 0.24);
    --tap-highlight: rgba(223, 135, 48, 0.3);
    --shadow-focus: 0 0 0 3px rgba(223, 135, 48, 0.24);
    --admin-gradient: linear-gradient(135deg, #8f2318 0%, #c24a12 100%);
    --admin-gradient-hover: linear-gradient(135deg, #a22a1d 0%, #d35c19 100%);
    --admin-link-text: #fff1e6;
    --header-stripe: rgba(255, 244, 230, 0.04);
    --header-glow: rgba(255, 164, 82, 0.16);
    
    /* Dark rank colors - brighter for contrast */
    --rank-r5-bg: linear-gradient(135deg, #ff8a57, #ffb347);
    --rank-r4-bg: linear-gradient(135deg, #7b93f5, #9b6fcc);
    --rank-r3-bg: linear-gradient(135deg, #38d96a, #5de6a0);
    --rank-r2-bg: linear-gradient(135deg, #3bc4d9, #8b5cf6);
    --rank-r1-bg: #8e99a4;
    
    /* Dark mode status colors - brighter */
    --bs-success: #3ddc84;
    --bs-danger: #ff6b6b;
    --bs-warning: #ffd93d;
    --bs-info: #4dd0e1;
    --bs-secondary: #8e99a4;
    --bs-warning-bg: #3d3520;
    --bs-warning-text: #ffd93d;
    --bs-success-bg: #1a3a2a;
    --bs-success-text: #3ddc84;
    --bs-success-border: #2d5a3e;
    
    --interactive-hover-bg: #4a5568;
    --border-subtle: #4a5568;
    --border-light: #4a5568;
    --bg-subtle: #2d3748;
    --bg-item-separator: #3a4556;
    --text-disabled: #718096;
    --accent-primary-hover: #ec9745;
    --accent-secondary-hover: #af3a1f;
    --danger-hover: #e04250;
    --btn-secondary-hover: #6b7b8d;
    --medal-gold: #ffd700;
    --medal-silver: #c0c0c0;
    --medal-bronze: #cd7f32;
    --color-orange: #ff9340;
    --color-orange-warning: #ffb74d;
    --schedule-gradient: linear-gradient(135deg, #14b8a6 0%, #4ade80 100%);
    --schedule-success-gradient: linear-gradient(135deg, #3ddc84 0%, #5de6a0 100%);
    
    /* Darker shadows for dark mode */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.22);
    --shadow-base: 0 2px 4px 0 rgba(0, 0, 0, 0.28);
    --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.36);
    --shadow-lg: 0 8px 24px 0 rgba(0, 0, 0, 0.44);
    --shadow-xl: 0 16px 48px 0 rgba(0, 0, 0, 0.52);
}

/* Explicit light theme */
html.theme-light {
    color-scheme: light;
    --bg-gradient-start: #1d140f;
    --bg-gradient-end: #5d331a;
    --container-bg: #f4eee6;
    --text-primary: #241a13;
    --text-secondary: #4f3c2f;
    --text-muted: #3d2f24;
    --card-bg: #fff9f2;
    --border-color: #d7c1aa;
    --input-bg: #fffdf8;
    --input-border: #cbb39a;
    --accent-primary: #a75018;
    --accent-secondary: #5e1f13;
    --hover-bg: rgba(167, 80, 24, 0.06);
    --accent-glow: 0 8px 24px rgba(124, 36, 20, 0.25);
    --accent-focus-ring: 0 0 0 2px rgba(201, 109, 31, 0.14);
    --accent-bg-subtle: rgba(167, 80, 24, 0.06);
    --accent-bg-hover: rgba(167, 80, 24, 0.1);
    --accent-bg-active: rgba(167, 80, 24, 0.14);
    --accent-bg-light: rgba(167, 80, 24, 0.24);
    --tap-highlight: rgba(167, 80, 24, 0.3);
    --shadow-focus: 0 0 0 3px rgba(201, 109, 31, 0.18);
    --admin-gradient: linear-gradient(135deg, #8b1e16 0%, #c2410c 100%);
    --admin-gradient-hover: linear-gradient(135deg, #9f2418 0%, #d95510 100%);
    --admin-link-text: #fff6ed;
    --header-stripe: rgba(255, 244, 230, 0.06);
    --header-glow: rgba(255, 184, 107, 0.18);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    line-height: 1.6;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
}

/* Touch-friendly improvements */
button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: var(--tap-highlight);
}

/* Keyboard accessibility: show focus ring only for keyboard navigation */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

/* Prevent text selection only on buttons for better UX */
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Keep text selectable everywhere else */
* {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Improve touch target sizes for mobile */
@media (hover: none) and (pointer: coarse) {
    button,
    a,
    input[type="checkbox"],
    input[type="radio"],
    select {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.container {
    width: 100%;
    min-height: 100vh;
    background: var(--container-bg);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    background: var(--primary-gradient);
    color: white;
    padding: 1.25rem 3rem;
    text-align: center;
    position: relative;
    overflow: visible;
    box-shadow: var(--shadow-md);
    z-index: 1200;
    margin-left: 260px;
    transition: margin-left var(--transition-base);
}

header.sidebar-collapsed {
    margin-left: 0;
}

header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 22%, var(--header-glow) 0%, transparent 34%),
        linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.07) 45%, transparent 46%),
        repeating-linear-gradient(90deg, var(--header-stripe) 0, var(--header-stripe) 1px, transparent 1px, transparent 26px);
    pointer-events: none;
    z-index: -1;
}

header > * {
    position: relative;
}

header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 4px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    opacity: 0.92;
}

header .user-info {
    position: absolute;
    top: 14px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1201;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.username-btn {
    font-family: var(--font-display);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.username-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.username-btn::after {
    content: '▼';
    font-size: 0.7em;
    margin-left: 5px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1300;
    overflow: hidden;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--card-bg);
    color: var(--accent-secondary);
}

.dropdown-item:active {
    background: var(--interactive-hover-bg);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

.admin-only {
    background: var(--accent-bg-active);
    color: var(--accent-secondary);
    font-weight: bold;
}

.admin-only:hover {
    background: var(--accent-bg-light);
    color: var(--accent-secondary);
}

/* Theme Options */
.theme-section {
    padding: 8px 0;
    margin: 5px 0;
}

.theme-section-label {
    padding: 8px 20px;
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-option {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    border-radius: 8px;
    margin: 2px 0;
    cursor: pointer;
    gap: 10px;
}

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

.theme-option.active {
    background: var(--accent-bg-active);
    color: var(--accent-secondary);
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    html.theme-auto .theme-option:hover,
    html.theme-dark .theme-option:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

#username-display {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.9);
    color: var(--accent-primary);
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: var(--container-bg);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.3em;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.sidebar-toggle:hover {
    box-shadow: var(--shadow-lg);
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Content Wrapper */
.content-wrapper {
    display: flex;
    flex: 1;
    position: relative;
}

/* Sidebar Navigation */
.nav-menu {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 260px;
    background: var(--container-bg);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-base);
    overflow: hidden;
}

.nav-menu.collapsed {
    transform: translateX(-260px);
}

/* Sidebar branded header — anchors the panel at the top */
.nav-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem 0 1.25rem;
    min-height: 64px;
    background: var(--primary-gradient);
    border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.05em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-collapse-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    line-height: 1;
    transition: background var(--transition-fast);
    margin-left: 8px;
}

.nav-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.nav-collapse-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

/* Scrollable links area */
.nav-links {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0 1rem;
}

.nav-links::-webkit-scrollbar { width: 4px; }
.nav-links::-webkit-scrollbar-track { background: transparent; }
.nav-links::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.nav-links::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 1rem;
    margin: 2px 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.875em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
    position: relative;
    user-select: none;
}

.nav-link:hover {
    background: var(--accent-bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-bg-active);
    color: var(--accent-secondary);
    font-weight: 700;
}

.nav-link.active:hover {
    background: var(--accent-bg-active);
}

/* Admin link special styling */
.nav-link.admin-link {
    background: var(--admin-gradient);
    color: var(--admin-link-text) !important;
    font-weight: bold;
}

.nav-link.admin-link:hover {
    background: var(--admin-gradient-hover);
    color: var(--admin-link-text) !important;
}

.nav-link.admin-link.active {
    background: var(--admin-gradient);
    color: var(--admin-link-text) !important;
}

main {
    padding: 2rem 3rem;
    flex: 1;
    width: calc(100% - 260px);
    background: var(--container-bg);
    margin-left: 260px;
    transition: margin-left var(--transition-base), width var(--transition-base);
    min-height: calc(100vh - 160px);
    box-sizing: border-box;
}

main.sidebar-collapsed {
    margin-left: 0;
    width: 100%;
}

@media (max-width: 1024px) {
    main {
        padding: 1.5rem 2rem;
    }
}

@media (max-width: 768px) {
    main {
        padding: 1rem 1.5rem;
    }

    /* On mobile, sidebar is overlay — header/footer always full width */
    header,
    header.sidebar-collapsed {
        margin-left: 0;
    }

    .app-footer,
    .app-footer.sidebar-collapsed {
        margin-left: 0;
    }
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.primary-action-btn,
.secondary-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    user-select: none;
}

.primary-action-btn {
    background: var(--primary-gradient);
    color: white;
}

.primary-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--accent-glow);
}

.secondary-action-btn {
    background: var(--container-bg);
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.secondary-action-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--accent-glow);
}

.btn-icon {
    font-size: 1.2em;
}

.btn-text {
    font-weight: 600;
}

/* CSV Import Section */
.csv-import-section {
    margin-bottom: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease-out;
}

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

.csv-import-card {
    background: var(--container-bg);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.csv-import-card h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.csv-help {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.6;
}

.csv-help code {
    background: var(--card-bg);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e83e8c;
    font-size: 0.9em;
}

.csv-upload {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.import-btn {
    background: var(--success);
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.import-btn:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.import-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.permission-notice {
    background: var(--info-light);
    border-left: 4px solid var(--info);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.permission-notice p {
    color: var(--info-dark);
    font-size: 1em;
    font-weight: 500;
    margin: 0;
}

/* Modal Enhancements */
.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-base) ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-member {
    animation: slideUp var(--transition-slow) ease-out;
    box-shadow: var(--shadow-xl);
}

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

.modal-member h3 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.6em;
    padding-right: 30px;
}

.modal-buttons {
    margin-top: 25px;
    display: flex;
    gap: 12px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    flex: 1;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-base);
    user-select: none;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.primary-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-base);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
}

.secondary-btn:hover {
    background: var(--accent-bg-subtle);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.secondary-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.form-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-section h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus);
}

.button-group {
    display: flex;
    gap: 10px;
}

button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all var(--transition-base);
}

.members-section h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

#search-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 2px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all var(--transition-base);
    background: var(--input-bg);
    color: var(--text-primary);
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus);
}

.clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-muted);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--transition-base);
}

.clear-search:hover {
    background: var(--text-secondary);
}

.members-list {
    display: grid;
    gap: 15px;
}

.member-card {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-base);
}

.member-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.member-info {
    flex: 1;
}

.member-name {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.member-rank {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.member-power {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    background: var(--primary-gradient);
    color: white;
    cursor: help;
}

.rank-R5 {
    background: var(--rank-r5-bg);
    color: white;
}

.rank-R4 {
    background: var(--rank-r4-bg);
    color: white;
}

.rank-R3 {
    background: var(--rank-r3-bg);
    color: white;
}

.rank-R2 {
    background: var(--rank-r2-bg);
    color: white;
}

.rank-R1 {
    background: var(--rank-r1-bg);
    color: white;
}

.member-eligible {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 500;
    margin-left: 8px;
}

.member-eligible.eligible {
    background: var(--bs-success-bg);
    color: var(--bs-success-text);
}

.member-eligible.not-eligible {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.member-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.edit-btn,
.delete-btn,
.create-user-btn,
.toggle-eligible-btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
}

.edit-btn {
    background: var(--success);
    color: white;
    transition: all var(--transition-base);
}

.edit-btn:hover {
    background: var(--success-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.delete-btn {
    background: var(--danger);
    color: white;
    transition: all var(--transition-base);
}

.delete-btn:hover {
    background: var(--danger-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.create-user-btn {
    background: var(--info);
    color: white;
    transition: all var(--transition-base);
}

.create-user-btn:hover {
    background: var(--info-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.toggle-eligible-btn {
    font-size: 13px;
    padding: 6px 12px;
}

.toggle-eligible-btn.eligible {
    background: var(--bs-success);
    color: white;
}

.toggle-eligible-btn.eligible:hover {
    background: var(--success-dark);
}

.toggle-eligible-btn.not-eligible {
    background: var(--text-muted);
    color: white;
}

.toggle-eligible-btn.not-eligible:hover {
    background: var(--text-secondary);
    color: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.loading,
.empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

/* ===== MOBILE RESPONSIVE STYLES ===== */

/* Tablet and below */
@media (max-width: 1024px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 2em;
    }

    header h2 {
        font-size: 1.1em;
    }

    main {
        padding: 20px;
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    /* Header adjustments */
    header {
        padding: 15px 10px 50px 10px;
    }

    header h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }

    header h2 {
        font-size: 0.9em;
    }

    /* User info - move below header */
    header .user-info {
        position: static;
        width: 100%;
        justify-content: center;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.3);
    }

    .user-dropdown {
        width: 100%;
        max-width: 300px;
    }

    .username-btn {
        width: 100%;
        justify-content: center;
        font-size: 0.85em;
        padding: 10px 15px;
    }

    .dropdown-menu {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(-10px);
        min-width: 250px;
    }

    .dropdown-menu.show {
        transform: translateX(-50%) translateY(0);
    }

    #username-display {
        font-size: 0.85em;
        padding: 6px 12px;
    }

    .logout-btn {
        font-size: 0.85em;
        padding: 6px 15px;
    }

    /* Navigation menu - collapsible sidebar on mobile */
    .sidebar-toggle {
        top: 15px;
        left: 15px;
        width: 36px;
        height: 36px;
        font-size: 1.1em;
    }

    .nav-menu {
        width: 240px;
        padding-top: 70px;
    }

    .nav-menu.collapsed {
        transform: translateX(-240px);
    }

    .nav-link {
        padding: 0.875rem 1.25rem;
        font-size: 0.9em;
    }

    main {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
    }

    main.sidebar-collapsed {
        margin-left: 0;
        width: 100%;
    }

    /* Form sections */
    .form-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .form-section h3 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 0.95em;
    }

    .form-group input,
    .form-group select {
        padding: 10px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Button adjustments */
    button {
        padding: 10px 20px;
        font-size: 15px;
    }

    .button-group {
        flex-direction: column;
        gap: 8px;
    }

    #submit-btn,
    #cancel-btn {
        width: 100%;
    }

    /* Member cards */
    .member-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
    }

    .member-info {
        width: 100%;
        margin-bottom: 10px;
    }

    .member-name {
        font-size: 1.1em;
        margin-bottom: 8px;
    }

    .member-rank {
        font-size: 0.85em;
        padding: 4px 12px;
    }

    .member-eligible {
        display: block;
        margin-left: 0;
        margin-top: 8px;
        width: fit-content;
    }

    .member-actions {
        margin-top: 10px;
        width: 100%;
        gap: 8px;
    }

    .edit-btn,
    .delete-btn,
    .create-user-btn {
        flex: 1;
        min-width: 0;
        padding: 8px 12px;
        font-size: 13px;
    }

    .toggle-eligible-btn {
        width: 100%;
        margin-top: 5px;
    }

    /* Search box */
    .search-box {
        margin-bottom: 15px;
    }

    #search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* CSV Import section */
    .csv-upload {
        flex-direction: column;
        align-items: stretch;
    }

    #csv-file {
        width: 100%;
    }

    .import-btn {
        width: 100%;
        padding: 12px;
    }

    /* Summary stats */
    .summary-stats {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
        padding: 15px;
    }

    .stat-value {
        font-size: 1.5em;
    }

    /* Loading and empty states */
    .loading,
    .empty {
        padding: 30px 15px;
        font-size: 1em;
    }

    /* Permission notice */
    .permission-notice {
        padding: 15px;
        font-size: 0.95em;
    }

    .permission-notice p {
        font-size: 1em;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.3em;
    }

    header h2 {
        font-size: 0.85em;
    }

    .nav-link {
        padding: 10px 12px;
        font-size: 0.85em;
    }

    .form-section h3 {
        font-size: 1.1em;
    }

    .member-name {
        font-size: 1em;
    }

    .member-actions {
        flex-direction: column;
    }

    .edit-btn,
    .delete-btn,
    .create-user-btn {
        width: 100%;
    }
}

#csv-file {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: var(--input-bg);
    color: var(--text-primary);
}

.import-result {
    padding: 15px;
    border-radius: var(--radius-md);
    margin-top: 10px;
}

.import-result.success {
    background: var(--success-light);
    color: var(--success-dark);
    border: 1px solid var(--success);
}

.import-result.error {
    background: var(--danger-light);
    color: var(--danger-dark);
    border: 1px solid var(--danger);
}

.import-result.warning {
    background: var(--warning-light);
    color: var(--warning-dark);
    border: 1px solid var(--warning);
}

.import-result ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

.import-result li {
    margin: 5px 0;
}

/* CSV Preview Modal Styles */
.csv-summary {
    margin-bottom: 20px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
}

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

.stat-label {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.stat-label.new {
    color: var(--bs-success);
}

.stat-label.change {
    color: var(--bs-warning);
}

.stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-value.new {
    color: var(--bs-success);
}

.stat-value.change {
    color: var(--bs-warning);
}

.csv-members-preview {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.csv-members-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.csv-member-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.csv-member-item:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csv-member-item.new {
    border-left: 4px solid var(--bs-success);
    background: linear-gradient(to right, rgba(40, 167, 69, 0.1) 0%, var(--container-bg) 100%);
}

.csv-member-item.changed {
    border-left: 4px solid var(--bs-warning);
    background: linear-gradient(to right, rgba(255, 193, 7, 0.1) 0%, var(--container-bg) 100%);
}

.csv-member-item .member-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.csv-member-item .member-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.csv-member-item .member-name {
    font-weight: bold;
    flex: 1;
}

.csv-member-item .member-rank {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.9em;
}

.csv-member-item .member-status {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 100px;
    text-align: right;
}

.similar-match-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-top: 8px;
    background: var(--bs-warning-bg);
    border-left: 3px solid var(--bs-warning);
    border-radius: 4px;
    font-size: 0.9em;
}

.similar-match-notice .warning-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.rename-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--bs-warning);
    border-radius: 4px;
    background: var(--container-bg);
    font-size: 0.9em;
    cursor: pointer;
}

.rename-select:focus {
    outline: none;
    border-color: var(--color-orange-warning);
    box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.2);
}

.stat-value.warning {
    color: var(--color-orange-warning);
}

.stat-label.warning {
    color: var(--color-orange-warning);
}

.remove-members-section {
    margin-top: 25px;
    padding: 20px;
    background: var(--bs-warning-bg);
    border: 2px solid var(--bs-warning);
    border-radius: 8px;
}

.remove-members-section h4 {
    margin: 0 0 10px 0;
    color: var(--bs-warning-text);
    font-size: 1.1em;
}

.remove-help {
    margin: 0 0 15px 0;
    color: var(--bs-warning-text);
    font-size: 0.9em;
}

.members-to-remove-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 6px;
}

.remove-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--container-bg);
    border: 1px solid var(--bs-warning);
    border-radius: 6px;
    transition: all 0.2s;
}

.remove-member-item:hover {
    background: var(--bs-warning-bg);
    border-color: var(--color-orange-warning);
}

.remove-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.remove-member-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.remove-member-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95em;
}

.csv-sync-option {
    background: var(--bs-warning-bg);
    border: 2px solid var(--bs-warning);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.sync-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.sync-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
}

.sync-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sync-text strong {
    color: var(--bs-warning-text);
    font-size: 1em;
}

.sync-help {
    font-size: 0.85em;
    color: var(--bs-warning-text);
    font-style: italic;
}

/* Train Schedule Styles */
.schedule-controls {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.week-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.message-copy-section {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.weekly-message-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.weekly-message-section h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.message-box {
    position: relative;
}

.message-box textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    background: var(--container-bg);
}

.copy-btn {
    margin-top: 10px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--accent-glow);
}

/* Conductor Messages */
.conductor-messages-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.conductor-messages-section h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.conductor-messages-section .info-text {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.conductor-messages-list {
    display: grid;
    gap: 15px;
}

.conductor-message-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.conductor-message-header {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 16px;
}

.conductor-message-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    resize: vertical;
    background: var(--container-bg);
    color: var(--text-primary);
    margin-bottom: 10px;
}

.week-nav-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.week-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--accent-glow);
}

.week-today-btn {
    background: var(--container-bg);
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary) !important;
    font-size: 0.875rem;
    padding: 8px 14px;
}

.week-today-btn:hover {
    background: var(--hover-bg);
    box-shadow: none;
}

#week-display {
    color: var(--text-primary);
    font-size: 1.3em;
    margin: 0;
}

.auto-schedule-controls {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.auto-schedule-btn {
    background: var(--schedule-gradient);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.auto-schedule-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.4);
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.day-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
}

.day-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.day-card.past {
    opacity: 0.7;
}

.day-header {
    background: var(--primary-gradient);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-header h4 {
    margin: 0;
    font-size: 1.1em;
}

.day-date {
    font-size: 0.9em;
    opacity: 0.9;
}

.schedule-info {
    padding: 15px;
}

.schedule-info.success {
    background: var(--bs-success-bg);
}

.schedule-info.warning {
    background: var(--bs-warning-bg);
}

.schedule-info .conductor,
.schedule-info .backup {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
}

.schedule-info .notes {
    margin-top: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 5px;
    font-size: 0.9em;
    font-style: italic;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 5px;
}

.status-badge.success {
    background: var(--bs-success);
    color: white;
}

.status-badge.warning {
    background: var(--bs-warning);
    color: var(--bs-warning-text);
}

.status-badge.active {
    background: var(--bs-info);
    color: white;
}

.status-badge.info {
    background: var(--text-muted);
    color: white;
}

.score-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 700;
    margin-left: 8px;
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.no-schedule {
    padding: 40px 15px;
    text-align: center;
}

.no-schedule p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.schedule-btn,
.edit-schedule-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.schedule-btn:hover,
.edit-schedule-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--accent-glow);
}

.schedule-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.edit-schedule-btn,
.clear-schedule-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.edit-schedule-btn {
    background: var(--primary-gradient);
    color: white;
}

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

.clear-schedule-btn:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
}

/* Modal Styles */
.modal-content {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
}

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

.close:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
    border-radius: var(--radius-sm);
}

.date-display {
    background: var(--card-bg);
    padding: 10px;
    border-radius: 5px;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-search {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 8px;
    transition: border-color 0.3s;
}

.dropdown-search:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#conductor-select,
#backup-select {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 14px;
}

#conductor-select option,
#backup-select option {
    padding: 8px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 2px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-label:hover {
    border-color: var(--accent-primary);
    background: var(--card-bg);
}

.radio-label input[type="radio"] {
    margin-right: 10px;
}

.submit-btn,
.cancel-btn {
    flex: 1;
}

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

.cancel-btn:hover {
    background: var(--text-secondary);
    color: white;
}

/* History Section */
.history-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border-subtle);
}

.history-section h3 {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: var(--container-bg);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-primary);
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.filter-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--accent-primary);
}

.history-grid {
    display: grid;
    gap: 15px;
}

.history-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s;
}

.history-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.history-card.success {
    border-left: 5px solid var(--bs-success);
}

.history-card.warning {
    border-left: 5px solid var(--bs-warning);
}

.history-date {
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.history-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-notes {
    margin-top: 8px;
    padding: 8px;
    background: var(--card-bg);
    border-radius: 5px;
    font-size: 0.9em;
    font-style: italic;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .week-selector {
        flex-direction: column;
    }
    
    .week-nav-btn {
        width: 100%;
    }
    
    .schedule-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-menu {
        flex-direction: column;
    }
    
    .nav-link {
        border-bottom: 1px solid var(--border-subtle);
        border-left: 3px solid transparent;
    }
    
    .nav-link.active {
        border-bottom: 1px solid var(--border-subtle);
        border-left-color: var(--accent-primary);
    }
}

/* Awards Page Styles */
.awards-controls {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

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

.week-info h3 {
    margin: 0;
    color: var(--text-primary);
}

.week-subtitle {
    margin: 5px 0 0 0;
    color: var(--text-muted);
    font-size: 0.9em;
}

.awards-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.save-btn,
.clear-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.save-btn {
    background: var(--schedule-success-gradient);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

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

.clear-btn:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
}

.awards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.award-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.award-card.focused {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus), var(--shadow-lg);
    transform: scale(1.02);
    z-index: 10;
    background: var(--accent-bg-subtle);
}

.award-card.unfocused {
    opacity: 0.4;
    filter: grayscale(50%);
    transform: scale(0.98);
}

.award-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.award-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--interactive-hover-bg);
}

.award-title {
    margin: 0;
    color: var(--accent-primary);
    font-size: 1.1em;
}

.toggle-award-btn {
    background: var(--bs-danger);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    min-height: 36px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.toggle-award-btn:hover {
    background: var(--danger-hover);
    transform: scale(1.1);
}

.inactive-awards-section {
    grid-column: 1 / -1;
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.inactive-title {
    color: var(--text-muted);
    font-size: 1.1em;
    margin: 0 0 15px 0;
    text-align: center;
}

.inactive-awards-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.inactive-award-chip {
    background: var(--container-bg);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.inactive-award-chip:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--accent-glow);
}

.award-suggestions-box {
    padding: 10px;
    background: var(--container-bg);
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
}

.award-suggestions-label {
    display: block;
    font-size: 0.9em;
    margin-bottom: 5px;
    font-weight: bold;
}

.award-suggestions-label.hidden-label {
    color: var(--accent-primary);
}

.award-suggestions-label.inactive-label {
    color: var(--bs-danger);
}

.award-chip-activate {
    background: var(--accent-bg-subtle);
    border-color: var(--accent-primary);
    cursor: pointer;
}

.award-chip-activate .chip-icon {
    color: var(--accent-primary);
}

.award-chip-reactivate {
    background: var(--bs-warning-bg);
    border-color: var(--bs-warning);
    cursor: pointer;
    position: relative;
}

.award-chip-reactivate .chip-restore {
    color: var(--bs-success);
}

.award-chip-reactivate .chip-delete {
    color: var(--bs-danger);
    margin-left: 5px;
    font-weight: bold;
}

.award-similar-box {
    padding: 10px;
    background: var(--bs-success-bg);
    border-radius: 6px;
    border: 1px solid var(--bs-success-border);
    color: var(--bs-success-text);
    font-size: 0.9em;
}

.award-position {
    margin-bottom: 15px;
}

.award-position label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.member-search {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 5px;
    transition: border-color 0.3s;
}

.member-search:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.member-select {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 14px;
}

.member-select option {
    padding: 8px;
}

.history-search,
.week-filter {
    padding: 10px 15px;
    border: 2px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.history-search {
    flex: 1;
}

.history-search:focus,
.week-filter:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.week-filter {
    min-width: 200px;
}

.history-content {
    margin-top: 20px;
}

.week-history {
    margin-bottom: 40px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 10px;
}

.week-history-title {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    font-size: 1.3em;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-subtle);
}

.awards-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.history-award-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.history-award-title {
    margin: 0 0 10px 0;
    color: var(--accent-primary);
    font-size: 1em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--interactive-hover-bg);
}

.history-award-item {
    padding: 8px;
    margin: 5px 0;
    border-radius: 5px;
    font-weight: 500;
}

.history-award-item.rank-1 {
    background: var(--medal-gold);
    color: #2d1d00;
}

.history-award-item.rank-2 {
    background: var(--medal-silver);
    color: #2d2d2d;
}

.history-award-item.rank-3 {
    background: var(--medal-bronze);
    color: white;
}

@media (max-width: 768px) {
    .awards-grid {
        grid-template-columns: 1fr;
    }
    
    .awards-history-grid {
        grid-template-columns: 1fr;
    }
    
    .history-filters {
        flex-direction: column;
    }
    
    .week-filter {
        width: 100%;
    }
}

/* Recommendations Page Styles */
.recommendation-form-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    margin: 30px;
}

.recommendation-form-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.recommendation-form {
    background: var(--container-bg);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.notes-input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.notes-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.btn-primary {
    width: 100%;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary-gradient);
    color: white;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--accent-glow);
}

.recommendations-list-section {
    padding: 30px;
}

.recommendations-list-section h3 {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.filter-section {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    background: var(--container-bg);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.filter-chip:hover {
    border-color: var(--accent-primary);
    background: var(--card-bg);
}

.filter-chip.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.filter-chip:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.section-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.view-toggle {
    display: flex;
    gap: 10px;
}

.toggle-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--container-bg);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    color: var(--text-primary);
}

.toggle-btn:hover {
    border-color: var(--accent-primary);
    background: var(--card-bg);
}

.toggle-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Statistics Dashboard */
.stats-dashboard {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: var(--primary-gradient);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon {
    font-size: 2.5em;
    opacity: 0.9;
}

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

.stat-value {
    font-size: 2em;
    font-weight: bold;
    line-height: 1;
    color: white;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.stat-label {
    font-size: 0.85em;
    opacity: 0.9;
    margin-top: 5px;
    color: white;
}

/* Charts Section */
.charts-section {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.chart-container {
    background: var(--section-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    min-height: 300px;
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 1.1em;
    text-align: center;
}

.chart-container canvas {
    max-height: 300px;
}

/* Grouped View Styles */
.grouped-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.grouped-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.grouped-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--interactive-hover-bg);
    flex-wrap: wrap;
    gap: 10px;
}

.grouped-member-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-name-large {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-primary);
}

.grouped-badges {
    display: flex;
    gap: 10px;
}

.count-badge {
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
}

.active-count {
    background: var(--accent-primary);
    color: white;
}

.assigned-count {
    background: var(--bs-success);
    color: white;
}

.grouped-recommendations {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recommendation-item {
    background: var(--card-bg);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid var(--interactive-hover-bg);
    transition: all 0.3s;
}

.recommendation-item:hover {
    background: var(--interactive-hover-bg);
}

.recommendation-item.active-rec {
    border-left-color: var(--accent-primary);
}

.recommendation-item.expired-rec {
    border-left-color: var(--bs-success);
    opacity: 0.8;
}

.rec-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.rec-by {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

.rec-date {
    font-size: 0.85em;
    color: var(--text-disabled);
}

.delete-btn-small {
    padding: 4px 10px;
    border: none;
    border-radius: 5px;
    background: var(--bs-danger);
    color: white;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s;
}

.delete-btn-small:hover {
    background: var(--danger-hover);
}

.rec-notes-small {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-style: italic;
    padding: 8px;
    background: var(--card-bg);
    border-radius: 5px;
    margin-top: 5px;
}

.active-badge {
    padding: 4px 10px;
    background: var(--accent-primary);
    color: white;
    font-size: 0.75em;
    border-radius: 12px;
    font-weight: 600;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recommendation-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
}

.recommendation-card.expired {
    opacity: 0.7;
    background: var(--card-bg);
    border-color: var(--bs-success);
}

.recommendation-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.recommendation-card.expired:hover {
    border-color: var(--bs-success);
}

.recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--interactive-hover-bg);
}

.recommendation-member {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.expired-badge {
    padding: 4px 10px;
    background: var(--bs-success);
    color: white;
    font-size: 0.75em;
    border-radius: 12px;
    font-weight: 600;
}

.member-name {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
}

.member-rank {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    color: white;
}

.rank-R5 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.rank-R4 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.rank-R3 {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.rank-R2 {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.rank-R1 {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.delete-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    background: var(--bs-danger);
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.delete-btn:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
}

.recommendation-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recommendation-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.9em;
}

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

.recommendation-date {
    color: var(--text-disabled);
}

.recommendation-notes {
    background: var(--card-bg);
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid var(--accent-primary);
    color: var(--text-muted);
    font-style: italic;
    margin-top: 5px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-disabled);
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .recommendation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .recommendation-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .delete-btn {
        width: 100%;
    }
}

/* Settings page styles */
.settings-group {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
}

.settings-group h4 {
    margin-bottom: 15px;
    color: var(--accent-primary);
    font-size: 1.1em;
}

.help-text {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 5px;
    font-style: italic;
}

.info-text {
    color: var(--text-muted);
    margin-bottom: 20px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 5px;
    border-left: 4px solid #2196F3;
}

.info-section {
    background: var(--container-bg);
    padding: 30px;
    border-top: 2px solid var(--border-color);
}

.info-section h3 {
    color: var(--accent-primary);
    margin-bottom: 15px;
}

.info-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
}

.info-card ul {
    margin: 15px 0;
    padding-left: 20px;
}

.info-card li {
    margin: 10px 0;
    line-height: 1.6;
}

.info-card strong {
    color: var(--accent-primary);
}

.info-box {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #4a90e2;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.info-box p {
    margin: 5px 0;
    line-height: 1.6;
}

.info-box code {
    background: var(--container-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

/* Rankings page styles */
.charts-section {
    background: var(--container-bg);
    padding: 30px;
    margin-top: 20px;
}

.charts-section h3 {
    color: var(--accent-primary);
    margin-bottom: 20px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.chart-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    min-height: 350px;
}

.chart-container h4 {
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.1em;
}

.chart-container canvas {
    max-height: 300px;
}

.chart-options {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
    flex-wrap: wrap;
}

.chart-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 15px;
    background: var(--container-bg);
    border-radius: 6px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.chart-options label:hover {
    border-color: var(--accent-primary);
    background: var(--accent-bg-subtle);
}

.chart-options input[type="checkbox"],
.chart-options input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.member-search-box {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    max-width: 600px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
}

.member-search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.member-search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.member-search-box .clear-search {
    padding: 10px 20px;
    background: var(--bs-secondary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.member-search-box .clear-search:hover {
    background: var(--btn-secondary-hover);
}

.member-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.member-timeline-chart {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--interactive-hover-bg);
}

.member-timeline-chart h5 {
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.05em;
    font-weight: 600;
}

.member-timeline-chart canvas {
    max-height: 250px;
}

.rankings-section {
    background: var(--container-bg);
    padding: 30px;
    margin-top: 20px;
}

.rankings-section h3 {
    color: var(--accent-primary);
    margin-bottom: 20px;
}

.rankings-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group input[type="text"] {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-size: 1em;
    min-width: 200px;
    transition: border-color 0.3s;
}

.filter-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--accent-focus-ring);
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    background: var(--container-bg);
    cursor: pointer;
    min-width: 150px;
    transition: border-color 0.3s;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--accent-focus-ring);
}

.info-badge {
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: 20px;
    border-left: 4px solid #2196F3;
    color: var(--text-primary);
}

.system-info-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
}

.system-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.system-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--container-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 700;
    color: var(--accent-primary);
}

.system-note {
    padding: 15px;
    background: var(--bs-warning-bg);
    border-left: 4px solid var(--bs-warning);
    border-radius: 4px;
    color: var(--bs-warning-text);
    line-height: 1.6;
}

.rankings-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ranking-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
}

.ranking-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.rank-first {
    border-color: var(--medal-gold);
    background: linear-gradient(to right, rgba(255, 215, 0, 0.1), var(--container-bg));
}

.rank-second {
    border-color: var(--medal-silver);
    background: linear-gradient(to right, rgba(192, 192, 192, 0.1), var(--container-bg));
}

.rank-third {
    border-color: var(--medal-bronze);
    background: linear-gradient(to right, rgba(205, 127, 50, 0.1), var(--container-bg));
}

.ranking-position {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.position-number {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--accent-primary);
}

.ranking-position h4 {
    margin: 0;
    font-size: 1.5em;
    color: var(--text-primary);
}

.rank-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent-primary);
    color: white;
    border-radius: 15px;
    font-size: 0.7em;
    font-weight: 600;
    margin-left: 10px;
}

.rank-badge-r5 {
    background: var(--rank-r5-bg);
}

.rank-badge-r4 {
    background: var(--rank-r4-bg);
}

.rank-badge-r3 {
    background: var(--rank-r3-bg);
}

.rank-badge-r2 {
    background: var(--rank-r2-bg);
}

.rank-badge-r1 {
    background: var(--rank-r1-bg);
}

.total-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--primary-gradient);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.score-value {
    font-size: 2.5em;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.ranking-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ranking-details.collapsed {
    display: none;
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    border-radius: 8px;
    padding: 10px;
}

.ranking-header:hover {
    background: var(--accent-bg-subtle);
}

.ranking-card:not(:has(.ranking-details.collapsed)) .ranking-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.expand-icon {
    font-size: 1.2em;
    color: var(--text-muted);
    transition: transform 0.2s;
    margin-left: 15px;
}

.rank-change {
    font-size: 0.75em;
    font-weight: 700;
    margin-left: 8px;
}

.rank-up {
    color: var(--bs-success);
}

.rank-down {
    color: var(--bs-danger);
}

.rank-same {
    color: var(--text-muted);
    font-size: 0.65em;
}

.timeline-loading {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-style: italic;
}

.detail-section {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
}

.detail-section h5 {
    margin: 0 0 15px 0;
    color: var(--accent-primary);
    font-size: 1.1em;
}

.section-header-with-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.section-header-with-toggle h5 {
    margin: 0;
    color: var(--accent-primary);
    font-size: 1.1em;
}

.section-header-with-toggle .checkbox-label {
    margin: 0;
    white-space: nowrap;
}

.member-timeline-canvas {
    max-height: 300px;
    width: 100% !important;
    height: auto !important;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 5px;
    border-left: 3px solid var(--border-color);
}

.detail-item.positive {
    border-left-color: var(--bs-success);
}

.detail-item.positive .detail-value {
    color: var(--bs-success);
}

.detail-item.negative {
    border-left-color: var(--bs-danger);
}

.detail-item.negative .detail-value {
    color: var(--bs-danger);
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 700;
}

.awards-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.award-chip {
    display: inline-block;
    padding: 6px 12px;
    background: var(--container-bg);
    border: 1px solid var(--accent-primary);
    border-radius: 20px;
    font-size: 0.9em;
    color: var(--accent-primary);
    font-weight: 600;
}

.awards-detailed-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.award-detail-item {
    display: grid;
    grid-template-columns: 40px 1fr 100px 80px;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 6px;
    border-left: 4px solid var(--accent-primary);
}

.award-icon {
    font-size: 1.5em;
    text-align: center;
}

.award-type {
    font-weight: 600;
    color: var(--text-primary);
}

.award-rank {
    color: var(--text-muted);
    font-size: 0.9em;
}

.award-points {
    font-weight: 700;
    color: var(--bs-success);
    text-align: right;
}

/* Compact awards list */
.awards-compact-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.award-compact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    font-size: 0.9em;
    transition: all 0.2s;
}

.award-compact-item:hover {
    background: var(--interactive-hover-bg);
    border-color: var(--accent-primary);
}

.award-compact-item.expired-award {
    opacity: 0.5;
    background: var(--card-bg);
    border-color: var(--input-border);
    border-style: dashed;
}

.award-compact-item.expired-award:hover {
    opacity: 0.7;
    background: var(--interactive-hover-bg);
    border-color: var(--text-disabled);
}

.award-compact-item.expired-award .award-type-compact {
    color: var(--text-muted);
    text-decoration: line-through;
}

.award-compact-item.expired-award .award-points-compact {
    color: var(--text-muted);
    text-decoration: line-through;
}

.award-icon-compact {
    font-size: 1.2em;
}

.award-info-compact {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.award-type-compact {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.award-week-compact {
    font-size: 0.85em;
    color: var(--text-muted);
    line-height: 1;
}

.award-points-compact {
    font-weight: 700;
    color: var(--bs-success);
    margin-left: 5px;
}

.no-awards {
    color: var(--text-disabled);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: var(--container-bg);
    border-radius: 5px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85em;
    color: var(--text-secondary) !important;
    font-weight: 600;
}

.stat-value {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-primary) !important;
}

.loading, .error, .empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
}

.error {
    color: var(--bs-danger);
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        min-height: 300px;
    }
    
    .member-charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .chart-options label {
        width: 100%;
        justify-content: center;
    }
    
    .member-search-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .member-search-box input,
    .member-search-box .clear-search {
        width: 100%;
    }
    
    .award-detail-item {
        grid-template-columns: 30px 1fr;
        gap: 5px;
    }
    
    .award-rank {
        grid-column: 2;
    }
    
    .award-points {
        grid-column: 2;
        text-align: left;
    }
    
    .award-compact-item {
        flex: 1 1 100%;
        justify-content: space-between;
    }
    
    .ranking-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .expand-icon {
        position: absolute;
        right: 15px;
        top: 15px;
    }
    
    .filter-controls {
        position: static;
    }
    
    .total-score {
        align-self: flex-end;
    }
    
    .rankings-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .info-badge {
        text-align: center;
    }
}

/* ========================================
   DESERT STORM STYLES
   ======================================== */

.storm-strategy {
    background: var(--card-bg);
}

.strategy-phases {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.phase-card {
    background: var(--container-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.phase-card h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 1.1em;
}

.phase-card ul {
    margin: 0;
    padding-left: 20px;
}

.phase-card li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.storm-buildings-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.storm-stage {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
}

.storm-stage-title {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 1.2em;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.storm-stage-buildings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.storm-building {
    background: var(--container-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--bs-secondary);
    transition: transform 0.3s, box-shadow 0.3s;
}

.storm-building:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.storm-building.critical {
    border-left-color: var(--bs-danger);
    background: linear-gradient(to right, rgba(220, 53, 69, 0.1) 0%, var(--container-bg) 100%);
}

.storm-building.high {
    border-left-color: var(--color-orange);
    background: linear-gradient(to right, rgba(253, 126, 20, 0.1) 0%, var(--container-bg) 100%);
}

.storm-building.medium {
    border-left-color: var(--bs-warning);
    background: linear-gradient(to right, rgba(255, 193, 7, 0.1) 0%, var(--container-bg) 100%);
}

.storm-building.low {
    border-left-color: var(--bs-secondary);
}

.building-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.building-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1em;
}

.priority-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
    color: white;
}

.priority-badge.critical {
    background: var(--bs-danger);
    animation: pulse 2s infinite;
}

.priority-badge.high {
    background: var(--color-orange);
}

.priority-badge.medium {
    background: var(--bs-warning);
    color: var(--text-primary);
}

.priority-badge.low {
    background: var(--bs-secondary);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.building-info {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.building-info .points {
    color: var(--bs-success);
    font-weight: bold;
    font-size: 0.9em;
}

.building-info .boost {
    color: var(--accent-primary);
    font-size: 0.85em;
    font-style: italic;
}

.member-slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.slot-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
}

.slot-container label {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 600;
}

.searchable-select {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9em;
    background: var(--container-bg);
    cursor: text;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--container-bg);
    border: 2px solid var(--accent-primary);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: -2px;
}

.dropdown-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--bg-item-separator);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--bg-subtle);
}

.dropdown-item.disabled {
    color: var(--text-muted);
    cursor: default;
    font-style: italic;
}

.dropdown-item.disabled:hover {
    background-color: white;
}

.member-select-storm {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

.member-select-storm:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.member-select-storm option:first-child {
    color: var(--text-muted);
    font-style: italic;
}

.mail-content {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    font-size: 0.9em;
    line-height: 1.6;
    max-height: 600px;
    overflow-y: auto;
    border: 2px solid var(--border-subtle);
}

.mail-header {
    margin-bottom: 15px;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .strategy-phases {
        grid-template-columns: 1fr;
    }
    
    .storm-stage-buildings {
        grid-template-columns: 1fr;
    }
    
    .member-slots {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   UPLOAD PAGE STYLES
   ======================================== */

.upload-instructions {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.upload-instructions h4 {
    margin: 0 0 15px 0;
    color: var(--text-secondary);
}

.upload-instructions ol {
    margin: 0;
    padding-left: 25px;
}

.upload-instructions li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.preview-section {
    margin-top: 20px;
}

.file-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.file-preview {
    position: relative;
    background: var(--card-bg);
    border: 2px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.preview-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}

.file-info {
    font-size: 0.85em;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.9em;
}

.remove-file-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--bs-danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.remove-file-btn:hover {
    background: var(--danger-hover);
}

.processing-status {
    text-align: center;
    padding: 40px 20px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--interactive-hover-bg);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    transition: width 0.5s ease;
    width: 0%;
}

#processing-message {
    font-size: 1.1em;
    color: var(--text-secondary);
}

.results-summary {
    margin-bottom: 30px;
}

.summary-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    background: var(--primary-gradient);
    padding: 30px;
    border-radius: 10px;
    color: white;
}

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

.summary-label {
    display: block;
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.summary-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
}

.summary-value.new {
    color: #90ee90;
}

.summary-value.change {
    color: var(--medal-gold);
}

.detected-members h4 {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.detected-member-card {
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.detected-member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.detected-member-card.new {
    border-color: var(--bs-success);
    background: linear-gradient(to right, rgba(40, 167, 69, 0.1) 0%, var(--container-bg) 100%);
}

.detected-member-card.changed {
    border-color: var(--bs-warning);
    background: linear-gradient(to right, #fff8e1 0%, white 100%);
}

.detected-member-card .member-name {
    font-weight: bold;
    flex: 1;
}

.detected-member-card .member-rank {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
    margin: 0 10px;
}

.detected-member-card .member-status {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 600;
}

.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-message h4 {
    color: var(--bs-success);
    font-size: 1.5em;
    margin-bottom: 30px;
}

.update-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.stat-value {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
    color: var(--accent-primary);
}

/* ===== ADDITIONAL MOBILE STYLES FOR ALL PAGES ===== */
@media (max-width: 768px) {
    /* File upload and preview styles */
    .file-previews {
        grid-template-columns: 1fr;
    }
    
    .summary-card,
    .update-stats {
        grid-template-columns: 1fr;
    }
    
    .members-grid {
        grid-template-columns: 1fr;
    }

    /* Awards page mobile styles */
    .awards-controls {
        padding: 15px;
    }

    .awards-actions {
        flex-direction: column;
        gap: 8px;
    }

    .save-btn,
    .clear-btn {
        width: 100%;
        padding: 12px;
    }

    .awards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .award-card {
        padding: 15px;
    }

    .award-header {
        flex-wrap: wrap;
    }

    .inactive-awards-section {
        padding: 15px;
    }

    .inactive-awards-chips {
        gap: 8px;
    }

    .inactive-award-chip {
        font-size: 13px;
        padding: 6px 12px;
    }

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

    .history-filters {
        flex-direction: column;
        gap: 10px;
    }

    .history-search,
    .week-filter {
        width: 100%;
        min-width: 0;
    }

    .week-history {
        padding: 15px;
    }

    /* Recommendations page mobile styles */
    .recommendation-form-section {
        padding: 15px;
        margin: 15px 10px;
    }

    .recommendation-form {
        padding: 15px;
    }

    .recommendation-card {
        padding: 15px;
    }

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

    .recommendation-member {
        width: 100%;
        justify-content: space-between;
    }

    .member-name {
        font-size: 1.1em;
    }

    .member-rank {
        font-size: 0.8em;
        padding: 4px 10px;
    }

    .recommendation-meta {
        flex-direction: column;
        gap: 5px;
    }

    .delete-btn {
        width: 100%;
        margin-top: 10px;
    }

    .delete-btn-small {
        width: 100%;
        padding: 8px;
    }

    .recommendations-list {
        gap: 12px;
    }

    /* Rankings page mobile styles */
    .rankings-section {
        padding: 15px;
    }

    .rankings-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .rankings-controls select,
    .rankings-controls button {
        width: 100%;
    }

    .info-badge {
        text-align: center;
        margin: 10px 0;
    }

    .charts-section {
        padding: 15px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .rankings-list {
        gap: 12px;
    }

    .ranking-card {
        padding: 15px;
    }

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

    .ranking-position {
        font-size: 1.8em;
    }

    .ranking-info h4 {
        font-size: 1.1em;
    }

    .score-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .total-score {
        align-self: flex-start;
        font-size: 1.3em;
    }

    /* Desert Storm page mobile styles */
    .storm-strategy {
        padding: 15px;
    }

    .strategy-phases {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .phase-card {
        padding: 15px;
    }

    .storm-buildings-grid {
        gap: 20px;
    }

    .storm-stage {
        padding: 15px;
    }

    .storm-stage-buildings {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .storm-building {
        padding: 15px;
    }

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

    /* Settings page mobile styles */
    .settings-group {
        padding: 15px;
        margin-bottom: 20px;
    }

    .info-section {
        padding: 15px;
    }

    .info-card {
        padding: 15px;
    }

    .secondary-btn {
        width: 100%;
        padding: 12px;
    }

    /* Profile page mobile styles */
    .profile-section {
        padding: 15px;
    }

    .profile-info {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Train schedule mobile styles */
    .train-schedule-section {
        padding: 15px;
    }

    .train-controls {
        flex-direction: column;
        gap: 10px;
    }

    .train-controls input,
    .train-controls select,
    .train-controls button {
        width: 100%;
    }

    .train-list {
        gap: 12px;
    }

    .train-card {
        padding: 15px;
    }

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

    .train-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .train-actions button {
        width: 100%;
    }

    /* Modal mobile styles */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        padding: 20px 15px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header {
        padding: 15px;
        margin: -20px -15px 15px -15px;
    }

    .modal-body {
        padding: 10px 0;
    }

    .modal-footer {
        padding: 15px;
        margin: 15px -15px -20px -15px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer button {
        width: 100%;
        margin: 0;
    }

    /* Member modal mobile styles */
    .modal-member h3 {
        font-size: 1.3em;
        margin-bottom: 20px;
    }

    .modal-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .modal-buttons button {
        width: 100%;
    }

    /* Action bar mobile */
    .action-bar {
        flex-direction: column;
        margin-bottom: 20px;
        gap: 10px;
    }

    .primary-action-btn,
    .secondary-action-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }

    .csv-import-card {
        padding: 15px;
    }

    .csv-import-card h4 {
        font-size: 1.1em;
    }

    .csv-upload {
        flex-direction: column;
        gap: 8px;
    }

    .csv-upload input,
    .csv-upload button {
        width: 100%;
    }

    /* Table mobile styles */
    table {
        font-size: 0.9em;
    }

    th,
    td {
        padding: 8px 6px;
    }

    /* Make tables scrollable on mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Compact display for long content */
    .compact-mobile {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 150px;
    }
}

/* Small mobile adjustments (smaller phones) */
@media (max-width: 480px) {
    /* Further reduce padding and font sizes */
    .award-title {
        font-size: 1em;
    }

    .ranking-position {
        font-size: 1.5em;
    }

    .total-score {
        font-size: 1.2em;
    }

    .phase-card {
        padding: 12px;
    }

    .storm-building {
        padding: 12px;
    }

    .stat-value {
        font-size: 2em;
    }

    /* Adjust chart containers for very small screens */
    .chart-container {
        min-height: 250px;
    }
}

/* ================================================ */
/* ADMIN PANEL STYLES */
/* ================================================ */

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 15px 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

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

.tab-button.active {
    color: var(--accent-secondary);
    border-bottom-color: var(--accent-primary);
    background: var(--accent-bg-active);
    font-weight: 700;
}

.tab-button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

.tab-content {
    display: none;
}

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

/* Users List */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.user-card:hover {
    background: var(--card-bg);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.user-card .user-info {
    position: static;
    flex: 1;
}

.user-info h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-badge {
    background: var(--primary-gradient);
    color: white;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.member-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.9em;
}

.no-member {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-style: italic;
    opacity: 0.6;
}

.user-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.user-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.stat-value {
    color: var(--text-primary);
    font-weight: bold;
}

/* Recent Logins */
.recent-logins {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.recent-logins strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 10px;
}

.login-entry {
    display: grid;
    grid-template-columns: 1fr 120px 150px;
    gap: 10px;
    padding: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.85em;
}

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

.login-ip {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.login-time {
    color: var(--text-secondary);
    font-size: 0.9em;
    opacity: 0.8;
}

/* Login History Table */
.login-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--container-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-base);
}

.login-table thead {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
}

.login-table th {
    color: white;
    font-weight: 600;
    padding: 15px;
    text-align: left;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

.login-table tbody tr {
    transition: all var(--transition-fast);
}

.login-table tbody tr:nth-child(even) {
    background: var(--card-bg);
}

.login-table tbody tr:hover {
    background: var(--accent-bg-hover);
    transform: scale(1.01);
    box-shadow: var(--shadow-sm);
}

.login-table td {
    padding: 12px 15px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.login-table tbody tr:last-child td {
    border-bottom: none;
}

.login-row.failed {
    background: rgba(229, 62, 62, 0.1);
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 1.2em;
}

.status-badge.success {
    background: rgba(72, 187, 120, 0.2);
}

.status-badge.failed {
    background: rgba(229, 62, 62, 0.2);
}

.device-info {
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-controls select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
}

/* Search Box */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 16px;
}

.search-box input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Modal Overrides for Admin */
#reset-password-result {
    padding: 20px;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 10px;
    border: 2px solid rgba(72, 187, 120, 0.3);
}

#result-password {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 8px;
    display: inline-block;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.checkbox-group {
    background: var(--accent-bg-subtle);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: bold;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Empty States and Loading */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1.1em;
    opacity: 1;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

/* Error and Info Messages */
.error-message {
    padding: 20px;
    margin: 20px 0;
    background: rgba(229, 62, 62, 0.1);
    border-left: 4px solid #e53e3e;
    border-radius: 8px;
    color: var(--text-primary);
}

.info-message {
    padding: 20px;
    margin: 20px 0;
    background: rgba(66, 153, 225, 0.1);
    border-left: 4px solid #4299e1;
    border-radius: 8px;
    color: var(--text-primary);
}

html.theme-dark .error-message {
    color: var(--danger);
}

html.theme-dark .info-message {
    color: var(--info);
}

@media (prefers-color-scheme: dark) {
    html.theme-auto .error-message {
        color: var(--danger);
    }

    html.theme-auto .info-message {
        color: var(--info);
    }
}

/* Responsive Admin Styles */
@media (max-width: 768px) {
    .user-header {
        flex-direction: column;
    }
    
    .user-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .user-actions button {
        flex: 1;
        min-width: 0;
        font-size: 0.85em;
        padding: 8px 12px;
    }
    
    .login-entry {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .login-table {
        font-size: 0.85em;
    }
    
    .login-table th,
    .login-table td {
        padding: 8px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .login-table {
        display: block;
        overflow-x: auto;
    }
    
    .user-actions button {
        font-size: 0.75em;
        padding: 6px 8px;
    }
}

/* Admin Panel Cards */
.card {
    background: var(--container-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-base);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

.card-header h2 {
    color: var(--text-primary);
    font-size: 1.5em;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

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

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

/* Inline count badge */
.badge {
    display: inline-block;
    padding: 3px 12px;
    background: var(--accent-bg-light);
    color: var(--accent-secondary);
    border-radius: var(--radius-full);
    font-size: 0.85em;
    font-weight: 600;
}

/* Button size modifier — overrides upload-page full-width defaults */
.btn-sm {
    padding: 6px 14px !important;
    font-size: 0.85em !important;
    width: auto !important;
    margin: 0 !important;
    display: inline-flex !important;
}

/* Button color variants */
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
    color: white;
}

.btn-warning:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

/* Modal structural helpers */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3em;
    font-weight: 700;
}

.modal-body {
    padding: var(--space-xs) 0;
    color: var(--text-primary);
}

.modal-body p {
    margin-bottom: var(--space-xs);
    line-height: 1.6;
}

.modal-footer,
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-xs);
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* ✕ close button used inside .modal-header */
.modal-close {
    background: none;
    border: none;
    font-size: 1.4em;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    transition: color var(--transition-fast);
}

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

/* Timezone tags styling */
.timezone-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 10px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
}

.timezone-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent-primary);
    color: white;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background 0.2s;
}

.timezone-tag:hover {
    background: var(--accent-primary-hover);
}

.timezone-tag .remove-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.timezone-tag .remove-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#time-preview {
    font-family: monospace;
    color: var(--accent-primary);
    font-weight: bold;
}

/* ===== TOAST NOTIFICATION SYSTEM ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--container-bg);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    min-width: 300px;
    max-width: 500px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: all;
    animation: toastSlideIn var(--transition-base) ease-out;
    border-left: 4px solid var(--accent-primary);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-info {
    border-left-color: var(--info);
}

.toast-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2em;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

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

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

.toast.toast-exit {
    animation: toastSlideOut var(--transition-base) ease-in;
}

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

@media (max-width: 640px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

/* ===== SCROLL TO TOP BUTTON ===== */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.scroll-to-top:active {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.3em;
    }
}

/* ===== LOADING SKELETON ===== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--card-bg) 0%,
        var(--border-color) 20%,
        var(--card-bg) 40%,
        var(--card-bg) 100%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

.skeleton-text {
    height: 16px;
    margin-bottom: 10px;
}

.skeleton-text:last-child {
    width: 70%;
    margin-bottom: 0;
}

.skeleton-title {
    height: 24px;
    width: 40%;
    margin-bottom: 15px;
}

.skeleton-card {
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 15px;
}

/* ===== SECTION SPACING UTILITIES ===== */
section {
    margin-bottom: var(--space-xl);
}

section:last-child {
    margin-bottom: 0;
}

.section-spacing-sm { margin-bottom: var(--space-md); }
.section-spacing-md { margin-bottom: var(--space-lg); }
.section-spacing-lg { margin-bottom: var(--space-xl); }
.section-spacing-xl { margin-bottom: var(--space-2xl); }

/* ===== UTILITY CLASSES ===== */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }

.bg-success { background-color: var(--success-light) !important; }
.bg-warning { background-color: var(--warning-light) !important; }
.bg-danger { background-color: var(--danger-light) !important; }
.bg-info { background-color: var(--info-light) !important; }

.elevation-0 { box-shadow: none !important; }
.elevation-1 { box-shadow: var(--shadow-sm) !important; }
.elevation-2 { box-shadow: var(--shadow-base) !important; }
.elevation-3 { box-shadow: var(--shadow-md) !important; }
.elevation-4 { box-shadow: var(--shadow-lg) !important; }
.elevation-5 { box-shadow: var(--shadow-xl) !important; }

/* ========================================
   CONFIRM DIALOG
   ======================================== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-fast) ease-out;
}

.confirm-overlay.confirm-hiding {
    animation: fadeOut var(--transition-fast) ease-in forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.confirm-dialog {
    background: var(--container-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slideUp var(--transition-base) ease-out;
}

.confirm-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.confirm-message {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.confirm-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.confirm-cancel-btn {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--container-bg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.confirm-cancel-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.confirm-ok-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.confirm-ok-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.confirm-ok-btn.confirm-dangerous {
    background: var(--danger);
}

.confirm-ok-btn.confirm-dangerous:hover {
    background: var(--danger-dark);
}

/* ========================================
   BUTTON SPINNER
   ======================================== */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}

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

/* ========================================
   FORM FIELD ERROR STATES
   ======================================== */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-group .field-error {
    display: none;
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
    font-weight: 500;
}

.form-group.has-error .field-error {
    display: block;
}

/* ========================================
   SKELETON LOADING
   ======================================== */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.skeleton-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-line {
    height: 14px;
    border-radius: var(--radius-full);
    background: var(--border-color);
    margin-bottom: 8px;
}

.skeleton-line:last-child { margin-bottom: 0; }

.skeleton-badge {
    height: 24px;
    width: 56px;
    border-radius: var(--radius-full);
    background: var(--border-color);
}

/* ========================================
   LOGIN PAGE STYLES
   ======================================== */
.login-container {
    max-width: 450px;
    margin: 100px auto;
    padding: 0;
}

.login-box {
    background: var(--container-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.login-header p {
    font-size: 1em;
    opacity: 0.95;
}

.login-form {
    padding: 40px 30px;
}

.login-error {
    background: var(--danger-light);
    color: var(--danger-dark);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: none;
    border: 1px solid var(--danger);
}

.login-success {
    background: var(--success-light);
    color: var(--success-dark);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: none;
    border: 1px solid var(--success);
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 768px) {
    .login-container {
        margin: 50px auto 20px;
        padding: 0 10px;
        max-width: 100%;
    }

    .login-box {
        border-radius: var(--radius-lg);
    }

    .login-header {
        padding: 30px 20px;
    }

    .login-header h1 {
        font-size: 1.6em;
    }

    .login-form {
        padding: 25px 20px;
    }

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

@media (max-width: 480px) {
    .login-container {
        margin: 30px auto 20px;
    }

    .login-header {
        padding: 25px 15px;
    }

    .login-header h1 {
        font-size: 1.4em;
    }

    .login-form {
        padding: 20px 15px;
    }
}

/* ========================================
   VS POINTS PAGE STYLES
   ======================================== */
.vs-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-base);
}

.vs-table th {
    background: var(--accent-primary);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.vs-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.vs-table tr:last-child td {
    border-bottom: none;
}

.vs-table tr:hover {
    background: var(--hover-bg);
}

.vs-input {
    width: 70px;
    padding: 8px;
    min-height: 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    text-align: center;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.vs-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus);
}

.total-column {
    font-weight: bold;
    color: var(--accent-primary);
    font-size: 1.1em;
}

.vs-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.vs-search-box {
    width: 100%;
    max-width: 300px;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.vs-search-box:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.table-wrapper {
    overflow-x: auto;
}

@media (max-width: 768px) {
    .vs-input {
        width: 50px;
        padding: 4px 6px;
        font-size: 0.75rem;
    }

    .vs-table th,
    .vs-table td {
        padding: 8px 6px;
        font-size: 0.8125rem;
    }
}

/* ========================================
   UPLOAD PAGE STYLES
   ======================================== */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
}

.upload-section {
    background: var(--container-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-base);
}

.tab-buttons {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-size: 1rem;
    white-space: nowrap;
    transition: all var(--transition-base);
}

.tab-btn.active {
    border-bottom-color: var(--accent-primary);
    color: var(--accent-primary);
    font-weight: 700;
}

.tab-content {
    display: none;
}

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

.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--card-bg);
    transition: all var(--transition-base);
    margin-bottom: 15px;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent-primary);
    background: var(--input-bg);
}

.drop-zone.dragover {
    border-style: solid;
}

.drop-icon {
    font-size: 64px;
    margin-bottom: 10px;
}

.preview-container {
    display: none;
}

.preview-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.preview-img:hover {
    transform: scale(1.05);
}

.preview-item {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 5px;
    background: var(--card-bg);
}

.preview-item .remove-file {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-item .remove-file:hover {
    background: var(--danger);
}

.preview-item .file-name {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-input {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    resize: vertical;
    background: var(--input-bg);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus);
}

.upload-btn {
    padding: 15px 30px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all var(--transition-base);
    margin: 5px 0;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.result-box {
    padding: 15px;
    border-radius: var(--radius-md);
    margin-top: 15px;
}

.result-success {
    background: var(--success-light);
    border: 1px solid var(--success);
    color: var(--success-dark);
}

.result-error {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger-dark);
}

.result-info {
    background: var(--info-light);
    border: 1px solid var(--info);
    color: var(--info-dark);
}

.upload-help-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 10px 0;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .drop-icon {
        font-size: 48px;
    }

    .upload-section {
        padding: 15px;
        border-radius: var(--radius-md);
    }

    .tab-btn {
        padding: 10px 15px;
        font-size: 0.875rem;
    }

    .upload-btn {
        padding: 12px 20px;
        font-size: 0.9375rem;
    }

    .text-input {
        min-height: 250px;
        font-size: 0.8125rem;
    }

    .preview-img {
        max-height: 300px;
    }

    .vs-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .vs-search-box {
        max-width: 100%;
    }
}

/* ========================================
   SHARED ACTION BUTTONS ROW
   ======================================== */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ========================================
   GENERIC BTN CLASSES (upload page)
   ======================================== */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all var(--transition-base);
    margin: 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--interactive-hover-bg);
}

.btn-primary:active,
.btn-secondary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Info banner variants */
.info-banner--warning {
    background: var(--bs-warning-bg);
    border-color: var(--bs-warning);
}

/* Required field indicator */
.form-group label:has(+ input[required])::after,
.form-group label:has(+ select[required])::after,
.form-group label:has(+ textarea[required])::after {
    content: ' *';
    color: var(--danger);
}

/* Upload spinner (used via innerHTML in upload.js) */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

/* ===== SIDEBAR OVERLAY FOR MOBILE ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 769px) {
    .sidebar-overlay {
        display: none;
    }
}

/* ===== SIDEBAR NAVIGATION IMPROVEMENTS ===== */
.nav-menu .nav-section {
    padding: 0.5rem 1.5rem;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: 1rem;
}

.nav-menu .nav-section:first-child {
    margin-top: 0;
}

/* Improve admin link in sidebar */
.nav-link.admin-link {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white !important;
    margin: 0.5rem;
    border-radius: var(--radius-md);
}

.nav-link.admin-link:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, var(--accent-secondary-hover) 100%);
    padding-left: 1.5rem;
    box-shadow: var(--shadow-md);
}

.nav-link.admin-link.active::before {
    background: white;
}

/* Responsive adjustments for tablets */
@media (max-width: 1024px) and (min-width: 769px) {
    .nav-menu {
        width: 220px;
    }

    .nav-menu.collapsed {
        transform: translateX(-220px);
    }

    main {
        margin-left: 220px;
    }

    header:not(.sidebar-collapsed) {
        margin-left: 220px;
    }

    .app-footer:not(.sidebar-collapsed) {
        margin-left: 220px;
    }

    .nav-link {
        font-size: 0.875em;
        padding: 0.6rem 0.9rem;
        margin: 2px 6px;
    }
}

/* ── Footer ─────────────────────────────────── */
.app-footer {
    text-align: center;
    padding: 1rem 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 260px;
    transition: margin-left var(--transition-base);
}

.app-footer.sidebar-collapsed {
    margin-left: 0;
}

.app-footer a {
    color: var(--accent-color);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* ========================================
   RANKINGS PAGE  (rk-* namespace)
   ======================================== */

/* ── Up Next strip ───────────────────────────────────────────────────────── */
.rk-up-next-section {
    margin-bottom: 1.5rem;
}

.rk-up-next-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.rk-up-next-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.rk-up-next-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.rk-meta-sep {
    opacity: 0.4;
}

.rk-formula-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.rk-formula-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.rk-up-next-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.rk-up-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
}

.rk-up-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-md);
}

.rk-up-1 { border-top: 3px solid var(--medal-gold, #ffd700); }
.rk-up-2 { border-top: 3px solid var(--medal-silver, #c0c0c0); }
.rk-up-3 { border-top: 3px solid var(--medal-bronze, #cd7f32); }

.rk-up-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.rk-up-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.rk-up-score {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-primary);
    line-height: 1;
    margin-bottom: 0.15rem;
}

.rk-up-pts {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
}

.rk-up-since {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.rk-never {
    color: var(--accent-primary);
    font-weight: 600;
}

.first-timer-badge {
    font-size: 0.8em;
    opacity: 0.85;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.rk-section {
    margin-bottom: 1.5rem;
}

.rk-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.rk-search-input {
    flex: 1 1 160px;
    min-width: 130px;
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg, var(--container-bg));
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.rk-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.rk-rank-chips {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.rk-first-timer-chip {
    font-size: 0.8em;
    padding: 6px 12px;
}

.rk-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.rk-sort-select {
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg, var(--container-bg));
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

/* ── Rankings table ───────────────────────────────────────────────────────── */
.rk-table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.rk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.rk-table thead th {
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.rk-table tbody tr.rk-row {
    cursor: pointer;
    transition: background 0.15s;
}

.rk-table tbody tr.rk-row:hover {
    background: var(--card-bg);
}

.rk-table tbody tr.rk-row.rk-row-open {
    background: var(--card-bg);
}

.rk-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
}

.rk-table tbody tr:last-child td {
    border-bottom: none;
}

/* column widths */
.rk-col-pos    { width: 56px; text-align: center; font-weight: 700; white-space: nowrap; }
.rk-col-name   { min-width: 140px; }
.rk-col-score  { width: 120px; }
.rk-col-runs   { width: 60px; text-align: center; }
.rk-col-since  { width: 80px; text-align: center; }
.rk-col-awards { width: 70px; text-align: center; }
.rk-col-recs   { width: 70px; text-align: center; }
.rk-col-expand { width: 32px; text-align: center; color: var(--text-muted); }

.rk-member-name {
    font-weight: 600;
    margin-right: 0.3rem;
}

.rk-score-num {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-primary);
    margin-bottom: 3px;
}

.rk-score-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.rk-score-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.rk-zero {
    color: var(--text-muted);
    opacity: 0.5;
}

.rk-expand-icon {
    font-size: 0.7rem;
    transition: transform 0.2s;
    display: inline-block;
    color: var(--text-muted);
}

/* ── Detail row ───────────────────────────────────────────────────────────── */
.rk-detail-row {
    display: none;
}

.rk-detail-row.rk-detail-open {
    display: table-row;
}

.rk-detail-row td {
    padding: 0;
    background: var(--container-bg);
    border-bottom: 2px solid var(--accent-primary);
}

.rk-detail-inner {
    padding: 1rem 1.25rem 1.25rem;
}

.rk-detail-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.rk-detail-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rk-detail-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.9rem 1rem;
}

.rk-detail-section h5 {
    margin: 0 0 0.6rem 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.rk-dsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.rk-dsection-header h5 {
    margin: 0;
}

.rk-count {
    font-weight: 400;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-left: 0.3rem;
}

.rk-toggle-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ── Score breakdown bars ─────────────────────────────────────────────────── */
.rk-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rk-breakdown-total {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
}

.rk-brow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.rk-blabel {
    width: 110px;
    flex-shrink: 0;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rk-bbar-wrap {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.rk-bbar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.rk-bbar-gold   { background: var(--medal-gold, #ffd700); }
.rk-bbar-teal   { background: var(--bs-info, #17a2b8); }
.rk-bbar-purple { background: #9b6fcc; }
.rk-bbar-blue   { background: var(--info, #3b82f6); }
.rk-bbar-red    { background: var(--danger, #ef4444); }
.rk-bbar-orange { background: var(--bs-warning, #f59e0b); }

.rk-bval {
    width: 40px;
    text-align: right;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.rk-bval.positive { color: var(--bs-success); }
.rk-bval.negative { color: var(--danger); }

/* ── Conductor stats ──────────────────────────────────────────────────────── */
.rk-stat-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.rk-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 60px;
}

.rk-stat-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.rk-stat-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Timeline section ─────────────────────────────────────────────────────── */
.rk-timeline-section {
    margin-top: 0;
}

.rk-timeline-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.rk-timeline-controls label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.rk-advanced-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s;
    margin-left: auto;
}

.rk-advanced-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.rk-timeline-advanced {
    display: none;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0 0.25rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-top: 1px dashed var(--border-color);
    margin-bottom: 0.5rem;
}

.rk-timeline-advanced label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.rk-timeline-advanced.rk-advanced-open {
    display: flex;
}

.member-timeline-canvas {
    max-height: 280px;
}

.rk-power-canvas {
    max-height: 110px;
    margin-top: 0.6rem;
    opacity: 0.85;
}

/* ── Trend indicator ─────────────────────────────────────────────────────── */
.rk-trend {
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.rk-trend-up   { color: var(--bs-success, #22c55e); }
.rk-trend-down { color: var(--danger, #ef4444); }
.rk-trend-flat { color: var(--text-muted); }

/* ── Last-run cell colors ─────────────────────────────────────────────────── */
.rk-last-never  { color: var(--text-muted); font-style: italic; }
.rk-last-recent { color: var(--bs-success, #22c55e); font-weight: 600; }
.rk-last-mid    { color: var(--bs-warning, #f59e0b); font-weight: 600; }
.rk-last-old    { color: var(--danger, #ef4444); font-weight: 600; }

/* ── Analytics collapsible ────────────────────────────────────────────────── */
.rk-analytics {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.rk-analytics-summary {
    padding: 0.85rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-primary);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

.rk-analytics-summary::-webkit-details-marker { display: none; }

.rk-analytics-summary:hover {
    background: var(--container-bg);
}

.rk-analytics-body {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border-color);
}

.rk-analytics-canvas {
    max-height: 280px;
}

/* ── Mobile overrides ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .rk-up-next-list {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .rk-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .rk-actions {
        margin-left: 0;
        justify-content: flex-end;
    }

    .rk-rank-chips {
        order: -1;
    }

    .rk-detail-columns {
        grid-template-columns: 1fr;
    }

    .rk-col-awards,
    .rk-col-recs {
        display: none;
    }

    .rk-blabel {
        width: 90px;
    }

    .rk-analytics-canvas {
        max-height: 200px;
    }
}

/* ========================================
   VS DUEL PAGE  (vs2-* namespace)
   ======================================== */

/* ── Week nav ────────────────────────────────────────────────────────────── */
.vs2-week-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.vs2-week-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

.vs2-ocr-link { margin-left: auto; }

/* ── Day cards ───────────────────────────────────────────────────────────── */
.vs2-day-strip {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.vs2-day-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    border-top-width: 3px;
    transition: box-shadow 0.15s;
}

.vs2-day-card:hover { box-shadow: 0 3px 12px var(--shadow-md); }

.vs2-day-ok      { border-top-color: var(--bs-success, #22c55e); }
.vs2-day-partial { border-top-color: var(--bs-warning, #f59e0b); }
.vs2-day-empty   { border-top-color: var(--danger, #ef4444); }
.vs2-day-future  { border-top-color: var(--border-color); opacity: 0.6; }

.vs2-day-theme {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vs2-day-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.vs2-day-total {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-primary);
    line-height: 1;
    margin-bottom: 0.2rem;
}

.vs2-day-part {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ── Summary bar ─────────────────────────────────────────────────────────── */
.vs2-summary-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.9rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.vs2-sb-item strong { color: var(--text-primary); }
.vs2-sb-sep { opacity: 0.4; }
.vs2-sb-edit-hint {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Table toolbar ───────────────────────────────────────────────────────── */
.vs2-table-section { }

.vs2-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.vs2-table { table-layout: auto; }

.vs2-col-day {
    width: 90px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.vs2-col-total {
    width: 100px;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Status colours */
.vs2-cell-ok   { color: var(--bs-success, #22c55e); font-weight: 700; }
.vs2-cell-miss { color: var(--danger, #ef4444); }
.vs2-zero      { color: var(--text-muted); opacity: 0.45; }

.vs2-row-nodata td { opacity: 0.6; }

/* ── Inline edit ─────────────────────────────────────────────────────────── */
.vs2-editable {
    cursor: pointer;
    position: relative;
}

.vs2-editable:hover::after {
    content: ' ✏';
    font-size: 0.65em;
    opacity: 0.45;
}

.vs2-edit-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: flex-end;
}

.vs2-edit-input {
    width: 72px;
    padding: 2px 5px;
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    background: var(--input-bg, var(--container-bg));
    color: var(--text-primary);
    font-size: 0.85rem;
    text-align: right;
    outline: none;
}

.vs2-edit-ok,
.vs2-edit-cancel {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 3px;
    line-height: 1;
    border-radius: 3px;
}

.vs2-edit-ok     { color: var(--bs-success, #22c55e); }
.vs2-edit-cancel { color: var(--danger, #ef4444); }
.vs2-edit-ok:hover     { background: rgba(34,197,94,0.12); }
.vs2-edit-cancel:hover { background: rgba(239,68,68,0.10); }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .vs2-day-strip {
        grid-template-columns: repeat(3, 1fr);
    }

    .vs2-day-theme { display: none; }

    .vs2-col-day { width: 60px; }
}

/* ========================================
   VS COMPLIANCE PAGE  (vc-* namespace)
   ======================================== */

.vc-target-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.vc-target-item strong { color: var(--text-primary); }

.vc-sep { opacity: 0.4; }

.vc-settings-link {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--accent-primary);
    text-decoration: none;
}

.vc-settings-link:hover { text-decoration: underline; }

/* ── Week tabs ────────────────────────────────────────────────────────────── */
.vc-week-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.vc-tab {
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--container-bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.vc-tab:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.vc-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* ── Summary row ──────────────────────────────────────────────────────────── */
.vc-summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.vc-summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    text-align: center;
    border-top-width: 3px;
}

.vc-card-ok   { border-top-color: var(--bs-success, #22c55e); }
.vc-card-warn { border-top-color: var(--bs-warning, #f59e0b); }
.vc-card-miss { border-top-color: var(--danger, #ef4444); }
.vc-card-none { border-top-color: var(--border-color); }

.vc-summary-num {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.vc-summary-lbl {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Compliance grid ──────────────────────────────────────────────────────── */
.vc-grid-section { }

.vc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

.vc-member-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-radius: 8px;
    padding: 0.85rem 0.9rem;
    transition: box-shadow 0.15s;
}

.vc-member-card:hover { box-shadow: 0 2px 10px var(--shadow-md); }

.vc-member-card.vc-card-ok   { border-left-color: var(--bs-success, #22c55e); }
.vc-member-card.vc-card-warn { border-left-color: var(--bs-warning, #f59e0b); }
.vc-member-card.vc-card-miss { border-left-color: var(--danger, #ef4444); }
.vc-member-card.vc-card-none { border-left-color: var(--text-muted); }

.vc-card-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.vc-member-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Status badges ────────────────────────────────────────────────────────── */
.vc-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.vc-badge-ok   { background: rgba(34,197,94,0.15);  color: var(--bs-success, #22c55e); }
.vc-badge-miss { background: rgba(239,68,68,0.12);  color: var(--danger, #ef4444); }
.vc-badge-warn { background: rgba(245,158,11,0.15); color: var(--bs-warning, #f59e0b); }
.vc-badge-none { background: var(--border-color);   color: var(--text-muted); }

/* ── Daily dots ───────────────────────────────────────────────────────────── */
.vc-days-row,
.vc-dots-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
    margin-bottom: 3px;
}

.vc-day-label {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.vc-dot {
    display: block;
    height: 10px;
    border-radius: 3px;
    margin: 0 auto;
    width: 100%;
    max-width: 28px;
    cursor: default;
    transition: opacity 0.15s;
}

.vc-dot-ok     { background: var(--bs-success, #22c55e); }
.vc-dot-warn   { background: var(--bs-warning, #f59e0b); }
.vc-dot-miss   { background: rgba(239,68,68,0.4); }
.vc-dot-future { background: var(--border-color); opacity: 0.5; }

/* ── Weekly progress bar ──────────────────────────────────────────────────── */
.vc-progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.vc-progress-bar {
    flex: 1;
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.vc-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.vc-bar-fill-ok   { background: var(--bs-success, #22c55e); }
.vc-bar-fill-miss { background: var(--danger, #ef4444); }

.vc-progress-pct {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 30px;
    text-align: right;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .vc-summary-row {
        grid-template-columns: repeat(2, 1fr);
    }

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

/* ========================================
   REDUCED MOTION ACCESSIBILITY
   ======================================== */
@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;
    }
}
