:root {
    /* Color Palette - Premium & Modern */
    --color-primary: #2A5C3E;        /* Verde scuro iconico HM */
    --color-primary-light: #3D7B55;
    --color-primary-dark: #1E452D;
    
    --color-accent: #E5A822;         /* Giallo/Oro per elementi di spicco */
    
    --color-bg-body: #F7F5F0;        /* Beige molto morbido e chiaro */
    --color-bg-surface: #FFFFFF;     /* Superfici bianche pure */
    --color-bg-sidebar: #1E231F;     /* Sidebar grigio scurissimo/verde */
    
    --color-text-main: #2D332F;
    --color-text-muted: #6B7280;
    --color-text-light: #F9FAFB;
    
    /* Semantic Colors */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    --color-info: #3B82F6;
    --color-purple: #8B5CF6;
    
    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(42, 92, 62, 0.15);
    
    /* Radii */
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

ul {
    list-style: none;
}

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

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 76px; /* non scende mai sotto la versione collassata */
    flex-shrink: 0;  /* impedisce a flexbox di stringerla */
    background-color: var(--color-bg-sidebar);
    color: var(--color-text-light);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width var(--transition-smooth), padding var(--transition-smooth);
    overflow: hidden;
}

/* Testo e label della sidebar – transizione smooth */
.nav-item span,
.sidebar-collapse-btn span {
    max-width: 180px;
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width var(--transition-smooth), opacity var(--transition-smooth);
}

.logo h2 {
    max-width: 160px;
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    transition: max-width var(--transition-smooth), opacity var(--transition-smooth);
}

/* Sidebar collassata */
.sidebar.collapsed {
    width: 76px;
    padding: 24px 16px;
}

.sidebar.collapsed .logo h2,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-collapse-btn span {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .logo {
    justify-content: center;
}

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

.sidebar.collapsed .sidebar-collapse-btn {
    justify-content: center;
    padding: 14px;
    gap: 0;
}

.sidebar-header {
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    color: var(--color-success);
    width: 32px;
    height: 32px;
}

.light-text {
    font-weight: 300;
    opacity: 0.8;
}


.sidebar-nav {
    flex: 1;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.nav-item:hover:not(.disabled) {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--color-text-light);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-text-light);
    box-shadow: 0 4px 12px rgba(42, 92, 62, 0.3);
}

.nav-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;       /* permette a flex di restringere il contenuto senza spingere la sidebar */
    overflow-x: hidden; /* l'overflow orizzontale è gestito dalle singole tabelle */
    padding: 40px 60px;
    max-width: 1400px;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 48px;
}

.header-titles h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-text-main);
    letter-spacing: -1px;
    margin-bottom: 8px;
}

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

.subtitle {
    font-size: 16px;
    color: var(--color-text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg-surface);
    border-radius: var(--radius-full);
    color: var(--color-text-muted);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

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

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--color-danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-bg-body);
}

.user-avatar img {
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--color-bg-surface);
    transition: var(--transition-bounce);
}

.user-avatar img:hover {
    transform: scale(1.1);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

/* Modern Card Design */
.metric-card {
    position: relative;
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition-bounce);
    border: 1px solid rgba(0, 0, 0, 0.03);
    z-index: 1;
}

/* Glassmorphism / Glow Effect */
.card-glow {
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    opacity: 0;
    border-radius: 50%;
    transform: translate(30%, -30%);
    transition: var(--transition-smooth);
    z-index: -1;
}

.metric-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.metric-card:hover .card-glow {
    opacity: 0.15;
}

.card-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    font-size: 28px;
    transition: var(--transition-smooth);
}

.metric-card:hover .card-icon-wrapper {
    transform: scale(1.1) rotate(-5deg);
}

/* Card Theming based on Classes */
.primary-card .card-icon-wrapper {
    background-color: rgba(42, 92, 62, 0.1);
    color: var(--color-primary);
}
.primary-card:hover .card-glow { background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%); }

.success-card .card-icon-wrapper {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}
.success-card:hover .card-glow { background: radial-gradient(circle, var(--color-success) 0%, transparent 70%); }

.warning-card .card-icon-wrapper {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}
.warning-card:hover .card-glow { background: radial-gradient(circle, var(--color-warning) 0%, transparent 70%); }

.purple-card .card-icon-wrapper {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--color-purple);
}
.purple-card:hover .card-glow { background: radial-gradient(circle, var(--color-purple) 0%, transparent 70%); }

.info-card .card-icon-wrapper {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--color-info);
}
.info-card:hover .card-glow { background: radial-gradient(circle, var(--color-info) 0%, transparent 70%); }

