/* =========================================================
   Reset e base
   ========================================================= */

html, body {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
}

h1:focus { outline: none; }

/* =========================================================
   Layout applicazione (MainLayout)
   ========================================================= */

.app-shell {
    display: flex;
    align-items: flex-start;
}

.app-main {
    flex: 1;
    min-width: 0;
    background: #f8fafc;
    min-height: 100vh;
}

.app-content {
    padding: 2rem 2.5rem;
}

/* =========================================================
   Sidebar (NavMenu)
   ========================================================= */

.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0 0 0;
    overflow: hidden;
    z-index: 100;
    transition: width 0.2s ease, min-width 0.2s ease;
}

/* ── Sidebar collassata ──────────────────────────────────── */
.sidebar--collapsed {
    width: 64px;
    min-width: 64px;
}

.sidebar--collapsed .sidebar-logo {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar--collapsed .sidebar-logo-text {
    display: none;
}

.sidebar--collapsed .nav-item {
    justify-content: center;
    padding: 0.65rem;
    gap: 0;
}

.sidebar--collapsed .nav-item span {
    display: none;
}

.sidebar--collapsed .nav-item i {
    width: auto;
}

.sidebar--collapsed .sidebar-footer {
    flex-direction: column;
    align-items: center;
    padding: 1rem 0;
    gap: 0.5rem;
}

.sidebar--collapsed .sidebar-user {
    flex: 0 0 auto;
    padding: 0.35rem;
    justify-content: center;
    gap: 0;
}

.sidebar--collapsed .user-info {
    display: none;
}

/* ── Bottone collapse ────────────────────────────────────── */
.sidebar-nav-spacer {
    flex: 1;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

.sidebar-toggle-btn.active {
    background: none !important;
    color: rgba(255, 255, 255, 0.3) !important;
}

/* Impianto attivo */
.sidebar-impianto {
    padding: 0.6rem 1.25rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-impianto-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 0.3rem;
    padding-left: 0.1rem;
}

.sidebar-impianto-nome {
    color: #cbd5e1;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Radzen dropdown — box chiuso
   La classe sidebar-impianto-select è sul MEDESIMO elemento .rz-dropdown, non su un genitore */
.rz-dropdown.sidebar-impianto-select {
    background: #1d2537 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    width: 100%;
}

.rz-dropdown.sidebar-impianto-select:hover {
    border-color: rgba(255, 255, 255, 0.3) !important;
    background: #1d2537 !important;
}

.rz-dropdown.sidebar-impianto-select .rz-inputtext {
    background: transparent !important;
    color: #cbd5e1 !important;
    font-size: 0.82rem;
}

.rz-dropdown.sidebar-impianto-select .rz-dropdown-trigger {
    color: #64748b !important;
}

.sidebar-impianto-loading {
    min-height: 1.5rem;
    display: flex;
    align-items: center;
}

/* Radzen dropdown — panel popup (overlay, scopato via DropDownCssClass) */
.sidebar-impianto-dropdown-panel {
    background: #1d2537 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.sidebar-impianto-dropdown-panel .rz-dropdown-list {
    background: #1d2537;
}

.sidebar-impianto-dropdown-panel .rz-dropdown-item {
    color: #cbd5e1;
    background: #1d2537;
}

.sidebar-impianto-dropdown-panel .rz-dropdown-item:hover,
.sidebar-impianto-dropdown-panel .rz-dropdown-item.rz-state-hover {
    background: #263448;
    color: #e2e8f0;
}

.sidebar-impianto-dropdown-panel .rz-dropdown-item.rz-state-highlight {
    background: #1e3a5f;
    color: #e2e8f0;
}

.sidebar--collapsed .sidebar-impianto {
    display: none;
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem 1.75rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-logo-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo-icon svg { width: 22px; height: 22px; }
.sidebar-logo-icon i  { font-size: 1.15rem; color: white; }

.sidebar-logo-text {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.2px;
}

/* Voci di navigazione */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.25rem 0.75rem 0 0.75rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.875rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

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

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* Icone FA nella sidebar */
.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.logout-btn i { font-size: 0.95rem; }

/* Footer: utente + logout */
.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.625rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s;
    color: white;
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
}

.sidebar-user.active {
    background: rgba(59, 130, 246, 0.15);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.8375rem;
    font-weight: 600;
    color: black;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-form {
    display: flex;
}

.logout-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* =========================================================
   Errore Blazor
   ========================================================= */

#blazor-error-ui {
    color-scheme: light only;
    background: #fef3c7;
    border-top: 1px solid #f59e0b;
    bottom: 0;
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.875rem;
    color: #92400e;
}

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

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

/* =========================================================
   Stili comuni pagine applicative
   ========================================================= */

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

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.3px;
}

.page-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

.placeholder-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem;
    background: white;
    border-radius: 14px;
    border: 1px dashed #cbd5e1;
    color: #94a3b8;
    max-width: 400px;
}

.placeholder-box svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.placeholder-box p {
    margin: 0;
    font-size: 0.95rem;
}

/* =========================================================
   Pagine auth (Login, Register, ConfirmEmail) — layout
   ========================================================= */

.auth-wrapper {
    display: flex;
    min-height: 100vh;
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.home-button {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 18px;

    &:hover {
        background: white;
        color: #0a1628;
    }
}

.left-container {
    flex-direction: column;
    justify-content: space-between;
    display: flex;
    background: linear-gradient(150deg, #0a1628 0%, #0d2341 40%, #0c3560 75%, #0b4a8a 100%);
    flex: 0 0 48%;
    overflow: hidden;
}

/* Panel sinistro — branding */
.brand-panel {
    padding-top: 0px !important;
    padding: 3.5rem;
    color: white;
    position: relative;
}

/* Cerchi decorativi */
.brand-panel::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.brand-panel::after {
    content: '';
    position: absolute;
    bottom: -160px;
    left: -80px;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.brand-body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

/* Icona brand */
.brand-icon {
    width: 68px;
    height: 68px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.brand-icon svg {
    width: 36px;
    height: 36px;
}

/* Nome app */
.brand-name {
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: -0.75px;
    color: white;
    margin: 0 0 0.875rem 0;
    line-height: 1.1;
}

/* Tagline */
.brand-tagline {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 360px;
    line-height: 1.65;
    margin: 0 0 2.5rem 0;
}

/* Feature list */
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.55);
}

.feature-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #38bdf8;
    flex-shrink: 0;
}

/* Copyright */
.brand-copyright {
    position: relative;
    z-index: 1;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
    margin: 0;
}

/* Panel destro — form */
.form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: #f8fafc;
}

.form-card {
    width: 100%;
    max-width: 420px;
}

/* Report — avviso nessun conteggio */ 
.report-no-conteggi {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    font-size: 0.875rem;
    color: #92400e;
    margin-top: 1rem;
}

.report-no-conteggi i {
    color: #f59e0b;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Pagina conferma email */ 
.confirm-icon {
    font-size: 3rem;
    color: #4f8ef7;
    margin-bottom: 1rem;
}

.confirm-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: #f0f4ff;
    border: 1px solid #c7d7fc;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 1.5rem;
}

.confirm-hint i {
    color: #4f8ef7;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Header form */
.form-header {
    margin-bottom: 2rem;
}

.form-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.375rem 0;
    letter-spacing: -0.3px;
}

.form-header p {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

/* Alert */
.alert {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #16a34a;
}

/* Campi */
.field-group {
    margin-bottom: 1.1rem;
}

.field-group label {
    display: block;
    font-size: 0.8375rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.4rem;
}

.field-input {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9375rem;
    color: #0f172a;
    background: white;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.field-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.field-input::placeholder {
    color: #94a3b8;
}

.field-error {
    display: block;
    font-size: 0.8rem;
    color: #ef4444;
    margin-top: 0.3rem;
}

/* Riga Ricordami / Password dimenticata */
.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.remember-check {
    width: 15px;
    height: 15px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.link-subtle {
    font-size: 0.875rem;
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
}

.link-subtle:hover {
    color: #3b82f6;
}

/* Wrapper campo password con occhio */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .field-input {
    padding-right: 2.75rem;
}

.eye-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
    line-height: 1;
}

.eye-btn:hover {
    color: #374151;
}

/* Checklist requisiti password */
.pw-rules {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.pw-rule {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

.pw-icon {
    font-size: 0.75rem;
    font-weight: 700;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.pw-err { color: #ef4444; }
.pw-ok  { color: #22c55e; }

/* Bottone submit */
.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.875rem 1.5rem;
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
    letter-spacing: 0.01em;
    font-family: inherit;
}

.btn-submit:hover {
    background: #1e3a5f;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.25);
}

.btn-submit:active {
    transform: scale(0.985);
}

/* Footer form */
.form-footer {
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
}

.form-footer a {
    font-size: 0.875rem;
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
}

.form-footer a:hover {
    color: #0f172a;
}

.form-footer strong {
    color: #3b82f6;
    font-weight: 600;
}

/* =========================================================
   ConfirmEmail — esito conferma
   ========================================================= */

.form-card-centered {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Icona esito */
.result-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.result-icon svg { width: 34px; height: 34px; }

.result-ok {
    background: #dcfce7;
    color: #16a34a;
}

.result-err {
    background: #fee2e2;
    color: #dc2626;
}

/* Testi */
.result-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.3px;
}

.result-body {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 2rem 0;
}

/* Bottone conferma */
.btn-confirm {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: #0f172a;
    color: white;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.18s ease, box-shadow 0.18s ease;
    letter-spacing: 0.01em;
}

.btn-confirm:hover {
    background: #1e3a5f;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.25);
    color: white;
}

.btn-confirm-secondary {
    background: #64748b;
}

.btn-confirm-secondary:hover {
    background: #475569;
}

/* =========================================================
   Responsive auth — mobile: solo form
   ========================================================= */

@media (max-width: 820px) {
    .brand-panel {
        display: none;
    }

    .form-panel {
        background: white;
        padding: 2rem 1.5rem;
    }
}

/* =========================================================
   Home — header e stat cards
   ========================================================= */

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

.home-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.3px;
}

.home-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f5f9;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }
.stat-icon i   { font-size: 1.25rem; }

.stat-icon-blue  { background: #eff6ff; color: #3b82f6; }
.stat-icon-green { background: #f0fdf4; color: #22c55e; }
.stat-icon-amber { background: #fffbeb; color: #f59e0b; }

.stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

/* =========================================================
   Superadmin Dashboard — tab, tabelle, paginazione, modali
   ========================================================= */

/* ── Tab Navigation ───────────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    transition: color 0.15s, background 0.15s;
}

.tab-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.tab-btn i   { font-size: 0.9rem; flex-shrink: 0; }

.tab-btn--add {
    flex: 1;
    justify-content: flex-end;
    color: #3b82f6;
    font-weight: 600;
    gap: 0.4rem;
}

.tab-btn--add:hover {
    color: #2563eb;
    background: #eff6ff;
    border-bottom-color: #2563eb;
}

.tab-btn:hover {
    color: #0f172a;
    background: #f8fafc;
    border-bottom-color: #0f172a;
}

.tab-btn--active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    line-height: 1.4;
}

.tab-btn--active .tab-badge {
    background: #dbeafe;
    color: #2563eb;
}

/* ── Table Panel ──────────────────────────────────────────── */
.table-panel {
    background: white;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.table-info {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-size-label {
    font-size: 0.85rem;
    color: #64748b;
}

.page-size-select {
    padding: 0.3rem 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #0f172a;
    background: #f8fafc;
    cursor: pointer;
    outline: none;
}

.page-size-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* ── Data Table ───────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.775rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.data-table th.th-actions {
    text-align: right;
    padding-right: 1.25rem;
}

.data-table td {
    padding: 0.85rem 1rem;
    color: #0f172a;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

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

.data-table tbody tr:hover td {
    background: #f8fafc;
}

.td-secondary { color: #64748b; }
.td-strong    { font-weight: 600; }
.td-empty     {
    text-align: center;
    color: #94a3b8;
    padding: 3rem 1rem;
    font-size: 0.9rem;
}
.td-na { color: #cbd5e1; font-size: 0.9rem; }

/* User cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

/* Code chip */
.code-chip {
    display: inline-block;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.78rem;
    background: #f1f5f9;
    color: #475569;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* Role badges */
.role-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.role-superadmin { background: #fef3c7; color: #92400e; }
.role-admin      { background: #dbeafe; color: #1d4ed8; }
.role-operatore  { background: #dcfce7; color: #15803d; }
.role-readonly   { background: #f1f5f9; color: #475569; }
.role-none       { background: #f1f5f9; color: #94a3b8; }

/* Table action buttons */
.btn-tbl {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-tbl i   { font-size: 0.8rem; flex-shrink: 0; }
.btn-tbl svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.btn-tbl--primary {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.btn-tbl--primary:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.btn-tbl--secondary {
    background: rgb(59, 130, 246);
    color: white;
    border-color: #e2e8f0;
}

.btn-tbl--secondary:hover {
    background: #cbd5e1;
    border-color: #cbd5e1;
    color: rgb(59, 130, 246);
}

.btn-tbl--danger {
    background: #dc2626;
    color: white;
    border-color: #fecaca;
}

.btn-tbl--danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.tbl-actions-group {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
}

/* ── Skeleton loading ─────────────────────────────────────── */
.skel {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skel-shimmer 1.4s ease-in-out infinite;
    border-radius: 5px;
}

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

.skel-user   { height: 34px; width: 160px; border-radius: 999px; }
.skel-md     { height: 14px; width: 130px; }
.skel-sm     { height: 14px; width: 80px; }
.skel-badge  { height: 20px; width: 80px; border-radius: 999px; }
.skel-btn    { height: 28px; width: 110px; border-radius: 7px; float: right; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pagination-info {
    font-size: 0.85rem;
    color: #64748b;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 0.4rem;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: white;
    font-size: 0.875rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

.page-btn--active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    font-weight: 600;
}

.page-btn--active:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: white !important;
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* ── Modal ────────────────────────────────────────────────── */

/* Backdrop scuro — riceve @onclick per chiudere cliccando fuori */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    z-index: 1000;
    animation: modal-fade-in 0.15s ease;
}

/* Contenitore di centratura — pointer-events:none così i click
   passano al .modal-dialog sottostante e MAI all'overlay */
.modal-container {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-dialog {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modal-slide-up 0.18s ease;
    overflow: hidden;
    pointer-events: auto; /* riabilita i click sul dialog */
}

.modal-dialog--lg {
    max-width: 720px;
}

@keyframes modal-slide-up {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.2rem;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 1rem;
    color: #64748b;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover { background: #e2e8f0; color: #0f172a; }
.modal-close svg   { width: 16px; height: 16px; }
.modal-close i     { font-size: 1rem; }

/* Search bar inside modal (Assegna) */
.modal-search-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.modal-search-bar svg {
    width: 16px;
    height: 16px;
    color: #94a3b8;
    flex-shrink: 0;
}

.modal-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    color: #0f172a;
    background: transparent;
}

.modal-search-input::placeholder { color: #94a3b8; }

.modal-search-clear {
    border: none;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.modal-search-clear:hover { color: #64748b; }

/* Modal body */
.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body--scroll {
    max-height: 380px;
}

.modal-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    padding: 2rem 0;
}

/* Modal footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    gap: 0.75rem;
}

.modal-counter {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.modal-footer-btns {
    display: flex;
    gap: 0.75rem;
}

.btn-modal-cancel {
    padding: 0.55rem 1.1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-modal-cancel:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; }
.btn-modal-cancel:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-modal-primary {
    padding: 0.55rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-modal-primary:hover:not(:disabled) { background: #2563eb; }
.btn-modal-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-modal-danger {
    padding: 0.55rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: #dc2626;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-modal-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-modal-danger:disabled { opacity: 0.55; cursor: not-allowed; }

.modal-dialog--sm { max-width: 420px; }

/* ── Modal conferma eliminazione ──────────────────────────── */
.delete-confirm-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.delete-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff1f2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.delete-icon svg { width: 26px; height: 26px; }
.delete-icon i   { font-size: 1.5rem; }

.esito-icon--success {
    background: #f0fdf4;
    color: #16a34a;
}

.delete-confirm-text {
    font-size: 0.9rem;
    color: #0f172a;
    margin: 0;
    line-height: 1.6;
}

.delete-confirm-warn {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.5;
}

/* ── Lista impianti assegnati (modal Assegna) ─────────────── */
.assigned-section-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin: 0 0 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assigned-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    min-width: 20px;
}

.assigned-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
    padding: 1rem 0 1.25rem;
    border: 1px dashed #e2e8f0;
    border-radius: 10px;
    margin-bottom: 0.25rem;
}

.assigned-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 0.25rem;
}

.assigned-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    transition: border-color 0.12s;
}

.assigned-item:hover { border-color: #cbd5e1; }

.assigned-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    flex: 1;
    min-width: 0;
}

.assigned-nome {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assigned-detail {
    font-size: 0.775rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.assigned-remove {
    width: 26px;
    height: 26px;
    border: none;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}

.assigned-remove:hover { background: #fee2e2; color: #ef4444; }
.assigned-remove svg   { width: 12px; height: 12px; }

/* Divider col testo */
.assigned-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.1rem 0 0.9rem;
    color: #94a3b8;
    font-size: 0.775rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.assigned-divider::before,
.assigned-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

/* Hint sotto l'autocomplete */
.autocomplete-hint {
    font-size: 0.775rem;
    color: #94a3b8;
    margin: 0.45rem 0 0;
}

/* ── Custom autocomplete (Assegna Impianti) ───────────────── */
.ac-section {
    padding: 0 1.5rem;
    flex-shrink: 0;
}

.ac-input {
    width: 100%;
    box-sizing: border-box;
}

.ac-results {
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 220px;
    overflow-y: auto;
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 0.5rem;
}

.ac-item {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.875rem;
    transition: background 0.1s;
}

.ac-item:hover      { background: #f1f5f9; }
.ac-item:last-child { border-bottom: none; }

.ac-item-id {
    color: #3b82f6;
    font-family: monospace;
    font-size: 0.78rem;
    font-weight: 600;
    flex-shrink: 0;
}

.ac-item-name {
    color: #0f172a;
    font-weight: 500;
    flex-shrink: 0;
}

.ac-item-addr {
    color: #64748b;
    font-size: 0.82rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Code chip extra-small */
.code-chip--xs {
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
}

/* ── Impianto checklist (modal Assegna) ───────────────────── */
.impianto-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.impianto-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s;
    background: white;
}

.impianto-item:hover {
    border-color: #bfdbfe;
    background: #f8fafc;
}

.impianto-item--on {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.impianto-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

.impianto-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.impianto-item-nome {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.impianto-item-detail {
    font-size: 0.78rem;
    color: #64748b;
}

.impianto-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    background: #dcfce7;
    color: #15803d;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Edit form grid (modal Modifica) ──────────────────────── */
.edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.edit-field--full {
    grid-column: 1 / -1;
}

.edit-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.req { color: #ef4444; }

.edit-input {
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.edit-input:focus {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =========================================================
   Impostazioni
   ========================================================= */

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

.settings-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.3px;
}

.settings-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 540px;
}

.settings-card {
    background: white;
    border-radius: 14px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f5f9;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.settings-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.125rem 0;
}

.settings-card-email {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

.settings-alert {
    border-radius: 8px;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.settings-alert-ok {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.settings-alert-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.settings-field {
    margin-bottom: 1.25rem;
}

.settings-field label {
    display: block;
    font-size: 0.8375rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.4rem;
}

.settings-input {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9375rem;
    color: #0f172a;
    background: white;
    transition: border-color 0.18s, box-shadow 0.18s;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.settings-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.settings-hint {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.35rem;
}

.settings-error {
    display: block;
    font-size: 0.8rem;
    color: #ef4444;
    margin-top: 0.3rem;
}

.settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s;
    font-family: inherit;
}

.settings-btn:hover:not(:disabled) {
    background: #1e3a5f;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.settings-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =========================================================
   PageLoader — spinner di caricamento pagina
   ========================================================= */

.page-loader-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    gap: 1.5rem;
}

/* Spinner con gradiente conico + maschera circolare */
.page-loader-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        #bfdbfe 25%,
        #3b82f6 100%
    );
    animation: pl-spin 0.75s linear infinite;
    -webkit-mask: radial-gradient(farthest-side, transparent 63%, black 64%);
    mask: radial-gradient(farthest-side, transparent 63%, black 64%);
}

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

.page-loader-text {
    font-size: 0.875rem;
    color: #94a3b8;
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.01em;
    animation: pl-pulse 1.6s ease-in-out infinite;
}

@keyframes pl-pulse {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1;   }
}

/* =========================================================
   Gestione impianti
   ========================================================= */

.gestione-loader {
    padding: 1.5rem;
}

/* Pannello selettore impianto */
.gestione-selector-panel {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

/* Bottone selezione pompa (Nuovo Conteggio step 1) */
.pompa-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.875rem;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    line-height: 1.4;
}

.pompa-toggle:hover {
    border-color: #93c5fd;
    background: #f0f9ff;
    color: #1e40af;
}

.pompa-toggle--selected {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.pompa-toggle--selected:hover {
    background: #dbeafe;
    border-color: #2563eb;
}

.pompa-toggle-check {
    width: 15px;
    height: 15px;
    border: 1.5px solid #cbd5e1;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.6rem;
    transition: background 0.15s, border-color 0.15s;
}

.pompa-toggle--selected .pompa-toggle-check {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* Header sezione (titolo + pulsante aggiungi) */
.gestione-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.gestione-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.2rem;
}

.gestione-section-sub {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
}

/* Corpo con le pompe — grid responsiva */
.gestione-pompe-body {
    padding: 1rem 1.5rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);  /* ≥ 2200px */
    gap: 16px;
}

@media (max-width: 2199px) {
    .gestione-pompe-body { grid-template-columns: repeat(3, 1fr); }  /* 1600–2199px */
}

@media (max-width: 1599px) {
    .gestione-pompe-body { grid-template-columns: repeat(2, 1fr); }  /* 1000–1599px */
}

@media (max-width: 999px) {
    .gestione-pompe-body { grid-template-columns: 1fr; }             /* < 1000px */
}

/* Messaggio empty state interno */
.gestione-empty-pompe {
    padding: 2rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    border: 1px dashed #e2e8f0;
    border-radius: 10px;
}

/* Card singola pompa */
.pompa-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

/* Intestazione pompa */
.pompa-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.pompa-nome-input {
    flex: 1;
    max-width: 320px;
    font-weight: 500;
}

/* Lista erogatori nella card */
.erogatori-list {
    padding: 0.875rem 1rem;
}

/* Riga intestazione colonne */
.erogatori-header-row {
    display: grid;
    grid-template-columns: 2.25rem 1fr 1fr 2.25rem;
    gap: 0.5rem;
    padding: 0 0 0.4rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

/* Riga singolo erogatore */
.erogatore-row {
    display: grid;
    grid-template-columns: 2.25rem 1fr 1fr 2.25rem;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

/* Badge numero erogatore */
.erogatore-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Pulsante rimuovi erogatore (×) */
.btn-erog-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fef2f2;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.btn-erog-remove:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

/* Pulsante aggiungi erogatore */
.btn-add-erogatore {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.35rem 0.75rem;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-add-erogatore:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

/* Barra di salvataggio */
.gestione-save-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

/* Messaggi feedback salvataggio */
.gestione-msg {
    font-size: 0.85rem;
    font-weight: 500;
}

.gestione-msg--ok {
    color: #16a34a;
}

.gestione-msg--error {
    color: #dc2626;
}

/* ── Operatori — layout split ─────────────────────────── */

.addetti-split {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.5rem 1.5rem;
    align-items: flex-start;
}

.addetti-split-main {
    flex: 1;
    min-width: 0;
}

.addetti-split-side {
    width: 25%;
    flex-shrink: 0;
}

/* Card form "Nuovo operatore" */
.addetti-side-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.addetti-side-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
}

.addetti-side-header i {
    color: #3b82f6;
    font-size: 0.8rem;
}

.addetti-side-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.addetti-side-btn {
    width: 100%;
    justify-content: center;
}

/* Tabella operatori */
.addetti-table {
    width: 100%;
    border-collapse: collapse;
}

.addetti-table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 0 0.5rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.addetti-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

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

.addetti-table tbody tr:hover td {
    background: #f8fafc;
}

.addetti-td-nome {
    padding: 0.65rem 0.5rem;
    font-size: 0.9rem;
    color: #0f172a;
}

.addetti-td-azioni {
    padding: 0.5rem 0;
    text-align: right;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

/* Feedback barra (edit/remove) */
.addetti-feedback-bar {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.75rem;
}

/* Form modifica inline nella tabella */
.addetti-form-inline {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.875rem 1rem;
}

.addetti-form-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.addetti-form-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
    padding-bottom: 0.35rem;
}

/* Banner avviso modifica sostanziale */
.addetti-warn-banner {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    color: #92400e;
    line-height: 1.5;
}

.addetti-warn-banner i {
    margin-right: 0.3rem;
    color: #d97706;
}

/* Responsivo: sotto 800px la colonna destra si sposta sotto */
@media (max-width: 800px) {
    .addetti-split { flex-direction: column; }
    .addetti-split-side { width: 100%; }
}

/* Badge orario fascia turno */
.slot-orario-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
}

.slot-orario-badge i {
    color: #94a3b8;
    font-size: 0.75rem;
}

/* =========================================================
   ReconnectModal (Blazor Server)
   ========================================================= */

.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

#components-reconnect-modal {
    background-color: white;
    width: 20rem;
    margin: 20vh auto;
    padding: 2rem;
    border: 0;
    border-radius: 0.5rem;
    box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: display 0.5s allow-discrete, overlay 0.5s allow-discrete;
    animation: components-reconnect-modal-fadeOutOpacity 0.5s both;
}

#components-reconnect-modal[open] {
    animation: components-reconnect-modal-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s,
               components-reconnect-modal-fadeInOpacity 0.5s ease-in-out 0.3s;
    animation-fill-mode: both;
}

#components-reconnect-modal::backdrop {
    background-color: rgba(0, 0, 0, 0.4);
    animation: components-reconnect-modal-fadeInOpacity 0.5s ease-in-out;
    opacity: 1;
}

@keyframes components-reconnect-modal-slideUp {
    0%   { transform: translateY(30px) scale(0.95); }
    100% { transform: translateY(0); }
}

@keyframes components-reconnect-modal-fadeInOpacity {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes components-reconnect-modal-fadeOutOpacity {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

.components-reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#components-reconnect-modal p {
    margin: 0;
    text-align: center;
}

#components-reconnect-modal button {
    border: 0;
    background-color: #6b9ed2;
    color: white;
    padding: 4px 24px;
    border-radius: 4px;
}

#components-reconnect-modal button:hover {
    background-color: #3b6ea2;
}

#components-reconnect-modal button:active {
    background-color: #6b9ed2;
}

.components-rejoining-animation {
    position: relative;
    width: 80px;
    height: 80px;
}

.components-rejoining-animation div {
    position: absolute;
    border: 3px solid #0087ff;
    opacity: 1;
    border-radius: 50%;
    animation: components-rejoining-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-rejoining-animation div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes components-rejoining-animation {
    0% {
        top: 40px; left: 40px;
        width: 0; height: 0;
        opacity: 0;
    }
    4.9% {
        top: 40px; left: 40px;
        width: 0; height: 0;
        opacity: 0;
    }
    5% {
        top: 40px; left: 40px;
        width: 0; height: 0;
        opacity: 1;
    }
    100% {
        top: 0; left: 0;
        width: 80px; height: 80px;
        opacity: 0;
    }
}

/* =========================================================
   Conti — turni di cassa
   ========================================================= */
.filter-button {
    padding: 0.5rem 1rem;
    color: white;
    background: #2a4076;
    border-radius: 0.5rem;
    margin-bottom: 10px;
}

.conti-giornata {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Card turno */
.conti-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.conti-card-header {
    padding: 0.7rem;
}

.conti-card-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conti-card-titolo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-direction: column;
}

.conti-slot-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f1f5f9;
    color: #334155;
    border-radius: 6px;
    padding: 0 0.6rem;
    font-size: 1rem;
    font-weight: 600;
}

.conti-slot-orario {
    font-size: 0.875rem;
    color: #64748b;
}

.conti-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.conti-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: #475569;
}

.conti-card-incassi {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.conti-incasso-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.conti-incasso-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    text-align: center;
}

.conti-incasso-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}

.conti-incasso-item--sep {
    width: 1px;
    background: #e2e8f0;
    align-self: stretch;
    margin: 0 0.25rem;
}

.conti-chiusure-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 6px;
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: auto;
}

.conti-chiusure-badge--ok {
    background: #dcfce7;
    color: #15803d;
}

.conti-chiusure-badge--warn {
    background: #fef9c3;
    color: #92400e;
}

/* Corpo form modifica card */
.conti-card-edit-body {
    border-top: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: #f8fafc;
}

.conti-edit-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.conti-edit-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    font-weight: 600;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e2e8f0;
}

/* Tabella letture */
.conti-letture-wrap {
    overflow-x: auto;
}

.conti-letture-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.conti-letture-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.4rem 0.75rem;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.conti-letture-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #374151;
}

.conti-num-input {
    width: 110px;
    padding: 0.3rem 0.5rem !important;
    font-size: 0.875rem;
}

.conti-litri-cell {
    color: #475569;
    font-size: 0.875rem;
    text-align: right;
}

/* Tag modalità erogazione */
.conti-modalita-tag {
    display: inline-block;
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 0.3rem;
}

.conti-modalita-tag--servito {
    background: #dbeafe;
    color: #1d4ed8;
}

.conti-modalita-tag--fdt {
    background: #fce7f3;
    color: #9d174d;
}

/* Prezzi grid */
.conti-prezzi-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.conti-prezzo-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 160px;
}

/* Incassi grid */
.conti-incassi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

/* Addetti checkboxes */
.conti-addetti-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.conti-addetto-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.3rem 0.65rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    transition: border-color 0.15s, background 0.15s;
}

.conti-addetto-check:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.conti-addetto-check input[type="checkbox"] {
    accent-color: #6366f1;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Footer form */
.conti-edit-footer {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

/* Pannello nuovo conteggio */
.conti-nuovo-panel {
    margin-top: 0.5rem;
}

.conti-nuovo-top {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Pompe checkboxes */
.conti-pompe-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.conti-pompa-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: border-color 0.15s, background 0.15s;
    max-width: 520px;
}

.conti-pompa-check:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.conti-pompa-check input[type="checkbox"] {
    accent-color: #6366f1;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.conti-pompa-nome {
    font-weight: 600;
    color: #1e293b;
    min-width: 80px;
}

.conti-pompa-detail {
    color: #64748b;
    font-size: 0.8rem;
}

/* Riga filtri conti */
.conti-filtri-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 2rem;
}

.conti-filtri-row .mud-input-control {
    min-width: 200px;
}

.conti-filtri-actions {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 2px;
}

/* Pannello filtri con animazione */
.filtri-panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    transition: max-height 0.3s ease,
                opacity    0.25s ease,
                transform  0.25s ease;
}

.filtri-panel--open {
    max-height: 300px;
    opacity: 1;
    transform: translateY(0);
}

/* ── Conti page layout ─────────────────────────────────────── */
.conti-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.conti-fixed-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
    padding-bottom: 0.5rem;
}

.conti-fixed-top .page-header {
    margin-bottom: 1rem;
}

/* Panel storico turni */
.conti-storico-panel {
    background: white;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.conti-storico-header {
    flex-shrink: 0;
    padding: 1.1rem 1.5rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    background: white;
}

.conti-storico-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
}

.conti-storico-scroll {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Responsive */
@media (max-width: 640px) {
    .conti-card-header {
        padding: 0.875rem 1rem;
    }

    .conti-card-edit-body {
        padding: 1rem;
    }

    .conti-incassi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .conti-chiusure-badge {
        margin-left: 0;
    }
}

/* =========================================================
   Nuovo Conteggio — Step 2
   ========================================================= */

/* Layout flex column a tutta altezza (come conti-layout) */
.nc2-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
    gap: 0;
}

.nc2-top {
    flex-shrink: 0;
}

/* Card header con riepilogo + prezzi + differenza */
.nc2-header-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
}

/* Chip riepilogo (giorno, turno, operatori) */
.nc2-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 99px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: #334155;
    white-space: nowrap;
}

.nc2-chip i { color: #64748b; font-size: 0.75rem; }

/* Riga prezzi editabili */
.nc2-prezzi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.nc2-prezzo-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.3rem 0.65rem;
}

.nc2-prezzo-label {
    font-size: 0.78rem;
    color: #475569;
    white-space: nowrap;
}

/* Specchietto differenza turno */
.nc2-differenza-card {
    flex-shrink: 0;
    min-width: 200px;
    padding: 0.9rem 1.1rem;
    border-radius: 0.75rem;
    border: 1px solid;
    text-align: center;
}

.nc2-differenza-card--pos {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #15803d;
}

.nc2-differenza-card--neg {
    border-color: #dc2626;
    background: #fef2f2;
    color: #b91c1c;
}

.nc2-differenza-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.65;
    margin-bottom: 0.2rem;
}

.nc2-differenza-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.nc2-differenza-sub {
    font-size: 0.68rem;
    opacity: 0.6;
    margin-top: 0.3rem;
    line-height: 1.5;
}

/* Tab bar */
.nc2-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-top: 1rem;
}

.nc2-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.nc2-tab-btn:hover:not(:disabled) { color: #1e293b; }

.nc2-tab-btn--active {
    color: #0f172a;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

.nc2-tab-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.nc2-tab-btn i { font-size: 0.8rem; }

/* Area scrollabile contenuto tab */
.nc2-scroll-area {
    flex: 1;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
}

/* Tabella erogatori */
.nc2-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.nc2-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    padding: 0.4rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #e2e8f0;
    z-index: 1;
}

.nc2-table tbody td {
    padding: 0.2rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 0.85rem;
}

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

.nc2-tfoot-totale td {
    padding: 0.35rem 0.75rem;
    border-top: 2px solid #cbd5e1;
    font-size: 0.875rem;
    color: #1e293b;
    background: #f8fafc;
}


/* Prima colonna: etichetta erogatore su riga singola */
.nc2-erog-label {
    font-weight: 500;
    color: #0f172a;
    white-space: nowrap;
}

/* Colonna differenza e prezzo */
.nc2-diff       { color: #334155; font-variant-numeric: tabular-nums; }
.nc2-prezzo-col { color: #64748b; font-variant-numeric: tabular-nums; }

/* Input prezzo (sostituisce RadzenNumeric) */
.nc2-prezzo-input {
    width: 80px;
    height: 30px;
    padding: 0 0.5rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: right;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.nc2-prezzo-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.nc2-prezzo-input input[type=number] {
    -moz-appearance: textfield;
}

.nc2-prezzo-input input[type=number]::-webkit-outer-spin-button,
.nc2-prezzo-input input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Input descrizione prima nota */
.pn-desc-input {
    height: 38px;
    padding: 0 0.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.pn-desc-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

/* Input lettura finale */
.nc2-input-lettura {
    width: 110px;
    padding: 0.3rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    text-align: right;
    background: white;
    color: #0f172a;
    -moz-appearance: textfield;
}

.nc2-input-lettura::-webkit-outer-spin-button,
.nc2-input-lettura::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.nc2-input-lettura:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* ── Carte Compagnia ─────────────────────────────────────────── */
.addetti-check-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #1e293b;
    background: #f8fafc;
    transition: background 0.15s;
}

.addetti-check-row:hover {
    background: #f1f5f9;
}

.addetti-check-row input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #3b82f6;
    cursor: pointer;
}

.empty-state-inline {
    color: #94a3b8;
    font-size: 0.875rem;
    padding: 1rem 0;
}

.form-error {
    color: #ef4444;
    font-size: 0.8125rem;
}

.form-success {
    color: #22c55e;
    font-size: 0.8125rem;
}
