/* design_v1.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: #f4f6fb;
    color: #222;
}

.layout {
    display: flex;
    min-height: 100vh;
    overflow-x: visible;
}

html,
body {
    overscroll-behavior-y: none;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
    width: 260px;
    background: linear-gradient(180deg,
            #183B63,
            #1d497a);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, .10);
}

.logo {
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
}

.logo h1 {
    font-size: 30px;
    margin-bottom: 5px;
}

.tagline {
    font-size: 13px;
    color: #b6d0ee;
}

.signature {
    text-align: right;
    font-size: 11px;
    color: #8fb5dd;
    margin-top: 10px;
}

.menu {
    flex: 1;
    padding: 15px;
}

.menu a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: .2s;
}

.menu a:hover {
    background: rgba(255, 255, 255, .15);
    transform: translateX(5px);
}

.sidebar-footer {
    padding: 15px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, .10);
    font-size: 11px;
    color: #8fb5dd;
}

/* =========================
   CONTENU
========================= */

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

#content {
    width: 100%;
    padding: 5px;
}

/* =========================
   TOPBAR
========================= */

.topbar {
    background: white;
    border-radius: 20px;
    padding: 20px 25px;
    margin-bottom: 25px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    box-shadow: 0 3px 15px rgba(0, 0, 0, .05);
}

.welcome-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.current-date {
    color: #666;
    font-size: 14px;
}

/* =========================
   CARTES
========================= */

.cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.card {
    flex: 1;
    min-width: 250px;

    background: white;

    border-radius: 20px;
    padding: 25px;

    box-shadow: 0 3px 15px rgba(0, 0, 0, .05);

    transition: .2s;
}

.card:hover {
    transform: translateY(-5px);
}

.card-title {
    color: #777;
    margin-bottom: 10px;
}

.card-value {
    font-size: 34px;
    font-weight: bold;
}

.green {
    color: #2E7D32;
}

.red {
    color: #D32F2F;
}

.blue {
    color: #1976D2;
}

