/* Token brand BSA — allineati a mobile/src/theme/colors.ts */
:root {
    --bsa-primary: #A8000E;
    --bsa-primary-dark: #8A0000;
    --bsa-primary-muted: #980000;
    --bsa-background: rgba(168, 0, 14, 0.07);
    --bsa-background-solid: #FFF5F5;
    --bsa-surface: #FFFFFF;
    --bsa-surface-muted: #FFE8EA;
    --bsa-text: #1A1A1A;
    --bsa-text-muted: #555555;
    --bsa-text-on-primary: #FFFFFF;
    --bsa-border: #E8C5C8;
    --bsa-disabled: #C9A0A4;
    --bsa-disabled-text: #8A7072;
    --bsa-overlay: rgba(255, 245, 245, 0.92);
}

html, body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    color: var(--bsa-text);
    background: var(--bsa-background-solid);
}

/* Sidebar nav: testo bianco, niente aspetto hyperlink browser (:link/:visited) */
.app-sidebar a,
.app-sidebar a:link,
.app-sidebar a:visited,
.app-sidebar a:hover,
.app-sidebar a:focus,
.app-sidebar a:active {
    color: #ffffff;
    text-decoration: none;
}

/* Home hub autenticata — brand-first come tablet HomeScreen */
.home-hub {
    box-sizing: border-box;
    min-height: calc(100vh - 8rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem 2rem;
}

.home-hub-main {
    width: 100%;
    max-width: 52rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.home-hub-brand {
    text-align: center;
    max-width: 40rem;
}

.home-hub-marks {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.home-hub-mark {
    display: block;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(12%) sepia(94%) saturate(4800%) hue-rotate(346deg) brightness(0.85);
}

.home-hub-mark-leone {
    width: 5.5rem;
    height: 5.5rem;
}

.home-hub-mark-bsa {
    width: 6.5rem;
    height: 6.5rem;
}

.home-hub-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 0.4rem;
    color: var(--bsa-text);
}

.home-hub-subtitle {
    margin: 0 0 0.65rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bsa-primary);
    line-height: 1.35;
}

.home-hub-lead {
    margin: 0;
    line-height: 1.45;
    font-size: 0.95rem;
}

.home-hub .muted {
    color: var(--bsa-text-muted);
}

.home-hub-actions {
    width: 100%;
    max-width: 40rem;
}

.home-hub-actions-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 1rem;
    width: 100%;
}

.home-hub-cta {
    flex: 1 1 12rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3.25rem;
    padding: 0.85rem 1.5rem;
    border-radius: 6px;
    border: 2px solid transparent;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 650;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
}

.home-hub-cta-primary {
    background: var(--bsa-primary);
    border-color: var(--bsa-primary-dark);
    color: var(--bsa-text-on-primary);
}

.home-hub-cta-primary:hover {
    background: var(--bsa-primary-dark);
}

.home-hub-cta-secondary {
    background: var(--bsa-surface);
    border-color: var(--bsa-border);
    color: var(--bsa-text);
}

.home-hub-cta-secondary:hover {
    background: var(--bsa-surface-muted);
}

/* Legacy .home (eventuali riferimenti residui) */
.home {
    max-width: 40rem;
    margin: 4rem auto;
    padding: 0 1.5rem;
}

.home h1 {
    font-size: 1.75rem;
    font-weight: 650;
    margin: 0 0 0.75rem;
}

.home p {
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

.home .muted {
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.page {
    max-width: 48rem;
}

.page-wide {
    max-width: 56rem;
}

/* Elenchi anagrafici: tutta la larghezza del content (nessun cap 48/56rem) */
.page.page-list {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

/* Wrapper elenco/tabella Admin: espansione fino al bordo utile di .app-content */
.list-table-wrap,
.games-list,
.players-list,
.stat-defs-list {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.page h1 {
    font-size: 1.5rem;
    font-weight: 650;
    margin: 0 0 0.75rem;
}

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

.page .muted {
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.page .status,
.page .empty {
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.page .error {
    margin: 0 0 1rem;
    padding: 0.65rem 0.75rem;
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary-dark);
    border-radius: 4px;
    font-size: 0.95rem;
}

.page-games .games-header h1 {
    margin-bottom: 0.35rem;
}

.page-games .games-header .muted {
    margin-top: 0;
}

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

.games-header-text {
    flex: 1 1 16rem;
    min-width: 0;
}

.games-new-btn {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.games-new-btn .svg-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.games-view-toggle {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    width: fit-content;
    min-width: 14rem;
    max-width: 100%;
    margin-top: 0.85rem;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bsa-surface-muted);
    box-sizing: border-box;
}

.games-view-side {
    margin: 0;
    padding: 0.45rem 0.9rem;
    border: none;
    background: transparent;
    color: var(--bsa-text-muted);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.games-view-side-active {
    background: var(--bsa-surface);
    color: var(--bsa-primary-dark);
    box-shadow: inset 0 0 0 1px var(--bsa-border);
}

.games-view-side:hover:not(:disabled):not(.games-view-side-active),
.games-view-side:focus-visible:not(:disabled) {
    color: var(--bsa-text);
}

.games-view-side:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.games-status {
    margin: 1.25rem 0 0;
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.games-status-success {
    margin-top: 1rem;
    margin-bottom: 0;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    background: var(--bsa-surface);
    color: var(--bsa-text);
}

.games-state {
    margin-top: 1.25rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.games-state-empty .games-empty-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.games-state-empty .muted,
.games-state-error .error {
    margin: 0;
}

.games-state-error .error {
    background: transparent;
    padding: 0;
}

.games-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

/* Modale crea partita: stessa shell .users-modal + riga data/orario/sede + roster. */
.users-modal.games-modal {
    width: min(100%, 36rem);
    max-height: min(92vh, 52rem);
    overflow-y: auto;
}

/* Conferma soft-delete: larghezza standard utenti, senza scroll form. */
.users-modal.games-modal.games-delete-modal {
    width: min(28rem, 100%);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
}

.games-create-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 0.85rem;
}

.games-create-row .field {
    flex: 1 1 8.5rem;
    min-width: 0;
}

.games-create-time {
    flex: 0 1 7.5rem;
}

.games-create-venue {
    flex: 0 1 9rem;
}

.games-edit-events-hint {
    margin: 0 0 0.75rem;
}

.games-roster {
    margin-top: 0.35rem;
    margin-bottom: 0.25rem;
}

.games-roster-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.55rem;
}

.games-roster-title-block {
    min-width: 0;
    flex: 1 1 auto;
}

.games-roster-label {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--bsa-text);
    margin-bottom: 0.15rem;
}

.games-roster-hint {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.35;
}

.games-roster-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    flex: 0 0 auto;
}

.games-roster-link-btn {
    margin: 0;
    padding: 0.2rem 0;
    border: none;
    background: transparent;
    color: var(--bsa-primary);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.games-roster-link-btn:hover:not(:disabled) {
    text-decoration: underline;
}

.games-roster-link-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.games-roster-status {
    margin: 0.35rem 0 0;
}

.games-roster-empty {
    margin: 0;
    padding: 0.85rem 0.9rem;
    border: 1.5px dashed var(--bsa-border);
    border-radius: 6px;
    background: var(--bsa-surface);
}

.games-roster-empty-title {
    margin: 0 0 0.35rem;
    font-weight: 600;
    color: var(--bsa-text);
}

.games-roster-empty .muted {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.games-roster-retry {
    margin-top: 0.65rem;
}

.games-roster-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 14rem;
    overflow-y: auto;
    border: 1.5px solid var(--bsa-border);
    border-radius: 6px;
    background: var(--bsa-surface);
}

.games-roster-list > li + li {
    border-top: 1px solid var(--bsa-border);
}

.games-roster-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    margin: 0;
    padding: 0.55rem 0.7rem;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.games-roster-row:hover:not(:disabled) {
    background: color-mix(in srgb, var(--bsa-primary) 8%, transparent);
}

.games-roster-row:disabled {
    opacity: 0.7;
    cursor: default;
}

.games-roster-row-selected {
    background: color-mix(in srgb, var(--bsa-primary) 12%, transparent);
}

.games-roster-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
    border: 1.5px solid var(--bsa-border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    color: var(--bsa-text-on-primary);
    background: var(--bsa-surface);
}

.games-roster-row-selected .games-roster-check {
    border-color: var(--bsa-primary);
    background: var(--bsa-primary);
}

.games-roster-jersey {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.35rem;
    min-height: 2.35rem;
    padding: 0 0.35rem;
    border-radius: 4px;
    background: var(--bsa-primary);
    color: var(--bsa-text-on-primary);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    flex: 0 0 auto;
}

.games-roster-name {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--bsa-text);
    min-width: 0;
}

.game-row-item {
    margin: 0;
    padding: 0;
}

.game-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 3.5rem;
    padding: 0.55rem 0.65rem 0.55rem 0.15rem;
    background: var(--bsa-surface);
    border: 1.5px solid var(--bsa-border);
    border-radius: 6px;
    box-sizing: border-box;
    color: inherit;
    transition: border-color 0.12s ease;
}

.game-row:hover {
    border-color: var(--bsa-primary);
}

.game-row-deleted {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
}

.game-row-deleted:hover {
    border-color: var(--bsa-border);
}

.game-row-main-readonly {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.2rem 0;
}

.game-row-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 3.5rem;
    padding: 0.2rem 0.2rem 0.2rem 0.7rem;
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    box-sizing: border-box;
}

.game-row-link:hover {
    opacity: 0.95;
}

.game-row-link:focus-visible {
    outline: 2px solid var(--bsa-primary);
    outline-offset: 2px;
}

.game-row-actions {
    flex: 0 0 auto;
    padding-right: 0.2rem;
}

.game-row-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.game-datetime {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bsa-text-muted);
    text-transform: capitalize;
    line-height: 1.3;
}

.game-opponent {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--bsa-text);
}

