/* Modal per modifica spese - posizionato in alto nella pagina */
#modal-spesa {
    align-items: flex-start;
    padding-top: 5vh;
    background: rgba(0, 0, 0, 0.4);
}

/* Modal tipo modifica - assicura visibilità */
#modal-tipo-modifica {
    z-index: 10001 !important;
}

#modal-spesa .modal-content {
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    margin: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Migliore visibilità per i campi input modificabili */
#modal-spesa input[type="radio"],
#modal-spesa input[type="checkbox"] {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
    font-size: inherit !important;
}

#modal-spesa input[type="text"],
#modal-spesa input[type="number"],
#modal-spesa input[type="email"],
#modal-spesa input[type="date"],
#modal-spesa textarea,
#modal-spesa select {
    cursor: text !important;
    background-color: #fff !important;
    border: 2px solid #e9ecef !important;
    transition: all 0.3s ease !important;
}

#modal-spesa input[type="text"]:hover,
#modal-spesa input[type="number"]:hover,
#modal-spesa input[type="email"]:hover,
#modal-spesa input[type="date"]:hover,
#modal-spesa textarea:hover,
#modal-spesa select:hover {
    border-color: #0d0d0d !important;
    background-color: #f8f9fa !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1) !important;
}

#modal-spesa input[type="text"]:focus,
#modal-spesa input[type="number"]:focus,
#modal-spesa input[type="email"]:focus,
#modal-spesa input[type="date"]:focus,
#modal-spesa textarea:focus,
#modal-spesa select:focus {
    border-color: #0d0d0d !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2) !important;
    outline: none !important;
}

/* Campo importo con evidenziazione speciale */
#importo-totale {
    font-size: .83rem !important;
    color: #2c3e50 !important;
    padding-left: 2.5rem !important;
}

#importo-totale:hover {
    background-color: #e8f5e8 !important;
    border-color: #0d0d0d !important;
}

#importo-totale:focus {
    background-color: #fff !important;
    border-color: #0d0d0d !important;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.2) !important;
}

/* Sezione spese terminate collassabile */
.spese-terminate-section {
    margin-top: 20px;
    border-top: 2px solid #ddd;
    padding: 0;
    width: 100%;
}

.spese-terminate-header {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

.spese-terminate-header:hover {
    background-color: #e9ecef;
}

.spese-terminate-title {
    font-weight: 600;
    color: #6c757d;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spese-terminate-toggle {
    font-size: 0.9em;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.spese-terminate-toggle.expanded {
    transform: rotate(180deg);
}

.spese-terminate-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.spese-terminate-content.expanded {
    max-height: 2000px; /* Valore alto per permettere l'espansione */
}

.spese-terminate-content table {
    margin-top: 0;
}

/* Wrapper per spese terminate */
.spese-terminate-wrapper {
    width: 100%;
    margin-top: 20px;
}

/* Eredita tutti gli stili della tabella principale per le spese terminate */
.spese-terminate-content .table {
    /* Rimuovi l'opacità per i singoli elementi per applicarla solo alle righe */
}

.spese-terminate-content .table tr {
    opacity: 0.8; /* Rendi le spese terminate leggermente più trasparenti */
}

/* Assicura che tutti gli stili responsive siano applicati anche alle spese terminate */
@media (max-width: 768px) {
    .spese-terminate-content .table {
        border: 0;
    }
    
    .spese-terminate-content .table thead {
        display: none;
    }
    
    .spese-terminate-content .table,
    .spese-terminate-content .table tbody,
    .spese-terminate-content .table tr,
    .spese-terminate-content .table td {
        display: block;
        width: 100%;
    }
    
    .spese-terminate-content .table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 6px;
        background-color: #fff;
        opacity: 0.8;
    }
    
    .spese-terminate-content .table td {
        border: none;
        padding: 5px 0;
        text-align: left;
        border-bottom: 1px solid #eee;
    }
    
    .spese-terminate-content .table td:last-child {
        border-bottom: none;
    }
    
    .spese-terminate-content .table td:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        display: inline-block;
        width: 30%;
        margin-right: 10px;
    }
    
    .spese-terminate-content .azioni-cell {
        display: flex;
        gap: 5px;
        justify-content: flex-start;
        align-items: center;
        flex-wrap: wrap;
        padding-top: 10px;
    }
    
    .spese-terminate-content .azioni-cell:before {
        content: "Azioni: ";
        font-weight: bold;
        width: 30%;
        margin-right: 10px;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

/* MODIFICATO - Modal content con flexbox */
.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden; /* CAMBIATO da overflow-y: auto */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex; /* AGGIUNTO */
    flex-direction: column; /* AGGIUNTO */
}

/* MODIFICATO - Header fissa */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
    border-bottom: 1px solid #ecf0f1;
    position: sticky; /* AGGIUNTO */
    top: 0; /* AGGIUNTO */
    background-color: white; /* AGGIUNTO */
    z-index: 10; /* AGGIUNTO */
    flex-shrink: 0; /* AGGIUNTO - previene il restringimento */
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

/* MODIFICATO - Pulsante chiusura più visibile */
.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem; /* AUMENTATO da 1.2rem */
    color: #7f8c8d; /* CAMBIATO da #95a5a6 per maggiore contrasto */
    cursor: pointer;
    transition: all 0.3s; /* CAMBIATO da color 0.3s */
    width: 32px; /* AGGIUNTO */
    height: 32px; /* AGGIUNTO */
    display: flex; /* AGGIUNTO */
    align-items: center; /* AGGIUNTO */
    justify-content: center; /* AGGIUNTO */
    border-radius: 4px; /* AGGIUNTO */
}

.close-modal:hover {
    color: #e74c3c;
    background-color: #f8f9fa; /* AGGIUNTO - sfondo al hover */
}

/* MODIFICATO - Body scrollabile */
.modal-body {
    padding: 1.5rem;
    overflow-y: auto; /* AGGIUNTO */
    flex: 1; /* AGGIUNTO - occupa tutto lo spazio disponibile */
}

/* Stili per testo con ellipsis e tooltip */
.text-ellipsis {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    position: relative;
}

.tooltip-text {
    visibility: hidden;
    background-color: #333;
    color: white;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    white-space: normal;
    width: max-content;
    max-width: 300px;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.text-ellipsis:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Adatta la larghezza delle colonne */
#tabella-spese th:nth-child(1),
#tabella-spese td:nth-child(1) {
    max-width: 200px;
}

/* Indicatori stato con cerchi colorati */
.stato-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin: 0 auto;
}

.stato-indicator.in-corso {
    background-color: #0d0d0d;
    box-shadow: 0 0 4px rgba(39, 174, 96, 0.5);
}

.stato-indicator.sospeso {
    background-color: #f39c12;
    box-shadow: 0 0 4px rgba(243, 156, 18, 0.5);
}

.stato-indicator.terminato {
    background-color: #e74c3c;
    box-shadow: 0 0 4px rgba(231, 76, 60, 0.5);
}

/* Centra il cerchio nella cella */
td.stato-cell {
    text-align: center;
}