/* =========================
   DASHBOARD
========================= */
.dashboard-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-bottom:16px; }
.dashboard-kpi { min-height:112px; border-radius:16px; padding:18px 20px; display:flex; align-items:center; gap:16px; color:#fff; box-shadow:0 8px 24px rgba(15,23,42,.12); }
.dashboard-kpi-icon { flex:0 0 48px; height:48px; border-radius:14px; display:grid; place-items:center; font-size:23px; font-weight:800; background:rgba(255,255,255,.18); }
.dashboard-kpi>div:last-child { display:grid; min-width:0; }
.dashboard-kpi span { opacity:.88; font-size:14px; }
.dashboard-kpi strong { font-size:27px; line-height:1.15; margin:3px 0; overflow-wrap:anywhere; }
.dashboard-kpi small { opacity:.78; }
.dashboard-kpi-income { background:linear-gradient(135deg,#15803d,#22c55e); }
.dashboard-kpi-expense { background:linear-gradient(135deg,#dc2626,#f87171); }
.dashboard-kpi-result { background:linear-gradient(135deg,#6d28d9,#a78bfa); }
.dashboard-kpi-standby { background:linear-gradient(135deg,#c2410c,#fb923c); grid-column:1/-1; cursor:pointer; }
.dashboard-main-grid { display:grid; grid-template-columns:minmax(0,1.65fr) minmax(280px,.7fr); gap:16px; margin-bottom:16px; }
.dashboard-import-card,.dashboard-actions-card { min-width:0; }
.dashboard-section-heading,.dashboard-recent-header { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.dashboard-section-heading h3,.dashboard-actions-card h3,.dashboard-recent-header h3 { margin:4px 0 0; }
.dashboard-eyebrow { color:#64748b; font-size:12px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.dashboard-import-badge { padding:6px 10px; border-radius:20px; background:#e8f2ff; color:#1976d2; font-size:12px; white-space:nowrap; }
.dashboard-dropzone { height:230px; margin-top:18px; border-width:2px; border-style:dashed; border-color:#93c5fd; background:linear-gradient(145deg,#f8fbff,#eef6ff); }
.dashboard-dropzone h2 { margin:12px 0 5px; font-size:21px; }
.dashboard-dropzone p { color:#64748b; margin:0 0 14px; }
.dashboard-upload-button { padding:9px 16px; border-radius:10px; background:#1976d2; color:white; font-weight:700; box-shadow:0 5px 12px rgba(25,118,210,.25); }
.dashboard-actions { display:grid; gap:10px; margin-top:18px; }
.dashboard-action { width:100%; border:1px solid #e5e7eb; border-radius:12px; padding:13px; display:flex; align-items:center; gap:12px; text-align:left; background:white; cursor:pointer; color:#334155; }
.dashboard-action:hover { border-color:#93c5fd; background:#f8fbff; transform:translateY(-1px); }
.dashboard-action>span { width:38px; height:38px; border-radius:10px; display:grid; place-items:center; background:#eef6ff; font-size:18px; }
.dashboard-action div { display:grid; }
.dashboard-action small { color:#64748b; margin-top:2px; }
.dashboard-action.primary { border-color:#1976d2; background:#1976d2; color:white; }
.dashboard-action.primary>span { background:rgba(255,255,255,.16); }
.dashboard-action.primary small { color:#dbeafe; }
.dashboard-recent-panel { margin-top:0; }
.dashboard-recent-header { margin-bottom:12px; }
.dashboard-view-all { width:auto; padding:8px 14px; }
@media(max-width:900px){.dashboard-summary{grid-template-columns:repeat(2,minmax(0,1fr));}.dashboard-main-grid{grid-template-columns:1fr}.dashboard-kpi strong{font-size:23px}}
@media(max-width:600px){.dashboard-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.dashboard-kpi{min-height:72px;padding:10px 12px;gap:9px;border-radius:12px}.dashboard-kpi-icon{flex-basis:34px;height:34px;border-radius:10px;font-size:16px}.dashboard-kpi span{font-size:12px}.dashboard-kpi strong{font-size:17px;margin:1px 0}.dashboard-kpi small{display:none}.dashboard-kpi-standby{grid-column:1/-1}.dashboard-section-heading{align-items:flex-start}.dashboard-import-badge{display:none}.dashboard-dropzone{height:210px}.dashboard-recent-header{align-items:flex-start}.dashboard-view-all{padding:7px 10px}}

/* =========================
   BOUTONS
========================= */

.btn {
    background: #1976D2;
    color: white;

    border: none;
    border-radius: 12px;

    padding: 12px 20px;

    cursor: pointer;

    transition: .2s;
}

.btn:hover {
    background: #115293;
}

.btn-grey {
    background: #888;
}

.btn-grey:hover {
    background: #666;
}

.btn-small {
    margin-left: 10px;

    padding: 4px 10px;

    border: none;
    border-radius: 8px;

    background: #1976D2;
    color: white;

    cursor: pointer;
}

/* =========================
   DROPZONE PRINCIPALE
========================= */

.dropzone {
    background: white;

    border: 3px dashed #1E88E5;
    border-radius: 20px;

    height: 240px;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: center;

    cursor: pointer;

    transition: .2s;



    box-shadow: 0 3px 15px rgba(0, 0, 0, .05);
}

.dropzone:hover {
    background: #eef5ff;
    transform: scale(1.01);
}

.dragover {
    background: #dceeff !important;
}

.dropicon {
    font-size: 60px;
}

/* =========================
   PANELS
========================= */


.panel {
    width: 100%;
    max-width: 100%;
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, .05);
    overflow-x: auto;
}

.panel h3 {
    margin-bottom: 15px;
}


.operations-table-wrapper table {
    min-width: 900px;
}

.operations-table-wrapper table {
    min-width: 900px;
}

#content {
    flex: 1;
    min-width: 0;
    padding: 5px;
}

/* =========================
   TABLEAU
========================= */

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f7f9fc;
    text-align: left;
    padding: 12px;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

tr:hover {
    background: #f9fbff;
}

/* =========================
   MODAL OCR
========================= */

.modal {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, .45);

    justify-content: center;
    align-items: center;

    padding: 14px;

    z-index: 9999;
}

/*
   IMPORTANT :
   Le grand panneau blanc est ici.
*/

.modal-content {
    background: #ffffff;

    width: 94vw;
    max-width: 1280px;

    height: 95vh;
    max-height: 750px;

    border-radius: 20px;

    padding: 20px 26px;

    box-shadow: 0 15px 50px rgba(0, 0, 0, .30);

    display: flex;
    flex-direction: column;

    overflow: hidden;

    position: relative;
}

/*
   modal-large reste présent dans le HTML,
   mais on n'a plus besoin de lui faire
   gérer le layout.
*/

.modal-large {
    width: 94vw;
    max-width: 1280px;
}

.info-box {

    padding: 12px;
    margin-top: 10px;

    background: #f5f5f5;

    border-radius: 8px;

    font-size: 13px;

}

.admin-only {
    display: none;
}

.admin-only.visible {
    display: flex;
}

.ocr-toggle {
    margin-top: 6px;
    border: none;
    background: transparent;
    color: #0d6efd;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
}

.ocr-toggle:hover {
    text-decoration: underline;
}

.ocr-debug-icons {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
}

.ocr-debug-icons span {
    cursor: pointer;
    opacity: .7;
}

.ocr-debug-icons span:hover {
    opacity: 1;
}

/* =========================
   HEADER MODAL
========================= */

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    flex-shrink: 0;

    margin-bottom: 10px;
    padding-bottom: 10px;

    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 24px;
    margin: 0;
}

.close {
    font-size: 30px;
    line-height: 30px;
    cursor: pointer;
}

/* =========================
   CORPS MODAL
========================= */

.modal-body {
    display: flex;

    flex: 1;

    min-height: 0;

    gap: 25px;

    overflow: hidden;
}

/* =========================
   FORMULAIRE GAUCHE
========================= */

.modal-form {
    flex: 1;

    min-width: 0;

    padding: 4px 20px 4px 24px;

    overflow-y: auto;
    overflow-x: hidden;
}

/* =========================
   APERCU DROITE
========================= */

.modal-preview {
    flex: 0 0 42%;

    min-width: 380px;
    min-height: 0;

    border-left: 1px solid #eee;

    padding: 4px 0 4px 25px;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.preview-title {
    font-weight: 600;
    font-size: 14px;

    margin-bottom: 8px;

    flex-shrink: 0;
}

.ceesv-box {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: #eef6ff;
    border: 1px solid #c9dfff;
    line-height: 1.8;
}

/* =========================
   PDF
========================= */

.pdf-preview {
    display: none;


    width: 100%;

    flex: 1;
    min-height: 0;

    border: none;

    border-radius: 12px;

    background: #f6f8fb;
}

/* =========================
   IMAGE
========================= */
.modal-preview {
    overflow: auto;
}

.image-preview {
    display: none;
    transition: transform .2s;

    width: 100%;

    flex: 1;
    min-height: 0;

    object-fit: contain;

    border-radius: 12px;

    background: #f6f8fb;
}

/* =========================
   APERCU VIDE
========================= */

.preview-empty {
    flex: 1;

    min-height: 0;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: center;

    gap: 15px;

    border: 2px dashed #ddd;

    border-radius: 16px;

    background: #fafcff;

    color: #888;
}

/* =========================
   FORMULAIRE
========================= */

.form-group {
    margin-bottom: 8px;
}

.form-group label {
    display: block;

    margin-bottom: 4px;

    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;

    height: 37px;

    padding: 6px 10px;

    border: 1px solid #ddd;
    border-radius: 10px;

    font-size: 14px;

    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;

    border-color: #1976D2;

    box-shadow: 0 0 0 3px rgba(25, 118, 210, .15);
}

/* =========================
   OCR
========================= */

.ocr-suggestions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 6px;

    margin-top: 5px;
}

.ocr-chip {
    padding: 4px 9px;

    border: 1px solid #1976D2;
    border-radius: 18px;

    background: #eef5ff;
    color: #1976D2;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
}

.ocr-chip:hover {
    background: #1976D2;
    color: white;
}

.ocr-chip.active {
    background: #1976D2;
    color: white;
}

.ocr-wait {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top: 2px solid #0078d4;
    border-radius: 50%;
    animation: ocr-spin 0.8s linear infinite;
    vertical-align: middle;
}

.ocr-wait {
    display: none;
}

.ocr-loading .ocr-wait {
    display: inline-block;
}

@keyframes ocr-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* =========================
   DROPZONE MODAL
========================= */

.dropzone-mini {
    border: 2px dashed #1976D2;
    border-radius: 10px;

    min-height: 40px;

    padding: 6px 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    text-align: center;

    cursor: pointer;

    background: #fafcff;
}

.dropzone-mini:hover {
    background: #eef5ff;
}

/* =========================
   FICHIER SELECTIONNE
========================= */

.selected-file {
    display: none;

    margin-top: 5px;

    padding: 6px 10px;

    background: #eef5ff;

    border-radius: 8px;

    font-size: 13px;
}

/* =========================
   ACTIONS MODAL
========================= */

.modal-actions {
    flex-shrink: 0;

    display: flex;

    justify-content: flex-end;
    align-items: center;

    gap: 10px;

    margin-top: 8px;
    padding-top: 10px;

    border-top: 1px solid #eee;

    background: white;
}

/* =========================
   LOADER
========================= */

.loading-overlay {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, .45);

    z-index: 99999;

    justify-content: center;
    align-items: center;
}

.loading-box {
    background: white;

    padding: 30px;

    border-radius: 20px;

    min-width: 320px;

    text-align: center;

    box-shadow: 0 10px 30px rgba(0, 0, 0, .20);
}

.spinner {
    width: 60px;
    height: 60px;

    margin: auto;

    border: 6px solid #e5e5e5;
    border-top: 6px solid #1976D2;

    border-radius: 50%;

    animation: spin 1s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

/* =========================
   GOOGLE
========================= */

.google-badge {
    padding: 8px 14px;

    border-radius: 10px;

    font-size: 12px;
    font-weight: 600;
}

.google-badge.disconnected {
    background: #ffeaea;
    color: #c62828;
}

.google-badge.connected {
    background: #e7f8eb;
    color: #2e7d32;
}

.btn-google {
    text-decoration: none;

    padding: 10px 16px;

    border-radius: 10px;

    border: 1px solid #ddd;

    background: white;
    color: #333;

    transition: .2s;
}

.btn-google:hover {
    background: #f4f6f8;

    transform: translateY(-2px);
}

.actions {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

#toastContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    padding: 14px 18px;
    border-radius: 10px;

    color: white;
    font-weight: 600;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);

    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #2ecc71;
}

.toast.error {
    background: #e74c3c;
}

.toast.info {
    background: #3498db;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.autocomplete-box {

    position: absolute;

    background: white;

    border: 1px solid #ddd;

    border-radius: 6px;



    z-index: 1000;

    max-height: 200px;

    overflow-y: auto;

    display: none;
}

.autocomplete-item {

    padding: 8px 10px;

    cursor: pointer;
}

.autocomplete-item:hover {

    background: #f4f6f8;
}

/* =========================
   MOBILE / PETITS ECRANS
========================= */

@media(max-width:1100px) {

    .modal-content {
        height: 94vh;
        max-height: none;
    }

    .modal-body {
        flex-direction: column;
        overflow: auto;
    }

    .modal-form {
        overflow-y: visible;
    }

    .modal-form {
        overflow: visible;
    }

    .modal-preview {
        width: 100%;
        min-width: 0;

        flex: none;

        height: 450px;

        border-left: none;
        border-top: 1px solid #eee;

        padding: 15px 0 0 0;
    }

    .pdf-preview,
    .image-preview,
    .preview-empty {
        height: 400px;
        flex: none;
    }
}

@media (max-width: 1200px) {

    .sidebar {
        width: 200px;
    }

    .sidebar .tagline,
    .sidebar .signature {
        font-size: 12px;
    }

    .menu a {
        font-size: 14px;
        padding: 10px;
    }
}

@media (max-width: 900px) {

    .sidebar {
        width: 70px;
    }

    .logo h1 {
        font-size: 0;
    }

    .sidebar .tagline,
    .sidebar .signature {
        display: none;
    }

    .menu a {
        font-size: 0;
        text-align: center;
        padding: 14px 0;
    }

    .menu a::first-letter {
        font-size: 22px;
    }

    .content {
        padding: 15px;
        margin-left: 00px;
    }

    .card {

        min-width: 150px !important;
        width: auto;

        padding: 10px;
    }

    .card-value {
        font-size: 25px;
    }
}


@media (max-width: 600px) {

    .layout {
        flex-direction: column;

    }

    .sidebar {

        position: fixed;

        bottom: 0;
        left: 0;

        width: 100%;
        height: 60px;

        display: flex;

        justify-content: space-around;

        z-index: 1000;
    }

    .logo,
    .sidebar-footer {
        display: none;
    }

    .menu {
        display: flex;
        width: 100%;
        justify-content: space-around;
    }

    .menu a {
        font-size: 22px;
        padding: 15px 0;
    }

    .content {
        padding: 15px;
        margin-left: 00px;
    }

    .card {

        min-width: 150px !important;
        width: auto;

        padding: 10px;
    }

    .card-value {
        font-size: 25px;
    }
}

.exercice-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.exercice-row select {
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary {
    background: #28a745;
    color: white;
}

.btn-secondary {
    background: #ddd;
}

/* =========================
   TELEPHONE
========================= */
@media (max-width: 600px) {

    .content {
        padding: 12px;
        padding-bottom: 70px;
    }

    #content {
        padding-bottom: 80px;
    }

    /* Header */

    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 15px;
    }

    .welcome-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .welcome-row h2 {
        font-size: 20px;
    }

    .top-right {
        text-align: left;
        width: 100%;
    }

    /* Cartes */

    .cards {
        gap: 10px;
    }

    .card {
        min-width: calc(50% - 5px) !important;
        padding: 15px;
    }

    .card-value {
        font-size: 22px;
    }

    /* Dropzone */

    .dropzone {
        height: 180px;
    }

    .dropicon {
        font-size: 40px;
    }

    /* Menu bas */

    .sidebar {
        height: 55px;
    }

    .menu {
        display: flex;
        width: 100%;
        height: 100%;
        align-items: center;
        justify-content: space-around;
        padding: 0;
    }


    .menu a {
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: inherit;
    }

    .menu a .label {
        display: none;
    }

    .menu a .icon {
        font-size: 24px;
    }

    /* tableau */


    #depensesTable table {
        font-size: 14px;
        /* ou 15px */
    }

    #depensesTable th,
    #depensesTable td {
        padding: 6px 8px;

    }

    #depensesTable th:nth-child(3),
    #depensesTable td:nth-child(3),
    #depensesTable th:nth-child(4),
    #depensesTable td:nth-child(4) {
        display: none;
    }


    #depensesTable th:nth-child(1),
    #depensesTable td:nth-child(1) {
        white-space: nowrap;
    }

    #depensesTable td:nth-child(2),
    #depensesTable th:nth-child(2) {

        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

    }

    #lastOperationTable thead tr {
        background: linear-gradient(90deg, #1976D2, #42a5f5);
    }

    #lastOperationTable thead th {
        background: transparent;
        color: white;
        font-weight: bold;
        border: none;
    }

    #lastOperationTable thead {
        overflow: hidden;
        border-radius: 10px;
    }

    .operations-table-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    #lastOperationTable {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        font-size: 13px;
    }

    #lastOperationTable th,
    #lastOperationTable td {
        padding: 6px 4px;
        box-sizing: border-box;
    }

    #lastOperationTable th:nth-child(3),
    #lastOperationTable td:nth-child(3),
    #lastOperationTable th:nth-child(4),
    #lastOperationTable td:nth-child(4),
    #lastOperationTable th:nth-child(6),
    #lastOperationTable td:nth-child(6),
    #lastOperationTable th:nth-child(8),
    #lastOperationTable td:nth-child(8),
    #lastOperationTable th:nth-child(9),
    #lastOperationTable td:nth-child(9) {
        display: none;
    }

    #lastOperationTable th:nth-child(1),
    #lastOperationTable td:nth-child(1) {
        width: 28%;
        white-space: nowrap;
        overflow: hidden;
    }

    #lastOperationTable th:nth-child(2),
    #lastOperationTable td:nth-child(2) {
        width: 42%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #lastOperationTable th:nth-child(5),
    #lastOperationTable td:nth-child(5) {
        width: 24%;
        text-align: right;
        white-space: nowrap;
        overflow: hidden;
    }

    #lastOperationTable th:nth-child(7),
    #lastOperationTable td:nth-child(7) {
        width: 6%;
        text-align: center;
    }


}

.standby-card {
    border-left: 6px solid #f57c00;
    cursor: pointer;
}

.standby-card:hover {
    transform: translateY(-3px);
}


/* =========================
   LOADER NAVIGATION
========================= */

.page-loader {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(244, 246, 251, .85);

    backdrop-filter: blur(2px);

    z-index: 999999;

    justify-content: center;
    align-items: center;
}

.page-loader.active {
    display: flex;
}

.page-spinner {
    width: 70px;
    height: 70px;

    border: 7px solid #dce5f3;
    border-top: 7px solid #1976D2;

    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}


/* =========================
   VIEW OPERATIONS
   ======================== */
.operations-container {
    width: 100%;
}


.mois-separateur {
    padding: 0;
}

.mois-separateur>div {
    background: linear-gradient(90deg,
            #1976D2,
            #42a5f5);
    color: white;
    padding: 12px 16px;
    font-weight: bold;
}



.montant-negatif {
    color: #D32F2F;
    font-weight: bold;
}

.montant-positif {
    color: #2E7D32;
    font-weight: bold;
}

.search {
    width: 100%;
    max-width: 350px;

    padding: 12px 16px;

    border: 1px solid #d9e2ef;
    border-radius: 12px;

    background: #f8fbff;

    font-size: 14px;

    margin-bottom: 20px;

    transition: all .2s ease;
}

.search:focus {
    outline: none;

    border-color: #1976D2;

    background: white;

    box-shadow:
        0 0 0 4px rgba(25, 118, 210, .12);
}

.search::placeholder {
    color: #8a94a6;
}


.pdf-link {
    text-decoration: none;
    color: #1976D2;
    font-weight: 600;
}

.pdf-link:hover {
    color: #115293;
}

.pdf-preview {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: auto;
    box-sizing: border-box;
}

.pdf-preview canvas {
    max-width: none;
}

/* =========================
   VIEW STATISTIQUE
   ======================== */
.stats-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:16px; }
.stat-card { min-height:96px; display:flex; align-items:center; gap:14px; border-radius:14px; padding:18px; color:#fff; box-shadow:0 6px 18px rgba(15,23,42,.12); }
.stat-card-recettes { background:linear-gradient(135deg,#168b62,#38bdf8); }
.stat-card-depenses { background:linear-gradient(135deg,#dc2626,#fb7185); }
.stat-card-resultat { background:linear-gradient(135deg,#6d28d9,#a78bfa); }
.stat-card-operations { background:linear-gradient(135deg,#0369a1,#38bdf8); }
.stat-icon { width:42px; height:42px; border-radius:50%; display:grid; place-items:center; background:rgba(255,255,255,.18); font-size:20px; font-weight:bold; }
.stat-value { font-size:25px; font-weight:800; white-space:nowrap; }
.stat-value.negative { color:#ffe4e6; }
.stat-label { margin-top:3px; opacity:.9; }
.stats-toolbar { display:flex; justify-content:flex-end; margin-bottom:16px; }
.stats-toolbar label { display:flex; align-items:center; gap:10px; color:#64748b; }
.stats-toolbar select { min-width:180px; }
.stats-row,.stats-evolution-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
.stats-evolution-grid { grid-template-columns:minmax(0,2fr) minmax(280px,.8fr); }
.stats-panel { background:white; border-radius:14px; padding:20px; box-shadow:0 2px 10px rgba(15,23,42,.07); }
.stats-panel-header { display:flex; justify-content:space-between; gap:16px; align-items:center; }
.stats-legend { display:flex; gap:14px; font-size:12px; color:#64748b; }
.stats-legend span::before { content:""; display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:5px; }
.legend-income::before { background:#22a06b; }.legend-expense::before { background:#ef4444; }
.stats-chart-panel canvas { width:100%; height:320px; }
.stat-ranking-row { margin-top:15px; }
.stat-ranking-head { display:flex; justify-content:space-between; gap:12px; font-size:14px; }
.stat-ranking-head b { color:#94a3b8; margin-right:5px; }
.stat-ranking-head strong { white-space:nowrap; }
.stat-ranking-track { height:6px; background:#eef2f7; border-radius:6px; margin-top:7px; overflow:hidden; }
.stat-ranking-track div { height:100%; border-radius:6px; background:linear-gradient(90deg,#60a5fa,#2563eb); }
.stat-month-row { display:grid; grid-template-columns:70px 1fr auto; gap:12px; align-items:center; padding:11px 0; border-bottom:1px solid #edf0f5; }
.stat-month-row span { display:grid; font-size:12px; }.stat-month-row i { font-style:normal; }.month-income { color:#168b62; }.month-expense { color:#dc2626; }.stat-month-row .negative { color:#dc2626; }.stat-month-row .positive { color:#168b62; }
.stats-empty { padding:20px 0; color:#94a3b8; }
@media(max-width:900px){ .stats-grid{grid-template-columns:repeat(2,1fr)} .stats-evolution-grid{grid-template-columns:1fr}.stats-row{grid-template-columns:1fr}.stat-card{min-height:82px}.stat-value{font-size:22px}}
@media(max-width:560px){ .stats-grid{grid-template-columns:1fr}.stats-toolbar{justify-content:stretch}.stats-toolbar label{width:100%;justify-content:space-between}.stats-panel-header{align-items:flex-start;flex-direction:column}.stats-chart-panel canvas{height:260px}.stat-month-row{grid-template-columns:55px 1fr}.stat-month-row>b{grid-column:1/-1;text-align:right}}

.duplicate-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;

    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);

    justify-content: center;
    align-items: center;
}

.duplicate-card {
    width: min(1100px, 95vw);
    max-height: 90vh;

    display: flex;
    flex-direction: column;

    background: #fff;
    border-radius: 20px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.25);

    overflow: hidden;
}

.duplicate-header {
    padding: 18px 24px;

    background: linear-gradient(135deg,
            #ff9800,
            #ff5722);

    color: white;
    font-size: 1.4rem;
    font-weight: 700;
}

.duplicate-body {
    display: flex;
    gap: 20px;

    padding: 20px;

    overflow: auto;
}

.duplicate-content {
    flex: 1;
    min-width: 280px;

    background: #f8f9fb;
    border-radius: 14px;

    padding: 20px;
}

.duplicate-content .info-line {
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.5;
}

.duplicate-preview {
    flex: 2;

    min-height: 300px;
    max-height: 65vh;

    overflow: auto;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    background: #fafafa;

    padding: 10px;
}

.duplicate-preview canvas {
    border-radius: 8px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.1);
}

.duplicate-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;

    padding: 18px 20px;

    border-top: 1px solid #eee;

    background: #fff;
}

.duplicate-actions button {
    border: none;
    border-radius: 10px;

    padding: 12px 18px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: all .15s ease;
}

.duplicate-actions button:hover {
    transform: translateY(-2px);
}

.btn-cancel {
    background: #eef0f3;
    color: #333;
}

.btn-insert {
    background: #22c55e;
    color: white;
}

.btn-replace {
    background: #3b82f6;
    color: white;
}

/* Mobile */

@media (max-width: 900px) {

    .duplicate-card {
        width: 98vw;
        max-height: 96vh;
    }

    .duplicate-body {
        flex-direction: column;
    }

    .duplicate-preview {
        max-height: 40vh;
        order: 1;
    }

    .duplicate-content {
        order: 2;
    }

    .duplicate-actions {
        flex-direction: column;
    }

    .duplicate-actions button {
        width: 100%;
    }
}

.pdf-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;

    padding: 10px;

    border-bottom: 1px solid #eee;
    background: #f8f9fb;

    position: sticky;
    top: 0;
    z-index: 10;
}

.pdf-toolbar button {
    border: none;
    background: white;
    border-radius: 8px;

    width: 36px;
    height: 36px;

    cursor: pointer;
    font-size: 16px;

    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}

.pdf-toolbar button:hover {
    background: #f0f0f0;
}

#duplicateZoomLabel {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
}

/* ====== EXPORT */

.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.export-option:hover {
    background: #f5f5f5;
}


.exercice-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-toolbar {
    position: relative;
    margin-left: 4px;
}

.admin-menu {
    position: absolute;
    top: 30px;
    right: 0;

    min-width: 220px;

    background: linear-gradient(180deg,
            #183B63,
            #1d497a);

    border-radius: 12px;

    box-shadow:
        0 6px 20px rgba(0, 0, 0, .25);

    overflow: hidden;

    z-index: 9999;
}

.admin-menu a {
    display: flex;

    align-items: center;

    justify-content: flex-start;

    gap: 10px;

    padding: 12px 16px;

    color: white;

    text-decoration: none;

    text-align: left;

    transition: .2s;
}

.admin-menu a:hover {
    background: rgba(255, 255, 255, .15);
}

.admin-menu-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
}

.hidden {
    display: none;
}

#lastOperationTable tbody tr {
    cursor: pointer;
}

#lastOperationTable tbody tr:hover {
    background: #f5f7fa;
}

.ceesv-box {
    margin-top: 15px;
    padding: 12px;
    border-radius: 10px;
    background: #f3f8ff;
    border-left: 4px solid #168c8c;
    text-align: left;
    font-size: 14px;
    line-height: 1.8;
}