.game-meta {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    line-height: 1.35;
    color: var(--bsa-text);
}

.game-meta-chip {
    color: var(--bsa-text);
}

.game-meta-dot {
    color: var(--bsa-text-muted);
}

.game-status {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    font-weight: 600;
}

.game-status-finished {
    color: var(--bsa-primary);
    font-weight: 700;
    background: var(--bsa-surface-muted);
}

.game-status-progress {
    color: var(--bsa-text-muted);
    background: var(--bsa-background);
}

.game-chevron {
    flex: 0 0 auto;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--bsa-primary);
    padding: 0 0.15rem;
}

@media (max-width: 480px) {
    .game-row {
        gap: 0.35rem;
        padding: 0.45rem 0.45rem 0.45rem 0.1rem;
    }

    .game-row-link {
        gap: 0.55rem;
        padding: 0.15rem 0.1rem 0.15rem 0.55rem;
    }

    .game-opponent {
        font-size: 1.05rem;
    }

    .game-datetime {
        font-size: 0.85rem;
    }
}

.page-users .users-header h1 {
    margin-bottom: 0.35rem;
}

.page-users .users-header .muted {
    margin-top: 0;
}

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

.users-header-text {
    flex: 1 1 16rem;
    min-width: 0;
}

.users-new-btn {
    flex: 0 0 auto;
    align-self: center;
}

/*
  Overlay Admin: markup è dentro .app-content (overflow:auto in MainLayout).
  Con modale aperta togliamo il clip così position:fixed copre aside + header.
*/
.app-shell .app-content:has(.users-modal-backdrop) {
    overflow: visible;
}

/* WorkspaceSelector apre la stessa shell modale dall’header: evita clip overflow. */
.app-shell .app-header:has(.users-modal-backdrop),
.app-shell .header-leading:has(.users-modal-backdrop) {
    overflow: visible;
}

/*
  Pannello workspace (fase 305): stessa shell .users-modal / backdrop z-index 10000,
  leggermente più largo per autocomplete società + dropdown categoria.
*/
.users-modal.workspace-selector-modal {
    width: min(30rem, 100%);
    border-color: var(--bsa-border);
    box-shadow: 0 14px 42px rgba(40, 12, 14, 0.22);
}

.users-modal.workspace-selector-modal .users-modal-lead {
    margin-bottom: 1.1rem;
}

.users-modal-backdrop {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin: 0;
    box-sizing: border-box;
    background: rgba(20, 12, 12, 0.5);
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
    pointer-events: auto;
    isolation: isolate;
}

/* Evita scroll del documento mentre l’overlay copre viewport (aside + content). */
body:has(.users-modal-backdrop) {
    overflow: hidden;
}

/* Boot workspace: blocca UI finché società/categoria non sono pronte in header. */
.workspace-boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    margin: 0;
    padding: 1.25rem;
    box-sizing: border-box;
    background: rgba(255, 245, 245, 0.78);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    cursor: wait;
    user-select: none;
    -webkit-user-select: none;
}

.workspace-boot-spinner {
    width: 2.75rem;
    height: 2.75rem;
    border: 3px solid rgba(168, 0, 14, 0.18);
    border-top-color: var(--bsa-primary);
    border-radius: 50%;
    animation: workspace-boot-spin 0.7s linear infinite;
}

.workspace-boot-label {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--bsa-primary);
    letter-spacing: 0.01em;
}

@keyframes workspace-boot-spin {
    to {
        transform: rotate(360deg);
    }
}

body:has(.workspace-boot-overlay) {
    overflow: hidden;
}

.users-modal {
    position: relative;
    z-index: 1;
    width: min(28rem, 100%);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: auto;
    padding: 1.25rem 1.35rem 1.35rem;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
}

.users-modal-title {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bsa-text);
}

.users-modal-lead {
    margin: 0 0 1rem;
}

.users-modal-error {
    margin: 0 0 0.85rem;
}

.users-modal-form .field,
.users-modal .field {
    margin-bottom: 0.85rem;
}

.users-modal .field label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--bsa-text);
}

/*
  Controlli form in modale (shell .users-modal e varianti:
  .societa-create-modal, .categorie-modal, .players-modal, .stat-defs-modal, …).
  Classe riusabile: .input su text/email/search/number, select, textarea.
*/
.users-modal .input,
.users-modal input.input,
.users-modal select.input,
.users-modal textarea.input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 2.5rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
    background: var(--bsa-surface);
    color: var(--bsa-text);
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.35;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.users-modal textarea.input {
    min-height: 5.5rem;
    resize: vertical;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

/* Select / InputSelect: niente aspetto UA grezzo; freccia allineata al design. */
.users-modal select.input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.25rem;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--bsa-text-muted) 50%),
        linear-gradient(135deg, var(--bsa-text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 1.05rem) calc(50% - 0.15rem),
        calc(100% - 0.7rem) calc(50% - 0.15rem);
    background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
    background-repeat: no-repeat;
    cursor: pointer;
}

.users-modal select.input::-ms-expand {
    display: none;
}

.users-modal .input:hover:not(:disabled):not([readonly]) {
    border-color: #d4a0a4;
}

.users-modal .input:focus {
    outline: 2px solid var(--bsa-primary);
    outline-offset: 1px;
    border-color: var(--bsa-primary);
    box-shadow: 0 0 0 3px rgba(168, 0, 14, 0.12);
}

.users-modal .input:disabled,
.users-modal .input[readonly] {
    background: var(--bsa-surface-muted);
    color: var(--bsa-text-muted);
    border-color: var(--bsa-border);
    cursor: default;
    opacity: 1;
    box-shadow: none;
}

.users-modal select.input:disabled {
    cursor: not-allowed;
    background-color: var(--bsa-surface-muted);
    background-image:
        linear-gradient(45deg, transparent 50%, var(--bsa-disabled-text) 50%),
        linear-gradient(135deg, var(--bsa-disabled-text) 50%, transparent 50%);
    background-position:
        calc(100% - 1.05rem) calc(50% - 0.15rem),
        calc(100% - 0.7rem) calc(50% - 0.15rem);
    background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
    background-repeat: no-repeat;
}

.users-modal .input::placeholder {
    color: var(--bsa-text-muted);
    opacity: 0.75;
}

