/* ==========================================================================
   RUGBY SERIE A - ATTENDANCE & INJURY MANAGER
   Design System: Athletic Elite (Dark & Light Modes)
   Mobile-First, High Contrast, Touch-Friendly
   ========================================================================== */

/* 1. VARIABILI DI TEMA (DARK MODE DEFAULT) */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --bg-card: #192238;
    --bg-card-hover: #212c47;
    --bg-input: #0f1626;
    --bg-subtle: rgba(255, 255, 255, 0.04);
    
    --border-color: #273553;
    --border-subtle: #1c273d;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Rugby Status Colors */
    --color-present: #10b981;
    --color-present-hover: #059669;
    --color-present-bg: rgba(16, 185, 129, 0.16);
    --color-present-border: rgba(16, 185, 129, 0.45);
    
    --color-absent: #ef4444;
    --color-absent-hover: #dc2626;
    --color-absent-bg: rgba(239, 68, 68, 0.16);
    --color-absent-border: rgba(239, 68, 68, 0.45);
    
    --color-injured: #f59e0b;
    --color-injured-hover: #d97706;
    --color-injured-bg: rgba(245, 158, 11, 0.16);
    --color-injured-border: rgba(245, 158, 11, 0.45);
    
    /* Accents */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.3);
    --accent-gold: #fbbf24;
    
    /* Geometry */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.4);
    --shadow-modal: 0 20px 45px rgba(0, 0, 0, 0.7);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. LIGHT MODE */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f8fafc;
    --bg-subtle: rgba(0, 0, 0, 0.03);
    
    --border-color: #cbd5e1;
    --border-subtle: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --color-present: #059669;
    --color-present-hover: #047857;
    --color-present-bg: rgba(5, 150, 105, 0.12);
    --color-present-border: rgba(5, 150, 105, 0.35);
    
    --color-absent: #dc2626;
    --color-absent-hover: #b91c1c;
    --color-absent-bg: rgba(220, 38, 38, 0.12);
    --color-absent-border: rgba(220, 38, 38, 0.35);
    
    --color-injured: #d97706;
    --color-injured-hover: #b45309;
    --color-injured-bg: rgba(217, 119, 6, 0.14);
    --color-injured-border: rgba(217, 119, 6, 0.35);
    
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-glow: rgba(29, 78, 216, 0.15);
    --accent-gold: #b45309;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 14px -2px rgba(15, 23, 42, 0.08);
    --shadow-modal: 0 20px 40px rgba(15, 23, 42, 0.2);
}

/* RESET E BASE */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Icone SVG Generiche */
.icon-svg {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--radius-full); }

/* ==========================================================================
   TOP NAVIGATION
   ========================================================================== */
.top-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #1d4ed8, #059669);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.35);
}

.brand-text h1 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-text .badge-team {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-gold);
}

.nav-links-desktop {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    transition: var(--transition);
}

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

.nav-btn.active {
    color: var(--primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Theme Switcher Button */
.btn-theme-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.45rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 600;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: var(--transition);
}
.btn-logout:hover {
    color: var(--color-absent);
    border-color: var(--color-absent-border);
}

/* Mobile Bottom Bar Navigation */
.mobile-nav-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.4rem 0.5rem;
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

.mobile-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex: 1;
    min-height: 48px;
    transition: var(--transition);
}
.mobile-nav-btn.active {
    color: var(--primary);
}

/* Environment indicator badge */
.env-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.env-badge.online {
    background: var(--color-present-bg);
    color: var(--color-present);
    border: 1px solid var(--color-present-border);
}
.env-badge.demo {
    background: var(--color-injured-bg);
    color: var(--color-injured);
    border: 1px solid var(--color-injured-border);
}
.env-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ==========================================================================
   CONTAINER & LAYOUT
   ========================================================================= */
.view-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem;
    flex: 1;
}

.view-hidden { display: none !important; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
    white-space: nowrap;
    min-height: 40px;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-success {
    background: var(--color-present);
    color: #ffffff;
}
.btn-success:hover { background: var(--color-present-hover); }

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

.btn-pdf {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.25);
}
.btn-pdf:hover { background: #991b1b; }

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    min-height: 34px;
}

