/* Dashboard Specific Styles */

/* Top navbar: quick actions (no duplicate of sidebar) */
.nav-quick-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-quick-actions .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    transition: color 0.2s ease, background 0.2s ease;
}
.nav-quick-actions .nav-link:hover {
    color: var(--primary-color);
}
.nav-quick-actions .nav-cta {
    background: var(--primary-color);
    color: white !important;
    padding: 0.5rem 1rem;
}
.nav-quick-actions .nav-cta:hover {
    background: var(--primary-hover);
    color: white !important;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: calc(100vh - 4rem);
    background: var(--bg-secondary);
}

.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 4rem;
    height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 2.5rem;
    max-width: calc(100vw - 260px);
    width: 100%;
}

/* Sidebar Navigation */
.sidebar-menu {
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Menu raggruppato (coach JS + client HTML) — docs/analisi/DASHBOARD_MENU_UX_REORGANIZATION.md */
.menu-group {
    border: none;
    margin: 0 0 0.25rem 0;
    padding: 0;
}
.menu-group__title {
    list-style: none;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted, #64748b);
    padding: 0.5rem 1rem 0.35rem;
    user-select: none;
}
.menu-group__title::-webkit-details-marker {
    display: none;
}
.menu-group__title::before {
    content: '▸';
    display: inline-block;
    margin-right: 0.35rem;
    transition: transform 0.15s ease;
    font-size: 0.65rem;
    opacity: 0.85;
}
.menu-group[open] > .menu-group__title::before {
    transform: rotate(90deg);
}
.menu-group__items {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: 0.35rem;
}
.menu-group__items .menu-item {
    padding-left: 1rem;
}

/* Client: menu essenziale — nasconde voci secondarie finché l’utente non passa al menu completo */
#dashboardSidebarMenu a.menu-item.client-menu-hidden {
    display: none !important;
}
#dashboardSidebarMenu details.menu-group.client-menu-group--empty {
    display: none !important;
}
.client-menu-mode-sidebar-bar {
    margin-top: 0.75rem;
    padding: 0.5rem 0.5rem 0;
    border-top: 1px solid var(--border-color, #e2e8f0);
}
.client-menu-mode-sidebar-bar__btn {
    width: 100%;
}
.client-menu-mode-sidebar-bar__hint {
    font-size: 0.72rem;
    margin: 0.35rem 0 0;
    line-height: 1.35;
}

/* Dashboard cliente: 4 azioni principali */
.client-dashboard-starter {
    margin: 0 0 1.75rem;
    padding: 1rem 0 1.25rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.client-dashboard-starter__title {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
    font-weight: 700;
}
.client-dashboard-starter__subtitle {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
}
.client-dashboard-starter__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (min-width: 768px) {
    .client-dashboard-starter__grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
}
.client-dashboard-starter__tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 1rem 1rem 1.1rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 10px);
    background: var(--bg-primary, #fff);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: 5.5rem;
    font: inherit;
    color: inherit;
}
.client-dashboard-starter__tile:hover {
    border-color: var(--primary-color, #16a34a);
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.12);
}
.client-dashboard-starter__icon {
    font-size: 1.75rem;
    line-height: 1;
    margin-bottom: 0.35rem;
}
.client-dashboard-starter__label {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.25;
}
.client-dashboard-starter__hint {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    margin-top: 0.35rem;
    line-height: 1.3;
}
.client-dashboard-starter__tile {
    position: relative;
}
.client-dashboard-starter__badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.35rem;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Card primi passi (onboarding cliente) */
.client-onboarding-card {
    margin-bottom: 1.25rem;
}
.client-onboarding-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.client-onboarding-card__title {
    margin: 0;
    font-size: 1.05rem;
}
.client-onboarding-list {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    list-style: decimal;
}
.client-onboarding-step {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 0.75rem;
    align-items: start;
    margin-bottom: 0.85rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.client-onboarding-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.client-onboarding-step__text {
    grid-column: 1 / -1;
    font-size: 0.9rem;
    line-height: 1.45;
}
@media (min-width: 640px) {
    .client-onboarding-step {
        grid-template-columns: 1fr auto auto;
    }
    .client-onboarding-step__text {
        grid-column: 1;
    }
}
.client-onboarding-step__status {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
}
.client-onboarding-step--done .client-onboarding-step__status {
    color: var(--primary-color, #16a34a);
}
.client-onboarding-step .btn-sm {
    grid-column: 1 / -1;
    justify-self: start;
}
@media (min-width: 640px) {
    .client-onboarding-step .btn-sm {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
    }
}

/* Guida in top bar (solo mobile; .mobile-only da style.css) */
.navbar .container .client-nav-guida-btn {
    display: none;
}
@media (max-width: 768px) {
    .navbar .container .client-nav-guida-btn.mobile-only {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--primary-color, #16a34a);
        background: rgba(22, 163, 74, 0.1);
        border: 1px solid rgba(22, 163, 74, 0.35);
        border-radius: var(--radius-md, 10px);
        cursor: pointer;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }
    .navbar .container .client-nav-guida-btn.mobile-only:hover,
    .navbar .container .client-nav-guida-btn.mobile-only:focus {
        background: rgba(22, 163, 74, 0.18);
        outline: none;
    }
}

/* Riepilogo settimanale iscrizioni (dashboard cliente) */
.client-week-agenda-card {
    margin-bottom: 1.5rem;
}
.client-week-agenda-card__header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}
.client-week-agenda-card__title {
    margin: 0;
    font-size: 1.05rem;
}

/* ── Info popover (i) ── */
.info-popover-wrap {
    position: relative;
    display: inline-flex;
}
.info-popover-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted, #94a3b8);
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
.info-popover-btn:hover,
.info-popover-wrap.open .info-popover-btn {
    color: var(--accent, #3b82f6);
}
.info-popover-bubble {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: max(220px, min(300px, 80vw));
    padding: 0.65rem 0.75rem;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary, #64748b);
    z-index: 100;
}
.info-popover-wrap.open .info-popover-bubble {
    display: block;
}
.info-popover-close {
    display: inline-block;
    margin-top: 0.35rem;
    background: none;
    border: none;
    font-size: 0.78rem;
    color: var(--accent, #3b82f6);
    cursor: pointer;
    padding: 0;
}
.client-week-agenda-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.client-week-agenda-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.client-week-agenda-item:last-child {
    border-bottom: none;
}
.client-week-agenda-item__meta {
    flex: 1;
    min-width: 0;
}
.client-week-agenda-item__when {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    margin-top: 0.2rem;
}
.client-week-agenda-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
}

/* Menu essenziale: meno rumore sotto le 4 azioni */
#dashboard.client-dashboard--essenziale #clientDashboardMobileQuickWrap,
#dashboard.client-dashboard--essenziale #clientDashboardDesktopQuickWrap {
    display: none !important;
}
#dashboard.client-dashboard--essenziale .stats-grid {
    display: none !important;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.menu-item:hover {
    background: var(--bg-accent);
    color: var(--primary-color);
    transform: translateX(4px);
}

.menu-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.menu-item.active .icon {
    color: white;
}

/* Restricted menu items for coaches without active plan */
.menu-item.restricted {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.menu-item.restricted::after {
    content: "PRO";
    position: absolute;
    right: 0.75rem;
    font-size: 0.65rem;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.menu-item.restricted:hover {
    background: transparent;
    color: var(--text-secondary);
    transform: none;
}

/* Pulsante Chiudi e footer mobile: visibili solo su schermi piccoli */
.sidebar .sidebar-close-btn,
.sidebar .mobile-sidebar-footer {
    display: none;
}

.menu-item .icon {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

/* Icona racchetta + pallina pickleball per "Gioca" */
.icon-paddle-ball,
.action-icon.icon-paddle-ball {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}
.info-card h3 .icon-paddle-ball { width: 1.25em; height: 1.25em; vertical-align: -0.2em; }

/* Content Sections */
.content-section {
    display: none;
}

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

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* Upgrade banner (plan segregation) */
.upgrade-banner {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}
.upgrade-banner p {
    margin: 0 0 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}
.upgrade-banner .btn-primary { margin: 0; }
.coach-canone-banner { background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%); border-color: #d97706; }

@keyframes highlightBanner {
    0% { transform: scale(1); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
    50% { transform: scale(1.02); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); border-color: #d97706; }
    100% { transform: scale(1); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
}
.highlight-banner {
    animation: highlightBanner 1s ease-in-out infinite;
}

/* Leaderboard (Partite) */
.leaderboard-container { overflow-x: auto; }
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th, .leaderboard-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border-light, #eee); }
.leaderboard-table th { font-weight: 600; color: var(--text-secondary); }
.leaderboard-table tbody tr:hover { background: var(--bg-light, #f9fafb); }

/* Filtri regione/città: griglia ordinata (desktop e mobile) */
.leaderboard-geo-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1.25rem;
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--bg-secondary, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    width: 100%;
    box-sizing: border-box;
}
.leaderboard-geo-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    margin-bottom: 0.4rem;
}
.leaderboard-geo-field input.form-control-sm {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color, #e2e8f0);
}

/* Fatturazione: tabella desktop vs schede mobile (stile simile ai pagamenti) */
.billing-desktop-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.billing-mobile-cards {
    display: none;
    flex-direction: column;
    gap: 1rem;
}
.billing-client-card {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
}
.billing-client-card-title {
    margin: 0 0 0.65rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    line-height: 1.3;
}
.billing-card-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-light, #f1f5f9);
    font-size: 0.9375rem;
}
.billing-card-row:last-of-type {
    border-bottom: none;
}
.billing-card-row--total {
    margin-top: 0.25rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    border-bottom: none;
    font-weight: 700;
}
.billing-card-label {
    color: var(--text-muted, #64748b);
    flex-shrink: 0;
}
.billing-card-value {
    text-align: right;
    word-break: break-word;
    color: var(--text-primary, #0f172a);
}
.billing-client-card-actions {
    margin-top: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (min-width: 769px) {
    .billing-mobile-cards { display: none !important; }
}
@media (max-width: 768px) {
    .billing-desktop-table-wrap { display: none !important; }
    .billing-mobile-cards { display: flex !important; }
}

/* Tabelle “solo desktop” su mobile: scroll orizzontale, font leggibile (es. commissioni admin) */
.billing-table-scroll-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.75rem 0;
}
@media (max-width: 768px) {
    .billing-table-scroll-mobile .data-table {
        min-width: 480px;
        margin: 0;
    }
    .billing-table-scroll-mobile .data-table th,
    .billing-table-scroll-mobile .data-table td {
        font-size: 0.9375rem !important;
        padding: 0.65rem 0.75rem !important;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

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

.stat-icon {
    font-size: 2.25rem;
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    background: rgba(22, 163, 74, 0.1);
    color: var(--sport-color);
    transform: rotate(-5deg) scale(1.1);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sport-color);
    line-height: 1;
}

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

/* Global Data Table */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
}

.data-table th,
.data-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table th:first-child { border-top-left-radius: var(--radius-md); }
.data-table th:last-child { border-top-right-radius: var(--radius-md); }

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-accent);
}

.data-table td {
    color: var(--text-primary);
    font-size: 0.9375rem;
}

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

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-sm);
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.dashboard-card h3 {
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.contextual-tip-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 100%);
    border-color: var(--primary-color);
}
.contextual-tip-card--prominent {
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
    margin-bottom: 1.25rem;
}
.contextual-tip-card__title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}
.contextual-tip-content {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.deadlines-list,
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.deadline-item,
.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.deadline-date {
    color: var(--warning-color);
    font-weight: 500;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Quick Actions */
.quick-actions {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-light);
}

.quick-actions h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

/* Upload Container */
.upload-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-light);
}

.upload-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.upload-type-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.upload-type-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.upload-type-card.featured {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.upload-type-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.type-badge {
    position: absolute;
    top: -0.5rem;
    right: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
}

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

.type-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.upload-type-card .features {
    list-style: none;
    margin-bottom: 1.5rem;
}

.upload-type-card .features li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.upload-type-card .features li:last-child {
    border-bottom: none;
}

.select-type {
    width: 100%;
}

/* Upload Form */
.upload-form-container {
    border-top: 1px solid var(--border-light);
    padding-top: 2rem;
    margin-top: 2rem;
}

.selected-type {
    background: var(--bg-accent);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.change-type {
    background: none;
    border: none;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    margin-left: auto;
}

.file-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-accent);
}

.file-upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.upload-placeholder {
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.file-name {
    font-weight: 500;
    flex: 1;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.remove-file {
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Filter Tabs */
/* ──────────────────────────────────────────────────────────────────
   TAB NAVIGATION — Segmented control style
   Usato da .filter-tab/.filter-tabs (partite, tornei, sessioni…)
   e .page-inner-tab/.page-inner-tabs (obiettivi, profilo, impostazioni…)
   ────────────────────────────────────────────────────────────────── */
.filter-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-secondary, #f1f5f9);
    border-radius: 10px;
    padding: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
    flex-shrink: 0;
    padding: 0.55rem 1rem;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.filter-tab:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(255,255,255,0.6);
}

.filter-tab.active {
    background: #fff;
    color: var(--primary-color, #2563eb);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
}

/* Analysis Container */
.analysis-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.analysis-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

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

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

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

.analysis-status {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-delivered { background: #e0e7ff; color: #3730a3; }

.analysis-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.analysis-actions {
    display: flex;
    gap: 0.5rem;
}

/* Subscription Container */
.subscription-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-light);
}

.subscription-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.plan-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.plan-status {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

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

.usage-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.usage-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.usage-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.usage-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ── AI Chat (shared by client #ai-coach and coach #ai-assistant) ── */
.ai-chat-wrap {
    display: flex;
    flex-direction: column;
    max-width: 740px;
    margin: 0 auto;
    height: calc(100vh - 180px);
    max-height: 800px;
    background: var(--bg-white, #fff);
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border-light, #e5e7eb);
    overflow: hidden;
}
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
}
.ai-chat-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.ai-chat-header .ai-quota { font-size: 0.78rem; color: var(--text-muted, #94a3b8); }

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: linear-gradient(180deg, var(--bg-secondary, #f9fafb) 0%, var(--bg-white, #fff) 100%);
}
@keyframes ai-msg-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-chat-messages .ai-msg {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    animation: ai-msg-in 0.25s ease-out;
}
.ai-msg.is-user { flex-direction: row-reverse; }
.ai-msg-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
    background: var(--bg-secondary, #f1f5f9);
    border: 1px solid var(--border-light, #e5e7eb);
}
.ai-msg.is-user .ai-msg-avatar {
    background: var(--primary-color, #16a34a);
    border-color: var(--primary-color, #16a34a);
    color: #fff;
}
.ai-msg-bubble {
    max-width: 78%;
    padding: 0.65rem 0.9rem;
    font-size: 0.92rem;
    line-height: 1.55;
    word-break: break-word;
}
.ai-msg:not(.is-user) .ai-msg-bubble {
    background: var(--bg-secondary, #f1f5f9);
    color: var(--text-primary, #1e293b);
    border-radius: 2px 14px 14px 14px;
}
.ai-msg.is-user .ai-msg-bubble {
    background: #1e40af;
    color: #fff;
    border-radius: 14px 2px 14px 14px;
}
.ai-msg.is-user .ai-msg-bubble a { color: #fff; text-decoration: underline; }
.ai-msg-time {
    display: block;
    font-size: 0.68rem;
    margin-top: 0.2rem;
    opacity: 0.6;
}
.ai-msg-speak-btn {
    background: none; border: none; cursor: pointer;
    font-size: 0.85rem; opacity: 0.5; padding: 0 0.15rem;
    transition: opacity 0.15s;
}
.ai-msg-speak-btn:hover { opacity: 1; }

/* Typing indicator */
.ai-typing { display: flex; gap: 0.6rem; align-items: flex-end; }
.ai-typing-dots { display: flex; gap: 4px; padding: 0.65rem 0.9rem; background: var(--bg-secondary, #f1f5f9); border-radius: 2px 14px 14px 14px; }
.ai-typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted, #94a3b8); animation: ai-dot-pulse 1.2s ease-in-out infinite; }
.ai-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-dot-pulse { 0%,80%,100% { opacity: 0.3; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1.1); } }

/* Action confirm card */
.ai-action-card {
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-left: 3px solid var(--primary-color, #16a34a);
    border-radius: var(--radius-md, 8px);
    padding: 0.75rem 1rem;
    max-width: 78%;
    animation: ai-msg-in 0.25s ease-out;
}
.ai-action-card__summary { font-size: 0.9rem; margin: 0 0 0.5rem; color: var(--text-primary, #1e293b); }
.ai-action-card__actions { display: flex; gap: 0.5rem; }
.ai-action-card__actions .btn-sm { font-size: 0.82rem; padding: 0.35rem 0.75rem; }

/* Quick action chips */
.ai-chips-bar {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-white, #fff);
}
.ai-chips-bar::-webkit-scrollbar { display: none; }
.ai-chip {
    flex: 0 0 auto;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    border-radius: 20px;
    border: 1px solid var(--border-color, #d1d5db);
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.ai-chip:hover { background: var(--primary-color, #16a34a); color: #fff; border-color: var(--primary-color, #16a34a); }
.ai-chip.ai-chip--action { border-color: var(--primary-color, #16a34a); color: var(--primary-color, #16a34a); font-weight: 500; }
.ai-chip.ai-chip--action:hover { background: var(--primary-color, #16a34a); color: #fff; }

/* Chat input bar */
.ai-chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-white, #fff);
}
.ai-chat-input-bar textarea {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 20px;
    padding: 0.55rem 0.9rem;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.45;
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-primary, #1e293b);
    transition: border-color 0.15s;
}
.ai-chat-input-bar textarea:focus { outline: none; border-color: var(--primary-color, #16a34a); }
.ai-chat-input-bar textarea::placeholder { color: var(--text-muted, #94a3b8); }
.ai-mic-btn, .ai-send-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}
.ai-send-btn { background: var(--primary-color, #16a34a); color: #fff; }
.ai-send-btn:hover { transform: scale(1.05); }
.ai-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.ai-mic-btn { background: var(--bg-secondary, #f1f5f9); color: var(--text-secondary, #64748b); }
.ai-mic-btn:hover { background: var(--border-color, #d1d5db); }
.ai-mic-btn.recording { background: #ef4444; color: #fff; animation: ai-mic-pulse 1s ease-in-out infinite; }
@keyframes ai-mic-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } }

/* Coach KB drawer toggle */
.ai-kb-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; color: var(--text-muted, #94a3b8);
    padding: 0.25rem; transition: color 0.15s;
}
.ai-kb-toggle:hover { color: var(--text-primary, #1e293b); }
.ai-kb-drawer {
    display: none;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
    max-height: 300px;
    overflow-y: auto;
}
.ai-kb-drawer.open { display: block; }

@media (max-width: 768px) {
    .ai-chat-wrap { height: calc(100vh - 140px); max-height: none; border-radius: 0; border: none; }
    .ai-msg-bubble { max-width: 88%; }
}

/* Modal Enhancements */
.modal-content.large {
    max-width: 800px;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Textarea: altezza minima usabile su mobile (descrizioni, note, feedback) */
textarea {
    min-height: 4.5rem;
}
@media (max-width: 768px) {
    textarea {
        min-height: 120px;
        font-size: 16px; /* riduce zoom automatico su iOS */
    }
}

/* Modali full-width su mobile (touch-friendly) */
@media (max-width: 640px) {
    .modal-content--mobile {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh;
        overflow-y: auto;
    }
    .modal.show .modal-content--mobile {
        align-self: flex-start;
        margin-top: 0;
    }
    .form-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-top: 1rem;
    }
    .form-actions .btn-primary,
    .form-actions .btn-secondary {
        min-height: 44px;
        flex: 1 1 auto;
    }
}

/* Visibilità lezione di gruppo (Aperta a tutti / Solo i miei allievi) */
.form-group-visibility {
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg-secondary, #f8fafc);
    border-radius: var(--radius-md, 6px);
    border: 1px solid var(--border-light, #e2e8f0);
}
.form-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.5rem 0 0;
}
/*
 * Reset radio/checkbox: style.css impone .form-group input { width:100%; padding:0.75rem 1rem; border:2px... }
 * che deforma radio e checkbox. Il toggle hidden ha override specifico (.toggle-switch-label input).
 */
.form-group input[type="radio"],
.form-group input[type="radio"]:hover,
.form-group input[type="radio"]:focus {
    width: 1.1rem !important;
    height: 1.1rem !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: none !important;
    box-shadow: none !important;
    flex-shrink: 0;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: auto;
}
.form-group input[type="checkbox"],
.form-group input[type="checkbox"]:hover,
.form-group input[type="checkbox"]:focus {
    width: 1.25rem !important;
    height: 1.25rem !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 3px !important;
    background: none !important;
    box-shadow: none !important;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary-color, #3b82f6);
    appearance: auto;
    -webkit-appearance: auto;
}
/* Il checkbox dentro il toggle switch deve restare nascosto (override del reset sopra) */
.toggle-switch-label input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    appearance: none !important;
}

.notification-options { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin-top: 0.5rem; }
.notification-options .radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color, #334155);
    background: var(--bg-secondary, #1e293b);
    transition: border-color 0.15s, background 0.15s;
}
.notification-options .radio-label:hover { border-color: var(--primary-color, #3b82f6); }
.notification-options .radio-label:has(input:checked) {
    border-color: var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
}
.notification-options .radio-label input[type="radio"] {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    padding: 0;
    cursor: pointer;
    accent-color: var(--primary-color, #3b82f6);
}
@media (max-width: 768px) {
    .profile-container {
        padding: 1rem;
    }
    .form-section .text-muted {
        text-align: left;
        word-break: break-word;
        margin-right: 0;
    }
    .notification-options {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }
    .notification-options .radio-label {
        width: 100%;
        padding: 0.55rem 0.75rem;
        box-sizing: border-box;
    }
}
.form-radio-group .radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}
.form-radio-group .radio-label input[type="radio"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}
.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    line-height: 1.35;
}

/* Loading States */
.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mobile: textareas a piena larghezza e con altezza minima adeguata */
@media (max-width: 768px) {
    textarea {
        width: 100% !important;
        min-height: 120px;
        box-sizing: border-box;
    }
    .form-group {
        width: 100% !important;
    }
}

/* Mobile: textareas a piena larghezza e con altezza minima adeguata */
@media (max-width: 768px) {
    textarea {
        width: 100% !important;
        min-height: 120px;
        box-sizing: border-box;
    }
    .form-group {
        width: 100% !important;
    }
    .payments-summary-cards {
        grid-template-columns: 1fr;
    }

    .payment-card {
        padding: 1rem;
    }

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

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }
    
    .main-content {
        max-width: 100%;
    }
    
    .ai-coach-container {
        grid-template-columns: 1fr;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding-bottom: 6.5rem !important; /* Spazio per la bottom nav */
    }
    
    .sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1001;
        background: var(--bg-primary, #fff);
        overflow-y: auto;
        box-shadow: none;
    }
    
    .sidebar.mobile-open {
        display: block !important;
    }
    
    .sidebar .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border-light);
        background: var(--bg-secondary, #f8f9fa);
        position: sticky;
        top: 0;
        z-index: 1;
    }
    
    .sidebar .sidebar-close-btn .menu-close-label {
        font-weight: 600;
        color: var(--text-primary);
    }
    
    .sidebar .sidebar-close-btn .menu-close-x {
        width: 2.5rem;
        height: 2.5rem;
        border: none;
        background: transparent;
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        color: var(--text-secondary);
        padding: 0;
        border-radius: var(--radius-md);
    }
    
    .sidebar .sidebar-close-btn .menu-close-x:hover {
        background: var(--border-light);
        color: var(--text-primary);
    }
    
    .sidebar .mobile-sidebar-footer {
        display: block;
        padding: 1rem 1.5rem;
        border-top: 1px solid var(--border-light);
        margin-top: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .stat-icon {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.75rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .data-table th, 
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }

    /* Miglioramento Chat Mobile */
    .chat-one-to-one-container {
        flex-direction: column;
        height: 600px;
        min-height: auto;
    }

    .chat-conversations-list {
        width: 100%;
        min-width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .chat-thread {
        height: 400px;
        min-height: auto;
    }

    .chat-msg {
        max-width: 90%;
    }

    .chat-send-form {
        padding: 0.75rem;
    }

    .chat-send-form input {
        padding: 0.75rem; /* Più grande per touch */
    }

    /* AI Coach Chat Mobile */
    .ai-coach-container {
        padding: 1rem;
    }

    .chat-container {
        height: 450px;
    }

    .message-content {
        max-width: 85%;
        flex: none; /* Evita che occupi tutto lo spazio se il testo è corto */
    }

    .user-message .message-content {
        background: #1e40af;
        color: #fff;
        border-radius: var(--radius-md) 0 var(--radius-md) var(--radius-md);
    }

    .ai-message .message-content {
        border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
    }

    /* AI Assistant Chat Mobile */
    .chat-panel {
        height: 500px;
    }

    .ai-assistant-container .chat-panel {
        height: 550px;
    }
    
    .upload-types {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .upload-actions {
        flex-direction: column;
    }
    
    .analysis-container {
        grid-template-columns: 1fr;
    }
    
    .usage-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Coach-specific styles */
.analysis-completion-form {
    max-width: 600px;
}

.analysis-completion-form h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.analysis-completion-form .form-group {
    margin-bottom: 1.5rem;
}

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

.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.client-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all 0.3s ease;
    min-width: 0;
    overflow: hidden;
}

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

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

.client-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.client-analyses {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
}

.client-meta {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.client-level {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}
.client-level-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.client-level-row:last-of-type {
    margin-bottom: 0;
}
.client-level-row label {
    min-width: 4.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.client-level-row select {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}
.client-level-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}
.client-level-effective {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.client-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.btn-client-action {
    flex: 1;
    min-width: 100px;
}

.client-history {
    max-width: 600px;
}

.client-stats {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.client-stats p {
    margin: 0.25rem 0;
}

.client-analyses {
    max-height: 300px;
    overflow-y: auto;
}

.analysis-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

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

.sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.sessions-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* Tabelle fatturazione/pagamenti: la griglia card crea colonne strette e allinea a destra su desktop */
.sessions-container.sessions-container--stack {
    display: block;
    width: 100%;
    max-width: 100%;
}
.sessions-container.sessions-container--stack .data-table {
    width: 100%;
}
.sessions-container.sessions-container--stack .billing-summary {
    max-width: 100%;
}

.session-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

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

/* Partite (matches) */
.matches-profile-box {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
}
.matches-profile-content p { margin: 0.35rem 0; }
.matches-tabs { margin-bottom: 1rem; }
.matches-tabs.filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
}
.matches-panel { margin-top: 0.5rem; }
.matches-list { display: flex; flex-direction: column; gap: 1rem; }
/* Match Card improvements */
.match-card {
    border-left: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.match-card.match-full {
    border-left-color: var(--text-muted);
    opacity: 0.85;
}

.match-card .match-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.match-card .badge-open { background: #dcfce7; color: #166534; }
.match-card .badge-full { background: #fee2e2; color: #991b1b; }
.match-card .badge-completed { background: #f1f5f9; color: #475569; }

.match-card .match-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.match-card .match-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.match-card .match-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.match-card .match-info-item i {
    width: 16px;
    color: var(--primary-color);
    opacity: 0.8;
}

.match-card .match-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.match-card .match-participants {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.match-card .participant-dots {
    display: flex;
    gap: 4px;
}

.match-card .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
}

.match-card .dot.filled {
    background: var(--primary-color);
}

.match-card .match-actions {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    max-width: 100%;
}

/* Locandina fine partita */
.match-celebration-modal-content { max-width: 420px; }
.match-celebration-poster {
    background: linear-gradient(135deg, #166534 0%, #22c55e 45%, #facc15 100%);
    color: #fff;
    border-radius: var(--radius-lg, 12px);
    padding: 1.5rem 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.12));
}
.match-celebration-logo {
    display: block;
    margin: 0 auto 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}
.match-celebration-brand {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.95;
    margin-bottom: 0.75rem;
}
.match-celebration-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.match-celebration-score {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 0.5rem 0;
    letter-spacing: 0.02em;
}
.match-celebration-tagline {
    font-size: 0.95rem;
    margin: 0.75rem 0 0;
    font-style: italic;
    opacity: 0.95;
}
.match-celebration-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.share-reward-fallback-block {
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
}
.share-reward-honor-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}
.share-reward-honor-label input { margin-top: 0.2rem; flex-shrink: 0; }

@media (max-width: 480px) {
    .match-card .match-info-grid {
        grid-template-columns: 1fr;
    }
}
.score-team-assignments .form-row { margin-bottom: 0.5rem; }
.score-team-assignments select { margin-left: 0.5rem; }
.checkbox-group label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

/* Tornei: tabellone */
.tournament-bracket { display: flex; flex-direction: column; gap: 0.75rem; }
.tournament-match-row { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 0.75rem 1rem; }
.tournament-match-row .match-round { font-weight: 600; color: var(--text-secondary); }
.tournament-match-row .match-players { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tournament-match-row .match-score { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 768px) {
    .tournament-match-row { grid-template-columns: 1fr; }
}
.mixer-turn-group { border: 1px solid var(--border-color, #e2e8f0); border-radius: 6px; padding: 0.5rem 0.5rem 0.25rem; background: var(--bg-primary, #fff); }
.mixer-turn-group .mixer-turn-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary, #475569); background: var(--bg-secondary, #f4f4f5); border-radius: 4px; padding: 0.2rem 0.5rem; margin-bottom: 0.4rem; display: inline-block; }
.mixer-turn-group .tournament-match-row { border: none; box-shadow: none; margin-bottom: 0.35rem; }

/* Cerca partite: design più moderno e compatto */
.search-filters {
    padding: 1.25rem;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
}

.search-filters h4 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.search-filters .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-filters .form-group {
    flex: 1;
    min-width: 200px;
}

.search-filters .btn-primary {
    width: 100%;
    margin-top: 0.5rem;
}

/* Cerca partite: su mobile filtri in colonna e checkbox "mio livello" ben visibile e allineato */
@media (max-width: 768px) {
    .search-filters .form-row {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    .search-filters .form-group {
        width: 100%;
        min-width: 0;
    }
    .search-filters .form-group.checkbox-group {
        margin-bottom: 0.25rem;
    }
    .search-filters .form-group.checkbox-group label {
        width: auto;
        justify-content: flex-start;
        text-align: left;
        min-height: auto;
        padding: 0.5rem 0;
    }
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.session-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.session-type {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--bg-accent);
    color: var(--text-secondary);
}

/* Tournament create modal: AI section */
.tournament-ai-panel {
    margin-bottom: 1.25rem;
    padding: 1rem 1rem 0.9rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.tournament-ai-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.tournament-ai-panel__header h4 {
    margin: 0.15rem 0 0;
}

.tournament-ai-panel__eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary-color);
}

.tournament-ai-panel__badge {
    flex-shrink: 0;
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.tournament-ai-panel__intro {
    margin: 0 0 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tournament-ai-panel__fields {
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tournament-ai-panel__notes {
    flex: 1;
}

.tournament-ai-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tournament-ai-proposal-box {
    margin-top: 0.85rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.82);
    border-radius: var(--radius-md);
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.92rem;
    line-height: 1.55;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.tournament-create-divider {
    position: relative;
    margin: 1rem 0 1.1rem;
    text-align: center;
}

.tournament-create-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border-light, #e5e7eb);
    transform: translateY(-50%);
}

.tournament-create-divider span {
    position: relative;
    display: inline-block;
    padding: 0 0.85rem;
    background: white;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.session-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.session-actions {
    display: flex;
    gap: 0.5rem;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.stats-card h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

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

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

.chart-container {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.chart-container h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.chart-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
}

.profile-container {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.profile-form {
    max-width: 600px;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

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

/* Profilo client: sezioni a card per chiarezza */
.profile-section-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.profile-section-card:last-child {
    margin-bottom: 0;
}

/* Opzione D: card più spaziose e leggere (client e coach) */
.profile-cards-spaced .profile-section-card {
    border-width: 1px;
    border-color: rgba(0, 0, 0, 0.08);
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.profile-cards-spaced .profile-section-card:last-child {
    margin-bottom: 0;
}

.profile-card-icon {
    margin-right: 0.5rem;
    font-size: 1rem;
    opacity: 0.85;
}

.profile-card-settings,
.profile-card-profilo {
    /* eredita stili base */
}

.profile-card-danger {
    border-color: var(--danger, #dc3545) !important;
    background: rgba(220, 53, 69, 0.03);
}

.profile-subsection {
    margin-bottom: 2rem;
}

.profile-subsection:last-child {
    margin-bottom: 0;
}

.profile-subsection-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.35rem 0;
}

.profile-subsection .text-muted {
    margin-bottom: 0.75rem;
}

.profile-card-title {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.profile-section-card .text-muted {
    margin-bottom: 1rem;
}

.gl-participants-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.gl-participants-list .radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Pagamenti coach: card riepilogo */
.payments-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.payment-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.payment-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.payment-card p {
    margin: 0.25rem 0;
    font-size: 0.9375rem;
}

.payment-card .btn-sm {
    margin-top: 0.75rem;
}

.session-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.video-section {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

.video-section h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Enhanced analysis detail styles */
.analysis-detail {
    max-width: 700px;
}

.analysis-detail > div {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.analysis-detail > div:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.analysis-detail h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.analysis-detail p {
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Status-specific styles for coach dashboard */
.status-pending { 
    background: #fef3c7; 
    color: #92400e; 
}

.status-assigned { 
    background: #dbeafe; 
    color: #1e40af; 
}

.status-in_progress { 
    background: #f3e8ff; 
    color: #7c3aed; 
}

.status-completed { 
    background: #d1fae5; 
    color: #065f46; 
}

.status-delivered { 
    background: #e0e7ff; 
    color: #3730a3; 
}

@media (max-width: 768px) {
    #dashboard .stats-grid {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0.5rem;
        margin-bottom: 1rem;
        padding-bottom: 0.25rem;
    }
    #dashboard .stats-grid::-webkit-scrollbar { display: none; }
    #dashboard .stats-grid .stat-card {
        flex: 0 0 auto;
        min-width: 120px;
        max-width: 140px;
        padding: 0.65rem 0.75rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.25rem;
    }
    #dashboard .stats-grid .stat-icon {
        font-size: 1.25rem;
        width: auto;
        height: auto;
        background: none;
        border-radius: 0;
    }
    #dashboard .stats-grid .stat-number {
        font-size: 1.1rem;
    }
    #dashboard .stats-grid .stat-label {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .stats-grid:not(#dashboard .stats-grid) {
        grid-template-columns: 1fr;
    }
    
    .filter-tabs {
        flex-wrap: wrap;
    }
    
    .usage-stats {
        grid-template-columns: 1fr;
    }
    
    .clients-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .sessions-container {
        grid-template-columns: 1fr;
    }
    
    .session-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .client-actions {
        flex-direction: column;
    }
    
    .session-actions {
        flex-direction: column;
    }
}

/* AI Assistant Styles */
.ai-assistant-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    height: calc(100vh - 200px);
    max-height: 800px;
}

.knowledge-base-panel {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow-y: auto;
}

.knowledge-base-panel h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--primary-color-10);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    font-size: 2rem;
    opacity: 0.7;
}

.upload-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.uploaded-files {
    margin-bottom: 2rem;
}

.uploaded-files h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.file-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: monospace;
}

.kb-stats h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

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

.stat-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
}

.chat-panel {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.chat-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.chat-actions .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--bg-white);
}

.user-message, .ai-message {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: var(--primary-color);
    color: #fff;
    margin-left: 3rem;
}
.user-message .message-content p,
.user-message .message-content span,
.user-message .message-content a { color: #fff; }
.user-message .message-content a { text-decoration: underline; }

.ai-message .message-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-right: 3rem;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    max-width: 70%;
    word-wrap: break-word;
}

.message-content p {
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.message-content li {
    margin-bottom: 0.25rem;
}

/* Markdown rendering for AI coach responses */
.message-content .markdown-body {
    font-size: 0.95rem;
    line-height: 1.6;
}
.message-content .markdown-body p {
    margin: 0 0 0.75rem 0;
}
.message-content .markdown-body p:last-child {
    margin-bottom: 0;
}
.message-content .markdown-body h1,
.message-content .markdown-body h2,
.message-content .markdown-body h3 {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.3;
}
.message-content .markdown-body h1 { font-size: 1.25rem; }
.message-content .markdown-body h2 { font-size: 1.1rem; }
.message-content .markdown-body h3 { font-size: 1rem; }
.message-content .markdown-body ul,
.message-content .markdown-body ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}
.message-content .markdown-body li {
    margin-bottom: 0.35rem;
}
.message-content .markdown-body code {
    background: rgba(0,0,0,0.08);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}
.message-content .markdown-body pre {
    margin: 0.75rem 0;
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 0.85rem;
    background: rgba(0,0,0,0.06);
}
.message-content .markdown-body pre code {
    background: none;
    padding: 0;
}
.message-content .markdown-body blockquote {
    margin: 0.75rem 0;
    padding-left: 1rem;
    border-left: 4px solid var(--primary-color);
    opacity: 0.95;
}
.message-content .markdown-body strong {
    font-weight: 600;
}

/* Bozza AI nella vista analisi coach */
.ai-draft-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
}
.ai-draft-section h4 {
    margin: 0 0 0.75rem 0;
}
.ai-draft-content {
    font-size: 0.95rem;
    line-height: 1.6;
}
.ai-draft-preview .ai-draft-box {
    max-height: 200px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.ai-draft-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chat-input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
}

.chat-input-container {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.chat-input-container textarea {
    flex: 1;
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-input-container textarea::placeholder {
    color: var(--text-secondary);
}

.chat-input-container .btn-primary {
    padding: 1rem 1.5rem;
    white-space: nowrap;
    min-width: 80px;
    height: auto;
}

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

/* Responsive design for AI Assistant */
@media (max-width: 1024px) {
    .ai-assistant-container {
        grid-template-columns: 300px 1fr;
        gap: 1.5rem;
    }
    
    .knowledge-base-panel {
        padding: 1.25rem;
    }
}

@media (max-width: 768px) {
    .ai-assistant-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .knowledge-base-panel {
        order: 2;
        max-height: 400px;
    }
    
    .chat-panel {
        order: 1;
        height: 500px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .user-message .message-content {
        margin-left: 1rem;
    }
    
    .ai-message .message-content {
        margin-right: 1rem;
    }
}

@media (max-width: 480px) {
    .stats-grid:not(#dashboard .stats-grid) {
        grid-template-columns: 1fr;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .chat-input-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .file-item {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .stat-item {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
}

/* Chat 1-to-1 coach-cliente */
.chat-one-to-one-container {
    display: flex;
    gap: 1rem;
    min-height: 400px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-conversations-list {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background: var(--bg-secondary);
}

.chat-conversation-item {
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}

.chat-conversation-item:hover {
    background: var(--bg-accent);
}

.chat-conversation-item .chat-preview {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-thread-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Fix per messaggi che vanno a destra su mobile */
@media (max-width: 768px) {
    .chat-msg {
        max-width: 85% !important;
        word-wrap: break-word;
    }
    .chat-msg-sent {
        align-self: flex-end !important;
        margin-left: 15% !important;
    }
    .chat-msg-received {
        align-self: flex-start !important;
        margin-right: 15% !important;
    }
}

.chat-thread-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 2rem;
}

.chat-thread {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 350px;
}

.chat-thread-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-thread-header h4 {
    margin: 0;
    font-size: 1.125rem;
    flex: 1;
}

.chat-thread-header .chat-delete-btn {
    flex-shrink: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.chat-thread-header .chat-delete-btn:hover {
    color: var(--error-color, #ef4444);
}

.personalizza-menu-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 0.5rem;
}
.personalizza-menu-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.95rem;
}
.personalizza-menu-label input[type="checkbox"] {
    width: 1.1em;
    height: 1.1em;
    cursor: pointer;
}
.toggle-switch-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 0;
}
.toggle-switch-label .toggle-track {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    background: var(--text-muted, #64748b);
    border-radius: 1rem;
    flex-shrink: 0;
    transition: background 0.2s;
}
.toggle-switch-label .toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(1.5rem - 4px);
    height: calc(1.5rem - 4px);
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch-label input[type="checkbox"]:checked + .toggle-track {
    background: var(--primary-color, #3b82f6);
}
.toggle-switch-label input[type="checkbox"]:checked + .toggle-track::after {
    transform: translateX(1.25rem);
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-msg {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
}

.chat-msg-sent {
    align-self: flex-end;
    background: #1e40af;
    color: #fff;
}
.chat-msg-sent .chat-msg-body,
.chat-msg-sent .chat-msg-sender,
.chat-msg-sent .chat-msg-time { color: #fff; }

.chat-msg-received {
    align-self: flex-start;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.chat-msg-sender {
    font-size: 0.75rem;
    opacity: 0.9;
}

.chat-msg-body {
    margin: 0.25rem 0 0;
    font-size: 0.9375rem;
    line-height: 1.4;
}

.chat-msg-body p { margin: 0; }

.chat-msg-time {
    display: block;
    font-size: 0.7rem;
    margin-top: 0.25rem;
    opacity: 0.8;
}

.chat-send-form {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.chat-send-form input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.client-chat .chat-thread-panel {
    max-width: 100%;
}

/* Coach list filters (luogo) */
.coach-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.coach-filters label { margin-right: 0.25rem; font-weight: 500; }
.coach-filters .filter-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 120px;
}
.coach-location { color: var(--text-secondary); margin: 0.25rem 0; }
.form-hint { display: block; margin-top: 0.25rem; font-size: 0.85rem; color: var(--text-secondary); }
.required { color: var(--danger, #dc2626); }

/* Session detail: piano lezione, feedback, stelle */
.session-plan, .session-summary, .session-homework, .session-coach-feedback, .session-client-feedback { margin-top: 1rem; }
.session-plan h4, .session-summary h4, .session-homework h4, .session-coach-feedback h4, .session-client-feedback h4 { margin-bottom: 0.35rem; font-size: 0.95rem; }
.star-rating { font-size: 1.5rem; letter-spacing: 0.1em; }
.star-rating span { cursor: pointer; color: #ccc; }
.star-rating span:hover { color: #f59e0b; }

/* Prenotazioni: slot campi (libero / occupato) */
.slots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.slot-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    cursor: default;
}
.slot-btn.slot-free {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
    cursor: pointer;
}
.slot-btn.slot-free:hover {
    background: #bbf7d0;
}
.slot-btn.slot-occupied {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}
.slot-btn.slot-blocked {
    background: #374151;
    color: #f3f4f6;
    border-color: #6b7280;
    cursor: not-allowed;
    text-align: center;
    line-height: 1.2;
}
.slot-btn.slot-blocked small {
    font-size: 0.7rem;
    opacity: 0.8;
}
.slot-price {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #15803d;
    margin-top: 2px;
}
.court-detail-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin: 0.75rem 0;
}
.court-photo {
    width: 100px;
    height: 75px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
.court-detail-info { flex: 1; }
.court-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; }
.badge-surface { background: #dbeafe; color: #1e40af; }
.badge-lighting { background: #fef9c3; color: #854d0e; }
.badge-capacity { background: #f3e8ff; color: #6b21a8; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.court-desc { margin-top: 0.35rem; font-size: 0.85rem; color: var(--text-secondary); }
.booking-cards { display: flex; flex-direction: column; gap: 0.5rem; }
.booking-card { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 0.75rem; }
.booking-card-header { font-size: 0.95rem; margin-bottom: 0.25rem; }
.booking-card-body { font-size: 0.85rem; color: var(--text-secondary); }
.booking-card-actions { margin-top: 0.5rem; }
.weekly-calendar td, .weekly-calendar th { padding: 0.25rem 0.35rem; text-align: center; font-size: 0.75rem; min-width: 38px; }
.weekly-free { background: #dcfce7; }
.weekly-booked { background: #dbeafe; }
.weekly-blocked { background: #e5e7eb; }
.weekly-empty { background: var(--bg-secondary); }
.prenotazioni-panel { margin-top: 1rem; }
.stats-list { list-style: none; padding-left: 0; }
.stats-list li { padding: 0.25rem 0; }
.data-list { list-style: none; padding-left: 0; }
.data-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border-light); }
@media (max-width: 600px) {
    .court-detail-card { flex-direction: column; }
    .court-photo { width: 100%; height: auto; max-height: 150px; }
    .weekly-calendar { font-size: 0.65rem; }
}

/* Admin: lista utenti - layout e allineamento (pc e mobile) */
.admin-users-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.admin-users-card {
    overflow-x: auto;
}
.admin-users-card h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}
.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-users-table th,
.admin-users-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}
.admin-users-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}
.admin-users-table tbody tr:hover {
    background: var(--bg-secondary);
}
.admin-users-actions {
    white-space: nowrap;
}
.admin-users-actions .btn-sm {
    margin-right: 0.35rem;
    margin-bottom: 0.25rem;
}
@media (max-width: 768px) {
    .admin-users-table th,
    .admin-users-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.85rem;
    }
    .admin-users-actions {
        white-space: normal;
    }
    .admin-users-actions .btn-sm {
        display: inline-block;
        margin: 0.2rem;
    }
}

/* Obiettivi / Achievements */
.obiettivi-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    padding: 1rem 1.25rem;
}
.obiettivi-stat-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-secondary, #f8fafc);
    border-radius: 8px;
}
.obiettivi-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color, #0d9488);
}
.obiettivi-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary, #64748b);
}
.obiettivi-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.achievement-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-light, #e2e8f0);
    background: var(--bg-secondary, #f8fafc);
}
.achievement-card.unlocked {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
}
.achievement-card.locked {
    opacity: 0.75;
}
.achievement-icon {
    font-size: 2rem;
    line-height: 1;
}
.achievement-info {
    flex: 1;
}
.achievement-info strong { display: block; margin-bottom: 0.25rem; }
.achievement-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary, #64748b);
}
.achievement-info small {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
}

/* Giochi Pro */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.games-grid .game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 101, 52, 0.15);
}

/* Modal tabellone + classifica torneo (client) */
.client-tournament-bracket-modal .modal-content.client-tournament-bracket-modal__content {
    max-width: min(920px, calc(100vw - 1.5rem));
    width: 100%;
    max-height: min(92vh, 880px);
    display: flex;
    flex-direction: column;
    margin: 0.75rem auto;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    border-radius: var(--radius-lg, 12px);
}
.client-tournament-bracket-modal__header.modal-header {
    flex-shrink: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.client-tournament-bracket-modal__tabs {
    flex-shrink: 0;
    margin: 0;
    padding: 0.5rem 0.75rem 0;
    gap: 0.35rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f8fafc);
}
.client-tournament-bracket-modal__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem 1rem;
    -webkit-overflow-scrolling: touch;
}
.client-tournament-bracket-modal__footer {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
    padding: 0.65rem 1rem;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f8fafc);
}
.client-tournament-champion-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md, 8px);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border: 1px solid #f59e0b44;
}
.client-tournament-runnerup {
    font-weight: 500;
    color: var(--text-secondary, #64748b);
}
.client-standings-table-wrap {
    overflow-x: auto;
    margin-top: 0.35rem;
}
.client-standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.client-standings-table th,
.client-standings-table td {
    text-align: left;
    padding: 0.4rem 0.35rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.client-standings-table th {
    font-weight: 600;
    color: var(--text-secondary, #475569);
}
.tournament-bracket--modal .tournament-match-row--modal {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    text-align: left;
}
.tournament-bracket--modal .tournament-match-row__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}
.tournament-bracket--modal .tournament-match-row__head .match-round {
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    font-size: 0.88rem;
}
.tournament-bracket--modal .tournament-match-row__players {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-weight: 500;
    line-height: 1.35;
}
.tournament-bracket--modal .tournament-match-vs {
    align-self: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0;
}
.tournament-bracket--modal .tournament-match-row__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}
.tournament-bracket--modal .tournament-match-score {
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}
.tournament-bracket--modal .tournament-match-row__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
    flex: 1 1 auto;
}
.tournament-bracket--modal .tournament-match-players {
    display: block;
    margin: 0;
    font-weight: 500;
}
@media (min-width: 520px) {
    .tournament-bracket--modal .tournament-match-row__players {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.35rem 0.5rem;
    }
    .tournament-bracket--modal .tournament-match-vs {
        align-self: auto;
        padding: 0 0.15rem;
    }
}
@media (max-width: 480px) {
    .client-tournament-bracket-modal .modal-content.client-tournament-bracket-modal__content {
        max-height: 100vh;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }
}

/* Card torneo client — azioni ordinate (mobile) */
.client-tournament-registration-card .client-tournament-card__meta {
    margin-bottom: 0.5rem;
    font-size: 0.92rem;
    color: var(--text-secondary, #64748b);
}
.client-open-tournament-card .client-tournament-card__row {
    margin-bottom: 0.25rem;
    font-size: 0.92rem;
    color: var(--text-primary, #1e293b);
    line-height: 1.4;
}
.client-tournament-registration-card .client-tournament-card__row {
    margin-bottom: 0.65rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.client-tournament-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin-top: 0.25rem;
}
.client-tournament-card__actions .btn-primary,
.client-tournament-card__actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: calc(50% - 0.25rem);
    text-align: center;
}
@media (min-width: 520px) {
    .client-tournament-card__actions .btn-primary,
    .client-tournament-card__actions .btn-secondary {
        flex: 0 1 auto;
        min-width: unset;
    }
}

/* Coach — toolbar dettaglio torneo */
.coach-tournament-detail-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin: 0.75rem 0 0.35rem;
}
.coach-tournament-detail-toolbar .btn-primary,
.coach-tournament-detail-toolbar .btn-secondary,
.coach-tournament-detail-toolbar a.btn-secondary {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 8.5rem;
    text-align: center;
    justify-content: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.coach-tournament-toolbar__primary {
    flex: 1 1 100%;
    font-weight: 600;
}
.coach-tournament-toolbar__danger {
    color: var(--danger, #dc2626) !important;
    border-color: var(--danger, #dc2626) !important;
}
.coach-tournament-bracket-hint {
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* Tabellone coach nel modale: 3 blocchi chiari (fase / giocatori / punteggio) su mobile */
.coach-tournament-bracket-modal .tournament-match-row--coach-bracket {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}
.coach-tournament-bracket-modal .tournament-match-row--coach-bracket .tournament-match-row__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.coach-tournament-bracket-modal .tournament-match-row--coach-bracket .match-players {
    width: 100%;
}
.coach-tournament-bracket-modal .tournament-match-row--coach-bracket .match-score {
    width: 100%;
    flex-wrap: wrap;
}

/* Scrivania coach: tab Elenco / Nuova scheda */
.coach-scrivania-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    padding-bottom: 0.5rem;
}
.coach-scrivania-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: var(--radius-md, 8px) var(--radius-md, 8px) 0 0;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    font-size: 0.95rem;
    border-bottom: none;
    margin-bottom: -1px;
}
.coach-scrivania-tab.active {
    background: #fff;
    color: var(--primary-color, #16a34a);
    font-weight: 600;
    border-color: var(--border-light, #e2e8f0);
    position: relative;
    z-index: 1;
}
.coach-scrivania-panel {
    margin-top: 0.25rem;
}
.coach-scrivania-new-card__title {
    margin-top: 0;
}
.coach-scrivania-new-card__actions {
    margin-top: 0.5rem;
}
@media (min-width: 640px) {
    .coach-tournament-detail-toolbar .btn-primary,
    .coach-tournament-detail-toolbar .btn-secondary,
    .coach-tournament-detail-toolbar a.btn-secondary {
        flex: 0 1 auto;
        min-width: unset;
    }
    .coach-tournament-toolbar__primary {
        flex: 0 1 auto;
    }
}

/* Coach — card elenco tornei */
.coach-tournament-list-card__meta {
    margin-bottom: 0.65rem;
    font-size: 0.92rem;
    color: var(--text-secondary, #64748b);
}
.coach-tournament-list-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.coach-tournament-list-card__actions .btn-primary,
.coach-tournament-list-card__actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 7rem;
    text-align: center;
}

/* Coach — modal tabellone */
.coach-tournament-bracket-modal .modal-content.coach-tournament-bracket-modal__content {
    max-width: min(960px, calc(100vw - 1.5rem));
    width: 100%;
    max-height: min(92vh, 900px);
    display: flex;
    flex-direction: column;
    margin: 0.75rem auto;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    border-radius: var(--radius-lg, 12px);
}
.coach-tournament-bracket-modal__header.modal-header {
    flex-shrink: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.coach-tournament-bracket-modal__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem 1rem;
    -webkit-overflow-scrolling: touch;
}
.tournament-bracket-wrap--modal {
    min-height: 120px;
    margin-top: 0;
}
.coach-tournament-bracket-modal__footer {
    flex-shrink: 0;
    padding: 0.65rem 1rem;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f8fafc);
}
@media (max-width: 480px) {
    .coach-tournament-bracket-modal .modal-content.coach-tournament-bracket-modal__content {
        max-height: 100vh;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }
}

/* Tab interni a una content-section — stesso stile segmented di .filter-tabs */
.page-inner-tabs-root {
    margin-top: 0.5rem;
}
.page-inner-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-secondary, #f1f5f9);
    border-radius: 10px;
    padding: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
}
.page-inner-tabs::-webkit-scrollbar { display: none; }

.page-inner-tab {
    appearance: none;
    font: inherit;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary, #64748b);
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.page-inner-tab:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(255,255,255,0.6);
}
.page-inner-tab.active {
    background: #fff;
    color: var(--primary-color, #2563eb);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
}
.page-inner-tab:focus-visible {
    outline: 2px solid var(--primary-color, #2563eb);
    outline-offset: 2px;
    border-radius: 7px;
}
.page-inner-tab-panel {
    padding-top: 0.25rem;
}
.page-inner-tab-panel[hidden] {
    display: none !important;
}

/* La variante -scroll è ora già integrata nel base (.page-inner-tabs) */
.page-inner-tabs.page-inner-tabs-scroll {
    flex-wrap: nowrap;
}

/* Tab annidati: container interno leggermente più piccolo */
.page-inner-tabs-root .page-inner-tabs-root {
    margin-top: 0.25rem;
}
.page-inner-tabs-root .page-inner-tabs-root > .page-inner-tabs {
    margin-bottom: 1rem;
    background: rgba(0,0,0,0.04);
}
.page-inner-tabs-root .page-inner-tabs-root .page-inner-tab {
    font-size: 0.82rem;
    padding: 0.45rem 0.8rem;
}

/* Client: avviso comunicazioni in cima alla dashboard */
.client-announcements-strip {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.75rem;
    padding: 0.65rem 1rem;
    margin: 0 0 0.75rem 0;
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid #93c5fd;
    border-radius: var(--radius-md, 8px);
    font-size: 0.95rem;
}
.client-announcements-strip .client-announcements-strip__text {
    flex: 1 1 200px;
    min-width: 0;
    font-weight: 500;
    color: var(--text-primary, #1e293b);
}

/* ── Skeleton loading ── */
@keyframes skeleton-pulse {
    0%   { opacity: 0.6; }
    50%  { opacity: 0.3; }
    100% { opacity: 0.6; }
}
.skeleton-block {
    background: var(--border-color, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton-line {
    height: 0.85rem;
    margin-bottom: 0.5rem;
    background: var(--border-color, #e5e7eb);
    border-radius: 4px;
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton-line.w75 { width: 75%; }
.skeleton-line.w50 { width: 50%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w90 { width: 90%; }
.skeleton-card {
    padding: 1rem;
    border-radius: var(--radius-md, 8px);
    background: var(--bg-secondary, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
}
.skeleton-stats {
    display: flex;
    gap: 0.5rem;
    overflow: hidden;
}
.skeleton-stats .skeleton-stat {
    flex: 0 0 120px;
    height: 64px;
    border-radius: var(--radius-md, 8px);
    background: var(--border-color, #e5e7eb);
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton-stats .skeleton-stat:nth-child(2) { animation-delay: 0.15s; }
.skeleton-stats .skeleton-stat:nth-child(3) { animation-delay: 0.3s; }
.skeleton-stats .skeleton-stat:nth-child(4) { animation-delay: 0.45s; }