.users-modal .input.invalid,
.users-modal select.input.invalid {
    border-color: var(--bsa-danger, #b00020);
}

.users-modal .input.invalid:focus,
.users-modal select.input.invalid:focus {
    outline-color: var(--bsa-danger, #b00020);
    box-shadow: 0 0 0 3px rgba(176, 0, 32, 0.12);
}

.users-modal .validation-message {
    display: block;
    margin-top: 0.25rem;
    color: var(--bsa-danger, #b00020);
    font-size: 0.85rem;
}

.users-password-row .input {
    width: auto;
}

.users-password-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.users-password-input {
    flex: 1 1 auto;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.02em;
}

.users-copy-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.users-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.15rem;
    flex-wrap: wrap;
}

.users-status {
    margin: 1.25rem 0 0;
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.users-state {
    margin-top: 1.25rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.users-state-empty .users-empty-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.users-state-empty .muted,
.users-state-error .error {
    margin: 0;
}

.users-state-error .error {
    background: transparent;
    padding: 0;
}

.users-table-wrap {
    margin-top: 1.25rem;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.users-table .col-role {
    width: 9rem;
    white-space: nowrap;
}

.users-table .col-societa {
    min-width: 10rem;
}

.users-table .users-club-name {
    display: block;
}

.users-table .users-category-hint {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    line-height: 1.25;
}

.users-table .col-last-login {
    width: 10.5rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.users-table .col-actions {
    width: 6.5rem;
    text-align: right;
    white-space: nowrap;
}

.users-modal-hint {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
}

.users-new-btn,
.societa-new-btn,
.categorie-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.users-new-btn .svg-icon,
.societa-new-btn .svg-icon,
.categorie-new-btn .svg-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.user-role-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 650;
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary-dark);
}

.user-role-admin {
    background: var(--bsa-primary);
    color: var(--bsa-text-on-primary);
}

/* —— Società sportive (Admin) —— */

.page-societa .societa-header h1 {
    margin-bottom: 0.35rem;
}

.page-societa .societa-header .muted {
    margin-top: 0;
}

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

.societa-header-text {
    flex: 1 1 16rem;
    min-width: 0;
}

.societa-new-btn {
    flex: 0 0 auto;
    align-self: center;
}

.societa-status {
    margin: 1.25rem 0 0;
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.societa-state {
    margin-top: 1.25rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.societa-state-empty .societa-empty-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.societa-state-empty .muted,
.societa-state-error .error {
    margin: 0;
}

.societa-state-error .error {
    background: transparent;
    padding: 0;
}

.societa-retry-btn,
.societa-empty-add-btn {
    margin-top: 1rem;
}

.societa-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-top: 1.25rem;
    align-items: flex-end;
}

.societa-filter-field {
    flex: 1 1 10rem;
    min-width: 8rem;
    margin: 0;
}

.societa-filter-field label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.societa-filter-field .input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    background: var(--bsa-surface);
    color: var(--bsa-text);
    font: inherit;
}

.societa-filter-field .input:focus {
    outline: 2px solid var(--bsa-primary);
    outline-offset: 1px;
}

.societa-table-wrap {
    margin-top: 1rem;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.societa-table .col-province {
    width: 6rem;
    white-space: nowrap;
}

.societa-table .col-actions {
    width: 6.5rem;
    text-align: right;
    white-space: nowrap;
}

.societa-table tbody tr.societa-row-selected td {
    background: rgba(168, 0, 14, 0.08);
}

.societa-filter-count {
    margin: 0.65rem 0 0;
    font-size: 0.85rem;
}

.societa-create-modal {
    width: min(32rem, 100%);
}

.societa-categories-modal {
    width: min(28rem, 100%);
}

.societa-categories-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.societa-categories-modal-header .users-modal-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.societa-categories-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: min(18rem, 45vh);
    overflow-y: auto;
}

.societa-categories-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
    background: var(--bsa-surface);
}

.societa-categories-name {
    min-width: 0;
    font-weight: 600;
    color: var(--bsa-text);
}

/* Griglia a due colonne: stessi .field/.input della shell .users-modal. */
.societa-create-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 0.85rem;
}

.societa-create-row .field {
    flex: 1 1 10rem;
    min-width: 0;
}

.societa-create-province {
    flex: 0 1 7rem;
}

/* —— Categorie nested sotto Società (Admin) —— */

.page-categorie .categorie-header h1 {
    margin-bottom: 0.35rem;
}

.page-categorie .categorie-header .muted {
    margin-top: 0;
}

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

.categorie-header-text {
    flex: 1 1 16rem;
    min-width: 0;
}

.categorie-breadcrumb {
    margin: 0 0 0.45rem;
    font-size: 0.9rem;
}

.categorie-back-link {
    color: var(--bsa-primary);
    text-decoration: none;
    font-weight: 650;
}

.categorie-back-link:hover {
    text-decoration: underline;
}

.categorie-new-btn {
    flex: 0 0 auto;
    align-self: center;
}

.categorie-status {
    margin: 1.25rem 0 0;
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.categorie-state {
    margin-top: 1.25rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.categorie-state-empty .categorie-empty-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.categorie-state-empty .muted,
.categorie-state-error .error {
    margin: 0;
}

.categorie-state-error .error {
    background: transparent;
    padding: 0;
}

.categorie-retry-btn,
.categorie-empty-add-btn {
    margin-top: 1rem;
}

.categorie-table-wrap {
    margin-top: 1.25rem;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.categorie-table .col-actions {
    width: 4.5rem;
    text-align: right;
    white-space: nowrap;
}

.categorie-table tbody tr.categorie-row-selected td {
    background: rgba(168, 0, 14, 0.08);
}

.categorie-count {
    margin: 0.65rem 0 0;
    font-size: 0.85rem;
}

/*
  Modale Categorie: stessa shell .users-modal (+ foundation .input/.field).
  Larghezza allineata alle modali Utenti; form a un solo campo.
*/
.categorie-modal {
    width: min(28rem, 100%);
}

.categorie-modal .categorie-modal-form .field {
    margin-bottom: 0.25rem;
}

.categorie-modal .users-modal-actions,
.categorie-modal .players-modal-actions-edit {
    margin-top: 1.15rem;
}

/* —— Giocatori catalogo (Admin) —— */

.page-players .players-header h1 {
    margin-bottom: 0.35rem;
}

.page-players .players-header .muted {
    margin-top: 0;
}

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

.players-header-text {
    flex: 1 1 16rem;
    min-width: 0;
}

.players-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.players-add-btn {
    margin-top: 0;
}

.players-delete-all-btn {
    color: var(--bsa-primary-dark);
    border-color: var(--bsa-border);
}

.players-delete-all-btn:hover:not(:disabled) {
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary);
}

.players-status {
    margin: 1.25rem 0 0;
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.players-state {
    margin-top: 1.25rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.players-state-empty .players-empty-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.players-state-empty .muted,
.players-state-error .error {
    margin: 0;
}

.players-state-error .error {
    background: transparent;
    padding: 0;
}

.players-retry-btn,
.players-empty-add-btn {
    margin-top: 1rem;
}

.players-header,
.players-status,
.players-state {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.players-list {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bsa-surface);
}

.players-row {
    width: 100%;
    box-sizing: border-box;
    border-bottom: 1px solid var(--bsa-border);
}

.players-row:last-child {
    border-bottom: none;
}

.players-row-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    margin: 0;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.players-row-btn:hover:not(:disabled),
.players-row-btn:focus-visible {
    background: var(--bsa-surface-muted);
}

.players-row-btn:disabled {
    cursor: default;
    opacity: 0.7;
}

.players-jersey-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0 0.45rem;
    border-radius: 4px;
    background: var(--bsa-primary);
    color: var(--bsa-text-on-primary);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    flex: 0 0 auto;
}

.players-row-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--bsa-text);
    min-width: 0;
}

/*
  Modale Giocatori: stessa shell .users-modal (+ foundation .input/.field).
  Larghezza allineata alle modali Utenti/Categorie; edit con Elimina a sinistra.
*/
.players-modal {
    width: min(28rem, 100%);
}

.players-modal .players-modal-form .field:last-of-type {
    margin-bottom: 0.25rem;
}

/* Multi-select categorie in «Nuovo giocatore» (riusa .games-roster). */
.players-modal .players-categories {
    margin-top: 0.35rem;
    margin-bottom: 0.15rem;
}

.players-modal .users-modal-actions,
.players-modal .players-modal-actions-edit {
    margin-top: 1.15rem;
}

.players-modal-actions-edit {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.15rem;
    flex-wrap: wrap;
}

.players-modal-actions-right {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.btn-danger {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--bsa-primary);
    border-radius: 4px;
    background: var(--bsa-surface);
    color: var(--bsa-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-danger:hover:not(:disabled) {
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary-dark);
    border-color: var(--bsa-primary-dark);
}

.btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    color: var(--bsa-disabled-text);
    border-color: var(--bsa-disabled);
}

/* —— Statistiche catalogo (Admin) —— */

.page-stat-definitions .stat-defs-header h1 {
    margin-bottom: 0.35rem;
}

.page-stat-definitions .stat-defs-header .muted {
    margin-top: 0;
}

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

.stat-defs-header-text {
    flex: 1 1 16rem;
    min-width: 0;
}

.stat-defs-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.stat-defs-delete-all-btn {
    margin-top: 0;
    color: var(--bsa-primary-dark);
    border-color: var(--bsa-border);
}

.stat-defs-delete-all-btn:hover:not(:disabled) {
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary);
}

.stat-defs-add-btn {
    margin-top: 0;
}

.stat-defs-status {
    margin: 1.25rem 0 0;
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
}

.stat-defs-state {
    margin-top: 1.25rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.stat-defs-state-empty .stat-defs-empty-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.stat-defs-state-empty .muted,
.stat-defs-state-error .error {
    margin: 0;
}

.stat-defs-state-error .error {
    background: transparent;
    padding: 0;
}

.stat-defs-retry-btn,
.stat-defs-empty-add-btn {
    margin-top: 1rem;
}

.stat-defs-hint {
    margin: 1.15rem 0 0;
    font-size: 0.9rem;
    line-height: 1.45;
}

.stat-defs-list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
    overflow: visible;
    background: var(--bsa-surface);
}

.stat-defs-row {
    border-bottom: 1px solid var(--bsa-border);
}

.stat-defs-row:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.stat-defs-row:last-child {
    border-bottom: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.stat-defs-row-disabled {
    opacity: 0.62;
}

.stat-defs-action-error {
    margin: 0.85rem 0 0;
}

.stat-defs-reordering {
    margin: 0.85rem 0 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--bsa-text-muted);
}

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

@keyframes stat-defs-spin {
    to {
        transform: rotate(360deg);
    }
}

.stat-defs-list-locked {
    opacity: 0.85;
    pointer-events: none;
}

.stat-defs-row-body {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.8rem 1rem;
    flex-wrap: wrap;
    overflow: visible;
}

.stat-defs-reorder {
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 0 0 auto;
    margin-top: 0.1rem;
}

.stat-defs-reorder-btn {
    margin: 0;
    padding: 0.15rem 0.45rem;
    min-width: 2rem;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    background: var(--bsa-surface-muted);
    color: var(--bsa-text);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.stat-defs-reorder-btn:hover:not(:disabled),
.stat-defs-reorder-btn:focus-visible:not(:disabled) {
    border-color: var(--bsa-primary);
    color: var(--bsa-primary-dark);
}

.stat-defs-reorder-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.stat-defs-row-main {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: min(100%, 12rem);
    flex: 1 1 12rem;
    overflow: visible;
}

.stat-defs-row-label {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--bsa-text);
    overflow-wrap: anywhere;
}

.stat-defs-row-meta {
    font-size: 0.85rem;
    color: var(--bsa-text-muted);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.stat-defs-outcome-toggle {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    width: fit-content;
    min-width: 10.5rem;
    max-width: 100%;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    overflow: hidden; /* solo clip decorativo del segmented control */
    background: var(--bsa-surface-muted);
    box-sizing: border-box;
    flex: 0 0 auto;
}

.stat-defs-outcome-side {
    margin: 0;
    padding: 0.35rem 0.65rem;
    border: none;
    background: transparent;
    color: var(--bsa-text-muted);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.stat-defs-outcome-side-active {
    background: var(--bsa-surface);
    color: var(--bsa-primary-dark);
    box-shadow: inset 0 0 0 1px var(--bsa-border);
}

.stat-defs-outcome-side:hover:not(:disabled):not(.stat-defs-outcome-side-active),
.stat-defs-outcome-side:focus-visible:not(:disabled) {
    color: var(--bsa-text);
}

.stat-defs-outcome-side:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.stat-defs-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    flex: 0 0 auto;
    flex-wrap: wrap;
    margin-left: auto;
    overflow: visible;
}

.stat-defs-enable-icon-on {
    color: var(--bsa-primary);
}

.stat-defs-enable-busy {
    display: inline-block;
    min-width: 1rem;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1;
}

.stat-defs-locked {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 4px;
    color: var(--bsa-primary);
    border: 1px solid var(--bsa-primary);
    background: var(--bsa-surface);
    box-sizing: border-box;
}

.stat-defs-locked .svg-icon {
    width: 1.05rem;
    height: 1.05rem;
}

/*
  Modale Statistiche: stessa shell .users-modal (+ foundation .input/.field).
  Larghezza allineata alle modali Admin; form a un solo campo (label).
*/
.stat-defs-modal {
    width: min(28rem, 100%);
}

.stat-defs-modal .stat-defs-modal-form .field {
    margin-bottom: 0.25rem;
}

.stat-defs-modal .users-modal-actions {
    margin-top: 1.15rem;
}

.user-role-contributor {
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary-dark);
}

.user-role-report {
    background: #f0f0f0;
    color: var(--bsa-text-muted);
}

.user-role-tesserato {
    background: #e8eef5;
    color: var(--bsa-primary-dark);
}

.table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.list-table-wrap {
    display: block;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin-top: 1.25rem;
    border: 1px solid var(--bsa-border);
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: visible;
    background: var(--bsa-surface);
    box-shadow: 0 1px 0 rgba(168, 0, 14, 0.04), 0 8px 24px rgba(26, 26, 26, 0.04);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bsa-surface);
    font-size: 0.95rem;
    color: var(--bsa-text);
}

.list-table {
    width: 100%;
    min-width: 36rem;
    table-layout: auto;
}

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

.list-table th,
.list-table td {
    padding: 0.85rem 1rem;
}

.data-table thead th {
    font-weight: 650;
    color: var(--bsa-text);
    background: var(--bsa-surface-muted);
    border-bottom-color: var(--bsa-border);
}

.list-table thead th {
    color: var(--bsa-primary-dark);
    background: var(--bsa-surface-muted);
    border-bottom: 2px solid var(--bsa-border);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.list-table tbody tr {
    transition: background 0.12s ease;
}

.list-table tbody tr:hover td {
    background: rgba(168, 0, 14, 0.045);
}

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

.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.svg-icon {
    display: inline-flex;
    width: 1.15rem;
    height: 1.15rem;
    line-height: 0;
}

.svg-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--bsa-border);
    border-radius: 8px;
    background: var(--bsa-surface);
    color: var(--bsa-primary);
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.btn-icon:hover:not(:disabled) {
    background: var(--bsa-surface-muted);
    border-color: var(--bsa-primary);
    color: var(--bsa-primary-dark);
    box-shadow: 0 1px 4px rgba(168, 0, 14, 0.12);
}

.btn-icon:focus-visible {
    outline: 2px solid var(--bsa-primary);
    outline-offset: 2px;
}

.btn-icon:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    color: var(--bsa-disabled-text);
    border-color: var(--bsa-disabled);
}