/* ========== STILI CARD SPESE CON PALLINI STATO ========== */

/* Layout principale delle card spese */
.spese-card {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.spese-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
    border-color: #0d0d0d;
}

/* Sezione sinistra con pallino e info */
.spesa-left {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 12px;
}

/* Pallino di stato - nascosto */
.spesa-left .status-indicator {
    display: none;
}

/* Informazioni spesa */
.spesa-info {
    flex: 1;
    min-width: 0;
}

.spesa-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spesa-subtitle {
    font-size: 0.85rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sezione destra con importo e azioni */
.spesa-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.spesa-amount {
    text-align: right;
}

.amount-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.amount-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spesa-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive per mobile */
@media (max-width: 768px) {
    .spese-card {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .spesa-left {
        margin-bottom: 12px;
    }
    
    .spesa-right {
        justify-content: space-between;
    }
    
    .spesa-title {
        font-size: 0.95rem;
    }
    
    .spesa-subtitle {
        font-size: 0.8rem;
    }
}

/* Stile per posizionare il checkbox domiciliazione subito dopo i due punti */
.domiciliazione-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.domiciliazione-group label:first-child {
    margin-bottom: 0;
    margin-right: 0.5rem;
}

.domiciliazione-group .toggle-switch {
    margin-right: auto;
}

.domiciliazione-group small {
    width: 100%;
    margin-top: 0.5rem;
}

/* Sezioni del form */
.form-section {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #0d0d0d;
}

.form-section h4 {
    margin: 0 0 1rem 0;
    color: #9ca3af;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h4 i {
    color: #0d0d0d;
}

/* Info tooltip - VERSIONE SEMPLIFICATA */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.info-icon {
    color: #0d0d0d;
    font-size: 0.85rem;
    cursor: help;
    transition: color 0.3s;
}

.info-icon:hover {
    color: #1f1f1f;
}

.info-tooltip .tooltip-content {
    visibility: hidden;
    background-color: #333;
    color: white;
    text-align: left;
    padding: 8px 12px;
    border-radius: 6px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    max-width: calc(100vw - 40px);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    white-space: normal;
    word-wrap: break-word;
    margin-left: -20px;
    margin-right: -20px;
}

.info-tooltip .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.info-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Freccia invertita quando il tooltip appare sotto (gestito da JS) */
.tooltip-content.tooltip-below::after {
    top: -10px !important;
    border-color: transparent transparent #333 transparent !important;
}

/* Migliora spaziatura form */
.modal-body .form-group {
    margin-bottom: 1.2rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* Radio group allineato a sinistra */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    transition: none;
    width: 100%;
    box-sizing: border-box;
}

.radio-option:hover {
    background-color: transparent;
}

.radio-option input[type="radio"] {
    margin: 0;
    width: auto;
    height: auto;
    flex-shrink: 0;
}

.radio-option label {
    margin: 0;
    cursor: pointer;
    color: #2c3e50;
    font-weight: normal;
}

.tipo-descrizione {
    display: inline;
    font-size: inherit;
    color: inherit;
}

/* Separatore visuale */
.form-separator {
    height: 1px;
    background-color: #dee2e6;
    margin: 2rem 0;
}

/* Anteprima data più visibile */
#container-anteprima-data-fine .form-group {
    margin-bottom: 0;
}

#container-anteprima-data-fine > div {
    background-color: #f3f4f6 !important;
    border-left: 4px solid #2196F3 !important;
    padding: 1rem !important;
    margin-top: 0.5rem;
}

/* Assicuriamoci che l'input con icona non copra le frecce */
.input-with-icon input[type="number"] {
    padding-left: 2.5rem; /* Spazio per l'icona */
    padding-right: 30px; /* Spazio per le frecce */
}

/* Barra di ricerca */
.search-bar {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid #dee2e6;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-container .input-with-icon {
    flex: 1;
}

.search-container .filter-input {
    width: 100%;
    font-size: 1rem;
}

#chiudi-ricerca {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s;
}

#chiudi-ricerca:hover {
    color: #e74c3c;
}
/* Stili per modal storico */
.modal-storico {
    max-width: 700px;
}

.storico-section {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.storico-section h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.storico-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.storico-info-item {
    display: flex;
    flex-direction: column;
}

.storico-info-item label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.3rem;
}

.storico-info-item span {
    font-weight: 600;
    color: #2c3e50;
}