/* Card Content */
.card-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 42px;
    font-weight: 800;
    color: var(--color-text-main);
    line-height: 1.1;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.metric-value .unit {
    font-size: 20px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-left: 4px;
}

.metric-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}

.metric-trend i {
    width: 16px;
    height: 16px;
}

.metric-trend.positive { color: var(--color-success); }
.metric-trend.negative { color: var(--color-danger); }
.metric-trend.neutral { color: var(--color-text-muted); }

/* Notes Section */
.notes-section {
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 32px;
    transition: var(--transition-smooth);
}

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

.notes-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notes-icon {
    color: var(--color-accent);
}

.notes-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-main);
}

.save-status {
    font-size: 13px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s;
}

.save-status.visible {
    opacity: 1;
}

.save-status.success {
    color: var(--color-success);
}

.notes-body {
    position: relative;
}

.custom-textarea {
    width: 100%;
    min-height: 180px;
    padding: 20px;
    background-color: var(--color-bg-body);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 16px;
    color: var(--color-text-main);
    resize: vertical;
    transition: var(--transition-smooth);
    line-height: 1.6;
}

.custom-textarea:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.custom-textarea:focus {
    outline: none;
    background-color: var(--color-bg-surface);
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 4px rgba(42, 92, 62, 0.1);
}

.custom-textarea::placeholder {
    color: #A0AAB2;
    font-style: italic;
}

/* Animations */
@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-card {
    animation: fadeInSlideUp 0.6s ease-out backwards;
}

.metric-card:nth-child(1) { animation-delay: 0.1s; }
.metric-card:nth-child(2) { animation-delay: 0.2s; }
.metric-card:nth-child(3) { animation-delay: 0.3s; }
.metric-card:nth-child(4) { animation-delay: 0.4s; }
.metric-card:nth-child(5) { animation-delay: 0.5s; }

.notes-section {
    animation: fadeInSlideUp 0.6s ease-out backwards;
    animation-delay: 0.5s;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 220px; padding: 20px; }
    .main-content { padding: 32px 40px; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 16px 24px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .sidebar-header { margin-bottom: 0; }
    .sidebar-nav { display: none; } /* Mobile menu could go here */
    .sidebar-footer { display: none; }
    
    .main-content { padding: 24px; }
    .metrics-grid { grid-template-columns: 1fr; }
    .header-titles h1 { font-size: 28px; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.lucide-spin {
    animation: spin 1s linear infinite;
}

/* Modal e Clickable Card */
.metric-card.clickable {
    cursor: pointer;
}

.metric-card.clickable:active {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.custom-modal {
    margin: auto;
    padding: 0;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--color-bg-surface);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 700px;
}

.custom-modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.custom-modal[open] {
    animation: slideUpFade 0.4s ease-out;
}

.modal-content {
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.modal-header h2 {
    font-size: 22px;
    color: var(--color-text-main);
    font-weight: 700;
}

.modal-body {
    padding: 32px;
}

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

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

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

/* Modale Input Data & Bottoni Primari */
.custom-input {
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 15px;
    background: var(--color-bg-body);
    color: var(--color-text-main);
    transition: var(--transition-smooth);
}

.custom-input:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(42, 92, 62, 0.1);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--color-primary);
    color: white;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    width: 100%;
}

.btn-primary:hover {
    background: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary i {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    color: var(--color-primary);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-primary);
    transition: var(--transition-fast);
    width: 100%;
}

.btn-secondary:hover {
    background: rgba(42, 92, 62, 0.08);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary i {
    width: 18px;
    height: 18px;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    color: var(--color-danger);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-danger);
    transition: var(--transition-fast);
    width: 100%;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-danger i {
    width: 18px;
    height: 18px;
}

/* =========================================
   VIEWS & NAVIGATION SYSTEM
   ========================================= */
.view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: block;
}

/* =========================================
   RITIRI SECTION
   ========================================= */
.ritiri-header {
    margin-bottom: 24px;
}

.ritiri-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text-main);
}

.ritiri-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

/* Pulsante Genera Piano */
.btn-genera-piano {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: linear-gradient(135deg, var(--color-accent), #c98a10);
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: 0 4px 12px rgba(229, 168, 34, 0.35);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-genera-piano i {
    width: 16px;
    height: 16px;
}

.btn-genera-piano:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 168, 34, 0.5);
    filter: brightness(1.08);
}

.btn-genera-piano:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(229, 168, 34, 0.3);
}