.data-table .col-jersey,
.data-table .col-num {
    width: 5.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table .col-date {
    width: 7rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table .col-time {
    width: 4.5rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table .col-action {
    width: 4.5rem;
    text-align: right;
    white-space: nowrap;
}

.data-table .row-link,
.data-table .detail-link {
    color: var(--bsa-text);
    font-weight: 600;
    text-decoration: none;
}

.data-table .row-link:hover,
.data-table .detail-link:hover {
    text-decoration: underline;
}

.venue-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--bsa-surface-muted);
    color: var(--bsa-text);
}

.venue-badge.venue-home {
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary-dark);
}

.venue-badge.venue-away {
    background: var(--bsa-background);
    color: var(--bsa-text-muted);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page-stats {
    max-width: none;
}

.back-link {
    margin: 0 0 1rem;
}

.back-link a {
    color: var(--bsa-text);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
    color: var(--bsa-primary);
}

.game-detail-status {
    margin: 0.5rem 0 0;
    color: var(--bsa-text-muted);
}

.game-detail-state-error .error {
    background: transparent;
    padding: 0;
}

.game-detail-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.game-detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    background: var(--bsa-surface);
    border: 1.5px solid var(--bsa-border);
    border-radius: 6px;
    box-sizing: border-box;
}

.game-detail-meta {
    flex: 1 1 16rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.game-detail-datetime {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bsa-text-muted);
    text-transform: capitalize;
    line-height: 1.3;
}