/* Progress bar */
.progress-container {
    margin: 1.5rem 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background-color: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d0d0d 0%, #0d0d0d 100%);
    transition: width 0.5s ease;
    border-radius: 15px;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Stats cards */
.storico-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.storico-stats.tre-colonne {
    grid-template-columns: repeat(3, 1fr);
}

/* Tutte le stat-card del storico: colonna centrata — risolve overflow su qualsiasi larghezza */
.storico-stats .stat-card {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 0.6rem;
    gap: 0.2rem;
}

.storico-stats .stat-icon {
    margin-right: 0;
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

.storico-stats .stat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    width: 100%;
}

.storico-stats .stat-label {
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: normal;
}

.storico-stats .stat-value {
    font-size: 1.3rem;
}

.storico-stats .stat-amount {
    font-size: 0.85rem;
    font-weight: 700;
}

/* Layout risparmi/obiettivi: 3 colonne senza barra avanzamento */
.storico-stats.modalita-risparmio {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 0;
}

/* Schermo stretto: Disponibilità piena larghezza, Accantonati+Prelievi sotto */
@media (max-width: 540px) {
    .storico-stats.modalita-risparmio {
        grid-template-columns: 1fr 1fr;
    }

    .storico-stats.modalita-risparmio > .stat-card:first-child {
        grid-column: 1 / -1;
        padding: 1rem 1.2rem;
    }

    .storico-stats.modalita-risparmio > .stat-card:first-child .stat-value {
        font-size: 1.8rem;
    }
}

.stat-card {
    display: flex;
    align-items: center;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.stat-icon.green {
    background-color: #d4edda;
    color: #27ae60;
}

.stat-icon.orange {
    background-color: #fff3cd;
    color: #f39c12;
}

.stat-icon.blue {
    background-color: #dbeafe;
    color: #3b82f6;
}

.stat-icon.red {
    background-color: #fde8e8;
    color: #e74c3c;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: #6c757d;
}

.stat-info {
    min-width: 0;
}

.stat-hint-prossima {
    display: block;
    font-size: 0.72rem;
    color: #3b82f6;
    margin-top: 2px;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Colori card hero impegni */
.stat-card.card-spese  { border-left-color: #f59e0b; }
.stat-card.card-totale { border-left-color: #3b82f6; }
.stat-card.card-fondi  { border-left-color: #10b981; }
.stat-card.card-arrivo { border-left-color: #6b7280; }

.card-spese  .stat-icon { background: rgba(245,158,11,0.13);  color: #f59e0b; }
.card-arrivo .stat-icon { background: rgba(107,114,128,0.13); color: #6b7280; }
.card-totale .stat-icon { background: rgba(59,130,246,0.13);  color: #3b82f6; }
.card-fondi  .stat-icon { background: rgba(16,185,129,0.13);  color: #10b981; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.stat-amount {
    font-size: 0.9rem;
    color: #0d0d0d;
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.stat-amount {
    font-size: 0.9rem;
    color: #0d0d0d;
    font-weight: 600;
}

/* Responsive storico stats */
@media (max-width: 480px) {
    .storico-stats {
        gap: 0.5rem;
    }

    .storico-section {
        padding: 1rem;
    }

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

    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        margin-right: 0;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-amount {
        font-size: 0.75rem;
    }
}

/* Impatto card */
/* Impatto card */
.impatto-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    transition: all 0.3s ease;
}

/* Stato inattivo overlay - più sottile */
.impatto-card.inactive {
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
}

.impatto-card.inactive::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    z-index: 1;
}

.impatto-card.inactive .impatto-content {
    position: relative;
    z-index: 2;
}

.impatto-label {
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.impatto-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    transition: all 0.3s ease;
}

/* Valori per spese inattive - più elegante */
.impatto-value.inactive {
    opacity: 0.4;
    font-size: 1.6rem;
}

.impatto-percentuale {
    font-size: 1.2rem;
    color: #0d0d0d;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.impatto-percentuale.inactive {
    opacity: 0.4;
}

/* Badge stato - nuovo elemento elegante */
.stato-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 3;
}

.stato-badge.terminato {
    background-color: #f3f4f6;
    color: #0d0d0d;
}

.stato-badge.sospeso {
    background-color: #fff3cd;
    color: #856404;
}

/* Testo sottile per spiegazione */
.inactive-notice {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.75rem;
    color: #6c757d;
    font-style: italic;
    z-index: 3;
}

/* Timeline */
.timeline-container {
    max-height: 300px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #0d0d0d;
}

.timeline-item.past {
    border-left-color: #0d0d0d;
    opacity: 0.7;
}

.timeline-item.future {
    border-left-color: #f39c12;
}

.timeline-item.pending-confirmation {
    background: #fff7ed;
    border-left-color: #f97316;
    border-left-width: 4px;
}

.timeline-date {
    min-width: 100px;
    font-weight: 600;
    color: #2c3e50;
}

.timeline-amount {
    margin-left: auto;
    font-weight: 600;
    color: #0d0d0d;
}

/* ---- TIMELINE MOBILE ---- */
@media (max-width: 640px) {
    .timeline-container {
        max-height: 480px;
    }

    .timeline-item {
        padding: 0.85rem 0.7rem;
        margin-bottom: 0.65rem;
    }
}

/* Bottone storico */
.btn-storico {
    background-color: #0d0d0d !important;
    color: white !important;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.3s;
}

.btn-storico:hover {
    background-color: #1f1f1f !important;
}

/* Stile per spese infinite */
#rate-mancanti, #importo-mancante {
    font-size: inherit;
}

#rate-mancanti:has-text("∞"), #importo-mancante:has-text("∞") {
    font-size: 1.8rem;
    color: #0d0d0d;
}

.progress-fill[style*="9b59b6"] {
    background: linear-gradient(90deg, #0d0d0d 0%, #0d0d0d 50%, #0d0d0d 100%);
    background-size: 200% 100%;
    animation: infiniteFlow 3s ease-in-out infinite;
}

@keyframes infiniteFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
/* Ridistribuzione spazio colonne tabella */
#tabella-spese {
    table-layout: fixed;
}

/* Colonna Nome - lasciamo com'è */
#tabella-spese th:nth-child(1),
#tabella-spese td:nth-child(1) {
    width: 20%;
}

/* Colonna Tipo - riduciamo */
#tabella-spese th:nth-child(2),
#tabella-spese td:nth-child(2),

#tabella-spese-terminate td:nth-child(2) {
    width: 8%;
}

/* Colonna Importo Totale - riduciamo */
#tabella-spese th:nth-child(3),
#tabella-spese td:nth-child(3),

#tabella-spese-terminate td:nth-child(3) {
    width: 10%;
}

/* Colonna Importo Mensile - riduciamo */
#tabella-spese th:nth-child(4),
#tabella-spese td:nth-child(4),

#tabella-spese-terminate td:nth-child(4) {
    width: 10%;
}

/* Colonna Frequenza - riduciamo un po' */
#tabella-spese th:nth-child(5),
#tabella-spese td:nth-child(5),

#tabella-spese-terminate td:nth-child(5) {
    width: 12%;
}

/* Colonna Prossima Data - riduciamo */
#tabella-spese th:nth-child(6),
#tabella-spese td:nth-child(6),

#tabella-spese-terminate td:nth-child(6) {
    width: 10%;
}

/* Colonna Conto - riduciamo */
#tabella-spese th:nth-child(7),
#tabella-spese td:nth-child(7),

#tabella-spese-terminate td:nth-child(7) {
    width: 12%;
}

/* Colonna Stato - riduciamo */
#tabella-spese th:nth-child(8),
#tabella-spese td:nth-child(8),

#tabella-spese-terminate td:nth-child(8) {
    width: 6%;
}

/* Colonna Azioni - aumentiamo! */
#tabella-spese th:nth-child(9),
#tabella-spese td:nth-child(9),

#tabella-spese-terminate td:nth-child(9) {
    width: 12%;
    white-space: nowrap; /* Impedisce di andare a capo */
}

/* Assicuriamoci che i bottoni stiano sulla stessa riga */
#tabella-spese .table-actions,
#tabella-spese-terminate .table-actions {
    display: flex;
    gap: 5px;
    justify-content: flex-start;
    align-items: center;
}
/* ========== SISTEMA RESPONSIVE COMPLETO ========== */

/* BREAKPOINT 1: Schermi larghi ma non full desktop (1400px) */
@media (max-width: 1400px) {
    #tabella-spese,
    #tabella-spese-terminate {
        font-size: 0.9rem;
    }
    
    #tabella-spese th,
    #tabella-spese td,
    
    #tabella-spese-terminate td {
        padding: 0.7rem 0.5rem;
    }
}

/* BREAKPOINT 2: Laptop piccoli (1200px) */
@media (max-width: 1200px) {
    #tabella-spese,
    #tabella-spese-terminate {
        font-size: 0.85rem;
    }
    
    #tabella-spese th,
    #tabella-spese td,
    
    #tabella-spese-terminate td {
        padding: 0.6rem 0.4rem;
    }
    
    /* Nome spesa più corto */
    #tabella-spese td:first-child span,
    #tabella-spese-terminate td:first-child span {
        max-width: 180px !important;
    }
    
    /* Badge più piccoli */
    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* BREAKPOINT 3: Tablet landscape (1024px) - ATTIVA SCROLL CON COLONNE FISSE */
