/* Dashboard Minimal Design */

/* Stili per Obiettivi - Sistema di Conferma */
.obiettivi-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fef7cd, #fef3c7);
    border-radius: 12px;
    border-left: 4px solid #f59e0b;
}

.spese-normali-section {
    margin-top: 1rem;
}

.movimento-card {
    background: white;
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.movimento-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.obiettivo-card {
    /* Stesso stile delle spese normali - senza bordo colorato */
    background: white;
}

.obiettivo-card.gia-confermato {
    background: white;
}

.obiettivo-card.da-confermare {
    background: white;
}

.movimento-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.movimento-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.movimento-info {
    flex: 1;
}

.movimento-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #111827;
}

.movimento-date {
    margin: 0.25rem 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.movimento-amount {
    margin: 0.25rem 0;
    font-weight: 600;
    font-size: 1.1rem;
    color: #111827;
}

.movimento-status {
    flex-shrink: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.confermato {
    background: #0d0d0d;
    color: white;
}

.status-badge.da-confermare {
    background: #f59e0b;
    color: white;
    animation: pulse 2s infinite;
}

.status-badge.automatica {
    background: #6b7280;
    color: white;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.conferma-section {
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.btn-conferma-obiettivo {
    background: linear-gradient(135deg, #0d0d0d, #0d0d0d);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.btn-conferma-obiettivo:hover {
    background: linear-gradient(135deg, #0d0d0d, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.movimento-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
    font-size: 0.9rem;
    color: #6b7280;
}

.movimento-details p {
    margin: 0.25rem 0;
}

/* Modal Conferma Obiettivo */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ef4444;
}

.modal-body {
    padding: 1.5rem;
}

.obiettivo-info {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #f59e0b;
}

.obiettivo-info h4 {
    margin: 0 0 0.5rem 0;
    color: #111827;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0d0d0d;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0d0d0d, #0d0d0d);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0d0d0d, #047857);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.no-movements {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-style: italic;
}

/* User Area Styles - Simplified */
.user-avatar-simple {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #ff7a00, #ff9f40);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.user-avatar-simple .user-initial {
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.user-avatar-simple .user-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Desktop positioning - fuori dal menu nell'header */
.user-avatar-desktop {
    display: none; /* Hidden by default, shown only on desktop */
}

/* Mobile positioning - nel menu in basso a destra */
.user-menu-item-mobile {
    margin-left: auto !important;
    margin-top: auto !important;
    padding: 16px;
    display: none; /* Hidden by default, shown only on mobile */
}

/* Responsive rules */
@media (min-width: 768px) {
    /* Desktop: mostra avatar nell'header, nascondi nel menu */
    .user-avatar-desktop {
        display: flex;
        margin-right: 20px;
    }
    
    .user-menu-item-mobile {
        display: none !important;
    }
}

@media (max-width: 767px) {
    /* Mobile: nascondi avatar dall'header, mostra nel menu in basso a destra */
    .user-avatar-desktop {
        display: none !important;
    }
    
    .user-menu-item-mobile {
        display: flex !important;
        justify-content: flex-end;
        padding: 16px;
        margin-top: auto;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* Dashboard Header - Banner arancione con metriche */
.dashboard-header {
    background: linear-gradient(135deg, #ff7a00 0%, #ff9f40 100%);
    border-radius: 20px;
    padding: 24px 28px;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 4px 20px rgba(255, 122, 0, 0.25);
    position: relative;
    overflow: hidden;
}

.dashboard-header::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -8%;
    width: 220px;
    height: 220px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
    pointer-events: none;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -5%;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    pointer-events: none;
}

.header-info {
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Metriche compatte */
.compact-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
}

/* Sezione Grafici Finanziari */
.financial-charts-section {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 24px;
    box-shadow: none;
}

.financial-charts-section h2 {
    color: #1e293b;
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    row-gap: 32px;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Dashboard: margini piu' ampi rispetto alle altre pagine */
    .container {
        width: 90%;
        padding: 0 16px;
    }
}

@media (min-width: 1400px) {
    .charts-grid {
        gap: 32px;
        row-gap: 24px; /* Ridotto da 40px a 24px */
    }
    
    .chart-container {
        min-height: 500px;
        padding: 32px;
    }
    
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-container {
        min-height: 400px;
        padding: 20px;
        /* Migliora l'interazione touch */
        touch-action: manipulation;
    }
    
    
    .chart-container h3 {
        font-size: 1rem;
        margin-bottom: 3px;
    }
    
    .chart-description {
        font-size: 0.7rem !important;
        margin-bottom: 16px !important;
        opacity: 0.8 !important;
    }
    
    .chart-info p {
        font-size: 0.75rem;
        line-height: 1.4;
    }
}

/* Stili specifici per tooltip su mobile */
@media (max-width: 768px) and (hover: none) {
    .chart-container canvas {
        /* Assicura che i tooltip siano facilmente attivabili su touch */
        cursor: pointer;
    }
}

.chart-container {
    background: white;
    border-radius: 18px;
    padding: 24px;
    border: 1px solid #f1f5f9;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    min-height: 520px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.chart-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.chart-container h3 {
    margin: 0 0 4px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    flex-shrink: 0;
}

.chart-description {
    color: #9ca3af !important;
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
    margin: 0 0 20px 0 !important;
    font-style: italic !important;
    font-weight: 400 !important;
    opacity: 0.85 !important;
}

.chart-container-full-width {
    grid-column: 1 / -1;
}

.chart-container-full-width canvas {
    max-height: 450px !important;
}

.chart-hint {
    font-size: 0.7rem;
    color: #6b7280;
    margin: 0 0 16px 0;
}

/* Slider puntatore dati per grafici */
.chart-slider-container {
    margin-top: 12px;
    padding: 0 8px;
    position: relative;
}

.slider-swipe-icon {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #94a3b8;
    font-size: 1.3rem;
    opacity: 0.35;
    pointer-events: none;
    z-index: 3;
    animation: swipeHint 2.5s ease-in-out infinite;
}

@keyframes swipeHint {
    0%, 100% { transform: translate(-50%, -50%); }
    30% { transform: translate(calc(-50% - 14px), -50%); }
    60% { transform: translate(calc(-50% + 14px), -50%); }
}

.chart-data-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
}

.chart-data-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d0d0d 0%, #1f1f1f 100%);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(13, 13, 13, 0.4);
    cursor: grab;
    transition: transform 0.15s ease;
}

.chart-data-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.chart-data-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.15);
}

.chart-data-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d0d0d 0%, #1f1f1f 100%);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(13, 13, 13, 0.4);
    cursor: grab;
}

.chart-slider-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 10px 0;
    min-height: 24px;
}

.slider-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
}

.slider-chip .chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.slider-chip .chip-label {
    color: #94a3b8;
    font-weight: 400;
}

.slider-month-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    width: 100%;
    text-align: center;
    margin-bottom: 2px;
}