.game-detail-opponent {
    margin: 0;
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--bsa-text);
}

.game-detail-chips {
    margin: 0.2rem 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

/* Pillole contesto partita: venue + stato, palette non solo brand-red */
.game-detail-pills {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.game-detail-pills > li {
    margin: 0;
    padding: 0;
}

.game-detail-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 1.85rem;
    padding: 0.2rem 0.7rem 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid transparent;
    box-sizing: border-box;
    font-size: 0.8125rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
}

.game-detail-pill-mark {
    flex: 0 0 auto;
    position: relative;
    width: 0.95rem;
    height: 0.95rem;
}

.game-detail-pill-label {
    min-width: 0;
}

/* In casa — caldo ambra / terracotta soft (campo proprio) */
.game-detail-pill--home {
    color: #6b3a12;
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
    border-color: #f0c49a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.game-detail-pill--home .game-detail-pill-mark::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 58%;
    width: 0.62rem;
    height: 0.42rem;
    transform: translate(-50%, -50%);
    border: 1.5px solid currentColor;
    border-top: none;
    border-radius: 0 0 2px 2px;
    box-sizing: border-box;
}

.game-detail-pill--home .game-detail-pill-mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 28%;
    width: 0.55rem;
    height: 0.55rem;
    transform: translate(-50%, -50%) rotate(45deg);
    border-left: 1.5px solid currentColor;
    border-top: 1.5px solid currentColor;
    box-sizing: border-box;
}

/* Fuori casa — slate freddo (trasferta) */
.game-detail-pill--away {
    color: #334155;
    background: linear-gradient(180deg, #f8fafc 0%, #e8eef5 100%);
    border-color: #c5d0dc;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.game-detail-pill--away .game-detail-pill-mark::before {
    content: "";
    position: absolute;
    left: 0.08rem;
    top: 50%;
    width: 0.55rem;
    height: 1.5px;
    transform: translateY(-50%);
    background: currentColor;
    border-radius: 1px;
}

.game-detail-pill--away .game-detail-pill-mark::after {
    content: "";
    position: absolute;
    right: 0.08rem;
    top: 50%;
    width: 0.38rem;
    height: 0.38rem;
    transform: translateY(-50%) rotate(45deg);
    border-right: 1.5px solid currentColor;
    border-top: 1.5px solid currentColor;
    box-sizing: border-box;
}

/* Finita — sage/verde oliva calmo (chiusura, non allarme) */
.game-detail-pill--finished {
    color: #2f5d3a;
    background: linear-gradient(180deg, #f3faf4 0%, #dcefe0 100%);
    border-color: #a8cbb2;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.game-detail-pill--finished .game-detail-pill-mark::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.72rem;
    height: 0.72rem;
    transform: translate(-50%, -50%);
    border: 1.5px solid currentColor;
    border-radius: 50%;
    box-sizing: border-box;
}

.game-detail-pill--finished .game-detail-pill-mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 48%;
    width: 0.28rem;
    height: 0.16rem;
    transform: translate(-55%, -60%) rotate(-45deg);
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    box-sizing: border-box;
}

/* In corso — teal vivo, non rosso */
.game-detail-pill--progress {
    color: #0f5c66;
    background: linear-gradient(180deg, #f0fbfc 0%, #d5f0f3 100%);
    border-color: #9ed4db;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.game-detail-pill--progress .game-detail-pill-mark::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.42rem;
    height: 0.42rem;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(15, 92, 102, 0.16);
}

.game-detail-actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    min-width: 0;
}

.game-detail-actions .error {
    margin: 0;
    text-align: right;
    max-width: 18rem;
}

.game-detail-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem 0.65rem;
}

.game-detail-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    margin: 0;
    padding: 0;
    border: 1.5px solid var(--bsa-border);
    border-radius: 999px;
    background: var(--bsa-surface);
    color: var(--bsa-primary);
    font: inherit;
    text-decoration: none;
    box-sizing: border-box;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.game-detail-download:hover {
    background: var(--bsa-surface-muted);
    border-color: var(--bsa-primary);
    color: var(--bsa-primary-dark);
}

.game-detail-download:focus-visible {
    outline: 2px solid var(--bsa-primary);
    outline-offset: 2px;
}

.game-detail-download-icon {
    display: block;
    flex-shrink: 0;
}

.btn-brand-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    min-width: 8rem;
    padding: 0.5rem 1.1rem;
    border: 2px solid var(--bsa-primary);
    border-radius: 6px;
    background: var(--bsa-surface);
    color: var(--bsa-primary);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.12s ease, color 0.12s ease;
}

.btn-brand-outline:hover {
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary-dark);
}

.btn-brand-outline:focus-visible {
    outline: 2px solid var(--bsa-primary);
    outline-offset: 2px;
}

.btn-secondary {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    background: var(--bsa-surface);
    color: var(--bsa-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--bsa-surface-muted);
}

.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    color: var(--bsa-disabled-text);
    border-color: var(--bsa-disabled);
}

@media (max-width: 640px) {
    .game-detail-header {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 0.85rem;
    }

    .game-detail-actions {
        align-items: stretch;
        width: 100%;
    }

    .game-detail-actions .error {
        text-align: left;
        max-width: none;
    }

    .game-detail-toolbar {
        justify-content: space-between;
    }

    .btn-brand-outline {
        width: 100%;
    }
}

/* Griglia stats dettaglio — layout stile tablet StatsGrid (sola lettura) */
.stats-grid-section {
    margin: 0 0 0.5rem;
}

.stats-grid-hint {
    margin: 0 0 0.55rem;
    padding: 0 0.15rem;
    font-size: 0.8125rem;
    color: var(--bsa-text-muted);
    line-height: 1.35;
}

.stats-grid-empty {
    margin: 0.75rem 0 1rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.stats-grid-empty-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.stats-grid-empty .muted {
    margin: 0;
}

.stats-grid-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.35rem;
}

.tablet-stats-grid {
    border-collapse: separate;
    border-spacing: 0.375rem 0.375rem;
    min-width: 36rem;
    width: max-content;
    max-width: none;
    background: transparent;
}

.tablet-stats-grid th,
.tablet-stats-grid td {
    margin: 0;
    padding: 0;
    border: none;
    vertical-align: middle;
    font-weight: 400;
}

.tablet-stats-grid thead .tsg-player-col,
.tablet-stats-grid thead .tsg-stat-col {
    min-height: 4.25rem;
    padding: 0.4rem 0.35rem;
    background: var(--bsa-surface-muted);
    border: 1.5px solid var(--bsa-border);
    border-radius: 4px;
    box-sizing: border-box;
    vertical-align: bottom;
}

.tablet-stats-grid .tsg-player-col {
    width: 11.75rem;
    min-width: 11.75rem;
    max-width: 13rem;
    padding: 0.4rem 0.55rem;
    text-align: left;
    background: var(--bsa-surface);
    border: 1.5px solid var(--bsa-border);
    border-radius: 4px;
    box-sizing: border-box;
}