@media (max-width: 1024px) {
    /* Container per il sistema di colonne fisse */
    .table-responsive {
        position: relative;
        overflow: hidden;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        margin-bottom: 15px;
        background: white;
    }
    
    /* Wrapper per la tabella scrollabile */
    .table-scroll-wrapper {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Tabella principale */
    #tabella-spese {
        min-width: 900px;
        width: 100%;
        position: relative;
    }
    
    /* Colonna fissa a destra - Solo Azioni */
    .table-fixed-columns {
        position: absolute;
        top: 0;
        right: 0;
        width: 120px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(8px);
        border-left: 1px solid rgba(222, 226, 230, 0.8);
        box-shadow: -2px 0 12px rgba(0,0,0,0.04);
        z-index: 10;
    }
    
    /* Header delle colonne fisse */
    .fixed-header {
        background: rgba(248, 249, 250, 0.95);
        backdrop-filter: blur(8px);
        color: #495057;
        font-weight: 600;
        font-size: 0.85rem;
        padding: 12px 8px;
        text-align: center;
        border-bottom: 1px solid rgba(222, 226, 230, 0.6);
        position: sticky;
        top: 0;
        z-index: 11;
    }
    
    /* Celle delle colonne fisse */
    .fixed-cell {
        padding: 12px 8px;
        border-bottom: 1px solid rgba(222, 226, 230, 0.4);
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        min-height: 45px;
        transition: background-color 0.2s ease;
    }
    
    .fixed-cell:hover {
        background: rgba(248, 249, 250, 0.98);
    }
    
    /* Stile per lo stato nelle colonne fisse */
    .fixed-cell .stato-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
        border-radius: 12px;
        font-weight: 500;
        white-space: nowrap;
    }
    
    /* Stile per i pulsanti nelle colonne fisse */
    .fixed-cell .btn-actions {
        display: flex;
        gap: 0.2rem;
        align-items: center;
    }
    
    .fixed-cell .btn-actions button {
        padding: 0.3rem 0.4rem;
        font-size: 0.7rem;
        border-radius: 4px;
        border: none;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    /* Nascondi solo la colonna Azioni nella tabella scrollabile */
    #tabella-spese th:nth-last-child(1),
    #tabella-spese td:nth-last-child(1) {
        display: none;
    }
    
    /* Indicatore visivo dello scroll */
    .table-responsive::after {
        content: "↔ Scorri per vedere tutti i dettagli";
        display: block;
        text-align: center;
        padding: 8px;
        background: linear-gradient(90deg, #f0f0f0 0%, #f8f8f8 50%, #f0f0f0 100%);
        color: #666;
        font-size: 0.75rem;
        font-weight: 500;
        letter-spacing: 0.5px;
        border-top: 1px solid #e0e0e0;
    }
    
    /* Ombra per indicare contenuto scrollabile */
    .table-scroll-wrapper {
        background: 
            linear-gradient(to right, white 30%, rgba(255,255,255,0)),
            linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
            radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.2), rgba(0,0,0,0)),
            radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;
        background-repeat: no-repeat;
        background-color: white;
        background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
        background-position: 0 0, 100%, 0 0, 100%;
        background-attachment: local, local, scroll, scroll;
    }
}

/* BREAKPOINT 4: Tablet portrait (768px) - PASSA A CARDS */
@media (max-width: 768px) {
    /* Rimuovi lo scroll e passa al layout mobile cards */
    .table-responsive {
        overflow-x: visible;
        border: none;
        background: none;
    }
    
    .table-responsive::after {
        display: none;
    }
    
    #tabella-spese,
    #tabella-spese-terminate {
        min-width: auto;
    }
    
    /* ========== LAYOUT MOBILE ULTRA-COMPATTO ========== */
    /* Nascondi header tabella */
    #tabella-spese thead,
    #tabella-spese-terminate thead {
        display: none;
    }
    
    /* Card ultra-compatta */
    #tabella-spese tbody tr,
    #tabella-spese-terminate tbody tr {
        display: block;
        margin: 0 8px 10px 8px;
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        padding: 10px;
        position: relative;
        min-height: 100px;
    }
    
    /* Reset celle */
    #tabella-spese td,
    #tabella-spese-terminate td {
        display: inline-block;
        border: none;
        padding: 0;
        margin: 0;
        position: static;
    }
    
    /* RIGA 1: Nome + Tipo + Stato */
    #tabella-spese td:first-child,
    #tabella-spese-terminate td:first-child {
        width: calc(100% - 100px);
        font-weight: 600;
        font-size: 0.95rem;
        margin-bottom: 8px;
        position: relative;
        padding-right: 5px; /* Piccolo spazio di sicurezza */
    }

    /* Container per il nome con ellipsis perfetto */
    #tabella-spese td:first-child .nome-container,
    #tabella-spese-terminate td:first-child .nome-container {
        display: block !important;
        width: 100%;
        overflow: hidden;
    }

    #tabella-spese td:first-child span,
    #tabella-spese-terminate td:first-child span {
        display: block !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        padding-right: 5px; /* Evita che tocchi il badge */
    }
    
    /* Tipo badge - posizione assoluta */
    #tabella-spese td:nth-child(2),
    #tabella-spese-terminate td:nth-child(2) {
        position: absolute;
        top: 12px;
        right: 40px;
    }
    
    #tabella-spese td:nth-child(2) .badge,
    #tabella-spese-terminate td:nth-child(2) .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Stato - posizione assoluta */
    #tabella-spese td:nth-child(8),
    #tabella-spese-terminate td:nth-child(8) {
        position: absolute;
        top: 14px;
        right: 12px;
    }
    
    #tabella-spese td:nth-child(8) .stato-indicator,
    #tabella-spese-terminate td:nth-child(8) .stato-indicator {
        width: 14px;
        height: 14px;
    }
    
    /* RIGA 2: Totale + Mensile + Frequenza + Prossima */
    #tabella-spese td:nth-child(3),
    #tabella-spese td:nth-child(4),
    #tabella-spese td:nth-child(5),
    #tabella-spese td:nth-child(6),
    
    
    
    #tabella-spese-terminate td:nth-child(6) {
        width: 25%;
        font-size: 0.8rem;
        margin-bottom: 8px;
        vertical-align: top;
    }
    
    /* Mini etichette */
    #tabella-spese td:nth-child(3):before,
    #tabella-spese td:nth-child(4):before,
    #tabella-spese td:nth-child(5):before,
    #tabella-spese td:nth-child(6):before,
    
    
    
    #tabella-spese-terminate td:nth-child(6):before {
        display: block;
        font-size: 0.65rem;
        color: #888;
        margin-bottom: 1px;
    }
    
    #tabella-spese td:nth-child(3):before,
    #tabella-spese-terminate td:nth-child(3):before { content: "Tot."; }
    #tabella-spese td:nth-child(4):before,
    #tabella-spese-terminate td:nth-child(4):before { content: "Mens."; }
    #tabella-spese td:nth-child(5):before,
    #tabella-spese-terminate td:nth-child(5):before { content: "Freq."; }
    #tabella-spese td:nth-child(6):before,
    #tabella-spese-terminate td:nth-child(6):before { content: "Pross."; }
    
    /* Valori più compatti */
    #tabella-spese td:nth-child(3),
    #tabella-spese td:nth-child(4),
    
    #tabella-spese-terminate td:nth-child(4) {
        font-weight: 600;
    }
    
    #tabella-spese td.importo.positivo,
    #tabella-spese-terminate td.importo.positivo { color: #0d0d0d; }
    #tabella-spese td.importo.negativo,
    #tabella-spese-terminate td.importo.negativo { color: #e74c3c; }
    
    /* Frequenza abbreviata */
    #tabella-spese td:nth-child(5),
    #tabella-spese-terminate td:nth-child(5) {
        font-size: 0.75rem;
    }
    
    /* Data più piccola */
    #tabella-spese td:nth-child(6),
    #tabella-spese-terminate td:nth-child(6) {
        font-size: 0.75rem;
    }
    
    /* RIGA 3: Conto + Azioni */
    #tabella-spese td:nth-child(7),
    #tabella-spese-terminate td:nth-child(7) {
        width: calc(100% - 130px);
        font-size: 0.8rem;
        display: inline-block;
        vertical-align: middle;
        padding-top: 4px;
    }
    
    #tabella-spese td:nth-child(7):before,
    #tabella-spese-terminate td:nth-child(7):before {
        content: "";
        display: none;
    }
    
    /* AZIONI - inline a destra */
    #tabella-spese td:last-child,
    #tabella-spese-terminate td:last-child {
        width: 120px;
        display: inline-flex !important;
        gap: 6px;
        justify-content: flex-end;
        vertical-align: middle;
        float: right;
    }
    
    /* Bottoni compatti ma visibili */
    #tabella-spese .btn-icon-small {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
        border-radius: 6px;
        background: white;
        border: 1px solid #ddd;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        flex-shrink: 0;
    }

    #tabella-spese .btn-storico,
    #tabella-spese-terminate .btn-storico {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
        border-radius: 6px;
        background: #0d0d0d !important;
        border-color: #0d0d0d !important;
        color: white !important;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        flex-shrink: 0;
    }
    
    #tabella-spese .btn-storico svg,
    #tabella-spese-terminate .btn-storico svg {
        width: 14px;
        height: 14px;
    }
    
    #tabella-spese .edit-spesa,
    #tabella-spese-terminate .edit-spesa {
        background: #0d0d0d;
        color: white;
        border-color: #0d0d0d;
    }
    
    #tabella-spese .delete-spesa,
    #tabella-spese-terminate .delete-spesa {
        background: #e74c3c;
        color: white;
        border-color: #e74c3c;
    }
    
    /* Clear float */
    #tabella-spese tbody tr:after,
    #tabella-spese-terminate tbody tr:after {
        content: "";
        display: table;
        clear: both;
    }
}