/* ==========================================================================
   CALENDARIO A TUTTO SCHERMO PER GLI ALLENAMENTI
   ========================================================================== */
.calendar-view-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.calendar-header-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.calendar-month-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.calendar-month-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: capitalize;
    min-width: 180px;
}

.btn-nav-cal {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-nav-cal:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.calendar-actions-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.calendar-grid-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.calendar-weekdays-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.calendar-weekday-cell {
    padding: 0.75rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: var(--border-subtle);
    width: 100%;
}

.calendar-day-cell {
    background: var(--bg-card);
    min-height: 110px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    cursor: pointer;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    transition: var(--transition);
}

.calendar-day-cell:hover {
    background: var(--bg-card-hover);
}

.calendar-day-cell.other-month {
    opacity: 0.35;
    background: var(--bg-primary);
}

.calendar-day-cell.today {
    background: var(--bg-subtle);
}
.calendar-day-cell.today .day-number {
    background: var(--primary);
    color: #ffffff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.day-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.day-trainings-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.cal-training-pill {
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.5rem;
    font-size: 0.74rem;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: var(--transition);
    cursor: pointer;
}
.cal-training-pill:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--primary-glow);
}
.cal-training-pill:hover .cal-pill-stats {
    color: rgba(255, 255, 255, 0.9);
}

.cal-pill-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.3rem;
}

.cal-pill-stats {
    font-size: 0.68rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cal-pill-stat-p { color: var(--color-present); font-weight: 700; }
.cal-pill-stat-a { color: var(--color-absent); font-weight: 700; }
.cal-pill-stat-i { color: var(--color-injured); font-weight: 700; }

/* Barra Superiore Scheda Presenze con Pulsante "Torna al Calendario" */
.sheet-back-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1.15rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.85rem;
    box-shadow: var(--shadow-sm);
}

.btn-back-to-calendar {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    min-height: 40px;
}
.btn-back-to-calendar:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ==========================================================================
   KPI STATS CARDS
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}
.stat-card.present::before { background: var(--color-present); }
.stat-card.absent::before { background: var(--color-absent); }
.stat-card.injured::before { background: var(--color-injured); }
.stat-card.streak::before { background: var(--accent-gold); }
.stat-card.primary::before { background: var(--primary); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ==========================================================================
   TOOLBAR E AZIONI RAPIDE PRESENZE
   ========================================================================== */
.session-info-badge {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.quick-action-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1.15rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    box-shadow: var(--shadow-sm);
}

.quick-batch-btns {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.batch-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 38px;
}
.batch-btn:hover { background: var(--bg-card-hover); }

.batch-btn.all-present:hover {
    background: var(--color-present-bg);
    border-color: var(--color-present-border);
    color: var(--color-present);
}
.batch-btn.forwards:hover {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
    color: #60a5fa;
}
.batch-btn.backs:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
}

.filter-search-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.search-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    min-height: 38px;
    width: 200px;
    transition: var(--transition);
}
.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.role-filter-pills {
    display: flex;
    background: var(--bg-input);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.pill-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    min-height: 32px;
}
.pill-btn.active {
    background: var(--primary);
    color: #ffffff;
}

/* Griglia Presenze Giocatori */
.players-attendance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 0.85rem;
}

.player-att-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.player-att-card:hover {
    border-color: var(--text-muted);
}

.player-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.jersey-badge {
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--accent-gold);
    flex-shrink: 0;
}

.player-name-role { min-width: 0; }

.player-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.player-name:hover {
    color: var(--primary);
    text-decoration: underline;
}

.player-role-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* SELETTORE RAPIDO A 3 STATI */
.att-status-selector {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 3px;
    flex-shrink: 0;
}