.slider-variazioni-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #6b7280;
    width: 100%;
    margin-top: 4px;
    margin-bottom: 2px;
}

.chart-canvas-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    position: relative;
    margin: 20px 0; /* Aggiunto margine verticale per bilanciare lo spazio */
}

.chart-container canvas {
    width: 100% !important;
    max-height: 350px !important;
    max-width: 100%;
    margin: 0 auto;
    display: block;
}

.chart-info {
    margin-top: 20px;
    flex-shrink: 0;
    background: rgba(248, 250, 252, 0.6);
    padding: 16px;
    border-radius: 12px;
    border-top: 1px solid #e5e7eb;
}

/* Stili per controlli navigazione grafici */
.chart-navigation-controls {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.6) 100%) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.chart-nav-btn {
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    opacity: 1 !important;
}

.chart-nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chart-arrow-btn {
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.chart-arrow-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: #475569 !important;
}

.chart-arrow-btn:active:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.chart-arrow-btn:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.chart-time-navigation {
    user-select: none;
}

.chart-info p {
    color: #6b7280;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

.metric {
    background: rgba(255,255,255,0.13);
    padding: 16px 12px;
    border-radius: 14px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    flex-direction: column;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.metric:hover {
    background: rgba(255,255,255,0.2);
}

.metric-icon {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.metric-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
}

.metric-label {
    font-size: 0.6rem;
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
    color: white !important;
    margin-bottom: 6px;
}

.metric-value {
    font-size: clamp(0.7rem, 2vw, 1.3rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
    white-space: nowrap;
    color: white !important;
}

.metric-value.large {
    font-size: clamp(0.8rem, 2.2vw, 1.5rem);
}

/* Forza bianco per tutte le varianti dentro il banner (inclusi inline style dal JS) */
.dashboard-header .metric-value,
.dashboard-header .metric-value.highlight,
.dashboard-header .metric-value.negative,
.dashboard-header .metric-value.positive,
.dashboard-header .metric-sub,
.dashboard-header .metric-label,
.dashboard-header .metric-content span,
.dashboard-header [id^="dashboard-"] {
    color: white !important;
}

.metric-sub {
    font-size: clamp(0.5rem, 1.2vw, 0.68rem);
    opacity: 0.7;
    line-height: 1.3;
    font-weight: 400;
    white-space: nowrap;
    color: white !important;
    margin-top: 4px;
}

/* Link "Dettagli" in fondo alla card metrica */
.metric-detail-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
    padding: 5px 8px;
    font-size: 0.6rem !important;
    font-weight: 600 !important;
    color: white !important;
    letter-spacing: 0.5px;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease;
    border-top: none;
    text-transform: uppercase;
    opacity: 0.85;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
}

.metric-detail-link:hover {
    opacity: 1;
    background: rgba(255,255,255,0.2);
    color: white !important;
}

.metric-detail-link:active {
    opacity: 0.6;
}

.metric-detail-link i {
    font-size: 0.55rem !important;
}

/* Sezione Movimenti - stile standalone come Analisi Finanziaria */
.important-movements {
    background: transparent;
    padding: 0;
    margin-bottom: 24px;
    box-shadow: none;
}

/* Upcoming Expenses */
.upcoming-expenses {
    margin-bottom: 32px;
}

/* Header standalone (stile Analisi Finanziaria) */
.section-header-standalone {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 8px;
}

.section-header-standalone h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.section-header-standalone .period-info {
    margin-bottom: 0 !important;
}


/* Header section reorganizzata */
.expenses-header-section {
    margin-bottom: 24px;
}

.section-title-area {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.section-title-area h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.period-info {
    font-size: 0.75rem !important;
    color: #9ca3af !important;
    margin: 0 0 24px 0 !important;
    font-style: italic !important;
    font-weight: 400 !important;
    opacity: 0.85 !important;
    display: block !important;
    visibility: visible !important;
}

/* Tab box per filtrare le spese - Warm & Rounded style */
.expenses-tabs-box, .movements-tabs-box {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0 auto 18px auto;
    max-width: 900px;
    box-shadow: none;
}

.tabs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.expenses-summary {
    display: flex;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 8px;
    align-items: center;
}

/* Tab items - Warm & Rounded */
.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    padding: 14px 8px;
    background: #f1f5f9;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tab-item:not(.info-only):hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: none;
    box-shadow: none;
}

.tab-item.active {
    background: #fff7ed;
    border-color: #fed7aa;
    box-shadow: 0 0 0 1px #fed7aa;
    transform: none;
}

.tab-item.active::before {
    display: none;
}

.tab-item.info-only {
    cursor: default;
    opacity: 0.75;
    background: #f8fafc;
    border-style: dashed;
    border-color: #e2e8f0;
}

.tab-item.info-only:hover {
    transform: none;
    box-shadow: none;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.tab-item.info-only .tab-label {
    color: #9ca3af;
}

.tab-item.info-only .tab-count {
    color: #9ca3af;
}

/* Label e valori dei tab */
.tab-label {
    font-size: 0.58rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 2px 0;
}

.tab-count {
    font-size: 0.58rem;
    color: #94a3b8;
    font-weight: 400;
    margin-top: 0;
}

.tab-item.active .tab-label {
    color: #9a3412;
}

.tab-item.active .tab-count {
    color: #c2410c;
}

.tab-value.negative {
    color: #ef4444;
}

.tab-value.paid {
    color: #0d0d0d;
}

.tab-value.pending {
    color: #ef4444;
}

.tab-value.positive {
    color: #10b981;
}

/* Expenses Grid - Card Design */
.expenses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* Movements Grid - List Design */
.movements-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 16px;
}

.expense-card {
    background: white;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 10px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
}

.expense-card:hover {
    box-shadow: 0 3px 12px rgba(0,0,0,0.06);
}

/* Compact movement row layout */
.movement-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.spesa-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #64748b;
    flex-shrink: 0;
}

.movement-info {
    flex: 1;
    min-width: 0;
}

.movement-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movement-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.movement-dt {
    font-size: 0.72rem;
    color: #94a3b8;
}

.conto-badge {
    font-size: 0.6rem;
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.movement-right {
    text-align: right;
    flex-shrink: 0;
}

.movement-amt {
    font-weight: 700;
    font-size: 0.95rem;
}

.movement-amt.neg {
    color: #ef4444;
}

.movement-amt.pos {
    color: #0d0d0d;
}

.movement-amt.muted {
    color: #9ca3af;
}

.movement-original {
    font-size: 0.72rem;
    color: #9ca3af;
    text-decoration: line-through;
    opacity: 0.7;
}

.movement-countdown {
    font-size: 0.62rem;
    color: #94a3b8;
    margin-top: 2px;
}

.movement-edit-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.movement-edit-btn:hover {
    background: #0d0d0d;
    border-color: #0d0d0d;
    color: white;
}

/* Confirm box for obiettivi */
.movement-confirm-box {
    margin-top: 12px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.movement-confirm-actions {
    display: flex;
    gap: 8px;
}

.movement-confirm-btn {
    flex: 1;
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    background: #0d0d0d;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.movement-confirm-btn:hover {
    background: #5a6fd6;
    transform: translateY(-1px);
}

.movement-info-btn {
    padding: 9px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background: #f1f5f9;
    color: #0d0d0d;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
}

.movement-info-btn:hover {
    background: #0d0d0d;
    border-color: #0d0d0d;
    color: white;
}

/* Undo row for confirmed obiettivi */
.movement-undo-row {
    margin-top: 10px;
}

.movement-undo-btn {
    width: 100%;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.movement-undo-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

.expense-card.today {
    background: #fffbf0;
    border-color: #fed7aa;
}

.expense-card.paid {
    background: #fafbfc;
    opacity: 0.75;
}

.expense-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.expense-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Container per l'importo e il pulsante modifica */
.expense-amount-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expense-amount {
    font-weight: 600;
    font-size: 1.2rem;
    color: #ef4444;
}

/* Stili per movimenti positivi (risparmi) */
.expense-amount.positive-amount {
    color: #0d0d0d;
}

.expense-card.positive-movement {
    /* Bordo rimosso per design più pulito */
}

.expense-card.positive-movement .expense-name {
    color: #0d0d0d;
}

/* Pulsante modifica spesa */
.edit-expense-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    flex-shrink: 0;
}

.edit-expense-btn:hover {
    background: #0d0d0d;
    border-color: #0d0d0d;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.edit-expense-btn i {
    font-size: 0.8rem;
    color: #64748b;
}

.edit-expense-btn:hover i {
    color: white;
}

.expense-details {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 8px;
}

.expense-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.expense-account {
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-today {
    background: #ff9800;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.badge-confirmation {
    background: #f59e0b;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    animation: pulse-confirmation 2s infinite;
}

.badge-attesa {
    background: #f97316;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    animation: pulse-attesa 3s infinite;
}

@keyframes pulse-confirmation {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes pulse-attesa {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.badge-paid {
    background: #0d0d0d;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.badge-sdd {
    background: #0d0d0d;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
}

.expense-note {
    font-size: 0.8rem;
    color: #f57c00;
    font-style: italic;
    margin-top: 8px;
}

.expense-note-paid {
    font-size: 0.8rem;
    color: #0d0d0d;
    font-style: italic;
    margin-top: 8px;
}

/* Container separato per spese pagate - pulito */
#spese-pagate-container {
    margin-top: 20px;
}

/* Sezione espandibile spese pagate - completamente separata */
.paid-expenses-section {
    border: 2px solid #0d0d0d;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.15);
    max-width: 1000px;
    margin: 0 auto;
}

.paid-expenses-header {
    background: linear-gradient(135deg, #0d0d0d 0%, #0d0d0d 100%);
    padding: 20px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border-bottom: none;
}

.paid-expenses-header:hover {
    background: linear-gradient(135deg, #0d0d0d 0%, #047857 100%);
    transform: translateY(-1px);
}

.paid-expenses-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.paid-expenses-header h3::before {
    content: '✅';
    font-size: 1.1rem;
}

.expand-icon {
    font-size: 1.3rem;
    color: white;
    transition: transform 0.2s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.paid-expenses-content {
    padding: 24px;
    background: white;
}

.paid-expenses-content .expenses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin: 0;
}

/* Financial Insights */
.financial-insights h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2c3e50;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.insight-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.insight-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

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

.insight-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.insight-icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

.insight-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.insight-value.positive {
    color: white;
}

.insight-value.negative {
    color: #ef4444;
}

.insight-value.potential {
    color: #f59e0b;
}

.insight-description {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-style: italic;
}

/* Stili per riferimenti temporali dashboard */
.temporal-reference {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-top: 8px;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    background: -webkit-linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%); /* Safari fallback */
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #064e5a;
    font-weight: 500;
    -webkit-font-smoothing: antialiased; /* Migliora rendering font Safari */
    font-feature-settings: "kern" 1; /* Migliora spaziatura caratteri */
}

.temporal-reference i {
    color: #10b981;
    font-size: 0.8rem;
}

.temporal-reference.dashboard-general {
    margin-bottom: 16px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    background: -webkit-linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%); /* Safari fallback */
    border: 1px solid #90caf9;
    color: #1565c0;
    font-weight: 600;
}

.temporal-reference.dashboard-general i {
    color: #0d0d0d;
}

.metric-update {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-top: 4px;
    display: block;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(5px);
}

/* Notifiche Email - Bell Toggle */
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title-row h2 {
    margin: 0;
}

/* Il toggle e' figlio diretto di .movimenti-header */
.movimenti-header {
    position: relative;
}

.movimenti-header > .notifiche-bell-toggle {
    position: absolute;
    right: 0;
    top: 8px;
}

@media (max-width: 480px) {
    .movimenti-header > .notifiche-bell-toggle {
        position: relative;
        right: auto;
        top: auto;
        display: block;
        margin: 8px auto 0;
    }
}

.notifiche-bell-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: #d1d5db;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
    border: none;
    padding: 0;
}

.notifiche-bell-toggle .bell-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.notifiche-bell-toggle .bell-knob i {
    font-size: 0.7rem;
    color: #9ca3af;
    transition: color 0.3s;
}

.notifiche-bell-toggle.active {
    background: linear-gradient(135deg, #0d0d0d 0%, #1f1f1f 100%);
}

.notifiche-bell-toggle.active .bell-knob {
    transform: translateX(24px);
    box-shadow: 0 2px 6px rgba(13, 13, 13, 0.4);
}

.notifiche-bell-toggle.active .bell-knob i {
    color: #1f1f1f;
}

/* Modal Styles */
.modal {
    position: fixed !important;
    z-index: 9999 !important;
    left: 0;
    top: 0;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    color: #1e293b;
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s ease;
}

.close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 32px;
}

.health-description p {
    color: #475569;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

.health-ranges {
    display: grid;
    gap: 16px;
    margin-bottom: 32px;
}

.range {
    padding: 16px 20px;
    border-radius: 12px;
    border-left: 4px solid;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.range.excellent {
    border-left-color: white;
    background: #ecfdf5;
}

.range.good {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.range.sufficient {
    border-left-color: #f97316;
    background: #fff7ed;
}

.range.critical {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.range-label {
    font-weight: 600;
    color: #1e293b;
}

.range-desc {
    color: #64748b;
    font-size: 0.9rem;
}

.improvement-tips {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 24px;
}

.improvement-tips h3 {
    color: #1e293b;
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 600;
}

.improvement-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.improvement-tips li {
    padding: 8px 0;
    color: #475569;
    font-size: 1rem;
    line-height: 1.5;
}

.improvement-tips li strong {
    color: #1e293b;
}

/* Info Button */
.info-button {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    margin-left: 12px;
    color: #475569;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    max-width: 24px;
    max-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

.info-button::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d0d0d, #0d0d0d);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: -1;
}

.info-button:hover {
    background: linear-gradient(135deg, #0d0d0d 0%, #0d0d0d 100%);
    border-color: #0d0d0d;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.info-button:hover::before {
    opacity: 1;
}

.info-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* Methodology sections */
.methodology, .calculation-method, .ai-recommendations {
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.methodology h3, .calculation-method h3, .ai-recommendations h3 {
    color: #1e293b;
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.methodology ul {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
}

.methodology li {
    padding: 6px 0;
    color: #475569;
    line-height: 1.5;
}

.calculation-method code {
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    display: inline-block;
    margin: 8px 0;
}

/* AI Recommendations */
.ai-recommendations {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #0ea5e9;
}

.personalized-tip {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin: 12px 0;
    border-left: 4px solid #0ea5e9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tip-title {
    font-weight: 600;
    color: #0c4a6e;
    margin-bottom: 8px;
}

.tip-description {
    color: #475569;
    line-height: 1.5;
    margin-bottom: 8px;
}

.tip-impact {
    font-size: 0.9rem;
    color: #0d0d0d;
    font-weight: 500;
}

.tip-priority {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 8px;
}

.tip-priority.high {
    background: #fef2f2;
    color: #dc2626;
}

.tip-priority.medium {
    background: #fff7ed;
    color: #ea580c;
}

.tip-priority.low {
    background: #f0fdf4;
    color: #0d0d0d;
}

.tip-actions {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.tip-actions li {
    padding: 4px 0;
    color: #475569;
    line-height: 1.4;
}

.error, .no-tips {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-style: italic;
}

/* *** OBIETTIVI CONFIRMATION STYLES *** */

/* Stile speciale per le card degli obiettivi */
.expense-card.obiettivo-card {
    /* Stesso stile delle spese normali - senza bordo colorato */
    background: white;
    transition: all 0.3s ease;
}

.expense-card.obiettivo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Stile per obiettivi in attesa di conferma */
.expense-card.obiettivo-card.in-attesa {
    /* Stesso stile delle spese normali - senza bordo colorato */
    background: white;
    opacity: 1;
}

.expense-card.obiettivo-card.in-attesa:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.expense-card.obiettivo-card.in-attesa .obiettivo-question span {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.3);
    color: #9a3412;
}

/* Importo degli obiettivi */
.expense-amount.obiettivo-amount {
    color: #f59e0b;
    font-weight: 700;
}

/* Sezione azioni obiettivo */
.obiettivo-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px dashed #f59e0b;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 8px;
    padding: 16px;
}

.obiettivo-question {
    text-align: center;
    margin-bottom: 16px;
}

.obiettivo-question span {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #92400e;
    background: rgba(245, 158, 11, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Bottoni di conferma/rimozione obiettivi */
.obiettivo-buttons {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

.obiettivo-buttons button {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.conferma-btn {
    background: linear-gradient(135deg, #0d0d0d 0%, #0d0d0d 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.conferma-btn:hover {
    background: linear-gradient(135deg, #0d0d0d 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.rimanda-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.rimanda-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* Responsive per obiettivi */
@media (max-width: 768px) {
    .obiettivo-buttons {
        gap: 10px;
    }
    
    .obiettivo-buttons button {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    
    .obiettivo-question span {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    .obiettivo-actions {
        padding: 12px;
        margin-top: 12px;
        padding-top: 12px;
    }
}

@media (max-width: 480px) {
    .obiettivo-buttons {
        gap: 8px;
    }
    
    .obiettivo-buttons button {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .obiettivo-question span {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
}

/* Responsive Design per metriche */
@media (max-width: 1200px) {
    .metric-value {
        font-size: clamp(0.6rem, 2.2vw, 1.2rem);
    }

    .metric-value.large {
        font-size: clamp(0.7rem, 2.5vw, 1.4rem);
    }

    .metric-sub {
        font-size: clamp(0.45rem, 1.4vw, 0.65rem);
    }
}

@media (max-width: 992px) {
    .metric-value {
        font-size: clamp(0.55rem, 2.5vw, 1.1rem);
    }

    .metric-value.large {
        font-size: clamp(0.65rem, 2.8vw, 1.3rem);
    }

    .metric-sub {
        font-size: clamp(0.4rem, 1.6vw, 0.6rem);
    }

    .metric {
        padding: 12px 10px;
    }

    .compact-metrics {
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 18px 16px;
        border-radius: 16px;
    }

    .compact-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .header-info {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }

    .main-balance h1 {
        font-size: 2.5rem;
    }

    .key-metrics {
        grid-template-columns: 1fr;
    }


    .expenses-grid {
        grid-template-columns: 1fr;
    }

    /* Compact movement cards responsive */
    .movement-row {
        gap: 10px;
    }

    .spesa-icon {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .movement-name {
        font-size: 0.82rem;
    }

    .movement-meta {
        gap: 6px;
    }

    .movement-dt {
        font-size: 0.68rem;
    }

    .movement-amt {
        font-size: 0.85rem;
    }

    .movement-confirm-actions {
        flex-wrap: wrap;
    }

    .movement-confirm-btn {
        flex: 1;
        min-width: 0;
    }

    .header-info {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .metric-value {
        font-size: clamp(0.75rem, 3.5vw, 1.2rem);
    }

    .metric-value.large {
        font-size: clamp(0.85rem, 4vw, 1.4rem);
    }

    .metric-sub {
        font-size: clamp(0.5rem, 2.2vw, 0.65rem);
    }

    .metric {
        padding: 14px 10px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .chart-container {
        padding: 12px;
    }
    
    .chart-container canvas {
        max-width: 280px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-body {
        padding: 24px;
    }
    
    .health-ranges {
        gap: 12px;
    }
    
    .range {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: left;
    }
    
    .improvement-tips {
        padding: 20px;
    }
    
    /* Header responsive */
    .expenses-header-section {
        margin-bottom: 20px;
    }
    
    .section-title-area {
        text-align: left;
        max-width: none;
    }
    
    .section-title-area h2 {
        font-size: 1.3rem;
    }
    
    .period-info {
        font-size: 0.7rem !important;
        opacity: 0.8 !important;
    }
    
    /* Tab responsive - Warm & Rounded */
    .tabs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .tab-item {
        padding: 10px 8px;
        border-radius: 12px;
    }

    .tab-label {
        font-size: 0.55rem;
    }

    .tab-value {
        font-size: 0.9rem;
    }

    .tab-count {
        font-size: 0.55rem;
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        padding: 20px;
    }
    
    .main-balance h1 {
        font-size: 2rem;
    }
    
    .action-card {
        padding: 20px;
    }
    
    .action-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    /* Very small screens - single column tabs */
    .tabs-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .tab-item {
        padding: 10px;
        gap: 4px;
    }
    
    .tab-label {
        font-size: 0.65rem;
    }
    
    .tab-value {
        font-size: 0.9rem;
    }
    
    .tab-count {
        font-size: 0.6rem;
    }
}

/* Box di conferma pagamento per obiettivi e spese con richiede_conferma=1 */
.obiettivo-conferma-box {
    margin-top: 12px;
    padding: 12px;
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.conferma-status {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
    line-height: 1.4;
}

.conferma-pagamento-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    background: #0d0d0d;
    color: white;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.conferma-pagamento-btn:hover {
    background: #0d0d0d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.conferma-pagamento-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.rimanda-btn-compact {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: #f59e0b;
    color: white;
    transition: all 0.2s ease;
    text-align: center;
}

.rimanda-btn-compact:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Stili compatti per obiettivi (legacy - mantenuto per compatibilità) */
.obiettivo-actions-compact {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.conferma-btn-compact {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
    background: #0d0d0d;
    color: white;
}

.conferma-btn-compact:hover {
    background: #0d0d0d;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.badge-attesa {
    background: #f59e0b;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
}

.obiettivo-undo-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #fbbf24;
}

.undo-obiettivo-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    background: #ef4444;
    color: white;
    transition: all 0.2s ease;
    width: 100%;
}

.undo-obiettivo-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* ===== Sezione Metodo EasyBudget ===== */
.easybudget-method-section {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 24px;
    box-shadow: none;
}

.easybudget-method-section h2 {
    color: #1e293b;
    margin: 0 0 6px 0;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.easybudget-method-section .section-subtitle {
    color: #9ca3af;
    font-size: 0.75rem;
    line-height: 1.3;
    margin: 0 0 20px 0;
    font-style: italic;
    font-weight: 400;
    opacity: 0.85;
    text-align: center;
}

/* Card Rate Easy */
.easy-rate-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.easy-rate-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: all 0.3s ease;
}

.easy-rate-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.easy-rate-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.1rem;
}

.easy-rate-icon-altri {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
}

.easy-rate-icon-te {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.easy-rate-icon-totale {
    background: rgba(139, 92, 246, 0.12);
    color: #0d0d0d;
}

.easy-rate-label {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.easy-rate-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    margin-bottom: 4px;
}

.easy-rate-sub {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 400;
}

/* Varianti colore bordo superiore */
.easy-rate-card.easy-rate-altri {
    border-top: 3px solid #f97316;
}

.easy-rate-card.easy-rate-te {
    border-top: 3px solid #10b981;
}

.easy-rate-card.easy-rate-totale {
    border-top: 3px solid #0d0d0d;
}

/* Responsive: 2 card piccole + totale sotto su mobile */
@media (max-width: 768px) {
    .easy-rate-cards {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .easy-rate-card {
        padding: 12px 10px;
    }

    .easy-rate-card.easy-rate-totale {
        grid-column: 1 / -1;
    }

    .easy-rate-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .easy-rate-label {
        font-size: 0.55rem;
    }

    .easy-rate-value {
        font-size: 1.15rem;
    }

    .easy-rate-sub {
        font-size: 0.6rem;
    }

    .easybudget-method-section .section-subtitle {
        font-size: 0.7rem;
    }
}

@media (max-width: 1024px) {
    #distribuzione-famiglia-totale { display: none; }
}