/* Schermi molto piccoli */
@media (max-width: 480px) {
    #tabella-spese tbody tr,
    #tabella-spese-terminate tbody tr {
        padding: 8px;
        min-height: 95px;
    }
    
    #tabella-spese td:first-child,
    #tabella-spese-terminate td:first-child {
        font-size: 0.9rem;
        width: calc(100% - 90px);
    }
    
    #tabella-spese td:nth-child(3),
    #tabella-spese td:nth-child(4),
    #tabella-spese td:nth-child(5),
    #tabella-spese td:nth-child(6),
    
    
    
    #tabella-spese-terminate td:nth-child(6) {
        font-size: 0.75rem;
    }
    
    #tabella-spese td:nth-child(7),
    #tabella-spese-terminate td:nth-child(7) {
        font-size: 0.75rem;
        width: calc(100% - 115px);
    }
    
    #tabella-spese td:last-child,
    #tabella-spese-terminate td:last-child {
        width: 110px;
    }
    
    #tabella-spese .btn-icon-small {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    #tabella-spese .btn-storico,
    #tabella-spese-terminate .btn-storico {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        background: #0d0d0d;
        border-color: #0d0d0d;
    }
}

/* Landscape - torna tabella normale con scroll */
@media (max-width: 812px) and (orientation: landscape) {
    .table-responsive {
        overflow-x: auto;
    }
    
    #tabella-spese,
    #tabella-spese-terminate {
        min-width: 700px;
        font-size: 0.8rem;
    }
    
    #tabella-spese thead,
    #tabella-spese-terminate thead {
        display: table-header-group;
    }
    
    #tabella-spese tbody tr,
    #tabella-spese-terminate tbody tr {
        display: table-row;
        margin: 0;
        padding: 0;
        min-height: auto;
    }
    
    #tabella-spese td,
    #tabella-spese-terminate td {
        display: table-cell !important;
        position: static !important;
        width: auto !important;
        padding: 0.5rem !important;
        float: none !important;
        margin: 0 !important;
    }
    
    #tabella-spese td:before,
    #tabella-spese-terminate td:before {
        display: none !important;
    }
}
/* Stili per terminazione anticipata */
.btn-outline-danger {
    background: transparent;
    color: #e74c3c;
    border: 2px dashed #e74c3c;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-outline-danger:hover {
    background-color: #e74c3c;
    color: white;
    border-style: solid;
}

/* Miglioramenti per i contenitori di terminazione */
#container-terminazione-anticipata .form-group {
    margin-bottom: 10px;
}

#container-terminazione-anticipata .form-group:last-child {
    margin-bottom: 0;
}

/* Stile per textarea delle note */
#note-terminazione {
    min-height: 80px;
    font-family: inherit;
    line-height: 1.4;
}

#note-terminazione:focus {
    border-color: #0d0d0d;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Stili per i messaggi informativi sullo stato terminato */
.terminazione-info {
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

.terminazione-info.anticipata {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.terminazione-info.automatica {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Miglioramenti responsive per la sezione terminazione */
@media (max-width: 768px) {
    #container-terminazione-anticipata {
        padding: 10px;
    }
    
    #container-terminazione-anticipata .form-group {
        margin-bottom: 15px;
    }
    
    .btn-outline-danger {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }
}

/* Nuovo layout ricerca e filtri unificato */
.search-container-extended {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filters-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 0 40px 0 0; /* Spazio per il pulsante X */
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.9rem;
    color: #6c757d;
    white-space: nowrap;
}

.filter-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
    cursor: pointer;
}