.tablet-stats-grid .tsg-player-col.tsg-on-court {
    border-color: var(--bsa-primary);
    background: var(--bsa-surface-muted);
}

.tablet-stats-grid .tsg-jersey {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--bsa-primary);
    line-height: 1.2;
}

.tablet-stats-grid .tsg-player-name {
    display: block;
    font-size: 0.8125rem;
    color: var(--bsa-text);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tablet-stats-grid thead .tsg-stat-label {
    display: -webkit-box;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    color: var(--bsa-text);
    max-width: 5rem;
    margin: 0 auto;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.tablet-stats-grid .tsg-stat-col {
    width: 5rem;
    min-width: 5rem;
    text-align: center;
}

.tablet-stats-grid .tsg-stat-cell {
    height: 3.75rem;
    background: var(--bsa-surface);
    border: 1.5px solid var(--bsa-border);
    border-radius: 4px;
    box-sizing: border-box;
}

.tablet-stats-grid .tsg-stat-cell.tsg-cell-active {
    border-color: var(--bsa-primary);
    background: var(--bsa-surface-muted);
}

.tablet-stats-grid .tsg-cell-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--bsa-text-muted);
}

.tablet-stats-grid .tsg-cell-active .tsg-cell-value {
    color: var(--bsa-primary);
    font-weight: 700;
}

.tablet-stats-grid .tsg-muted {
    opacity: 0.85;
    border-color: var(--bsa-disabled);
    background: var(--bsa-background-solid);
}

.tablet-stats-grid .tsg-muted .tsg-cell-value,
.tablet-stats-grid .tsg-muted .tsg-stat-label {
    color: var(--bsa-disabled-text);
}

.tablet-stats-grid .tsg-bench-sep td {
    padding: 0.55rem 0.15rem;
    background: transparent;
    border: none;
}

.tablet-stats-grid .tsg-bench-inner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
}

.tablet-stats-grid .tsg-bench-line {
    flex: 1 1 auto;
    height: 2px;
    background: var(--bsa-border);
    border-radius: 1px;
}

.tablet-stats-grid .tsg-bench-label {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bsa-text-muted);
    padding: 0 0.25rem;
}

.tablet-stats-grid .tsg-total-player {
    background: var(--bsa-surface-muted);
    border: 2px solid var(--bsa-primary);
    font-size: 1rem;
    font-weight: 800;
    color: var(--bsa-primary);
}

.tablet-stats-grid .tsg-total-cell {
    height: 3.75rem;
    background: var(--bsa-surface-muted);
    border: 2px solid var(--bsa-primary);
    border-radius: 4px;
    box-sizing: border-box;
}

.tablet-stats-grid .tsg-total-cell .tsg-cell-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--bsa-primary);
}

.tablet-stats-grid .tsg-total-cell.tsg-muted {
    border-color: var(--bsa-disabled);
    background: var(--bsa-background-solid);
}

.tablet-stats-grid .tsg-total-cell.tsg-muted .tsg-cell-value {
    color: var(--bsa-disabled-text);
}

.game-report-hint {
    margin: 0 0 1rem;
    font-size: 0.8125rem;
    line-height: 1.35;
}

/* Filtro giocatore in cima al report (come tablet GameReportPlayerFilter) */
.game-report-player-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin: 0 0 1rem;
    padding: 0.75rem 0.9rem;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.game-report-player-filter-caption {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--bsa-text-muted);
}

.game-report-player-filter-select {
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 28rem;
    min-height: 2.5rem;
    padding: 0.4rem 0.65rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bsa-text);
    background: var(--bsa-surface);
    border: 1.5px solid var(--bsa-border);
    border-radius: 4px;
}

.game-report-player-filter-select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.game-report-player-filter-hint {
    flex: 1 1 100%;
    margin: 0;
    font-size: 0.8125rem;
}

/* Report stacked Q1–Q4 + Partita intera */
.game-report-stack {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    margin: 0 0 1rem;
}

.game-report-quarter {
    padding: 1rem 1.1rem 1.15rem;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.game-report-full {
    border-color: var(--bsa-primary);
}

/* Convocati a fine report (dopo Partita intera) */
.game-report-roster {
    padding: 1rem 1.1rem 1.15rem;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.game-report-roster-title {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--bsa-primary);
    line-height: 1.2;
}

.game-report-roster-count {
    margin: 0 0 0.65rem;
    font-size: 0.8125rem;
}

.game-report-roster-group-heading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.55rem 0 0.4rem;
}

.game-report-roster-group-line {
    flex: 1;
    height: 1px;
    background: var(--bsa-border);
}

.game-report-roster-group-label {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bsa-text-muted);
}

.game-report-roster-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.game-report-roster-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    background: var(--bsa-surface-muted);
}

.game-report-roster-row-on-court {
    border-color: var(--bsa-primary);
    background: var(--bsa-surface);
}

.game-report-roster-jersey {
    min-width: 2.5rem;
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--bsa-primary);
}

.game-report-roster-name {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--bsa-text);
}

.game-report-roster-empty {
    margin-top: 0.35rem;
}

.game-report-roster-empty-title {
    margin: 0 0 0.25rem;
    font-weight: 700;
    color: var(--bsa-text);
}

.game-report-quarter-title {
    margin: 0 0 0.85rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--bsa-primary);
    line-height: 1.2;
}

/* Accordion sezione periodo (Primo–Quarto / Partita intera) — default chiuso */
.report-section-accordion {
    margin: 0;
}

.report-section-toggle {
    margin: 0 0 0.85rem;
    gap: 0.65rem;
}

.report-section-accordion:not([open]) > .report-section-toggle {
    margin-bottom: 0;
}

.report-section-title {
    margin: 0;
    flex: 0 1 auto;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
}

.report-section-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.game-report-events {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 2px solid var(--bsa-border);
}

.game-report-events-heading {
    margin: 0 0 0.55rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--bsa-text);
}

/* Accordion report (stats / eventi) — schema come mobile */
.report-accordion {
    margin: 0 0 0.55rem;
}

/*
  Nested <details>: all’apertura del parent (sezione periodo) il pannello del figlio
  chiuso (es. .report-events-panel) può restare in layout finché non si toggola.
  Nascondere esplicitamente i non-summary a schermo; @media print riapre con !important.
*/
.report-accordion:not([open]) > *:not(summary) {
    display: none;
}

.report-accordion-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    list-style: none;
    cursor: pointer;
    min-height: 2.75rem;
    padding: 0.4rem 0.65rem;
    /* Neutro report (parità mobile REPORT_MUTED); non usare --bsa-surface-muted rosa */
    background: #F3F4F6;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    box-sizing: border-box;
    user-select: none;
}

/*
  Sezione periodo (Primo–Quarto / Partita intera): dopo .report-accordion-toggle
  così lo sfondo rosso non viene sovrascritto dal grigio neutro.
*/
.report-accordion-toggle.report-section-toggle {
    background: rgba(168, 0, 14, 0.88);
    border-color: rgba(138, 0, 0, 0.55);
}

.report-accordion-toggle.report-section-toggle .report-section-title,
.report-accordion-toggle.report-section-toggle .game-report-quarter-title,
.report-accordion-toggle.report-section-toggle .report-accordion-hint,
.report-accordion-toggle.report-section-toggle .report-accordion-chevron {
    color: var(--bsa-text-on-primary);
}

.report-accordion-toggle::-webkit-details-marker {
    display: none;
}

.report-accordion-title {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--bsa-primary);
    line-height: 1.2;
}

.report-accordion-hint {
    flex: 1 1 auto;
    font-size: 0.8125rem;
    color: var(--bsa-text-muted);
    line-height: 1.2;
}

.report-accordion-chevron {
    flex: 0 0 auto;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--bsa-primary);
    padding: 0 0.25rem;
}

.report-accordion:not([open]) .report-accordion-hint-open,
.report-accordion:not([open]) .report-accordion-chevron-open {
    display: none;
}