.header-actions-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-bar {
    position: relative;
    width: 280px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    width: 20px;
    height: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 15px;
    background: var(--color-bg-surface);
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(42, 92, 62, 0.1);
}

/* Tabs */
.ritiri-tabs {
    display: flex;
    gap: 8px;
    background: rgba(0,0,0,0.03);
    padding: 6px;
    border-radius: var(--radius-lg);
    width: max-content;
}

.tab-btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--color-text-main);
}

.tab-btn.active {
    background: var(--color-bg-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* Premium Table */
.table-container {
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.03);
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.premium-table th {
    background: rgba(0,0,0,0.02);
    padding: 16px 24px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.premium-table td {
    padding: 16px 24px;
    font-size: 14px;
    color: var(--color-text-main);
    border-bottom: 1px solid rgba(0,0,0,0.03);
    transition: var(--transition-fast);
}

.premium-table tbody tr:hover td {
    background-color: rgba(42, 92, 62, 0.02);
}

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

/* Wide Table Scroll */
.wide-scroll-container {
    overflow-x: auto;
    max-width: 100%;
}

.wide-table {
    min-width: 2000px; /* Force horizontal scroll for many columns */
}

/* Badge for ID */
.id-badge {
    background: var(--color-bg-body);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    border: 1px solid rgba(0,0,0,0.05);
}

/* Action Button */
.actions-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    background: rgba(42, 92, 62, 0.1);
    color: var(--color-primary);
    transition: var(--transition-fast);
    border: none;
    cursor: pointer;
}

.action-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.action-btn i {
    width: 14px;
    height: 14px;
}


.action-btn.reverse-btn {
    background: rgba(220, 38, 38, 0.1);
    color: #DC2626;
    padding: 8px; /* icon only */
}

.action-btn.reverse-btn:hover {
    background: #DC2626;
    color: white;
}

/* =========================================
   GENERA PIANO MODAL
   ========================================= */
.genera-piano-tabs {
    display: flex;
    gap: 8px;
    background: rgba(0,0,0,0.04);
    padding: 6px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.gp-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: var(--transition-smooth);
    cursor: pointer;
}

.gp-tab i {
    width: 16px;
    height: 16px;
}

.gp-tab:hover {
    color: var(--color-text-main);
    background: rgba(255,255,255,0.6);
}

.gp-tab.active {
    background: var(--color-bg-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.gp-panel {
    animation: fadeIn 0.2s ease-out;
}

.gp-hint {
    font-size: 13px;
    color: var(--color-text-muted);
    background: rgba(42, 92, 62, 0.06);
    border-left: 3px solid var(--color-primary-light);
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    line-height: 1.5;
}

.gp-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    display: block;
}

.gp-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 14px;
    background: rgba(229, 168, 34, 0.1);
    border: 1px solid rgba(229, 168, 34, 0.3);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: #92680a;
}


/* =========================================
   TOAST NOTIFICATION SYSTEM
   ========================================= */
#toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--color-bg-surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-main);
    min-width: 280px;
    max-width: 400px;
    pointer-events: all;
    border-left: 4px solid transparent;
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    opacity: 0.15;
    transform-origin: left;
    animation: toastProgress var(--toast-duration, 3s) linear forwards;
}

.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-success .toast-icon { color: var(--color-success); }
.toast.toast-success::after { background: var(--color-success); }

.toast.toast-danger { border-left-color: var(--color-danger); }
.toast.toast-danger .toast-icon { color: var(--color-danger); }
.toast.toast-danger::after { background: var(--color-danger); }

.toast.toast-info { border-left-color: var(--color-info); }
.toast.toast-info .toast-icon { color: var(--color-info); }
.toast.toast-info::after { background: var(--color-info); }

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast-message { flex: 1; line-height: 1.4; }

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: var(--color-text-muted);
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.toast-close:hover { opacity: 1; }

.toast.hiding {
    animation: toastSlideOut 0.35s ease-in forwards;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(60px) scale(0.95); }
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* =========================================
   CHART.JS CONTAINER
   ========================================= */
.chart-container {
    position: relative;
    height: 350px; /* Altezza fissa necessaria per Chart.js in modal */
    width: 100%;
}

/* =========================================
   TOGGLE MANUTENZIONE SEDI
   ========================================= */
.manutenzione-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 2px solid transparent;
}

.manutenzione-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.manutenzione-toggle.active {
    background: rgba(245, 158, 11, 0.15); /* Colore warning/giallo chiaro */
    color: var(--color-warning);
    border-color: var(--color-warning);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.manutenzione-toggle.active:hover {
    background: rgba(245, 158, 11, 0.25);
}
