:root {
   --green: #1A8855;
   --yellow: #FEC107;
}

/* CSS scope pour éviter de polluer le reste du site */
/* .amept-table-scope {
    --green: var(--amept-green, var(--green, #1A8855));
    --yellow: var(--amept-yellow, var(--yellow, #FEC107));
} */

/* --- TABLE MODERNE --- */
.amept-table-scope .table-container {
    width: 100%;
    overflow-x: auto;
    margin: 40px 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.amept-table-scope .projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.amept-table-scope .projects-table thead {
    background: linear-gradient(135deg, var(--green), #5fa822);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.amept-table-scope .projects-table th {
    padding: 18px 15px;
    text-align: left;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 3px solid var(--yellow);
}

.amept-table-scope .projects-table th:last-child {
    text-align: right;
}

.amept-table-scope .projects-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.3s ease;
}

.amept-table-scope .projects-table tbody tr:hover {
    background: #f9f9f9;
}

.amept-table-scope .projects-table td {
    padding: 15px;
    color: #333;
}


.amept-table-scope .projects-table tr:not(.year-total) td {
   background-color: white;
}

.amept-table-scope .projects-table td:last-child {
    text-align: right;
}

/* Classes d'alignement (utilisées par l'éditeur admin) */
.amept-table-scope .projects-table .text-left { text-align: left !important; }
.amept-table-scope .projects-table .text-center { text-align: center !important; }
.amept-table-scope .projects-table .text-right { text-align: right !important; }

/* Cellules d'année avec rowspan */
.amept-table-scope .year-cell {
    background: var(--yellow) !important;
    font-weight: 800;
    vertical-align: middle;
    text-align: center;
    font-size: 0.95rem;
    border-right: 3px solid var(--green);
}

/* Lignes groupées par année */
.amept-table-scope .year-group {
    background: #fafafa;
}

/* Lignes de total */
.amept-table-scope .year-total {
    background: var(--green) !important;
    color: white;
    font-weight: 800;
}

.amept-table-scope .year-total td {
    padding: 12px 15px;
    color: white !important;
}

.amept-table-scope .year-total .total-label {
    text-align: left;
    font-size: 0.95rem;
}

.amept-table-scope .year-total .amount {
    font-size: 1.1rem;
    color: white !important;
}

/* Lignes en surbrillance */
.amept-table-scope .highlight-row {
    background: #e8f5e9;
}

/* Style des montants */
.amept-table-scope .amount {
    font-weight: 700;
    color: var(--green);
    white-space: nowrap;
    font-size: 1rem;
}

.amept-table-scope .total-amount {
    color: white !important;
    font-size: 1.2rem !important;
}

@media (max-width: 768px) {

    /* Masquer le thead */
    .amept-table-scope .projects-table thead {
        display: none;
    }

    /* Table en flux vertical */
    .amept-table-scope .projects-table,
    .amept-table-scope .projects-table tbody,
    .amept-table-scope .projects-table tr,
    .amept-table-scope .projects-table td {
        display: block;
        width: 100%;
    }

    /* Bloc année */
    .amept-table-scope .projects-table .year-block {
        margin-bottom: 20px;
        border: 2px solid var(--green);
        border-radius: 8px;
        overflow: hidden;
        background: white;
    }

    /* Bloc période */
    .amept-table-scope .projects-table .period-block {
        margin: 0; /* pas d’espace interne, collé */
        border: none;
        border-radius: 0;
        overflow: hidden;
    }

    /* Lignes internes (projets) */
    .amept-table-scope .projects-table .period-block tr {
        margin: 0;
        border: none;
        border-radius: 0;
        background: white;
    }

    /* Cellules standard */
    .amept-table-scope .projects-table td {
        padding: 12px 15px;
        padding-left: 45%;
        border-bottom: 1px solid #eee;
        text-align: left !important;
        position: relative;
    }

    .amept-table-scope .projects-table td:last-child {
        border-bottom: none;
    }

    /* Labels avant chaque td */
    .amept-table-scope .projects-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 40%;
        font-weight: 800;
        color: var(--green);
        text-transform: uppercase;
        font-size: 0.75rem;
    }

    /* Cellule année */
    .amept-table-scope .year-cell {
        padding-left: 15px !important;
        text-align: center !important;
        font-size: 1.1rem;
        border-right: none !important;
    }
    .amept-table-scope .year-cell:before {
        display: none;
    }

    /* Lignes de total période */
    .amept-table-scope .period-total td {
        padding: 12px 15px !important;
        border-bottom: none;
        font-weight: 700;
        background: #f0f4c3;
    }
    .amept-table-scope .period-total td:before {
        display: none;
    }

    /* Ligne de total année */
    .amept-table-scope .year-total td {
        padding: 12px 15px !important;
        border-bottom: none;
        font-weight: 800;
        background: var(--green);
        color: white !important;
    }
    .amept-table-scope .year-total td:before {
        display: none;
    }

}