.att-btn {
    border: none;
    background: transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 800;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    min-width: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.att-btn.btn-p.active {
    background: var(--color-present);
    color: #ffffff;
    box-shadow: 0 0 12px var(--color-present-border);
}

.att-btn.btn-a.active {
    background: var(--color-absent);
    color: #ffffff;
    box-shadow: 0 0 12px var(--color-absent-border);
}

.att-btn.btn-i.active {
    background: var(--color-injured);
    color: #ffffff;
    box-shadow: 0 0 12px var(--color-injured-border);
}

.injury-hint-badge {
    font-size: 0.68rem;
    color: var(--color-injured);
    background: var(--color-injured-bg);
    border: 1px solid var(--color-injured-border);
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
    margin-top: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* ==========================================================================
   VIEW 2: ROSA & PROFILI GIOCATORI
   ========================================================================== */
.roster-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.player-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1rem;
}

.player-profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    cursor: pointer;
}
.player-profile-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.player-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.9rem;
    width: 100%;
}

.player-card-identity {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.player-card-name-wrap {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.player-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.player-card-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    margin-top: 0.15rem;
}

.player-card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    margin-left: auto;
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}
.status-badge.active {
    background: var(--color-present-bg);
    color: var(--color-present);
    border: 1px solid var(--color-present-border);
}
.status-badge.injured {
    background: var(--color-injured-bg);
    color: var(--color-injured);
    border: 1px solid var(--color-injured-border);
}

.player-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    background: var(--bg-input);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.9rem;
    text-align: center;
}

.mini-stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}
.mini-stat-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.player-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   VIEW 3: RESOCONTI & ANALYTICS - HEADER PULITO & MULTI-FILTRI
   ========================================================================== */
.report-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.35rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.report-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 0.2rem;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.report-header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.filter-count-badge {
    background: var(--primary);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    margin-left: 0.25rem;
}

.report-period-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

.period-pills-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.custom-date-inputs-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Pannello Filtri Avanzati Espandibile */
.advanced-filters-panel {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    margin-top: 0.25rem;
    animation: fadeInSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.advanced-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.9rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.advanced-filters-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
    gap: 0.5rem;
}

/* Active Filter Chips */
.active-filter-chips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.4rem;
}

.active-chips-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.filter-chips-list {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.filter-chip-item {
    background: rgba(37, 99, 235, 0.14);
    border: 1px solid rgba(37, 99, 235, 0.35);
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.22rem 0.6rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.filter-chip-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: var(--transition);
}
.filter-chip-remove:hover {
    color: var(--color-absent);
}

.chip-clear-all {
    background: transparent;
    border: none;
    color: var(--color-absent);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 0.35rem;
}
.chip-clear-all:hover {
    color: var(--color-absent-hover);
}

.date-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    min-height: 38px;
}

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
    .charts-row { grid-template-columns: 1fr; }
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* ==========================================================================
   RESPONSIVE TABLES
   ========================================================================== */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card);
}

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

.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    text-align: left;
}

.custom-table th {
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.custom-table tr:hover td {
    background: var(--bg-subtle);
}

.progress-bar-wrap {
    width: 80px;
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.4rem;
}
.progress-bar-fill {
    height: 100%;
    background: var(--color-present);
    border-radius: var(--radius-full);
}

/* ==========================================================================
   MODAL / POPUP DIALOGS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.15rem 1.4rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem 1.4rem;
    flex: 1;
}

.modal-footer {
    padding: 0.9rem 1.4rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    background: var(--bg-input);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
}
.btn-close-modal:hover { color: var(--text-primary); }

.form-group { margin-bottom: 0.9rem; }

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-input, .form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    min-height: 40px;
    transition: var(--transition);
}

.form-select {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 2.4rem 0.65rem 0.95rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 600;
    min-height: 42px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 16px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.form-select:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.form-select option {
    background-color: #1e293b;
    color: #f8fafc;
    font-size: 0.9rem;
    padding: 10px 14px;
    font-weight: 500;
}

.form-select-sm {
    min-height: 38px;
    padding: 0.42rem 2.2rem 0.42rem 0.8rem;
    font-size: 0.82rem;
}

[data-theme="light"] .form-select {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="light"] .form-select:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}

[data-theme="light"] .form-select option {
    background-color: #ffffff;
    color: #0f172a;
}

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

/* Stili Eliminazione Multipla Giocatori */
.roster-actions-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.batch-delete-bar {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--color-absent-border);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.2s ease;
}