.report-accordion[open] .report-accordion-hint-closed,
.report-accordion[open] .report-accordion-chevron-closed {
    display: none;
}

/* Stats: giocatori solo a accordion aperto; Totale sempre visibile */
.report-stats-accordion:not(:has(.report-accordion[open])) .report-stats-players {
    display: none;
}

/* Modalità team: header statico (niente accordion giocatori) */
.report-stats-team-header {
    cursor: default;
    margin: 0 0 0.55rem;
}

/* Angolo thead vuoto in modalità team (niente label «Squadra»). */
.tablet-stats-grid thead .tsg-corner-col {
    color: transparent;
    user-select: none;
}

/*
  Report web: fill neutri su griglia stats (parità mobile #F3F4F6).
  Override solo nel contesto .report-stats-accordion — token root e menu invariati.
*/
.report-stats-accordion .tablet-stats-grid thead .tsg-player-col,
.report-stats-accordion .tablet-stats-grid thead .tsg-stat-col {
    background: #F3F4F6;
}

.report-stats-accordion .tablet-stats-grid .tsg-player-col.tsg-on-court {
    background: #F3F4F6;
}

.report-stats-accordion .tablet-stats-grid .tsg-stat-cell.tsg-cell-active {
    background: #F3F4F6;
}

.report-stats-accordion .tablet-stats-grid .tsg-muted {
    background: #F3F4F6;
}

.report-stats-accordion .tablet-stats-grid .tsg-total-player,
.report-stats-accordion .tablet-stats-grid .tsg-total-cell {
    background: #F3F4F6;
}

.report-stats-accordion .tablet-stats-grid .tsg-total-cell.tsg-muted {
    background: #F3F4F6;
}

.report-events-panel {
    margin-top: 0.55rem;
}

.game-report-kpi-block {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 2px solid var(--bsa-border);
}

.game-report-kpi-heading {
    margin: 0 0 0.55rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--bsa-text);
    line-height: 1.2;
}

/* Heatmap canestri (team) — due campi affiancati made/miss; allineata al mobile */
.game-report-heatmap {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 2px solid var(--bsa-border);
}

.game-report-heatmap-heading {
    margin: 0 0 0.55rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--bsa-text);
    line-height: 1.2;
}

.game-report-heatmap-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin: 0 0 0.55rem;
    font-size: 0.75rem;
    color: var(--bsa-text-muted);
}

.game-report-heatmap-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.game-report-heatmap-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    border: 1px solid var(--bsa-surface);
    box-sizing: border-box;
}

.game-report-heatmap-dot-fg2 {
    background: var(--bsa-primary);
}

.game-report-heatmap-dot-fg3 {
    background: #1A5F7A;
}

.game-report-heatmap-panels {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.55rem;
}

.game-report-heatmap-panel {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.game-report-heatmap-panel-title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--bsa-text);
    text-align: center;
    line-height: 1.2;
}

@media (max-width: 36rem) {
    .game-report-heatmap-panels {
        flex-direction: column;
    }
}

.game-report-court-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 7.5rem;
    max-height: 11.25rem;
    padding: 0.35rem;
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
    /* Frame campo neutro (parità mobile courtFrame → surface bianco) */
    background: var(--bsa-surface);
    overflow: hidden;
    box-sizing: border-box;
}

.game-report-court-box {
    position: relative;
    width: min(100%, calc(11.25rem * 639 / 599));
    max-height: 100%;
}

.game-report-court-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

.game-report-court-marker {
    position: absolute;
    width: 0.875rem;
    height: 0.875rem;
    margin: 0;
    border-radius: 50%;
    border: 2px solid var(--bsa-surface);
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    opacity: 0.9;
    pointer-events: none;
}

.game-report-court-marker-made.game-report-court-marker-fg2 {
    background: var(--bsa-primary);
}

.game-report-court-marker-made.game-report-court-marker-fg3 {
    background: #1A5F7A;
}

.game-report-court-marker-miss {
    background: transparent;
    border-width: 2.5px;
    opacity: 0.95;
}

.game-report-court-marker-miss.game-report-court-marker-fg2 {
    border-color: var(--bsa-primary);
}

.game-report-court-marker-miss.game-report-court-marker-fg3 {
    border-color: #1A5F7A;
}

/* Footer KPI sotto Totale (allineato a MatchKpiFooter tablet) */
.match-kpi-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.55rem;
    margin: 0.65rem 0 0;
    padding-top: 0.65rem;
    border-top: 2px solid var(--bsa-border);
}

.match-kpi-footer-section {
    margin: 0;
    padding-top: 0;
    border-top: none;
}

.match-kpi-empty {
    margin: 0;
    width: 100%;
    padding: 0.65rem 0.7rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bsa-text-muted);
    background: var(--bsa-surface-muted);
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    text-align: center;
}

.match-kpi-item {
    flex: 1 1 10rem;
    min-width: 9rem;
    padding: 0.55rem 0.7rem;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    box-sizing: border-box;
}

.match-kpi-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--bsa-text-muted);
}

.match-kpi-value {
    display: block;
    margin-top: 0.15rem;
    font-size: 1.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: var(--bsa-primary);
}

.events-section {
    margin-top: 2rem;
}

.events-section h2 {
    font-size: 1.15rem;
    font-weight: 650;
    margin: 0 0 0.35rem;
}

.events-section .events-hint {
    margin-bottom: 0.75rem;
}

/* Timeline eventi report: altezza = somma righe; niente max-height / scroll interno
   (scroll solo della pagina; accordion Eventi espande nel flusso). */
.events-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: none;
    overflow: visible;
}

.events-timeline-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.75rem;
    padding: 0.65rem 0.9rem;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
}

/* Bordo sinistro esito (come mobile GameReportQuarterEvents) — solo border-left */
.events-timeline-row--vincenti {
    border-left-width: 4px;
    border-left-color: #1B7A3D;
}

.events-timeline-row--perdenti {
    border-left-width: 4px;
    border-left-color: var(--bsa-primary);
}

.etl-quarter {
    flex: 0 0 auto;
    min-width: 2.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--bsa-primary);
}

.etl-stat {
    flex: 1 1 8rem;
    min-width: 6rem;
}

.etl-stat-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bsa-text);
    line-height: 1.25;
}

.etl-player {
    flex: 0 1 auto;
    margin-left: auto;
    max-width: 40%;
    font-size: 0.9375rem;
    font-weight: 600;
    text-align: right;
    color: var(--bsa-text);
}

.events-timeline-empty {
    margin: 0.5rem 0 0;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 6px;
}

.events-timeline-empty-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--bsa-text);
}

.events-timeline-empty .muted {
    margin: 0;
}

@media (max-width: 640px) {
    .etl-player {
        margin-left: 0;
        max-width: none;
        width: 100%;
        text-align: left;
    }
}

.section-links {
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

.section-links a {
    color: var(--bsa-text);
    font-weight: 600;
    text-decoration: none;
}

.section-links a:hover {
    text-decoration: underline;
    color: var(--bsa-primary);
}

/* Login anonimo: brand BSA senza dipendere dalla shell autenticata */
.login {
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(ellipse 80% 55% at 50% -10%, rgba(168, 0, 14, 0.18), transparent 70%),
        var(--bsa-background-solid);
}

.login-panel {
    width: 100%;
    max-width: 26rem;
    padding: 2rem 1.75rem 1.75rem;
    background: var(--bsa-surface);
    border: 1px solid var(--bsa-border);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(168, 0, 14, 0.08);
}

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

.login-marks {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.login-mark {
    display: block;
    object-fit: contain;
    /* Line-art → rosso brand (come tint tablet) */
    filter: brightness(0) saturate(100%) invert(12%) sepia(94%) saturate(4800%) hue-rotate(346deg) brightness(0.85);
}

.login-mark-leone {
    width: 4.5rem;
    height: 4.5rem;
}

.login-mark-bsa {
    width: 5.5rem;
    height: 5.5rem;
}

.login-title {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 0.35rem;
    color: var(--bsa-text);
}

.login-subtitle {
    margin: 0 0 0.65rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bsa-primary);
    line-height: 1.3;
}

.login .lead {
    margin: 0;
    color: var(--bsa-text-muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.login .error {
    margin: 0 0 1rem;
    padding: 0.65rem 0.75rem;
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary-dark);
    border-radius: 4px;
    font-size: 0.95rem;
}

.login-form .field {
    margin-bottom: 1rem;
}

.login-form label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--bsa-text);
}