.filter-select:focus {
    border-color: #0d0d0d;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Responsive per filtri */
@media (max-width: 768px) {
    .search-container-extended {
        gap: 0.75rem;
    }
    
    .filters-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        padding-right: 0;
    }
    
    .filter-group {
        width: auto;
        min-width: unset;
        flex-direction: column;
        gap: 0.25rem;
        align-items: stretch;
    }
    
    .filter-group label {
        font-size: 0.8rem;
        margin-bottom: 0;
    }
    
    .filter-select {
        padding: 0.4rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .filters-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .filter-group {
        gap: 0.2rem;
    }
    
    .filter-group label {
        font-size: 0.75rem;
    }
    
    .filter-select {
        padding: 0.35rem;
        font-size: 0.8rem;
    }
}
/* Selettore Vista Dropdown */
.view-selector {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    position: relative;
    padding-right: 35px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 150px;
    z-index: 1000;
    margin-top: 5px;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item.active {
    background-color: #f3f4f6;
    color: #0d0d0d;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Vista Agenda */
.agenda-view {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

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

.agenda-header h4 {
    margin: 0;
    color: #2c3e50;
}

.agenda-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.agenda-content {
    max-height: 700px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .agenda-content {
        max-height: 560px;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .agenda-content {
        max-height: 520px;
        overflow-y: auto;
    }
}

.agenda-day {
    margin-bottom: 25px;
}

.agenda-day-header {
    background: linear-gradient(135deg, #0d0d0d15, #1f1f1f15);
    padding: 14px 18px;
    border-left: 5px solid #0d0d0d;
    margin-bottom: 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agenda-day-date {
    font-weight: 700;
    font-size: 1.05rem;
    color: #2c3e50;
}

.agenda-day-summary {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0d0d0d;
}

.agenda-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border: 1.5px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 12px;
    background: white;
    transition: all 0.2s;
    gap: 15px;
}

.agenda-item:hover {
    background-color: #f8fbff;
    transform: translateX(3px);
    border-color: #0d0d0d;
    box-shadow: 0 3px 8px rgba(13, 13, 13, 0.15);
}

/* Rimuovo il tempo - non necessario */
.agenda-item-time {
    display: none;
}

.agenda-item-content {
    flex: 1;
    min-width: 0;
}

.agenda-item-name {
    font-weight: 600;
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 4px;
}

/* Semplifico i dettagli - mostra solo le info essenziali */
.agenda-item-details {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 4px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.agenda-item-details > * {
    white-space: nowrap;
}

/* Nascondi badge extra non necessari */
.agenda-item-details .badge:not(:first-child) {
    display: none;
}

.agenda-item-amount {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.agenda-item-amount.positive {
    color: #0d0d0d;
}

.agenda-item-amount.negative {
    color: #e74c3c;
}

/* Badge tipo nella vista agenda - più compatto */
.agenda-item .badge {
    font-size: 0.75rem;
    padding: 4px 8px;
}
/* Stili aggiuntivi per agenda mensile */
.agenda-month {
    margin-bottom: 35px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.agenda-month-header {
    display: none;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agenda-month-name {
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: capitalize;
}

.agenda-month-summary {
    font-size: 0.9rem;
    opacity: 0.9;
}

.agenda-month-content {
    padding: 15px;
    background-color: #fafbfc;
}

.agenda-date-group {
    margin-bottom: 20px;
}

.agenda-date-header {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 8px;
    padding-left: 10px;
    font-weight: 500;
}
/* Stili per la navigazione mensile dell'agenda */
.agenda-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.agenda-month-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    min-width: 150px;
    text-align: center;
}

.agenda-navigation .btn {
    padding: 5px 10px;
}

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

@media (max-width: 768px) {
    .agenda-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .agenda-navigation {
        width: 100%;
        justify-content: center;
    }
}
/* Stili per eventi passati nell'agenda */
.agenda-item.past-event {
    background-color: #f8f9fa;
    opacity: 0.7;
    position: relative;
}

.agenda-item.past-event::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #95a5a6;
    opacity: 0.3;
}

.agenda-item.past-event:hover {
    background-color: #ecf0f1;
    transform: translateX(2px);
}

/* Icona check per eventi passati */
.agenda-item.past-event .fa-check-circle {
    color: #0d0d0d;
    opacity: 0.7;
}

/* ========== STILI CALENDARIO COMPATTO (COME AGENDA) ========== */

/* Toolbar del calendario */
.fc .fc-toolbar {
    padding: 15px 0 !important;
    margin-bottom: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* Rimuovi margini extra */
.fc-toolbar-chunk {
    margin: 0 !important;
}

/* Pulsante Oggi */
.fc-today-button {
    background-color: transparent !important;
    border: 2px solid #0d0d0d !important;
    color: #0d0d0d !important;
    padding: 8px 24px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    font-size: 1rem !important;
}

.fc-today-button:hover {
    background-color: #0d0d0d !important;
    color: white !important;
}

.fc-today-button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Titolo del mese */
.fc .fc-toolbar-title {
    font-size: 1.8rem !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    text-transform: capitalize !important;
    margin: 0 !important;
}

/* Container navigazione mese */
.fc-toolbar-chunk:last-child {
    background-color: #f0f4f8 !important;
    border-radius: 30px !important;
    padding: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
}

/* Testo "Mese" */
.fc-button-group::before {
    content: "Mese" !important;
    padding: 0 15px 0 10px !important;
    color: #64748b !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* Rimuovi separatori tra pulsanti */
.fc-button-group {
    display: inline-flex !important;
    align-items: center !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
}

/* Pulsanti frecce */
.fc-prev-button,
.fc-next-button {
    background-color: white !important;
    border: none !important;
    color: #64748b !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    margin: 0 3px !important;
    padding: 0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.fc-prev-button:hover,
.fc-next-button:hover {
    background-color: #0d0d0d !important;
    color: white !important;
    transform: scale(1.1) !important;
}

/* Icone frecce */
.fc-icon {
    font-size: 1rem !important;
}

/* Responsive */
@media (max-width: 768px) {
    .fc .fc-toolbar {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .fc-toolbar-chunk {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .fc .fc-toolbar-title {
        font-size: 1.4rem !important;
    }
    
    .fc-today-button {
        width: 100% !important;
    }
}

/* ========== STILI AGENDA DESIGN MODERNO ========== */

/* Header agenda */
.agenda-header {
    background: #f8f9fb;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    border-bottom: none;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========== STILI UNIFICATI PER TUTTI I TITOLI DELLE VISTE ========== */

/* Titolo agenda */
.agenda-header h4 {
    margin: 0 !important;
    color: #111827 !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    display: flex;
    align-items: center;
    gap: 12px !important;
}

.agenda-header h4 i {
    color: #ff7a00 !important;
}

/* Header vista elenco */
.list-view-header {
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.list-view-header h4 {
    margin: 0 !important;
    color: #0d0d0d !important;
    font-size: 1.4rem !important;
    font-weight: 600 !important;
    display: flex;
    align-items: center;
    gap: 12px !important;
}

.list-view-header h4 i {
    color: #0d0d0d !important;
}

/* Responsive per tutti i titoli */
@media (max-width: 768px) {
    .list-view-header {
        padding: 15px;
    }

    .list-view-header h4,
    .agenda-header h4,
    .calendar-custom-header h4 {
        font-size: 1rem !important;
        gap: 10px !important;
    }
}

/* Navigazione agenda */
.agenda-navigation {
    background-color: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
}

/* Display del mese corrente */
.agenda-month-display {
    padding: 0 8px !important;
    color: #374151 !important;
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    min-width: 120px !important;
    text-align: center !important;
    text-transform: capitalize !important;
    white-space: nowrap !important;
}

/* Pulsanti navigazione agenda */
#agenda-prev,
#agenda-next,
#agenda-today {
    background: #f8f9fb !important;
    border: 1px solid #e5e7eb !important;
    color: #4b5563 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    transition: all 0.2s !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    font-size: 0.75rem !important;
    flex-shrink: 0 !important;
}

#agenda-prev:hover,
#agenda-next:hover,
#agenda-today:hover {
    background: #fff0e0 !important;
    color: #ff7a00 !important;
    transform: none !important;
}

#agenda-today {
    margin-left: 0.4rem !important;
}

/* Contenuto agenda */
.agenda-content {
    background-color: #ffffff;
    border-radius: 0 0 12px 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    border-top: none;
}

/* Header del mese nell'agenda */
.agenda-month-header {
    display: none !important;
}

/* Migliora l'aspetto degli elementi agenda */
.agenda-item {
    border: 1px solid #e9ecef !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    background-color: white !important;
}

.agenda-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-2px) !important;
}

/* Stili per eventi stipendio in agenda */
.agenda-item-stipendio {
    cursor: default !important;
}

.agenda-item-stipendio:hover {
    transform: none !important;
}

.agenda-description {
    font-size: 0.85rem;
    color: #2d6a3e;
    margin-top: 4px;
    line-height: 1.4;
}

/* Responsive per agenda */
@media (max-width: 768px) {
    .agenda-header {
        flex-direction: column;
        gap: 15px;
        padding: 12px;
    }

    .agenda-navigation {
        width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 10px !important;
        padding: 8px !important;
    }

    /* Display del mese su mobile */
    .agenda-month-display {
        min-width: 160px !important;
        font-size: 1rem !important;
        padding: 0 15px !important;
    }

    /* Pulsanti frecce su mobile - dimensioni fisse */
    #agenda-prev,
    #agenda-next {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        flex-shrink: 0 !important;
        font-size: 1rem !important;
    }

    /* Agenda items su mobile - layout orizzontale compatto */
    .agenda-item {
        flex-direction: row !important;
        align-items: center !important;
        padding: 8px 12px !important;
        gap: 8px !important;
        margin-bottom: 6px !important;
    }

    .agenda-item-content {
        width: auto;
        flex: 1;
        min-width: 0;
    }

    .agenda-item-name {
        font-size: 0.82rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .agenda-item-details {
        font-size: 0.72rem !important;
        margin-top: 2px !important;
    }

    .agenda-item-amount {
        align-self: center !important;
        font-size: 0.88rem !important;
        flex-shrink: 0;
    }

    /* Badge più piccolo su mobile */
    .agenda-item .badge {
        font-size: 0.65rem !important;
        padding: 2px 5px !important;
    }

    /* Header giorno compatto e leggibile */
    .agenda-day-header {
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px;
        padding: 6px 12px !important;
        background: #f8f9fb !important;
        border-left: 3px solid #ff7a00 !important;
    }

    .agenda-day-date {
        font-size: 0.78rem !important;
        color: #111827 !important;
        font-weight: 700 !important;
    }

    .agenda-day-summary {
        font-size: 0.7rem !important;
        color: #6b7280 !important;
    }

    .agenda-day {
        margin-bottom: 14px !important;
    }

    /* Pulsante Oggi su mobile */
    #agenda-today {
        margin-left: 0.4rem !important;
        margin-top: 0 !important;
        width: 32px !important;
        max-width: 32px !important;
        padding: 0 !important;
        font-size: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .agenda-header {
        padding: 10px;
    }
    
    .agenda-navigation {
        padding: 6px !important;
        gap: 8px !important;
    }
    
    .agenda-month-display {
        min-width: 140px !important;
        font-size: 0.95rem !important;
        padding: 0 12px !important;
    }
    
    #agenda-prev,
    #agenda-next {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        font-size: 0.75rem !important;
    }

    #agenda-today {
        padding: 0 !important;
        font-size: 0.75rem !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
    }
}

/* ========== CALENDARIO MOBILE COMPATTO + LISTA EVENTI (SOLUZIONE 1) ========== */

/* Container calendario mobile */
#calendario-mobile-compatto {
    display: none; /* Mostrato solo su mobile */
}

/* Griglia calendario */
.mobile-calendar-grid {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}

.mobile-weekday {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    padding: 5px 0;
}

.mobile-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.mobile-day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    background: #fafafa;
    border: 1px solid transparent;
}

.mobile-day-cell.other-month {
    opacity: 0.3;
    pointer-events: none;
}

.mobile-day-cell.today {
    background: #e3f2fd;
    border: 2px solid #2196F3;
}

.mobile-day-cell.selected {
    background: #0d0d0d;
    color: white;
    transform: scale(1.05);
}

.mobile-day-cell.has-events {
    background: #f0f4ff;
}

.mobile-day-cell.selected.has-events {
    background: #0d0d0d;
}

/* Giorno di accredito stipendio */
.mobile-day-cell.stipendio-accredito {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    font-weight: 600;
}

.mobile-day-cell.stipendio-accredito .mobile-day-number {
    color: #155724;
}

/* Giorni di sicurezza (dopo accredito) */
.mobile-day-cell.stipendio-sicurezza {
    background: linear-gradient(135deg, #f0f9f4 0%, #e8f5e9 100%);
}

.mobile-day-cell.stipendio-sicurezza .mobile-day-number {
    color: #2d6a3e;
}

/* Quando sono selezionati, mantengono il colore verde ma più intenso */
.mobile-day-cell.stipendio-accredito.selected,
.mobile-day-cell.stipendio-sicurezza.selected {
    background: #28a745;
}

.mobile-day-cell.stipendio-accredito.selected .mobile-day-number,
.mobile-day-cell.stipendio-sicurezza.selected .mobile-day-number {
    color: white;
}

.mobile-day-number {
    font-size: 0.85rem;
    font-weight: 500;
}

.mobile-day-indicators {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.mobile-indicator-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

.mobile-indicator-dot.spesa { background: #0d0d0d; }
.mobile-indicator-dot.obiettivi { background: #9b59b6; }
.mobile-indicator-dot.risparmi { background: #27ae60; }
.mobile-indicator-dot.investimenti { background: #16a085; }

.mobile-day-cell.selected .mobile-indicator-dot {
    background: white !important;
}

/* Sezione lista eventi */
.mobile-events-section {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-events-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.mobile-events-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

.mobile-events-count {
    background: #0d0d0d;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.mobile-events-list {
    max-height: 400px;
    overflow-y: auto;
}

.mobile-event-card {
    background: #fafafa;
    border-left: 4px solid #0d0d0d;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.mobile-event-card:active {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-event-card.spesa {
    border-left-color: #0d0d0d;
}

.mobile-event-card.risparmi {
    border-left-color: #27ae60;
}

.mobile-event-card.investimenti {
    border-left-color: #16a085;
}

.mobile-event-card.obiettivi {
    border-left-color: #9b59b6;
}

.mobile-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.mobile-event-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.mobile-event-amount {
    font-weight: 700;
    color: #0d0d0d;
    font-size: 1rem;
}

.mobile-event-amount.risparmi {
    color: #27ae60;
}

.mobile-event-amount.investimenti {
    color: #16a085;
}

.mobile-event-amount.spesa {
    color: #0d0d0d;
}

.mobile-event-amount.obiettivi {
    color: #9b59b6;
}

.mobile-event-details {
    font-size: 0.8rem;
    color: #6c757d;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mobile-event-badge {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.mobile-no-events {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

.mobile-no-events-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.3;
}

/* Nascondi FullCalendar sempre */
#calendario {
    display: none !important;
}

/* Vista settimanale custom nascosta di default */
#calendario-settimana-custom {
    display: none;
}

/* Calendario mobile compatto visibile di default (ma controllato da JS) */
#calendario-mobile-compatto {
    display: block;
}

/* Quando vista settimanale è attiva, nascondi calendario mobile - METODO 1 */
.calendar-view.week-view-active #calendario-mobile-compatto {
    display: none !important;
}

/* Quando vista settimanale è attiva, nascondi calendario mobile - METODO 2 */
#calendario-settimana-custom[style*="display: block"] ~ #calendario-mobile-compatto {
    display: none !important;
}

/* ========== LAYOUT DESKTOP: CALENDARIO A SINISTRA, EVENTI A DESTRA ========== */
@media (min-width: 950px) {
    #calendario-mobile-compatto {
        display: flex !important;
        gap: 20px;
        align-items: flex-start;
    }

    .mobile-calendar-grid {
        flex: 1; /* Occupa il resto dello spazio disponibile */
        margin-bottom: 0;
    }

    .mobile-events-section {
        flex: 0 0 400px; /* Larghezza fissa solo per contenere il testo */
        margin-top: 0;
        max-height: 80vh; /* Limita altezza per mostrare scrollbar */
        overflow-y: scroll; /* Forza sempre la visualizzazione della scrollbar */
    }

    /* Stile scrollbar più visibile */
    .mobile-events-section::-webkit-scrollbar {
        width: 10px;
    }

    .mobile-events-section::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .mobile-events-section::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 10px;
    }

    .mobile-events-section::-webkit-scrollbar-thumb:hover {
        background: #555;
    }

    /* Quando vista settimanale è attiva, nascondi calendario mobile anche su desktop */
    .calendar-view.week-view-active #calendario-mobile-compatto {
        display: none !important;
    }
}

/* Stili per giorni di accredito stipendio in FullCalendar (agenda view) */
.fc-stipendio-accredito {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
}

.fc-stipendio-accredito .fc-daygrid-day-number {
    color: #155724 !important;
    font-weight: 600 !important;
}

.fc-stipendio-sicurezza {
    background: linear-gradient(135deg, #f0f9f4 0%, #e8f5e9 100%) !important;
}

.fc-stipendio-sicurezza .fc-daygrid-day-number {
    color: #2d6a3e !important;
}

/* ===== STILE MV-ROW (Dashboard style per elenco impegni) ===== */
.mv-row { margin-bottom: 6px; }
.mv-row-main {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: box-shadow .2s;
    cursor: default;
    overflow: hidden;
}
.mv-row-main:hover { box-shadow: 0 1px 3px rgba(0,0,0,.06); }
/* Desktop: top (icona+info) e bot (importo+bottoni) affiancati */
.mv-top { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mv-bot { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mv-ic {
    width: 34px; height: 34px; border-radius: 8px;
    background: #f3f4f6; color: #0d0d0d;
    display: flex; align-items: center; justify-content: center;
    font-size: .82rem; flex-shrink: 0;
}
.mv-ic.green { background: #d1fae5; color: #10b981; }
.mv-ic.amber { background: #fef3c7; color: #f59e0b; }
.mv-ic.orange { background: #fff0e0; color: #ff7a00; }
.mv-ic.blue  { background: #eff6ff; color: #3b82f6; }
.mv-info { flex: 1; min-width: 0; }
.mv-name {
    font-size: .84rem; font-weight: 600; color: #111827;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mv-meta { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; align-items: center; }
.mv-pill {
    display: inline-flex; align-items: center; padding: 2px 7px;
    border-radius: 50px; font-size: .7rem; font-weight: 600;
    background: #f9fafb; color: #9ca3af; border: 1px solid #e5e7eb;
}
.mv-pill.orange { background: #fff0e0; color: #ff7a00; border-color: #fff0e0; }
.mv-pill.green  { background: #d1fae5; color: #10b981; border-color: #d1fae5; }
.mv-pill.amber  { background: #fef3c7; color: #f59e0b; border-color: #fef3c7; }
.mv-pill.blue   { background: #eff6ff; color: #3b82f6; border-color: #eff6ff; }
.mv-amt-wrap {
    display: flex; flex-wrap: wrap;
    align-items: baseline; justify-content: flex-end;
    column-gap: 5px; min-width: 52px; flex-shrink: 0;
}
.mv-amt { font-size: .88rem; font-weight: 700; letter-spacing: -.3px; }
.mv-countdown { font-size: .72rem; color: #9ca3af; }
.mv-amt-wrap .mv-countdown:last-child:nth-child(3) { flex-basis: 100%; text-align: right; }
.mv-sep { width: 1px; height: 22px; background: #e5e7eb; flex-shrink: 0; margin: 0 4px; }
.mv-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.mv-actions button {
    width: 34px; height: 34px; padding: 0;
    border: none; border-radius: 6px; cursor: pointer;
    font-size: 14px; transition: all 0.2s; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
/* Stato card */
.mv-row.terminata .mv-row-main { opacity: .7; }
.mv-row.in-arrivo .mv-row-main { border-left: 3px solid #3b82f6; }
.mv-row.in-attesa .mv-row-main { border-left: 3px solid #f59e0b; }
/* Mobile: variante D — top impilato, bot con importo + bottoni */
@media (max-width: 768px) {
    .mv-row-main {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
    }
    .mv-top {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 11px 12px 9px;
        flex: 0 0 auto;
    }
    .mv-name { white-space: normal; }
    .mv-bot {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        background: #fafafa;
        border-top: 1px solid #efefef;
        padding: 8px 12px;
        flex: 0 0 auto;
        min-width: 0;
    }
    .mv-amt-wrap { justify-content: flex-start; flex-shrink: 1; min-width: 0; }
    .mv-amt { font-size: 1rem; }
    .mv-amt-wrap .mv-countdown:last-child:nth-child(3) { text-align: left; }
    .mv-sep { display: none; }
    .mv-actions { gap: 6px; flex-shrink: 0; }
    .mv-actions button { width: 40px; height: 40px; font-size: 14px; }
}

/* ========== FIX MOBILE: NO ZOOM SU INPUT / TOOLTIP ========== */

/* Previene zoom su doppio-tap sull'icona info */
.info-icon,
.info-tooltip {
    touch-action: manipulation;
}

/* iOS Safari fa zoom automatico su input con font-size < 16px.
   Forziamo 16px su mobile per tutti gli input del modal. */
@media (max-width: 768px) {
    #modal-spesa input[type="text"],
    #modal-spesa input[type="number"],
    #modal-spesa input[type="email"],
    #modal-spesa input[type="date"],
    #modal-spesa textarea,
    #modal-spesa select {
        font-size: 16px !important;
    }
}