.player-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.btn-card-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-card-delete:hover {
    color: var(--color-absent);
    background: var(--color-absent-bg);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
#toast-container {
    position: fixed;
    bottom: 4.5rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.8rem 1.15rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-modal);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    pointer-events: auto;
    animation: slideIn 0.25s ease;
}

.toast.success { border-left: 4px solid var(--color-present); }
.toast.error { border-left: 4px solid var(--color-absent); }
.toast.info { border-left: 4px solid var(--primary); }

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

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: var(--bg-primary);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.25rem 1.75rem;
    box-shadow: var(--shadow-modal);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-brand-logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
    border-radius: var(--radius-md);
    margin-bottom: 0.85rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    background: #ffffff;
    padding: 2px;
}

.brand-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
    background: #ffffff;
    padding: 1px;
    flex-shrink: 0;
}

.login-brand h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-brand p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.excel-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    background: var(--bg-input);
    cursor: pointer;
    transition: var(--transition);
}
.excel-drop-zone:hover, .excel-drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-glow);
}

/* ==========================================================================
   INFERMERIA - CARTE INFORTUNI PRO & FEED ARCHIVIO (ZERO SCORRIMENTO)
   ========================================================================== */
.card-section-header {
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
}

.card-section-title-box {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.card-section-title-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-section-title {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.25;
}

.card-section-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.badge-count {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(239, 68, 68, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.badge-count-subtle {
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.injuries-pro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.15rem;
    width: 100%;
}

.injury-card-pro {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.injury-card-pro::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-injured);
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}

.injury-card-pro:hover {
    border-color: rgba(245, 158, 11, 0.45);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.injury-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.injury-athlete-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.injury-jersey-badge {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--primary);
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.injury-player-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.25;
}

.injury-player-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    flex-wrap: wrap;
}

.injury-role-pill {
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.injury-dept-pill {
    font-size: 0.7rem;
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.injury-severity-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.severity-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.injury-severity-badge.sev-high {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.injury-severity-badge.sev-high .severity-dot {
    background: #ef4444;
}

.injury-severity-badge.sev-medium {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.injury-severity-badge.sev-medium .severity-dot {
    background: #f59e0b;
}

.injury-severity-badge.sev-low {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.injury-severity-badge.sev-low .severity-dot {
    background: #3b82f6;
}

.injury-card-details {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0.75rem;
    background: var(--bg-subtle);
    padding: 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.injury-detail-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.injury-diag-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.45rem;
}

.injury-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.injury-subtag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.injury-subtag.type {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.injury-subtag.part {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.injury-stop-box {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-left: 1px solid var(--border-subtle);
    padding-left: 0.75rem;
}

.injury-stop-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.injury-stop-days {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-injured);
    line-height: 1;
}

.injury-stop-text {
    font-size: 0.7rem;
    line-height: 1.1;
    color: var(--text-secondary);
    font-weight: 600;
}

.injury-dates-grid {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.4rem;
}

.injury-dates-grid .lbl {
    color: var(--text-muted);
}

.injury-notes-preview {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--border-color);
}

.injury-card-footer {
    margin-top: auto;
}

.injury-card-footer .btn-block {
    width: 100%;
    justify-content: center;
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 0.85rem;
}

/* Feed Storico Infortuni Risolti */
.injuries-resolved-feed {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
}

.injury-resolved-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.8rem 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.injury-resolved-card:hover {
    background: var(--bg-subtle);
    border-color: var(--border-color);
}

.res-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.res-check-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.res-info {
    min-width: 0;
}

.res-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.res-status-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
}

.res-diagnosis {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.res-type-pill {
    color: var(--text-muted);
}

.res-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    flex-shrink: 0;
    text-align: right;
}

.res-period {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.res-duration {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
}

/* ==========================================================================
   REPORT - ALLENAMENTI NEL PERIODO (CARD FEED DINAMICO & ZERO SCORRIMENTO)
   ========================================================================== */
.trainings-report-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.training-report-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.95rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 1.15rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}

.training-report-card:hover {
    border-color: var(--primary);
    background: var(--bg-subtle);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.tr-card-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.tr-day-num {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.tr-month {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.tr-card-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.tr-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.tr-card-title-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.tr-card-title {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.tr-card-time {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.76rem;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}

.tr-type-pill {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    text-transform: capitalize;
}

.tr-type-pill.pill-campo {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.tr-type-pill.pill-palestra {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.tr-type-pill.pill-video {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.tr-type-pill.pill-rifinitura {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.tr-card-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.tr-pills-cluster {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.tr-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.55rem;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
}

.tr-stat-pill .pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.tr-stat-pill.present .pill-dot { background: var(--color-present); }
.tr-stat-pill.present .pill-count { color: var(--color-present); font-weight: 800; }

.tr-stat-pill.absent .pill-dot { background: var(--color-absent); }
.tr-stat-pill.absent .pill-count { color: var(--color-absent); font-weight: 800; }

.tr-stat-pill.injured .pill-dot { background: var(--color-injured); }
.tr-stat-pill.injured .pill-count { color: var(--color-injured); font-weight: 800; }

.pill-label {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.tr-rate-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 170px;
}

.tr-rate-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.tr-rate-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.tr-rate-pct {
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.1;
}

.tr-rate-bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    min-width: 60px;
}

.tr-rate-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.tr-card-action {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    transition: var(--transition);
    flex-shrink: 0;
}

.training-report-card:hover .tr-card-action {
    color: var(--primary);
}

.tr-action-arrow {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.training-report-card:hover .tr-action-arrow {
    background: var(--primary);
    color: #fff;
    transform: translateX(3px);
}

.tr-action-arrow svg {
    width: 14px;
    height: 14px;
}

/* Empty State Pro */
.empty-state-pro {
    text-align: center;
    padding: 2.25rem 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.empty-state-pro.success {
    border-style: solid;
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.04);
}

.empty-state-pro.subtle {
    border-style: dashed;
    border-color: var(--border-subtle);
    background: transparent;
    padding: 1.75rem 1rem;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.35rem;
}

.empty-state-pro h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.empty-state-pro p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 420px;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
    }

    .nav-links-desktop { display: none; }
    .mobile-nav-bar { display: flex; }

    .top-nav {
        padding: 0.55rem 0.85rem;
        gap: 0.5rem;
    }

    .brand {
        gap: 0.5rem;
        min-width: 0;
        flex: 1 1 auto;
    }

    .brand-logo-img {
        width: 34px;
        height: 34px;
        flex-shrink: 0;
    }

    .brand-text {
        min-width: 0;
    }

    .brand-text h1 {
        font-size: 0.95rem;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
    }

    .brand-text .badge-team {
        display: none;
    }

    .nav-actions {
        gap: 0.45rem;
        flex-shrink: 0;
    }

    /* Su mobile nascondiamo il testo lungo 'Staff Tecnico' lasciando l'avatar pulito per evitare sovrapposizioni */
    .user-badge {
        padding: 0;
        background: transparent;
        border: none;
    }

    .user-badge #nav-user-name {
        display: none;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.78rem;
    }

    .view-container {
        padding: 0.85rem;
    }

    /* Adattamento Calendario su Mobile */
    .calendar-header-toolbar {
        padding: 0.75rem 0.85rem;
    }
    .calendar-month-title {
        font-size: 1.05rem;
        min-width: auto;
    }
    .calendar-actions-right {
        width: 100%;
        justify-content: space-between;
    }
    .calendar-actions-right .btn {
        flex: 1;
    }

    .calendar-weekdays-row, .calendar-days-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
        width: 100% !important;
    }
    .calendar-weekday-cell {
        padding: 0.45rem 0.1rem;
        font-size: 0.65rem;
    }
    .calendar-day-cell {
        min-height: 70px;
        padding: 0.25rem;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .calendar-day-cell.today .day-number {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    .day-number {
        font-size: 0.72rem;
    }
    .cal-training-pill {
        padding: 0.2rem 0.25rem;
        font-size: 0.62rem;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    .cal-pill-title {
        font-size: 0.62rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .cal-pill-title span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .cal-pill-stats {
        display: none; /* Nasconde dettagli su mobile compatto */
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
    }

    .stat-card {
        padding: 0.85rem;
    }
    .stat-value {
        font-size: 1.45rem;
    }

    .session-toolbar, .quick-action-bar, .sheet-back-bar {
        padding: 0.85rem;
    }

    .report-header-card {
        padding: 0.95rem;
    }
    .report-title-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .report-header-actions {
        display: flex;
        width: 100%;
        justify-content: stretch;
    }
    .report-header-actions .btn {
        flex: 1;
        justify-content: center;
    }
    .report-period-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }
    .period-pills-group {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.35rem;
    }
    .period-pills-group .pill-btn {
        text-align: center;
        padding: 0.45rem 0.5rem;
        font-size: 0.78rem;
    }
    .custom-date-inputs-wrapper {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }
    .custom-date-inputs-wrapper .date-input {
        width: 100%;
    }
    .advanced-filters-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .advanced-filters-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    .advanced-filters-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .table-responsive-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    /* Adattamenti Mobile Fluidi per le nuove card (Zero scorrimento orizzontale) */
    .injuries-pro-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .injury-card-details {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .injury-stop-box {
        border-left: none;
        border-top: 1px solid var(--border-subtle);
        padding-left: 0;
        padding-top: 0.75rem;
    }

    .injury-resolved-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }

    .res-right {
        align-items: flex-start;
        text-align: left;
        width: 100%;
        border-top: 1px solid var(--border-subtle);
        padding-top: 0.45rem;
    }

    .training-report-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        padding: 0.95rem;
    }

    .training-report-card .tr-card-date-badge {
        flex-direction: row;
        gap: 0.45rem;
        width: auto;
        height: auto;
        padding: 0.35rem 0.65rem;
        align-self: flex-start;
    }

    .tr-card-stats-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .tr-rate-group {
        width: 100%;
    }

    .tr-card-action {
        border-top: 1px solid var(--border-subtle);
        padding-top: 0.55rem;
        justify-content: space-between;
    }

    .players-attendance-grid {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .modal-overlay {
        padding: 0.5rem;
        align-items: center;
        justify-content: center;
    }
    .modal-box {
        width: 100%;
        max-width: 100%;
        max-height: 88vh;
        border-radius: var(--radius-lg);
        padding: 1rem;
    }

    .modal-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .modal-footer .btn {
        flex: 1 1 45%;
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    .roster-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .roster-actions-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .roster-actions-bar .search-input {
        width: 100%;
        min-width: 100%;
    }

    .roster-actions-bar .form-select {
        flex: 1 1 48%;
    }

    .roster-actions-bar .btn {
        flex: 1 1 48%;
        justify-content: center;
    }

    .player-card-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .player-profile-card {
        padding: 0.95rem;
    }

    .player-att-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .att-status-selector {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 0.4rem;
    }

    .att-status-selector .att-btn {
        flex: 1;
        height: 42px;
        font-size: 1rem;
        font-weight: 800;
        border-radius: var(--radius-md);
    }

    .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    #toast-container {
        bottom: 5.5rem;
        left: 0.75rem;
        right: 0.75rem;
    }
}

/* ==========================================================================
   SISTEMA FESTEGGIAMENTO COMPLEANNI & DATA DI NASCITA
   ========================================================================== */
.birthday-alert-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.25) 100%);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: var(--radius-lg);
    padding: 0.95rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
    animation: bdayGlow 3s ease-in-out infinite alternate;
}

@keyframes bdayGlow {
    0% { box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.4); }
    100% { box-shadow: 0 6px 24px rgba(245, 158, 11, 0.35); border-color: rgba(245, 158, 11, 0.7); }
}

.birthday-banner-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bday-icon {
    font-size: 2.2rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    flex-shrink: 0;
}

.bday-banner-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bday-banner-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #f59e0b;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.bday-banner-names {
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.45;
}

.player-birthday-ribbon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    text-align: center;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.player-profile-card.has-birthday-today {
    border-color: #f59e0b !important;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.06) 0%, var(--bg-card) 45%);
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.22) !important;
}

.player-card-bdate {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    background: var(--bg-input);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    width: fit-content;
    border: 1px solid var(--border-subtle);
}

.att-bday-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    margin-left: 0.4rem;
    vertical-align: middle;
}