.login-form .input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--bsa-border);
    border-radius: 4px;
    font: inherit;
    background: var(--bsa-surface);
    color: var(--bsa-text);
}

.login-form .input:focus {
    outline: 2px solid var(--bsa-primary);
    outline-offset: 1px;
    border-color: var(--bsa-primary);
}

.login-form .validation-message {
    display: block;
    margin-top: 0.25rem;
    color: var(--bsa-primary-dark);
    font-size: 0.85rem;
}

.login-form .field-remember {
    margin-bottom: 0.85rem;
}

.login-form .remember-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-weight: 500;
    cursor: pointer;
}

.login-form .remember-checkbox {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--bsa-primary);
    cursor: pointer;
}

.login-submit {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.7rem 1.1rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: 6px;
    background: var(--bsa-primary);
    color: var(--bsa-text-on-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--bsa-primary-dark);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bsa-disabled);
    color: var(--bsa-disabled-text);
}

#blazor-error-ui {
    background: var(--bsa-surface-muted);
    color: var(--bsa-primary-dark);
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(168, 0, 14, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--bsa-primary);
    padding: 1rem;
    color: var(--bsa-text-on-primary);
}

/* PDF (printGameReport): landscape, contenuto adattato in orizzontale, senza chrome */
@page {
    size: landscape;
    margin: 0.6cm;
}

@media print {
    .no-print,
    .app-header,
    .app-sidebar,
    .back-link,
    .game-detail-actions,
    .game-report-hint,
    .game-report-player-filter,
    #blazor-error-ui,
    .blazor-error-boundary {
        display: none !important;
    }

    .app-shell,
    .app-body,
    .app-content {
        display: block;
        min-height: 0;
        background: #fff;
        color: #000;
    }

    .app-content {
        padding: 0 !important;
    }

    .page-stats {
        max-width: none;
        width: 100%;
    }

    /* Flex ignora page-break: in stampa usa blocco così i salti pagina funzionano. */
    .game-report-stack {
        display: block !important;
        gap: 0;
    }

    .game-report-quarter,
    details.report-section-accordion,
    .report-section-body {
        display: block !important;
    }

    .game-detail-header {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
    }

    /* Accordion sezione/stats/eventi: forza contenuto visibile anche se chiusi */
    details.report-accordion > *:not(summary) {
        display: block !important;
    }

    /*
      Sezioni periodo: in stampa print-report.js sostituisce <details> con
      .report-section-print-wrap (header+body). Nuova pagina prima di Q2–Q4
      e Partita intera sull’intero article.
    */
    .report-section-print-wrap {
        display: block !important;
    }

    .report-section-print-header {
        display: block !important;
        margin-bottom: 0.85rem;
        break-after: avoid !important;
        page-break-after: avoid !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .report-section-print-header .report-accordion-hint,
    .report-section-print-header .report-accordion-chevron {
        display: none !important;
    }

    .report-section-print-wrap > .report-section-body {
        display: block !important;
        break-before: avoid !important;
        page-break-before: avoid !important;
    }

    .game-report-quarter--q2,
    .game-report-quarter--q3,
    .game-report-quarter--q4,
    .game-report-full {
        break-before: page !important;
        page-break-before: always !important;
    }

    /* Griglia totali: adatta tutta la larghezza landscape, niente taglio a destra */
    .stats-grid-scroll {
        overflow: visible !important;
        width: 100%;
        max-width: 100%;
        padding-bottom: 0;
    }

    .tablet-stats-grid {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        table-layout: fixed;
        border-spacing: 0.2rem 0.2rem;
    }

    .tablet-stats-grid .tsg-player-col {
        width: 8%;
        min-width: 0;
        max-width: none;
        padding: 0.25rem 0.3rem;
        font-size: 0.7rem;
    }

    .tablet-stats-grid .tsg-stat-col,
    .tablet-stats-grid .tsg-stat-cell,
    .tablet-stats-grid .tsg-total-cell {
        width: auto;
        min-width: 0;
        height: auto;
        padding: 0.2rem 0.1rem;
    }

    .tablet-stats-grid thead .tsg-stat-label {
        max-width: none;
        font-size: 0.55rem;
        line-height: 1.1;
        -webkit-line-clamp: 2;
    }

    .tablet-stats-grid .tsg-cell-value,
    .tablet-stats-grid .tsg-total-cell .tsg-cell-value {
        font-size: 0.75rem;
    }

    .tablet-stats-grid .tsg-jersey {
        font-size: 0.7rem;
    }

    .tablet-stats-grid .tsg-player-name {
        font-size: 0.6rem;
    }

    .report-stats-accordion .report-stats-players {
        display: table-row-group !important;
    }

    .report-accordion-hint-closed,
    .report-accordion-chevron-closed {
        display: none !important;
    }

    .report-accordion-hint-open,
    .report-accordion-chevron-open {
        display: inline !important;
    }

    .report-section-toggle {
        margin-bottom: 0.85rem;
    }

    /* Quarto: non bloccare l’intero blocco (altrimenti il browser spezza
       heatmap/eventi a metà quando supera una pagina). */
    .game-report-kpi-block,
    .game-report-roster {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .game-report-heatmap {
        break-inside: avoid;
        page-break-inside: avoid;
        break-before: auto;
    }

    .game-report-heatmap-panels,
    .game-report-heatmap-panel,
    .game-report-court-frame {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Stampa: niente fill rosa su tabelle/campi (stessi neutri del viewport) */
    .report-accordion-toggle,
    .report-stats-accordion .tablet-stats-grid thead .tsg-player-col,
    .report-stats-accordion .tablet-stats-grid thead .tsg-stat-col,
    .report-stats-accordion .tablet-stats-grid .tsg-player-col.tsg-on-court,
    .report-stats-accordion .tablet-stats-grid .tsg-stat-cell.tsg-cell-active,
    .report-stats-accordion .tablet-stats-grid .tsg-muted,
    .report-stats-accordion .tablet-stats-grid .tsg-total-player,
    .report-stats-accordion .tablet-stats-grid .tsg-total-cell,
    .report-stats-accordion .tablet-stats-grid .tsg-total-cell.tsg-muted {
        background: #F3F4F6 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Sezione periodo: mantiene rosso/bianco anche in stampa/PDF */
    .report-accordion-toggle.report-section-toggle,
    .report-section-print-header {
        background: rgba(168, 0, 14, 0.88) !important;
        border: 1px solid rgba(138, 0, 0, 0.55) !important;
        border-radius: 4px;
        padding: 0.4rem 0.65rem;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .report-accordion-toggle.report-section-toggle .report-section-title,
    .report-accordion-toggle.report-section-toggle .game-report-quarter-title,
    .report-accordion-toggle.report-section-toggle .report-accordion-hint,
    .report-accordion-toggle.report-section-toggle .report-accordion-chevron,
    .report-section-print-header .report-section-title,
    .report-section-print-header .game-report-quarter-title {
        color: #fff !important;
    }

    .game-report-court-frame {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Cronologia eventi: righe più basse; non spezzare una riga tra pagine */
    .events-timeline {
        gap: 0.12rem;
        display: block;
    }

    .events-timeline-row {
        display: flex;
        gap: 0.2rem 0.45rem;
        padding: 0.18rem 0.5rem;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .game-report-events-heading,
    .report-events-accordion > .report-accordion > summary {
        break-after: avoid;
        page-break-after: avoid;
    }

    .etl-quarter {
        font-size: 0.75rem;
        line-height: 1.15;
    }

    .etl-stat-label {
        font-size: 0.8125rem;
        line-height: 1.15;
    }

    .etl-player {
        font-size: 0.75rem;
        line-height: 1.15;
    }

    a {
        text-decoration: none;
        color: inherit;
    }
}
