

    :root {
        --bg: #f0f2f5;
        --surface: #ffffff;
        --surface-2: #f8f9fb;
        --border: #e2e5eb;
        --border-strong: #c5cad3;

        --ink: #000;
        --ink-soft: #000;
        --muted: #000;

        --brand: #2563eb;
        --brand-ink: #1d4ed8;
        --brand-tint: #eff4ff;

        --pos: #059669;
        --pos-tint: #ecfdf5;
        --neg: #dc2626;
        --neg-tint: #fef2f2;
        --warn: #d97706;
        --warn-tint: #fffbeb;
        --info-tint: #eff4ff;
        --info: #2563eb;

        --topbar-1: #1a2744;
        --topbar-2: #2d4a7a;
        --grid-head: #1a2744;

        --radius: 8px;
        --radius-sm: 6px;
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .04);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
        --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .04);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, .1);
        --ring: 0 0 0 3px rgba(37, 99, 235, .18);
    }
    
    * {
        box-sizing: border-box;
    }
    
    body {
        background: var(--bg);
        color: var(--ink);
        font-family: Arial, Helvetica, sans-serif;
        font-size: 14px;
        line-height: 1.5;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        overflow-x: hidden;
        padding-bottom: 26px;
    }

    html:not([data-bs-theme="dark"]) .text-muted {
        color: #000 !important;
    }
    
    ::selection {
        background: #2563eb;
        color: #fff;
    }
    
    :focus-visible {
        outline: 1px dotted #000;
        outline-offset: 1px;
    }
    
    input,
    select,
    textarea,
    button {
        font-family: inherit;
        font-size: inherit;
    }
    
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
        outline: none;
        border-color: var(--brand) !important;
        box-shadow: none;
    }
    
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--border-strong) transparent;
    }
    
    *::-webkit-scrollbar {
        width: 11px;
        height: 11px;
    }
    
    *::-webkit-scrollbar-thumb {
        background: var(--border-strong);
        border-radius: 999px;
        border: 3px solid var(--bg);
    }
    
    *::-webkit-scrollbar-thumb:hover {
        background: var(--muted);
    }
    
    .panel,
    .kpi,
    .searchbox {
        min-width: 0;
    }
    
    .num,
    .tabnum {
        font-variant-numeric: tabular-nums;
    }
    
    @keyframes rise {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
    
        to {
            opacity: 1;
            transform: none;
        }
    }
    
    @media (prefers-reduced-motion: reduce) {
    
        *,
        *::before,
        *::after {
            animation-duration: .01ms !important;
            transition-duration: .01ms !important;
        }
    }
    
    .skip-link {
        position: absolute;
        left: .8rem;
        top: -48px;
        z-index: 200;
        background: var(--brand);
        color: #fff;
        padding: .45rem .8rem;
        border-radius: 8px;
        font-size: .8rem;
        font-weight: 700;
        text-decoration: underline;
    }
    
    .skip-link:focus {
        top: .8rem;
    }
    
    .app-chrome {
        position: sticky;
        top: 0;
        z-index: 40;
        box-shadow: 0 8px 24px -16px rgba(16, 24, 40, .35);
    }
    
    .topbar {
        background: linear-gradient(100deg, var(--topbar-1), var(--topbar-2));
        padding: .5rem 1.25rem;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: .55rem 1rem;
    }
    
    .brand {
        color: #fff;
        font-weight: 800;
        font-size: 1.02rem;
        letter-spacing: .02em;
        display: flex;
        align-items: baseline;
        gap: .45rem;
        white-space: nowrap;
        text-decoration: none;
    }
    
    .brand em {
        font-style: normal;
        font-weight: 500;
        opacity: .78;
        font-size: .86rem;
        letter-spacing: 0;
    }
    
    .brand:hover {
        color: #fff;
    }
    
    .brand-dot {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background: var(--warn);
        box-shadow: 0 0 0 4px rgba(224, 138, 30, .3);
    }
    
    .dossier {
        display: flex;
        align-items: center;
        gap: .55rem;
        color: #fff;
        text-decoration: none;
        padding: .28rem .55rem .28rem .3rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, .1);
        border: 1px solid rgba(255, 255, 255, .08);
        max-width: 240px;
        transition: background .15s;
    }
    
    .dossier:hover {
        background: rgba(255, 255, 255, .18);
        color: #fff;
    }
    
    .dossier-ico {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        flex-shrink: 0;
        background: rgba(255, 255, 255, .14);
        display: grid;
        place-items: center;
    }
    
    .dossier-ico svg {
        width: 15px;
        height: 15px;
    }
    
    .dossier-name {
        display: block;
        font-size: .8rem;
        font-weight: 700;
        line-height: 1.15;
    }
    
    .dossier-ex {
        display: block;
        font-size: .68rem;
        opacity: .72;
        margin-top: .08rem;
    }
    
    .searchbox {
        position: relative;
        flex: 1 1 220px;
        max-width: 420px;
    }
    
    .searchbox svg {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
        color: var(--muted);
    }
    
    .searchbox input {
        width: 100%;
        border: 0;
        border-radius: 10px;
        padding: .5rem 2.2rem .5rem 2.15rem;
        font-size: .85rem;
        background: rgba(255, 255, 255, .96);
        color: var(--ink);
    }
    
    .searchbox input::placeholder {
        color: #9aa4b4;
    }
    
    .search-kbd {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        font-family: inherit;
        font-size: .68rem;
        font-weight: 700;
        color: var(--muted);
        background: #eef0f4;
        border: 1px solid var(--border);
        border-radius: 6px;
        padding: .08rem .38rem;
        line-height: 1.4;
        pointer-events: none;
    }
    
    .topbar-tools {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: .35rem;
    }
    
    .topbar-tools>button,
    .topbar-tools>a {
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 10px;
        background: rgba(255, 255, 255, .12);
        color: #fff;
        text-decoration: none;
        display: grid;
        place-items: center;
        transition: background .15s;
        flex-shrink: 0;
    }
    
    .topbar-tools>button:hover,
    .topbar-tools>a:hover {
        background: rgba(255, 255, 255, .22);
        color: #fff;
    }
    
    .topbar-tools svg {
        width: 17px;
        height: 17px;
    }
    
    .user-menu {
        position: relative;
        margin-left: .2rem;
    }
    
    .user-chip {
        display: flex;
        align-items: center;
        gap: .5rem;
        height: 40px;
        padding: 0 .5rem 0 .2rem;
        border: 0;
        cursor: pointer;
        background: rgba(255, 255, 255, .12);
        color: #fff;
        border-radius: 11px;
        transition: background .15s;
    }
    
    .user-chip:hover,
    .user-menu.open .user-chip {
        background: rgba(255, 255, 255, .22);
    }
    
    .user-chip .chev {
        width: 12px;
        height: 12px;
        opacity: .7;
    }
    
    .user-menu.open .user-chip .chev {
        transform: rotate(180deg);
    }
    
    .user-meta {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        line-height: 1.15;
    }
    
    .user-name {
        font-size: .78rem;
        font-weight: 700;
    }
    
    .user-role {
        font-size: .66rem;
        opacity: .72;
    }
    
    .user-dd {
        right: 0;
        left: auto;
        top: calc(100% + 6px);
        width: 230px;
    }
    
    .user-menu.open>.user-dd {
        display: block;
        animation: rise .16s ease;
    }
    
    .user-dd-out {
        color: var(--neg) !important;
    }
    
    .user-dd-out:hover {
        background: var(--neg-tint) !important;
    }
    
    .avatar {
        width: 32px;
        height: 32px;
        border-radius: 9px;
        background: linear-gradient(180deg, #f0a94c, #e08a1e);
        color: #fff;
        font-weight: 700;
        display: grid;
        place-items: center;
        font-size: .85rem;
    }
    
    .topnav {
        position: relative;
        z-index: 30;
        margin: 0;
        background: #f3f4f7;
        border-bottom: 1px solid #d4d7de;
        padding: 0 .35rem;
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0;
    }

    .no-dossier-notice {
        display: flex;
        align-items: center;
        gap: .85rem;
        padding: .75rem 1rem;
        background: linear-gradient(105deg, #fff8eb, #fffdfa 72%);
        border-bottom: 1px solid #ead8b8;
        border-left: 4px solid #c07800;
        color: #292c32;
    }

    .no-dossier-mark {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        display: grid;
        place-items: center;
        border-radius: 8px;
        background: #f4e6c8;
        color: #8b5700;
    }

    .no-dossier-mark svg {
        width: 21px;
        height: 21px;
    }

    .no-dossier-copy {
        display: grid;
        gap: .08rem;
        min-width: 0;
        flex: 1;
    }

    .no-dossier-kicker {
        color: #8b5700;
        font-size: .64rem;
        font-weight: 800;
        letter-spacing: .08em;
    }

    .no-dossier-copy strong {
        font-size: .9rem;
        line-height: 1.3;
    }

    .no-dossier-description {
        color: #625e54;
        font-size: .78rem;
    }

    .no-dossier-actions {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        gap: .5rem;
    }

    .no-dossier-actions a {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .45rem;
        padding: .45rem .75rem;
        border: 1px solid #c8cbd1;
        border-radius: 5px;
        background: #fff;
        color: #252b35;
        font-size: .76rem;
        font-weight: 700;
        text-decoration: none;
        transition: background .15s, border-color .15s, transform .15s;
    }

    .no-dossier-actions a svg {
        width: 16px;
        height: 16px;
    }

    .no-dossier-actions a:hover {
        border-color: #8995a7;
        background: #f5f7fa;
        transform: translateY(-1px);
    }

    .no-dossier-actions .no-dossier-create {
        border-color: #2458a7;
        background: #2458a7;
        color: #fff;
    }

    .no-dossier-actions .no-dossier-create:hover {
        border-color: #194785;
        background: #194785;
    }

    @media (max-width: 680px) {
        .no-dossier-notice {
            align-items: flex-start;
            flex-wrap: wrap;
            gap: .65rem;
            padding: .7rem .8rem;
        }

        .no-dossier-mark {
            width: 36px;
            height: 36px;
            flex-basis: 36px;
        }

        .no-dossier-copy {
            flex-basis: calc(100% - 48px);
        }

        .no-dossier-actions {
            width: 100%;
            padding-left: 42px;
        }

        .no-dossier-actions a {
            flex: 1;
            padding-inline: .4rem;
        }
    }
    
    .nav-btn {
        border: 0;
        background: transparent;
        color: #1f2430;
        font-size: .8rem;
        font-weight: 500;
        white-space: nowrap;
        cursor: pointer;
        padding: .32rem .55rem;
        border-radius: 0;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: .15rem;
        border: 1px solid transparent;
        margin: 1px 0;
        transition: background .1s, border-color .1s;
    }
    
    .nav-btn>svg {
        width: 15px;
        height: 15px;
        opacity: .6;
    }
    
    .nav-btn:hover {
        background: #e7ebf3;
        border-color: #c5ccd8;
        color: #111;
    }
    
    .nav-btn.active {
        color: #0b3d8c;
        font-weight: 650;
        background: #dce6f6;
        border-color: #b9c9e4;
    }
    
    .nav-btn.active>svg {
        opacity: 1;
    }
    
    .nav-dd {
        position: relative;
        display: inline-flex;
    }
    
    .nav-dd-toggle .chev {
        display: none;
    }
    
    .nav-dd.open>.nav-dd-toggle {
        background: #dce6f6;
        border-color: #b9c9e4;
        color: #0b3d8c;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        margin-top: 0;
        background: #fff;
        border: 1px solid #9aa3b2;
        border-radius: 0;
        box-shadow: 2px 3px 8px rgba(16, 24, 40, .18);
        padding: .2rem;
        z-index: 60;
        display: none;
    }
    
    .nav-dd.open>.nav-menu {
        display: block;
    }
    
    .nav-menu.flip {
        left: auto;
        right: 0;
    }
    
    .toolbar-ribbon {
        position: relative;
        z-index: 20;
        display: flex;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0;
        padding: .28rem .4rem .32rem;
        background: linear-gradient(180deg, #f7f8fb, #e8eaef);
        border-bottom: 1px solid #c9ced8;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tb-btn {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .18rem;
        min-width: 52px;
        padding: .28rem .38rem .22rem;
        border-radius: 3px;
        border: 1px solid transparent;
        background: transparent;
        color: #2a3140;
        font-size: .68rem;
        font-weight: 700;
        letter-spacing: .01em;
        text-decoration: none;
        white-space: nowrap;
        cursor: pointer;
        transition: background .1s, border-color .1s;
    }
    
    .tb-ico {
        width: 28px;
        height: 28px;
        border-radius: 4px;
        display: grid;
        place-items: center;
        background: #fff;
        border: 1px solid #d5dae3;
        box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 1px 2px rgba(16, 24, 40, .06);
        color: #0b3d8c;
    }
    
    .tb-ico svg {
        width: 16px;
        height: 16px;
    }
    
    .tb-lbl {
        line-height: 1;
    }
    
    .tb-btn:hover {
        background: #fff;
        border-color: #b7c0ce;
    }
    
    .tb-btn:active {
        transform: translateY(1px);
    }
    
    .tb-btn.active {
        background: #dce6f6;
        border-color: #9eb4d6;
    }
    
    .tb-btn.active .tb-ico {
        border-color: #9eb4d6;
        background: #eef3fb;
    }
    
    .tb-btn.danger {
        color: var(--neg);
    }
    
    .tb-btn.danger .tb-ico {
        color: var(--neg);
    }
    
    .tb-btn.danger:hover {
        background: var(--neg-tint);
        border-color: #f3b4b6;
    }
    
    .tb-sep {
        width: 1px;
        align-self: stretch;
        min-height: 42px;
        margin: 2px .35rem;
        background: #c5cad3;
        box-shadow: 1px 0 0 #fff;
    }
    
    .tb-btn[data-k="Ouvrir"] .tb-ico {
        color: #c47b12;
    }
    
    .tb-btn[data-k="Saisie"] .tb-ico {
        color: #1a6fd4;
    }
    
    .tb-btn[data-k="Nouveau"] .tb-ico {
        color: #0f9d6b;
    }
    
    .tb-btn[data-k="BL"] .tb-ico {
        color: #0b3d8c;
    }
    
    .tb-btn[data-k="EF"] .tb-ico {
        color: #0f9d6b;
    }
    
    .tb-btn[data-k="PG"] .tb-ico {
        color: #6b4fd4;
    }
    
    .tb-btn[data-k="BI"] .tb-ico {
        color: #1a6fd4;
    }
    
    .tb-btn[data-k="RT"] .tb-ico {
        color: #c45b12;
    }
    
    .tb-btn[data-k="FX"] .tb-ico {
        color: #b8860b;
    }
    
    .tb-btn[data-k="AnA"] .tb-ico,
    .tb-btn[data-k="AnP"] .tb-ico,
    .tb-btn[data-k="AnR"] .tb-ico,
    .tb-btn[data-k="AnF"] .tb-ico {
        color: #0e7c66;
    }
    
    .tb-btn[data-k="R.Amrt"] .tb-ico {
        color: #c0392b;
    }
    
    .tb-btn[data-k="GL"] .tb-ico {
        color: #1a5bb5;
    }
    
    .tb-btn[data-k="GP"] .tb-ico {
        color: #5b6b8c;
    }
    
    .tb-btn[data-k="GD"] .tb-ico {
        color: #2f6fed;
    }
    
    .tb-btn[data-k="Parametres"] .tb-ico {
        color: #4a5568;
    }
    
    .nav-menu.simple {
        width: 266px;
    }
    
    .nav-menu.mega {
        width: 720px;
        max-width: calc(100vw - 2rem);
        padding: .55rem .7rem .15rem;
        column-count: 3;
        column-gap: 1.1rem;
    }
    
    .nav-menu a {
        display: flex;
        align-items: center;
        gap: .55rem;
        padding: .38rem .5rem;
        border-radius: 0;
        color: #2a3140;
        text-decoration: none;
        font-size: .82rem;
        font-weight: 500;
    }
    
    .nav-menu a svg {
        width: 15px;
        height: 15px;
        opacity: .55;
        flex-shrink: 0;
    }
    
    .nav-menu a:hover {
        background: var(--brand);
        color: #fff;
    }
    
    .nav-menu a:hover svg {
        opacity: 1;
        color: #fff;
    }
    
    .nav-menu-group {
        display: flex;
        flex-direction: column;
        break-inside: avoid;
        margin-bottom: .55rem;
    }
    
    .nav-menu-label {
        font-size: .66rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .07em;
        color: var(--muted);
        padding: .5rem .6rem .25rem;
    }
    
    .nav-menu-all {
        column-span: all;
        justify-content: center;
        margin-top: .3rem;
        border-top: 1px solid var(--border);
        padding-top: .45rem !important;
        color: #0b3d8c !important;
        font-weight: 600 !important;
    }
    
    .nav-menu-all:hover {
        background: var(--brand) !important;
        color: #fff !important;
    }
    
    .nav-menu-all .chev-r {
        width: 14px;
        height: 14px;
        transform: rotate(-90deg);
    }

    .nav-sub {
        position: relative;
    }

    .nav-sub:hover,
    .nav-sub.open {
        z-index: 5;
    }

  
    .nav-sub:hover::after {
        content: "";
        position: absolute;
        top: 0;
        right: -10px;
        width: 10px;
        height: 100%;
    }

    .nav-sub-toggle {
        display: flex;
        align-items: center;
        gap: .55rem;
        width: 100%;
        padding: .38rem .5rem;
        border: 0;
        background: transparent;
        color: #2a3140;
        font-family: inherit;
        font-size: .82rem;
        font-weight: 500;
        text-align: left;
        cursor: pointer;
    }

    .nav-sub-toggle>svg:first-child {
        width: 15px;
        height: 15px;
        opacity: .55;
        flex-shrink: 0;
    }

    .nav-sub-toggle>span {
        flex: 1;
    }

    .sub-caret {
        width: 13px;
        height: 13px;
        margin-left: auto;
        opacity: .5;
        flex-shrink: 0;
    }

    .nav-sub:hover>.nav-sub-toggle,
    .nav-sub.open>.nav-sub-toggle {
        background: var(--brand);
        color: #fff;
    }

    .nav-sub:hover>.nav-sub-toggle svg,
    .nav-sub.open>.nav-sub-toggle svg {
        opacity: 1;
        color: #fff;
    }

    .nav-menu.nav-submenu {
        top: -.2rem;
        left: 100%;
        margin-left: 0;
        width: max-content;
        min-width: 14rem;
        max-width: 21rem;
        z-index: 70;
    }

    .nav-sub:hover>.nav-submenu,
    .nav-sub.open>.nav-submenu {
        display: block;
    }

    .nav-menu.nav-submenu.flip {
        left: auto;
        right: 100%;
    }

    .nav-kbd {
        margin-left: auto;
        padding: .02rem .34rem;
        border: 1px solid #d4d7de;
        border-radius: 3px;
        background: #eef0f4;
        color: #5a6070;
        font-size: .68rem;
        font-weight: 600;
        line-height: 1.5;
        white-space: nowrap;
    }

    .nav-menu a:hover .nav-kbd {
        border-color: rgba(255, 255, 255, .45);
        background: rgba(255, 255, 255, .18);
        color: #fff;
    }

    /* ===== Coquille de page (#app / #main / .page-content) =========== */
    #app {
        display: grid;
        grid-template-columns: 184px minmax(0, 1fr);
        grid-template-rows: auto auto minmax(0, 1fr);
        column-gap: .75rem;
        min-height: 100vh;
    }

    .app-chrome,
    .no-dossier-notice {
        grid-column: 1 / -1;
    }
    
    #main {
        display: block;
        grid-row: 3;
        grid-column: 2;
        width: 100%;
        min-width: 0;
    }
    
    #sidebar:empty {
        display: none;
    }
    
    #main>header.mb-3 {
        display: none;
    }
    
    /* burger mobile inutilise ici */
    #main>.page-content {
        width: 100%;
    }
    
    /* la coquille enveloppe le contenu dans <section class="row"> : on annule
           le flex Bootstrap qui casse la mise en page pleine largeur */
    #main>.page-content>section.row {
        display: block;
        margin: 0;
    }
    
    #main>.page-content>section.row>* {
        padding: 0;
    }
    
    /* ===== Fleche de retour (Page-Heading.php) ======================== */
    .page-back {
        padding: .55rem 0 0;
    }

    .page-back .back-btn {
        text-decoration: none;
    }

    .page-back .back-btn svg {
        width: 16px;
        height: 16px;
    }

    @media print {
        .page-back { display: none; }
    }

    /* ===== Page shell ================================================= */
    .wrap {
        padding: .55rem .65rem 2.4rem;
    }
    
    .page-head {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: .45rem .8rem;
        margin-bottom: .55rem;
        background: linear-gradient(180deg, var(--surface), var(--surface-2));
        border: 1px solid var(--border);
        padding: .35rem .5rem;
    }
    
    .page-head h1 {
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0;
        margin: 0;
        display: flex;
        align-items: center;
        gap: .4rem;
        color: var(--topbar-1);
    }
    
    .page-head h1 .ph-ico {
        width: 18px;
        height: 18px;
        border-radius: 0;
        flex-shrink: 0;
        background: transparent;
        color: var(--topbar-1);
        display: grid;
        place-items: center;
    }
    
    .page-head h1 .ph-ico svg {
        width: 14px;
        height: 14px;
    }
    
    .page-head p {
        margin: 0;
        color: var(--muted);
        font-size: 11px;
    }
    
    .page-actions {
        display: flex;
        gap: .3rem;
        flex-wrap: wrap;
    }
    
    /* Boutons : UNE seule definition (forme, taille, police) pour toute l'application.
       Principal = .btn-solid ; secondaire = .btn-soft. Les autres classes ci-dessous sont des alias historiques. */
    .btn-solid,
    .btn-soft,
    .ec-btn-apply,
    .ec-btn-manage,
    .ec-balance-btn,
    .bal-btn-reset,
    .bulkbar .b-act {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .4rem;
        min-height: 34px;
        padding: .4rem .9rem;
        border: 1px solid transparent;
        border-radius: 8px;
        font-size: .8rem;
        font-weight: 600;
        line-height: 1.2;
        letter-spacing: 0;
        text-decoration: none;
        white-space: nowrap;
        cursor: pointer;
        box-shadow: none;
        transform: none;
        transition: background-color .15s ease, border-color .15s ease, color .15s ease;
    }

    .btn-solid,
    .ec-btn-apply {
        background: var(--brand);
        border-color: var(--brand-ink);
        color: #fff;
    }

    .btn-solid:hover,
    .ec-btn-apply:not(:disabled):hover {
        background: var(--brand-ink);
        color: #fff;
    }

    .btn-soft,
    .ec-btn-manage,
    .ec-balance-btn,
    .bal-btn-reset,
    .bulkbar .b-act {
        background: var(--surface);
        border-color: var(--border-strong);
        color: var(--ink);
    }

    .btn-soft:hover,
    .ec-btn-manage:hover,
    .ec-balance-btn:hover,
    .bal-btn-reset:hover,
    .bulkbar .b-act:hover {
        background: var(--brand-tint);
        border-color: var(--brand);
        color: var(--brand-ink);
    }

    .btn-solid[hidden],
    .btn-soft[hidden],
    .ec-btn-apply[hidden],
    .ec-btn-manage[hidden],
    .ec-balance-btn[hidden],
    .bal-btn-reset[hidden] {
        display: none;
    }

    .btn-solid:disabled,
    .btn-soft:disabled,
    .ec-btn-apply:disabled,
    .ec-balance-btn:disabled,
    .bal-btn-reset:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

    .btn-solid:focus-visible,
    .btn-soft:focus-visible,
    .ec-btn-apply:focus-visible,
    .ec-btn-manage:focus-visible,
    .ec-balance-btn:focus-visible,
    .bal-btn-reset:focus-visible,
    .bulkbar .b-act:focus-visible {
        outline: 2px solid var(--brand);
        outline-offset: 2px;
    }

    .btn-solid svg,
    .btn-soft svg,
    .ec-btn-apply svg,
    .ec-btn-manage svg,
    .ec-balance-btn svg,
    .bal-btn-reset svg,
    .bulkbar .b-act svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
    }
    
    .kpi-grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: .35rem;
        margin-bottom: .55rem;
    }
    
    .kpi-grid.cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .kpi-grid.cols-3 {
        grid-template-columns: repeat(3, minmax(0, 340px));
    }
    
    .kpi-grid.cols-2 {
        grid-template-columns: repeat(2, minmax(0, 340px));
    }
    
    .kpi {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 0;
        padding: .4rem .55rem;
        box-shadow: none;
        animation: none;
        transition: none;
    }
    
    .kpi:hover {
        transform: none;
        box-shadow: none;
        background: var(--surface-2);
    }
    
    .kpi-icon {
        width: 22px;
        height: 22px;
        border-radius: 0;
        display: grid;
        place-items: center;
    }
    
    .kpi-icon svg {
        width: 14px;
        height: 14px;
    }
    
    .kpi-value {
        font-size: 15px;
        font-weight: 700;
        letter-spacing: 0;
        margin-top: .25rem;
        line-height: 1.1;
        font-variant-numeric: tabular-nums;
    }
    
    .kpi-label {
        color: var(--muted);
        font-size: 11px;
        margin-top: .15rem;
    }
    
    .kpi-delta {
        margin-top: .25rem;
        display: inline-flex;
        align-items: center;
        gap: .22rem;
        font-size: 10.5px;
        font-weight: 700;
        padding: .05rem .3rem;
        border-radius: 0;
    }
    
    .kpi-delta svg {
        width: 12px;
        height: 12px;
    }
    
    .kpi-delta.up {
        background: var(--pos-tint);
        color: var(--pos);
    }
    
    .kpi-delta.down {
        background: var(--neg-tint);
        color: var(--neg);
    }
    
    .kpi-delta.flat {
        background: #eef0f4;
        color: var(--muted);
    }
    
    /* ===== Panels =================================================== */
    .panel {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 0;
        padding: .55rem .65rem;
        box-shadow: none;
        height: 100%;
    }
    
    .panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .5rem;
        margin: -.55rem -.65rem .45rem;
        padding: .28rem .5rem;
        background: var(--brand);
        color: #fff;
    }
    
    .panel-title {
        font-size: 12px;
        font-weight: 700;
        margin: 0;
        letter-spacing: 0;
        color: #fff;
    }
    
    .panel-link {
        font-size: 11px;
        font-weight: 600;
        color: #fff;
        text-decoration: underline;
        white-space: nowrap;
    }
    
    .panel-head .mini-select {
        background: #fff;
    }
    
    .mini-select {
        border: 1px solid var(--border);
        background: #fff;
        border-radius: 0;
        padding: .12rem .35rem;
        font-size: 11px;
        font-weight: 600;
        color: var(--ink-soft);
    }
    
    .side-card {
        position: relative;
        overflow: hidden;
        height: 100%;
        background: #fff;
        color: var(--ink);
        border-radius: 0;
        padding: .55rem .65rem;
        border: 1px solid var(--border);
    }
    
    .side-card::after {
        display: none;
    }
    
    .side-actions {
        position: absolute;
        top: .35rem;
        right: .35rem;
        display: flex;
        gap: .25rem;
        z-index: 2;
    }
    
    .side-actions a {
        width: 22px;
        height: 22px;
        border-radius: 0;
        background: var(--surface-2);
        color: var(--ink);
        text-decoration: none;
        display: grid;
        place-items: center;
        border: 1px solid var(--border);
    }
    
    .side-actions a:hover {
        background: var(--brand-tint);
    }
    
    .side-title {
        font-size: 12px;
        font-weight: 700;
        margin: -.55rem -.65rem .5rem;
        padding: .28rem .5rem;
        background: var(--brand);
        color: #fff;
    }
    
    .donut {
        --v: 0%;
        width: 140px;
        height: 140px;
        border-radius: 50%;
        margin: .7rem auto .2rem;
        display: grid;
        place-items: center;
        background:
            radial-gradient(closest-side, #fff 79%, transparent 80%),
            conic-gradient(var(--brand) var(--v), #d6d3c4 0);
    }
    
    .donut .pct {
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--topbar-1);
    }
    
    .donut .cap {
        font-size: 11px;
        opacity: .8;
        color: var(--muted);
    }
    
    .side-foot {
        display: flex;
        margin-top: .6rem;
        border-top: 1px solid var(--border);
        padding-top: .5rem;
    }
    
    .side-foot>div {
        flex: 1;
        text-align: center;
    }
    
    .side-foot>div+div {
        border-left: 1px solid var(--border);
    }
    
    .side-foot small {
        opacity: .8;
        font-size: 10.5px;
        color: var(--muted);
    }
    
    .side-foot .v {
        font-size: 13px;
        font-weight: 700;
        margin-top: .1rem;
    }
    
    /* ===== Bar chart : Produits vs Charges ========================== */
    .chart {
        display: flex;
        gap: .9rem;
        margin-top: 1.4rem;
    }
    
    .chart-y {
        display: flex;
        flex-direction: column-reverse;
        justify-content: space-between;
        height: 240px;
        padding-bottom: 22px;
        min-width: 34px;
        text-align: right;
        font-size: .68rem;
        color: var(--muted);
    }
    
    .chart-plot {
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
        height: 240px;
        overflow: hidden;
    }
    
    .chart-lines {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 22px;
        display: flex;
        flex-direction: column-reverse;
        justify-content: space-between;
    }
    
    .chart-lines span {
        border-top: 1px dashed var(--border-strong);
    }
    
    .barchart {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: flex-end;
        gap: .35rem;
    }
    
    .bc-col {
        position: relative;
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        height: 100%;
    }
    
    .bc-bars {
        flex: 1 1 auto;
        width: 100%;
        display: flex;
        align-items: flex-end;
        justify-content: center;
        gap: 5px;
        padding-bottom: 22px;
    }
    
    .bc-bar {
        width: 42%;
        max-width: 15px;
        height: 0;
        border-radius: 5px 5px 0 0;
        transition: height .7s cubic-bezier(.22, 1, .36, 1);
    }
    
    .bc-bar.pos {
        background: linear-gradient(180deg, #18b681, #0f9d6b);
    }
    
    .bc-bar.neg {
        background: linear-gradient(180deg, #f4696e, #e5484d);
    }
    
    .bc-label {
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        font-size: .7rem;
        color: var(--muted);
        white-space: nowrap;
    }
    
    .bc-tip {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translate(-50%, -4px);
        background: var(--ink);
        color: #fff;
        font-size: .68rem;
        line-height: 1.4;
        padding: .4rem .55rem;
        border-radius: 8px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity .14s;
        z-index: 3;
    }
    
    .bc-tip b {
        font-weight: 700;
    }
    
    .bc-col:hover .bc-tip {
        opacity: 1;
    }
    
    .bc-col:hover .bc-bar {
        filter: brightness(1.06);
    }
    
    .legend {
        display: flex;
        gap: 1.4rem;
        margin-top: 1rem;
        font-size: .8rem;
        color: var(--ink-soft);
    }
    
    .legend i {
        width: 12px;
        height: 12px;
        border-radius: 4px;
        display: inline-block;
        vertical-align: -1px;
        margin-right: .4rem;
    }
    
    /* ===== Data table (grille Mozaiss) ============================ */
    .tbl {
        width: 100%;
        font-size: 12px;
        border-collapse: collapse;
        border-spacing: 0;
    }
    
    .tbl th {
        text-align: left;
        font-weight: 700;
        color: #fff;
        font-size: 11px;
        text-transform: none;
        letter-spacing: 0;
        padding: .22rem .4rem;
        background: var(--brand);
        border: 1px solid var(--brand-ink);
    }
    
    .tbl td {
        padding: .18rem .4rem;
        border: 1px solid var(--border);
        background: #fff;
    }
    
    .tbl tbody tr {
        transition: none;
    }
    
    .tbl tbody tr:nth-child(even) td {
        background: var(--surface-2);
    }
    
    .tbl tbody tr:hover td {
        background: var(--brand-tint);
    }
    
    .tbl .r {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }
    
    .tbl .c {
        text-align: center;
    }
    
    .pill {
        display: inline-block;
        padding: .05rem .28rem;
        border-radius: 0;
        font-size: 10.5px;
        font-weight: 700;
        white-space: nowrap;
        border: 1px solid currentColor;
    }
    
    .pill.ok,
    .pill.pos {
        background: var(--pos-tint);
        color: var(--pos);
    }
    
    .pill.late,
    .pill.neg {
        background: var(--neg-tint);
        color: var(--neg);
    }
    
    .pill.sent,
    .pill.info {
        background: var(--info-tint);
        color: var(--info);
    }
    
    .pill.warn {
        background: var(--warn-tint);
        color: var(--warn);
    }
    
    .pill.draft,
    .pill.muted {
        background: #eef0f4;
        color: var(--muted);
    }
    
    /* ===== List rows (mini) ===================================== */
    .list-row {
        display: flex;
        align-items: center;
        gap: .8rem;
        padding: .72rem 0;
        border-bottom: 1px solid var(--border);
        font-size: .87rem;
    }
    
    .list-row:last-child {
        border-bottom: 0;
    }
    
    .list-row .grow {
        flex: 1 1 auto;
        min-width: 0;
    }
    
    .list-row .track {
        height: 6px;
        border-radius: 3px;
        background: #eef0f5;
        margin-top: .4rem;
        overflow: hidden;
    }
    
    .list-row .track span {
        display: block;
        height: 100%;
        border-radius: 3px;
        background: var(--brand);
    }
    
    .list-row small {
        color: var(--muted);
        font-size: .76rem;
    }
    
    .amt-pos,
    .amt-neg {
        font-weight: 700;
        white-space: nowrap;
        font-size: .82rem;
    }
    
    .amt-pos {
        color: var(--pos);
    }
    
    .amt-neg {
        color: var(--neg);
    }
    
    /* ==========================================================================
           COMPOSANT : page liste  (partials/list_page.php)
           ========================================================================== */
    .tabs {
        display: flex;
        gap: 0;
        flex-wrap: wrap;
        border-bottom: 1px solid var(--border);
        margin-bottom: .45rem;
    }
    
    .tabs a {
        padding: .22rem .55rem;
        font-size: 12px;
        font-weight: 600;
        color: #2a2a2a;
        text-decoration: none;
        border: 1px solid var(--border);
        border-bottom: 0;
        margin: 0 2px -1px 0;
        background: var(--surface-2);
        display: inline-flex;
        align-items: center;
        gap: .3rem;
        border-radius: 2px 2px 0 0;
    }
    
    .tabs a:hover {
        color: #000;
        background: var(--surface-2);
    }
    
    .tabs a.active {
        color: var(--topbar-1);
        background: #fff;
        border-bottom: 1px solid #fff;
    }
    
    .tabs a .cnt {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 0;
        padding: 0 .28rem;
        font-size: 10px;
        font-weight: 700;
    }
    
    .tabs a.active .cnt {
        background: var(--brand-tint);
        border-color: var(--brand);
        color: var(--topbar-1);
    }
    
    .toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: .3rem;
        align-items: center;
        margin-bottom: .4rem;
        background: var(--surface-2);
        border: 1px solid var(--border);
        padding: .3rem .4rem;
    }
    
    .toolbar .field.search {
        flex: 1 1 200px;
        max-width: 280px;
    }
    
    .toolbar .field.search input,
    .toolbar select {
        border: 1px solid var(--border);
        background: #fff;
        border-radius: 0;
        padding: .18rem .4rem;
        font-size: 12px;
        font-weight: 500;
        color: var(--ink);
    }
    
    .bulkbar {
        display: none;
        align-items: center;
        gap: .45rem;
        flex-wrap: wrap;
        background: var(--brand-tint);
        border: 1px solid var(--brand);
        border-radius: 0;
        padding: .28rem .45rem;
        margin-bottom: .35rem;
        font-size: 12px;
        font-weight: 600;
        color: var(--topbar-1);
    }
    
    .card-table {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 0;
        box-shadow: none;
        overflow: auto;
    }
    
    .card-table .tbl th {
        background: var(--brand);
        color: #fff;
        padding: .22rem .4rem;
        border: 1px solid var(--brand-ink);
        position: sticky;
        top: 0;
        z-index: 1;
    }
    
    .card-table .tbl td {
        padding: .18rem .4rem;
        border: 1px solid var(--border);
    }
    
    .card-table .tbl tbody tr:last-child td {
        border-bottom: 1px solid var(--border);
    }
    
    .card-table .tbl tbody tr.clickable:hover td {
        background: var(--brand-tint);
    }
    
    .card-table .tbl tbody tr.sel td {
        background: #c5d8f0;
        box-shadow: none;
    }
    
    .icon-btn {
        width: 28px;
        height: 28px;
        border: 1px solid var(--border-strong);
        border-radius: 8px;
        background: var(--surface);
        color: var(--ink);
        display: inline-grid;
        place-items: center;
        cursor: pointer;
    }
    
    .icon-btn:hover {
        background: var(--brand-tint);
        color: var(--brand-ink);
        border-color: var(--brand);
    }

    
    .ec-ins-btn {
        margin-right: .4rem;
        width: 23px;
        height: 23px;
        border: none;
        border-radius: 8px;
        background: #eef1f6;
        color: #97a1b0;
        box-shadow: none;
        transition: background .16s cubic-bezier(.34, 1.4, .64, 1), color .16s ease,
            transform .16s cubic-bezier(.34, 1.4, .64, 1), box-shadow .16s ease, opacity .16s ease;
    }

    .ec-ins-btn svg {
        stroke-width: 2.4;
    }

    tr:not(:hover) .ec-ins-btn {
        opacity: .5;
    }

    tr:hover .ec-ins-btn,
    .ec-ins-btn:hover,
    .ec-ins-btn:focus-visible {
        opacity: 1;
        background: var(--brand);
        color: #fff;
        transform: scale(1.14) rotate(90deg);
        box-shadow: 0 3px 8px rgba(49, 106, 197, .4);
    }

    .ec-ins-btn:active {
        transform: scale(.92) rotate(90deg);
        box-shadow: 0 1px 2px rgba(49, 106, 197, .4);
    }

    .ec-ins-btn:focus-visible {
        outline: 2px solid #7ba3e8;
        outline-offset: 2px;
    }

    #ecAddStart.ec-ins-btn {
        opacity: 1;
        background: var(--brand);
        color: #fff;
        box-shadow: 0 1px 4px rgba(49, 106, 197, .45);
        animation: ec-pulse 2.4s ease-in-out infinite;
    }

    #ecAddStart.ec-ins-btn:hover {
        background: var(--brand-ink);
        transform: scale(1.14) rotate(90deg);
        animation: none;
    }

    @keyframes ec-pulse {
        0%, 100% { box-shadow: 0 1px 4px rgba(49, 106, 197, .45); }
        50% { box-shadow: 0 1px 4px rgba(49, 106, 197, .45), 0 0 0 4px rgba(49, 106, 197, .12); }
    }

   
    @keyframes ec-row-in {
        from { opacity: 0; transform: translateY(-4px); background-color: #eaf1fd; }
        to   { opacity: 1; transform: translateY(0); }
    }

    tr.ec-row-in {
        animation: ec-row-in .32s ease-out;
    }
    
    .pagination2 {
        margin-top: .4rem;
        font-size: 11px;
    }
    
    .pagination2 .pages a {
        min-width: 24px;
        height: 22px;
        border: 1px solid var(--border);
        border-radius: 0;
        background: var(--surface-2);
        color: var(--ink);
        font-size: 11px;
    }
    
    .pagination2 .pages a.active {
        background: var(--brand);
        color: #fff;
        border-color: var(--brand-ink);
        box-shadow: none;
    }
    
    .fab {
        position: fixed;
        right: 12px;
        bottom: 34px;
        width: 28px;
        height: 28px;
        border-radius: 0;
        border: 1px solid var(--brand-ink);
        background: var(--brand);
        color: #fff;
        display: grid;
        place-items: center;
        cursor: pointer;
        box-shadow: none;
        z-index: 1030;
    }
    
    .fab:hover {
        transform: none;
        box-shadow: none;
        background: var(--brand-ink);
    }
    
    .fab svg {
        width: 14px;
        height: 14px;
    }

    .account-tools {
        grid-column: 1;
        grid-row: 3;
        position: sticky;
        top: 150px;
        display: flex;
        flex-direction: column;
        gap: .25rem;
        width: auto;
        min-width: 0;
        max-height: calc(100vh - 162px);
        overflow-y: auto;
        z-index: 20;
        padding: .8rem .55rem;
        border-right: 1px solid var(--border);
        box-shadow: 2px 0 12px rgba(16, 24, 40, .06);
    }

    .account-tools__label {
        display: flex;
        align-items: center;
        min-height: 32px;
        margin-bottom: .35rem;
        padding: 0 .55rem .45rem;
        border-bottom: 1px solid var(--border);
        color: var(--muted);
        font-size: .66rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .account-tools__button {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: .65rem;
        width: 100%;
        min-height: 46px;
        padding: .4rem .55rem;
        border-left: 3px solid transparent;
        border-radius: 6px;
        background: transparent;
        color: var(--ink);
        text-align: left;
        text-decoration: none;
        cursor: pointer;
        transition: background-color .14s ease, border-color .14s ease, color .14s ease;
    }

    .account-tools__button--entries {
        text-decoration: none;
    }

    .account-tools__button span {
        min-width: 0;
        font-size: .76rem;
        font-weight: 700;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .account-tools__button svg {
        flex: 0 0 28px;
        width: 34px;
        height: 34px;
        padding: 6px;
        border-radius: 7px;
        background: var(--brand-tint);
        color: var(--brand);
    }

    .account-tools__button:hover,
    .account-tools__button:focus-visible {
        border-color: var(--brand-tint);
        border-left-color: var(--brand);
        background: var(--surface);
        color: var(--brand-ink);
    }

    .account-tools__button:focus-visible {
        outline: 2px solid var(--brand);
        outline-offset: 2px;
    }

    @media (max-width: 767.98px) {
        #app {
            grid-template-columns: 60px minmax(0, 1fr);
            column-gap: .5rem;
        }

        .account-tools {
            align-items: center;
            gap: .4rem;
            top: 210px;
            max-height: calc(100vh - 222px);
            padding: .65rem .25rem;
        }

        .account-tools__label,
        .account-tools__button span {
            display: none;
        }

        .account-tools__button {
            justify-content: center;
            min-height: 50px;
            padding: .35rem;
            border-radius: 8px;
        }

        .account-tools__button svg {
            width: 30px;
            height: 30px;
            padding: 5px;
        }
    }

    @media (max-width: 400px) {
        .account-tools {
            top: 230px;
            max-height: calc(100vh - 242px);
        }
    }

    .toolbar .field {
        position: relative;
        flex: 0 0 auto;
    }
    
    .toolbar .field.search svg {
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 13px;
        height: 13px;
        color: var(--muted);
    }
    
    .toolbar .field.search input {
        padding-left: 1.7rem;
        width: 100%;
    }
    
    .toolbar .spacer {
        flex: 1 1 auto;
    }
    
    .bulkbar.show {
        display: flex;
    }
    
    .chk {
        width: 13px;
        height: 13px;
        accent-color: var(--brand);
        cursor: pointer;
    }
    
    .col-chk {
        width: 28px;
        text-align: center;
    }
    
    .rowlink {
        color: var(--topbar-1);
        font-weight: 700;
        text-decoration: none;
    }
    
    tr:hover .rowlink {
        color: var(--brand-ink);
        text-decoration: underline;
    }
    
    .sub-cell {
        color: var(--muted);
        font-size: 10.5px;
        margin-top: 0;
    }
    
    .muted-cell {
        color: var(--muted);
    }
    
    .strong-cell {
        font-weight: 700;
    }
    
    .row-acts {
        display: flex;
        gap: .15rem;
        justify-content: flex-end;
    }
    
    .card-table .tbl tbody tr.clickable {
        cursor: pointer;
    }
    
    .pagination2 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .5rem;
        flex-wrap: wrap;
        color: var(--muted);
    }
    
    .pagination2 .pages {
        display: flex;
        gap: 2px;
    }
    
    .pagination2 .pages a {
        display: inline-grid;
        place-items: center;
        text-decoration: none;
        font-weight: 600;
    }
    
    .pagination2 .pages a.disabled {
        opacity: .4;
        pointer-events: none;
    }
    
    .pagination2 .pages a svg {
        width: 12px;
        height: 12px;
    }
    
    .pagination2 .pages a.prev svg {
        transform: rotate(180deg);
    }
    
    .empty {
        text-align: center;
        padding: 2rem 1rem;
        color: var(--muted);
    }
    
    .empty svg {
        width: 28px;
        height: 28px;
        opacity: .4;
        margin-bottom: .4rem;
    }
    
    /* ===== Responsive ============================================= */
    @media (max-width: 1199.98px) {
    
        .kpi-grid,
        .kpi-grid.cols-4 {
            grid-template-columns: repeat(3, 1fr);
        }
    
        .kpi-grid.cols-3 {
            grid-template-columns: repeat(3, 1fr);
        }
    }
    
    @media (max-width: 767.98px) {
    
        .kpi-grid,
        .kpi-grid.cols-2,
        .kpi-grid.cols-3,
        .kpi-grid.cols-4 {
            grid-template-columns: repeat(2, 1fr);
            gap: .75rem;
        }
    
        .kpi-value {
            font-size: 1.25rem;
        }
    
        .chart-y {
            display: none;
        }
    
        .searchbox {
            order: 3;
            max-width: none;
            flex: 1 1 100%;
        }
    
        .search-kbd,
        .user-meta,
        .dossier-ex {
            display: none;
        }
    
        .dossier {
            max-width: none;
            padding: .28rem .5rem;
        }
    
        .topnav {
            margin: 0;
            padding: 0 .4rem;
        }
    
        .nav-btn {
            font-size: .8rem;
            padding: .5rem .55rem;
        }
    
        .toolbar-ribbon {
            padding: .28rem .35rem;
            overflow-x: auto;
            flex-wrap: nowrap;
            -webkit-overflow-scrolling: touch;
        }
    
        .tb-lbl {
            display: none;
        }
    
        .tb-btn {
            min-width: 40px;
            padding: .28rem .3rem;
        }
    
        .wrap {
            padding: 1.2rem .8rem 5rem;
        }
    
        .barchart {
            gap: .2rem;
        }
    
        .nav-dd {
            position: static;
        }
    
        .nav-menu,
        .nav-menu.simple,
        .nav-menu.mega {
            left: .8rem;
            right: .8rem;
            width: auto;
            max-width: none;
            column-count: 1;
            max-height: 60vh;
            overflow-y: auto;
        }
    
        .nav-menu.flip {
            left: .8rem;
            right: .8rem;
        }

        .nav-menu.nav-submenu,
        .nav-menu.nav-submenu.flip {
            position: static;
            left: auto;
            right: auto;
            width: auto;
            min-width: 0;
            max-width: none;
            max-height: none;
            overflow: visible;
            margin: .1rem 0 .1rem 1rem;
            border-width: 0 0 0 2px;
            border-left-color: var(--border);
            box-shadow: none;
        }

        .nav-sub:hover>.nav-submenu {
            display: none;
        }

        .nav-sub.open>.nav-submenu {
            display: block;
        }

        .nav-sub-toggle {
            padding: .55rem .5rem;
        }

        .card-table {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }
    
        .card-table .tbl {
            min-width: 820px;
        }
    
        .card-table .tbl td,
        .card-table .tbl th {
            white-space: nowrap;
        }
    
        .card-table .sub-cell {
            white-space: normal;
        }
    }
    
    @media (max-width: 400px) {
    
        .kpi-grid,
        .kpi-grid.cols-2,
        .kpi-grid.cols-3,
        .kpi-grid.cols-4 {
            grid-template-columns: 1fr;
        }
    }
    
    
    .ec-filter {
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 0;
        box-shadow: none;
        padding: .4rem .5rem;
        margin-bottom: .45rem;
        display: flex;
        flex-wrap: wrap;
        gap: .45rem 1rem;
        align-items: flex-end;
    }
    
    .ec-group {
        display: flex;
        flex-direction: column;
        gap: .2rem;
        padding: .1rem .6rem .1rem 0;
    }
    
    .ec-group+.ec-group {
        border-left: 1px solid var(--border);
        padding-left: .8rem;
    }
    
    .ec-legend {
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--topbar-1);
    }
    
    .ec-line {
        display: flex;
        align-items: center;
        gap: .3rem;
        flex-wrap: wrap;
    }
    
    .ec-line label {
        font-size: 11px;
        font-weight: 700;
        color: var(--ink-soft);
    }
    
    .ec-input,
    .ec-select {
        border: 1px solid var(--border);
        background: #fff;
        border-radius: 0;
        padding: .15rem .35rem;
        font-size: 12px;
        color: var(--ink);
        font-weight: 500;
        font-family: inherit;
    }
    
    .ec-select {
        min-width: 180px;
        font-weight: 600;
        color: var(--ink-soft);
    }
    
    
    tr.ec-acct td {
        background: var(--brand);
        color: #fff;
        font-weight: 700;
        font-size: 11px;
        border-color: var(--brand-ink);
    }
    
    tr.ec-ran td {
        color: var(--muted);
        font-style: italic;
        background: var(--surface-2);
    }
    
    tr.ec-sub td {
        background: var(--surface-2);
        font-weight: 700;
        border-color: var(--border);
    }
    
    tr.ec-tot td {
        background: var(--topbar-1);
        color: #fff;
        font-weight: 700;
        border-color: var(--topbar-1);
    }
    
    .ec-eq {
        display: flex;
        flex-wrap: wrap;
        gap: .8rem;
        align-items: center;
        margin-top: .4rem;
        padding: .35rem .5rem;
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 0;
        box-shadow: none;
    }
    
    .act-card {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 0;
        padding: .55rem .65rem;
        text-decoration: none;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        gap: .15rem;
        transition: none;
    }
    
    .act-card:hover {
        transform: none;
        box-shadow: none;
        border-color: var(--brand);
        background: var(--surface-2);
    }
    
    .act-ic {
        width: 24px;
        height: 24px;
        border-radius: 0;
        display: grid;
        place-items: center;
        color: var(--brand);
        margin-bottom: .15rem;
    }
    
    .form-panel {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 0;
        box-shadow: none;
        padding: .55rem .7rem;
        margin-bottom: .45rem;
    }
    
    .form-panel h3 {
        font-size: 12px;
        font-weight: 700;
        margin: -.55rem -.7rem .55rem;
        padding: .28rem .5rem;
        background: var(--brand);
        color: #fff;
    }
    
    .form-field input,
    .form-field select,
    .form-field textarea {
        border: 1px solid var(--border);
        background: #fff;
        border-radius: 0;
        padding: .18rem .4rem;
        font-size: 12px;
        color: var(--ink);
        font-family: inherit;
    }
    
    .gm-head {
        background: linear-gradient(180deg, var(--topbar-2), var(--topbar-1));
        color: #fff;
        border-bottom: 1px solid var(--topbar-1);
        padding: .28rem .45rem;
    }
    
    .gm-head h3 {
        color: #131212;
        font-size: 12px;
    }
    
    .gm-head h3 svg {
        color: #050505;
        opacity: 1;
    }
    
    .gm-head .gm-close {
        color: #111010;
        border-radius: 8px;
    }

    .gm-head .gm-close:hover {
        background: #c00000;
        color: #fff;
    }
    
    .gm {
        border-radius: 0;
        border: 1px solid var(--topbar-1);
    }
    
    .gm-foot {
        background: var(--surface-2);
    }
    
    .ec-group {
        display: flex;
        flex-direction: column;
        gap: .5rem;
        padding: .1rem .9rem .1rem 0;
    }
    
    .ec-group+.ec-group {
        border-left: 1px solid var(--border);
        padding-left: 1.3rem;
    }
    
    .ec-legend {
        font-size: .66rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .07em;
        color: var(--muted);
    }
    
    .ec-line {
        display: flex;
        align-items: center;
        gap: .5rem;
        flex-wrap: wrap;
    }
    
    .ec-line label {
        font-size: .78rem;
        font-weight: 700;
        color: var(--ink-soft);
    }
    
    .ec-input,
    .ec-select {
        border: 1px solid var(--border-strong);
        background: var(--surface);
        border-radius: 9px;
        padding: .46rem .62rem;
        font-size: .82rem;
        color: var(--ink);
        font-weight: 500;
        font-family: inherit;
        transition: border-color .13s, box-shadow .13s;
    }
    
    .ec-select {
        min-width: 200px;
        font-weight: 600;
        color: var(--ink-soft);
    }
    
    .ec-input[type="date"] {
        min-width: 150px;
    }
    
    .ec-spacer {
        flex: 1 1 auto;
    }
    
    .ec-icon-btn {
        width: 34px;
        height: 34px;
        flex-shrink: 0;
        border: 1px solid var(--border-strong);
        border-radius: 8px;
        background: var(--surface);
        color: var(--ink);
        display: inline-grid;
        place-items: center;
        cursor: pointer;
    }
    
    .ec-icon-btn:hover {
        background: var(--brand-tint);
        color: var(--brand-ink);
        border-color: var(--brand);
    }
    
    .ec-icon-btn svg {
        width: 15px;
        height: 15px;
    }
    
    .ec-search {
        position: relative;
    }
    
    .ec-search svg {
        position: absolute;
        left: 11px;
        top: 50%;
        transform: translateY(-50%);
        width: 15px;
        height: 15px;
        color: var(--muted);
        pointer-events: none;
    }
    
    .ec-search input {
        padding-left: 2rem;
        min-width: 210px;
    }
    
    .ec-count {
        font-size: .8rem;
        color: var(--muted);
        white-space: nowrap;
    }
    
    .ec-count b {
        color: var(--brand-ink);
        font-variant-numeric: tabular-nums;
    }
    
    .ec-table .tbl {
        font-size: .82rem;
    }
    
    .ec-table .tbl th {
        padding: .7rem .7rem .6rem;
    }
    
    .ec-table .tbl td {
        padding: .5rem .7rem;
    }
    
    .ec-table .tbl td.num,
    .ec-table .tbl th.r,
    .ec-table .tbl td.r {
        font-variant-numeric: tabular-nums;
    }
    
    .ec-muted {
        color: var(--muted);
    }
    
    tr.ec-acct td {
        background: var(--brand-tint);
        color: var(--brand-ink);
        font-weight: 800;
        font-size: .78rem;
        border-top: 1px solid #cdd3fb;
    }
    
    tr.ec-ran td {
        color: var(--muted);
        font-style: italic;
        background: var(--surface-2);
    }
    
    tr.ec-sub td {
        background: var(--surface-2);
        font-weight: 700;
        border-top: 1px solid var(--border-strong);
    }
    
    tr.ec-tot td {
        background: var(--ink);
        color: #fff;
        font-weight: 800;
        border-top: 0;
    }
    
    tr.ec-tot td .num,
    tr.ec-tot td .amt-pos,
    tr.ec-tot td .amt-neg {
        color: #fff;
    }
    
    .ec-letter {
        display: inline-grid;
        place-items: center;
        width: 20px;
        height: 20px;
        border-radius: 6px;
        background: var(--pos-tint);
        color: var(--pos);
        font-size: .7rem;
        font-weight: 800;
    }
    
    .ec-eq {
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        align-items: center;
        margin-top: 1rem;
        padding: .9rem 1.15rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-sm);
    }
    
    .ec-eq .ec-eq-cell {
        font-size: .76rem;
        color: var(--muted);
    }
    
    .ec-eq .ec-eq-cell b {
        display: block;
        margin-top: .15rem;
        font-size: 1.05rem;
        color: var(--ink);
        font-variant-numeric: tabular-nums;
        font-weight: 750;
    }
    
    .ec-summary {
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        padding: .5rem .2rem 0;
        font-size: .84rem;
    }
    
    .ec-summary>span {
        color: var(--muted);
    }
    
    .ec-summary>span b {
        color: var(--ink);
        font-variant-numeric: tabular-nums;
        margin-left: .3rem;
    }
    
    .act-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        gap: 1rem;
        margin-top: .4rem;
    }
    
    .act-card {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 1.1rem;
        text-decoration: none;
        box-shadow: var(--shadow-sm);
        display: flex;
        flex-direction: column;
        gap: .3rem;
        transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
    }
    
    .act-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow);
        border-color: #cdd3fb;
    }
    
    .act-ic {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        display: grid;
        place-items: center;
        color: var(--brand);
        margin-bottom: .35rem;
    }
    
    .act-ic svg {
        width: 19px;
        height: 19px;
    }
    
    .act-t {
        font-weight: 700;
        font-size: .9rem;
        color: var(--ink);
    }
    
    .act-d {
        font-size: .8rem;
        color: var(--muted);
        line-height: 1.45;
    }
    
    /* Formulaire de parametres / declaration */
    .form-panel {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
        padding: 1.4rem 1.5rem;
        margin-bottom: 1.1rem;
    }
    
    .form-panel h3 {
        font-size: .98rem;
        font-weight: 700;
        margin: 0 0 1rem;
    }
    
    .form-row {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        margin-bottom: .9rem;
    }
    
    .form-field {
        display: flex;
        flex-direction: column;
        gap: .35rem;
        flex: 1 1 240px;
    }
    
    .form-field label {
        font-size: .76rem;
        font-weight: 700;
        color: var(--ink-soft);
    }

    .req {
        color: var(--neg);
        margin-left: .1rem;
    }
    
    .form-field input,
    .form-field select,
    .form-field textarea {
        border: 1px solid var(--border-strong);
        background: var(--surface);
        border-radius: 9px;
        padding: .5rem .7rem;
        font-size: .85rem;
        color: var(--ink);
        font-family: inherit;
        transition: border-color .13s, box-shadow .13s;
    }
    
    @media (max-width: 767.98px) {
        .ec-group+.ec-group {
            border-left: 0;
            padding-left: 0;
        }
    
        .ec-table {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }
    
        .ec-table .tbl {
            min-width: 860px;
        }
    
        .statusbar .sb-item b,
        .statusbar .sb-muted {
            display: none;
        }
    
        .user-chip {
            padding: 0;
            background: transparent;
            height: auto;
        }
    
        .user-chip .chev {
            display: none;
        }
    }
    
    .statusbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 35;
        display: flex;
        align-items: center;
        gap: .55rem;
        flex-wrap: nowrap;
        height: 26px;
        padding: 0 .35rem;
        background: #ececec;
        color: #2a3140;
        font-size: .72rem;
        font-weight: 550;
        border-top: 1px solid #b8bdc6;
        box-shadow: inset 0 1px 0 #fff;
        overflow: hidden;
    }
    
    .statusbar svg {
        width: 12px;
        height: 12px;
        opacity: .75;
        flex-shrink: 0;
    }
    
    .sb-item {
        display: inline-flex;
        align-items: center;
        gap: .35rem;
        white-space: nowrap;
        border: 1px solid #c5cad3;
        background: #f7f7f7;
        padding: 0 .45rem;
        height: 18px;
        box-shadow: inset 1px 1px 0 #fff;
    }
    
    .sb-item b {
        font-weight: 700;
        color: #6b7385;
        text-transform: uppercase;
        letter-spacing: .04em;
        font-size: .62rem;
    }
    
    .sb-sep {
        display: none;
    }
    
    .sb-spacer {
        flex: 1 1 auto;
        background: transparent;
        border: 0;
        box-shadow: none;
    }
    
    .sb-muted {
        opacity: .6;
    }
    
    .sb-ready {
        font-weight: 700;
        min-width: 52px;
    }
    
    .sb-pill {
        background: var(--pos);
        color: #fff;
        border-radius: 2px;
        font-size: .62rem;
        font-weight: 800;
        padding: .05rem .35rem;
        letter-spacing: .02em;
    }
    
    html[data-bs-theme="dark"] {
        color-scheme: dark;
        --bg: #10131a;
        --surface: #181c27;
        --surface-2: #1f2431;
        --border: #2a3142;
        --border-strong: #3a4256;
        --ink: #eef1f7;
        --ink-soft: #c3cad8;
        --muted: #8b95a8;
        --brand-tint: #23264a;
        --pos-tint: #143528;
        --neg-tint: #3a1c1e;
        --warn-tint: #3a2a14;
        --info-tint: #1a2a48;
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .25);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 2px 8px rgba(0, 0, 0, .18);
        --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 26px -8px rgba(0, 0, 0, .4);
        --shadow-lg: 0 14px 40px -10px rgba(0, 0, 0, .5);
        --ring: 0 0 0 3px rgba(129, 140, 248, .28);
    }
    
    html[data-bs-theme="dark"] .searchbox input {
        background: var(--surface);
        color: var(--ink);
    }
    
    html[data-bs-theme="dark"] .search-kbd {
        background: var(--surface-2);
        color: var(--muted);
    }
    
    html[data-bs-theme="dark"] .kpi-delta.flat,
    html[data-bs-theme="dark"] .pill.draft,
    html[data-bs-theme="dark"] .pill.muted {
        background: var(--surface-2);
    }
    
    html[data-bs-theme="dark"] tr.ec-tot td {
        background: #0b0d14;
    }
    
    html[data-bs-theme="dark"] .card-table .tbl tbody tr.sel td {
        background: #23264a;
    }
    
    html[data-bs-theme="dark"] .topnav {
        background: #1c2130;
        border-bottom-color: #2a3142;
    }
    
    html[data-bs-theme="dark"] .nav-btn {
        color: var(--ink-soft);
    }
    
    html[data-bs-theme="dark"] .nav-btn:hover,
    html[data-bs-theme="dark"] .nav-btn.active,
    html[data-bs-theme="dark"] .nav-dd.open>.nav-dd-toggle {
        background: #2a3350;
        border-color: #3d4a6a;
        color: #d6def0;
    }
    
    html[data-bs-theme="dark"] .toolbar-ribbon {
        background: linear-gradient(180deg, #1c2130, #161b26);
        border-bottom-color: #2a3142;
    }
    
    html[data-bs-theme="dark"] .tb-btn {
        color: var(--ink-soft);
    }
    
    html[data-bs-theme="dark"] .tb-ico {
        background: #181c27;
        border-color: #3a4256;
    }
    
    html[data-bs-theme="dark"] .tb-sep {
        background: #3a4256;
        box-shadow: none;
    }
    
    html[data-bs-theme="dark"] .statusbar {
        background: #1c2130;
        color: var(--ink-soft);
        border-top-color: #2a3142;
        box-shadow: none;
    }
    
    html[data-bs-theme="dark"] .sb-item {
        background: #161b26;
        border-color: #2a3142;
        box-shadow: none;
    }
    
    @media print {
        /* === Masquer toute la chrome === */
        .app-chrome,
        .topbar,
        .topnav,
        .toolbar-ribbon,
        .statusbar,
        .fab,
        .page-actions,
        .skip-link,
        .bulkbar,
        .toolbar,
        .tabs,
        .topbar-tools,
        .searchbox,
        .ec-filter,
        .no-dossier-notice,
        .page-head,
        #sidebar,
        .nav-menu,
        .nav-dd,
        .account-tools,
        .ec-summary {
            display: none !important;
        }

        /* === Reset layout === */
        html, body {
            background: #fff !important;
            color: #000 !important;
            padding: 0 !important;
            margin: 0 !important;
            font-size: 11pt !important;
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
        }

        #app {
            display: block !important;
            grid-template-columns: unset !important;
        }

        #main {
            display: block !important;
            width: 100% !important;
            min-width: 0 !important;
            grid-column: unset !important;
            grid-row: unset !important;
        }

        .wrap {
            padding: 0 !important;
            margin: 0 !important;
            max-width: 100% !important;
        }

        .page-content > section.row {
            margin: 0 !important;
        }

        /* === Tables === */
        .panel,
        .card-table,
        .form-panel,
        .ec-filter {
            box-shadow: none !important;
            border: 1px solid #ccc !important;
            border-radius: 0 !important;
        }

        .card-table {
            overflow: visible !important;
        }

        .card-table .tbl th {
            position: static !important;
            background: #1a2744 !important;
            color: #fff !important;
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
        }

        .card-table .tbl {
            min-width: unset !important;
        }

        .card-table .tbl td,
        .card-table .tbl th {
            white-space: normal !important;
        }

        /* Total rows */
        tr.ec-tot td {
            background: #1a2744 !important;
            color: #fff !important;
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
        }

        /* Account rows */
        tr.ec-acct td {
            background: #eff4ff !important;
            color: #1a2744 !important;
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
        }

        /* Subtotal rows */
        tr.ec-sub td {
            background: #f0f2f5 !important;
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
        }

        /* === Links === */
        a {
            color: inherit !important;
            text-decoration: none !important;
        }

        /* === Modals === */
        .gm-backdrop,
        .gm {
            display: none !important;
        }

        /* === KPI cards === */
        .kpi-grid {
            break-inside: avoid;
        }

        .kpi {
            border: 1px solid #ddd !important;
            box-shadow: none !important;
        }

        /* === Action cards === */
        .act-grid {
            break-inside: avoid;
        }

        /* === Form panels === */
        .form-panel {
            break-inside: avoid;
        }

        /* === Page break control === */
        .tbl {
            page-break-inside: avoid;
        }

        h1, h2, h3 {
            page-break-after: avoid;
        }

        /* === Balance specific === */
        .bal-filters {
            display: none !important;
        }

        .bal-kpi-row {
            display: none !important;
        }
    }
    
   
    body.gm-open {
        overflow: hidden;
    }
    
    .gm-backdrop {
        position: fixed;
        inset: 0;
        z-index: 900;
        background: rgba(15, 23, 41, .44);
        animation: gm-fade .12s ease;
    }
    
    @keyframes gm-fade {
        from {
            opacity: 0;
        }
    
        to {
            opacity: 1;
        }
    }
    
    .gm {
        position: fixed;
        z-index: 901;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: min(640px, calc(100vw - 1.6rem));
        max-height: calc(100vh - 2.4rem);
        display: flex;
        flex-direction: column;
        background: var(--surface);
        color: var(--ink);
        border: 1px solid #9aa3b2;
        border-radius: 4px;
        box-shadow: 2px 4px 18px rgba(16, 24, 40, .30);
        animation: gm-pop .14s cubic-bezier(.22, 1, .36, 1);
    }
    
   
    .gm-backdrop--login {
        z-index: 950;
        background: rgba(15, 23, 41, .68);
    }

    .gm-login {
        z-index: 951;
        width: min(380px, calc(100vw - 1.6rem));
    }

    .login-error {
        margin: .6rem 0 0;
        padding: .5rem .7rem;
        border-radius: 4px;
        background: rgba(214, 69, 69, .12);
        color: #c23a3a;
        font-size: .85rem;
    }

    @keyframes gm-pop {
        from {
            opacity: 0;
            transform: translate(-50%, -50%) scale(.97);
        }
    
        to {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }
    
    .gm-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        padding: .7rem .85rem .7rem 1rem;
        border-bottom: 1px solid var(--border);
        background: linear-gradient(180deg, var(--surface), var(--surface-2));
    }
    
    .gm-head h3 {
        margin: 0;
        font-size: .92rem;
        font-weight: 700;
        letter-spacing: -.01em;
        display: flex;
        align-items: center;
        gap: .5rem;
    }
    
    .gm-head h3 svg {
        width: 16px;
        height: 16px;
        opacity: .7;
    }
    
   
    .gm-head .gm-close {
        border: 0;
        background: transparent;
        cursor: pointer;
        color: var(--muted);
        width: 30px;
        height: 30px;
        border-radius: 7px;
        flex-shrink: 0;
        display: grid;
        place-items: center;
        transition: background .12s, color .12s;
    }

    .gm-head .gm-close svg {
        width: 15px;
        height: 15px;
    }

    .gm-head .gm-close:hover {
        background: #eef0f4;
        color: var(--ink);
    }
    
    .gm-body {
        padding: 1.1rem 1.15rem .5rem;
        overflow-y: auto;
    }
    
    .gm-body .form-row {
        gap: .8rem 1rem;
    }
    
    .gm-body .form-field {
        flex: 1 1 220px;
    }
    
    .gm-body .form-field.gm-wide {
        flex-basis: 100%;
    }
    
    .gm-foot {
        display: flex;
        justify-content: flex-end;
        gap: .5rem;
        padding: .75rem 1rem;
        border-top: 1px solid var(--border);
        background: var(--surface-2);
    }

    /* Modale "Journaux" : ligne d'etat (X journaux crees / aucun journal)
       et ligne vide du tableau. */
    .jr-status,
    .pc-status {
        margin: 0 0 .5rem;
        font-size: .82rem;
        font-weight: 600;
        color: var(--muted);
    }

    .jr-status.none,
    .pc-status.none {
        color: #b26b00;
    }

    /* Plan comptable (page + modale du bouton flottant) : lignes de
       classe, rubriques en gras, compteur, defilement du tableau. */
    .tbl tbody tr.pc-class-row td {
        background: #dfe8f8;
        color: var(--brand-ink);
        font-weight: 700;
        padding: .3rem .5rem;
    }

    .tbl tbody tr.pc-rub td.pc-int {
        font-weight: 700;
    }

    .tbl td.pc-empty {
        padding: 1rem .6rem;
        text-align: center;
        color: var(--muted);
    }

    .pc-count {
        padding: .35rem .5rem;
        font-size: .82rem;
        font-weight: 600;
        color: var(--muted);
    }

    .gm.gm-lg {
        width: min(880px, calc(100vw - 1.6rem));
    }

    .toolbar .pc-range {
        display: flex;
        align-items: center;
        gap: .35rem;
        font-size: 12px;
        color: var(--muted);
    }

    .toolbar .pc-range input {
        width: 6.5ch;
        border: 1px solid var(--border);
        background: #fff;
        border-radius: 0;
        padding: .18rem .4rem;
        font-size: 12px;
        font-weight: 500;
        color: var(--ink);
    }

    .pc-scroll {
        max-height: 42vh;
        overflow: auto;
        border: 1px solid var(--border);
    }

    .pc-scroll .tbl th {
        position: sticky;
        top: 0;
        z-index: 1;
    }

   
    .pc-hint {
        margin: .6rem 0 0;
        font-size: .78rem;
        color: var(--muted);
    }

    .pc-hint svg {
        width: 11px;
        height: 11px;
        vertical-align: -1px;
    }

    .pc-hint kbd {
        font-size: .72rem;
        padding: .05rem .3rem;
        border: 1px solid var(--border);
        border-radius: 3px;
        background: var(--surface-2, #f4f2e8);
    }

    .pc-scroll td.r {
        display: flex;
        gap: .3rem;
        justify-content: flex-end;
    }

    .pc-scroll th.r {
        text-align: right;
    }

    .pc-edit-ok,
    .pc-edit-cancel {
        padding: .22rem .35rem;
    }

    .pc-edit-ok svg,
    .pc-edit-cancel svg {
        width: 12px;
        height: 12px;
    }

    tr.pc-newrow {
        background: #fff9db;
    }

    tr.pc-flash td {
        animation: pc-flash 2.4s ease-out;
    }

    @keyframes pc-flash {
        0%, 40% { background: #fff1a8; }
        100% { background: transparent; }
    }

    tr.pc-newrow td {
        padding: .3rem .4rem;
    }

    tr.pc-newrow input[type="text"] {
        width: 100%;
        border: 1px solid var(--border);
        border-radius: 2px;
        padding: .18rem .35rem;
        font-size: 12px;
        font-family: inherit;
        color: var(--ink);
    }

    tr.pc-newrow input[type="text"]:focus {
        outline: 2px solid var(--brand);
        outline-offset: -1px;
    }

    .pc-edit-lettrable {
        display: inline-flex;
        align-items: center;
        gap: .25rem;
        font-size: .75rem;
        color: var(--muted);
        cursor: pointer;
        white-space: nowrap;
    }

    .pc-tag {
        margin-left: .4rem;
        font-size: .68rem;
        font-weight: 700;
        color: #1f7a3d;
    }

    .pc-tag.del {
        color: #b23b3b;
    }

    /* Comptes du plan par defaut supprimes (visibles seulement sur demande). */
    .tbl tbody tr.pc-masque td {
        color: #8a8a8a;
    }

    .tbl tbody tr.pc-masque td.pc-int span:not(.pc-tag) {
        text-decoration: line-through;
    }

    .pc-toggle {
        display: inline-flex;
        align-items: center;
        gap: .3rem;
        margin: 0;
        font-size: 12px;
        font-weight: 500;
        color: var(--muted);
        cursor: pointer;
        white-space: nowrap;
    }

    .pc-toggle input:disabled + span {
        opacity: .55;
    }

    .tbl td.jr-empty {
        padding: 1rem .6rem;
        text-align: center;
        color: var(--muted);
    }

    @media (max-width: 560px) {
        .gm {
            width: calc(100vw - .8rem);
            max-height: calc(100vh - 1rem);
        }
    
        .gm-body .form-field {
            flex-basis: 100%;
        }
    }

.ec-suggest {
    position: fixed;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.16));
    max-height: 320px;
    overflow: hidden;
}
.ec-suggest-results {
    min-height: 0;
    overflow-y: auto;
}
.ec-suggest-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .6rem;
    font-size: .82rem;
    cursor: pointer;
}
.ec-suggest-item .pill { flex: none; min-width: 4.5rem; justify-content: center; }
.ec-suggest-item:hover, .ec-suggest-item.active { background: var(--brand-tint); }
.ec-suggest-create {
    flex: 0 0 auto;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--brand);
    font-weight: 700;
}


.tbl tbody tr.ec-tot td,
.tbl tbody tr.ec-tot:nth-child(even) td,
.tbl tbody tr.ec-tot:hover td {
    background: var(--ink);
    color: #fff;
}
html[data-bs-theme="dark"] .tbl tbody tr.ec-tot td,
html[data-bs-theme="dark"] .tbl tbody tr.ec-tot:nth-child(even) td,
html[data-bs-theme="dark"] .tbl tbody tr.ec-tot:hover td {
    background: #0b0d14;
}

.ec-summary>span {
    color: var(--ink-soft, var(--ink));
    font-weight: 600;
}
.ec-summary>span b {
    font-size: .98rem;
    font-weight: 800;
}

.dashboard-shell .page-head {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    background:
        radial-gradient(circle at 88% 15%, rgba(37, 99, 235, .12), transparent 25%),
        linear-gradient(135deg, var(--surface), var(--surface-2));
    box-shadow: var(--shadow-sm);
}

.dashboard-shell .page-head>div,
.dashboard-shell .page-actions {
    position: relative;
    z-index: 1;
}

.dashboard-shell .page-head h1 {
    gap: .65rem;
    color: var(--ink);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -.025em;
}

.dashboard-shell .page-head h1 .ph-ico {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--brand-tint);
    color: var(--brand);
}

.dashboard-shell .page-head h1 .ph-ico svg {
    width: 19px;
    height: 19px;
}

.dashboard-shell .page-head p {
    margin: .35rem 0 0 3.05rem;
    color: var(--muted);
    font-size: .82rem;
}

.dashboard-shell .page-actions {
    gap: .5rem;
}

.dashboard-shell .mini-select {
    border-radius: 9px;
    padding: .5rem .75rem;
    font-size: .8rem;
}

.dashboard-shell .mini-select {
    background-color: var(--surface);
}

.dashboard-shell .kpi-grid {
    gap: .8rem;
    margin-bottom: 1rem;
}

.dashboard-shell .kpi {
    position: relative;
    overflow: hidden;
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-top: 3px solid var(--kpi-accent, var(--brand));
    border-radius: 14px;
    background: linear-gradient(145deg, var(--surface), var(--surface-2));
    box-shadow: var(--shadow-sm);
    animation: rise .48s both;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.dashboard-shell .kpi:hover {
    transform: translateY(-4px);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.dashboard-shell .kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.dashboard-shell .kpi-icon svg {
    width: 19px;
    height: 19px;
}

.dashboard-shell .kpi-value {
    margin-top: .8rem;
    color: var(--ink);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.025em;
}

.dashboard-shell .kpi-label {
    margin-top: .3rem;
    color: var(--muted);
    font-size: .78rem;
}

.dashboard-shell .kpi-delta {
    margin-top: .65rem;
    padding: .22rem .5rem;
    border-radius: 999px;
    font-size: .7rem;
}

.dashboard-shell .panel,
.dashboard-shell .side-card {
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.dashboard-shell .panel {
    padding: 1rem;
    transition: box-shadow .2s ease, transform .2s ease;
}

.dashboard-shell .panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.dashboard-shell .panel-head {
    margin: -1rem -1rem .9rem;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    border-radius: 15px 15px 0 0;
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    color: var(--ink);
}

.dashboard-shell .panel-title {
    color: var(--ink);
    font-size: .9rem;
    letter-spacing: -.01em;
}

.dashboard-shell .panel-link {
    color: var(--brand);
}

.dashboard-shell .panel-head .mini-select {
    padding: .35rem .55rem;
}

.dashboard-shell .side-card {
    padding: 1rem;
}

.dashboard-shell .side-title {
    margin: -.1rem 0 .6rem;
    padding: .1rem 0 .75rem;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--ink);
    font-size: .9rem;
}

.dashboard-shell .side-actions {
    top: .75rem;
    right: .75rem;
}

.dashboard-shell .side-actions a {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--surface-2);
}

.dashboard-shell .side-actions a:hover {
    color: var(--brand);
    transform: translateY(-1px);
}

.dashboard-shell .donut {
    width: 156px;
    height: 156px;
    margin: .8rem auto .45rem;
    background:
        radial-gradient(closest-side, var(--surface) 78%, transparent 80%),
        conic-gradient(var(--brand) var(--v), var(--border) 0);
    filter: drop-shadow(0 5px 8px rgba(15, 23, 42, .08));
}

.dashboard-shell .donut .pct {
    color: var(--ink);
    font-size: 1.65rem;
    font-weight: 800;
}

.dashboard-shell .donut .cap,
.dashboard-shell .side-foot small {
    color: var(--muted);
}

.dashboard-shell .side-foot {
    margin-top: .75rem;
    padding-top: .65rem;
}

.dashboard-shell .side-foot .v {
    color: var(--ink);
    font-size: .9rem;
}

.dashboard-shell .chart {
    margin-top: .55rem;
}

.dashboard-shell .chart-lines span {
    border-color: var(--border);
}

.dashboard-shell .bc-bar {
    border-radius: 6px 6px 2px 2px;
}

.dashboard-shell .bc-label,
.dashboard-shell .chart-y {
    color: var(--muted);
}

.dashboard-shell .legend {
    margin-top: .65rem;
    color: var(--ink);
}

.dashboard-shell .list-row {
    padding: .85rem 0;
}

.dashboard-empty {
    min-height: 185px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    background: var(--surface-2);
    text-align: center;
}

.dashboard-empty.compact {
    min-height: 160px;
    margin-top: .5rem;
}

.dashboard-empty-icon {
    width: 38px;
    height: 38px;
    margin-bottom: .25rem;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-tint);
    color: var(--brand);
}

.dashboard-empty-icon svg {
    width: 19px;
    height: 19px;
}

.dashboard-empty strong {
    color: var(--ink);
    font-size: .82rem;
}

.dashboard-empty>span:last-child {
    color: var(--muted);
    font-size: .74rem;
}

@media (max-width: 767.98px) {
    .dashboard-shell .page-head {
        align-items: flex-start;
        padding: 1rem;
    }

    .dashboard-shell .page-head h1 {
        font-size: 1.2rem;
    }

    .dashboard-shell .page-head p {
        margin-left: 0;
    }

    .dashboard-shell .page-actions {
        width: 100%;
    }

    .dashboard-shell .kpi {
        padding: .8rem;
    }
}

.account-tools {
    align-self: stretch;
    top: 142px;
    max-height: calc(100vh - 154px);
    gap: .4rem;
    padding: .85rem .65rem;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    box-shadow: 4px 0 18px rgba(16, 24, 40, .045);
    scrollbar-color: var(--border-strong) transparent;
}

.account-tools__label {
    min-height: 36px;
    margin-bottom: .25rem;
    padding: 0 .65rem .55rem;
    color: var(--brand);
    font-size: .68rem;
    letter-spacing: .09em;
}

.account-tools__button {
    position: relative;
    min-height: 48px;
    gap: .65rem;
    padding: .45rem .6rem;
    border-left-width: 3px;
    border-radius: 10px;
    color: var(--ink);
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.account-tools__button span {
    font-size: .78rem;
    font-weight: 650;
}

.account-tools__button svg {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--brand-tint);
    color: var(--brand);
    transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.account-tools__button:nth-of-type(2) svg {
    background: var(--pos-tint);
    color: var(--pos);
}

.account-tools__button:nth-of-type(3) svg {
    background: var(--info-tint);
    color: var(--info);
}

.account-tools__button:nth-of-type(4) svg {
    background: var(--warn-tint);
    color: var(--warn);
}

.account-tools__button:hover,
.account-tools__button:focus-visible {
    border-color: transparent;
    border-left-color: var(--brand);
    background: var(--brand-tint);
    color: var(--ink);
    transform: translateX(2px);
}

.account-tools__button:hover svg,
.account-tools__button:focus-visible svg {
    transform: scale(1.06);
}

.account-tools__button:active {
    transform: translateX(1px) scale(.99);
}

@media (max-width: 767.98px) {
    .account-tools {
        top: 210px;
        max-height: calc(100vh - 222px);
        gap: .55rem;
        padding: .75rem .3rem;
        border-right: 0;
        border-radius: 0 14px 14px 0;
        background: var(--surface);
        box-shadow: 4px 0 18px rgba(16, 24, 40, .08);
    }

    .account-tools__button {
        min-height: 44px;
        border-left: 0;
        border-radius: 12px;
    }

    .account-tools__button:hover,
    .account-tools__button:focus-visible {
        border-left-color: transparent;
        transform: translateY(-1px);
    }
}

@media (max-width: 400px) {
    .account-tools {
        top: 230px;
        max-height: calc(100vh - 242px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .account-tools__button,
    .account-tools__button svg {
        transition: none;
    }
}

.wrap:not(.dashboard-shell)>.page-head {
    margin-bottom: .9rem;
    padding: .8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
    box-shadow: var(--shadow-xs);
}

.wrap:not(.dashboard-shell)>.page-head h1 {
    color: var(--ink);
    font-size: 1.1rem;
    font-weight: 800;
}

.wrap:not(.dashboard-shell)>.page-head h1 .ph-ico {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--brand-tint);
    color: var(--brand);
}

.wrap:not(.dashboard-shell)>.page-head h1 .ph-ico svg {
    width: 17px;
    height: 17px;
}

.wrap:not(.dashboard-shell)>.page-head p {
    margin-top: .2rem;
    font-size: .78rem;
}

.wrap:not(.dashboard-shell)>.page-head .page-actions {
    gap: .45rem;
}

.wrap:not(.dashboard-shell)>.kpi-grid .kpi {
    border-radius: 11px;
    box-shadow: var(--shadow-xs);
    transition: transform .16s ease, box-shadow .16s ease;
}

.wrap:not(.dashboard-shell)>.kpi-grid .kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.wrap:not(.dashboard-shell) .tabs {
    gap: .35rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .65rem;
}

.wrap:not(.dashboard-shell) .tabs a {
    margin: 0 0 -1px;
    padding: .45rem .7rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 9px 9px 0 0;
    background: transparent;
    color: var(--ink-soft);
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.wrap:not(.dashboard-shell) .tabs a:hover {
    background: var(--surface-2);
    color: var(--brand-ink);
}

.wrap:not(.dashboard-shell) .tabs a.active {
    border-color: var(--border);
    border-bottom: 1px solid var(--surface);
    background: var(--surface);
    color: var(--brand-ink);
}

.wrap:not(.dashboard-shell) .tabs a .cnt {
    border-radius: 999px;
    padding: .04rem .4rem;
    background: var(--surface-2);
}

.wrap:not(.dashboard-shell) .toolbar {
    gap: .5rem;
    margin-bottom: .65rem;
    padding: .55rem;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.wrap:not(.dashboard-shell) .toolbar .field.search input,
.wrap:not(.dashboard-shell) .toolbar select {
    min-height: 36px;
    padding: .4rem .6rem;
    border-radius: 8px;
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.wrap:not(.dashboard-shell) .toolbar .field.search input {
    padding-left: 1.8rem;
}

.wrap:not(.dashboard-shell) .toolbar select:focus-visible,
.wrap:not(.dashboard-shell) .toolbar .field.search input:focus-visible {
    border-color: var(--brand);
    box-shadow: var(--ring);
}

.wrap:not(.dashboard-shell) .bulkbar {
    border-radius: 9px;
    padding: .45rem .65rem;
}

.wrap:not(.dashboard-shell) .card-table {
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

.wrap:not(.dashboard-shell) .card-table .tbl th {
    padding: .6rem .7rem;
    border-color: var(--brand-ink);
}

.wrap:not(.dashboard-shell) .card-table .tbl td {
    padding: .55rem .7rem;
    border-right: 0;
    border-left: 0;
}

.wrap:not(.dashboard-shell) .card-table .tbl tbody tr {
    transition: background-color .14s ease;
}

.wrap:not(.dashboard-shell) .card-table .tbl tbody tr:not(.sel):hover td {
    background: var(--brand-tint);
}

.wrap:not(.dashboard-shell) .card-table .tbl tbody tr:last-child td {
    border-bottom: 0;
}

.wrap:not(.dashboard-shell) .card-table .pill {
    padding: .2rem .5rem;
    border: 0;
    border-radius: 999px;
    font-size: .7rem;
}

.wrap:not(.dashboard-shell) .icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.wrap:not(.dashboard-shell) .pagination2 {
    margin-top: .65rem;
}

.wrap:not(.dashboard-shell) .pagination2 .pages {
    gap: .25rem;
}

.wrap:not(.dashboard-shell) .pagination2 .pages a {
    min-width: 30px;
    height: 30px;
    border-radius: 8px;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.wrap:not(.dashboard-shell) .pagination2 .pages a:not(.active):not(.disabled):hover {
    border-color: var(--brand);
    background: var(--brand-tint);
    color: var(--brand-ink);
}

.wrap:not(.dashboard-shell) .form-panel {
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

.wrap:not(.dashboard-shell) .form-panel h3 {
    margin: 0 0 1rem;
    padding: .65rem .8rem;
    border-radius: 8px;
    background: var(--brand-tint);
    color: var(--brand-ink);
    font-size: .88rem;
}

.wrap:not(.dashboard-shell) .form-panel .form-field input,
.wrap:not(.dashboard-shell) .form-panel .form-field select,
.wrap:not(.dashboard-shell) .form-panel .form-field textarea {
    min-height: 38px;
    border-radius: 8px;
}

.wrap:not(.dashboard-shell) .empty {
    padding: 2.5rem 1rem;
}

@media (max-width: 767.98px) {
    .wrap:not(.dashboard-shell)>.page-head {
        align-items: flex-start;
    }

    .wrap:not(.dashboard-shell)>.page-head .page-actions {
        width: 100%;
    }

    .wrap:not(.dashboard-shell) .toolbar .field.search {
        flex-basis: 100%;
        max-width: none;
    }

    .wrap:not(.dashboard-shell) .card-table {
        border-radius: 9px;
    }

    .wrap:not(.dashboard-shell) .card-table .tbl th,
    .wrap:not(.dashboard-shell) .card-table .tbl td {
        padding: .5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wrap:not(.dashboard-shell) .kpi,
    .wrap:not(.dashboard-shell) .tabs a,
    .wrap:not(.dashboard-shell) .toolbar input,
    .wrap:not(.dashboard-shell) .toolbar select,
    .wrap:not(.dashboard-shell) .bulkbar .b-act,
    .wrap:not(.dashboard-shell) .card-table .tbl tbody tr,
    .wrap:not(.dashboard-shell) .icon-btn,
    .wrap:not(.dashboard-shell) .pagination2 .pages a {
        transition: none;
    }
}


/* ===== Responsive : tablette et mobile ================================
   Regles ajoutees en fin de fichier pour l'emporter sur les precedentes. */
.nav-burger { display: none; }

@media (max-width: 991.98px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    img, svg, video, canvas { max-width: 100%; }
    .form-field { min-width: 0; }
    input, select, textarea { max-width: 100%; box-sizing: border-box; }

    /* Tableaux : defilement horizontal dans leur cadre, jamais dans la page. */
    .card-table, .ec-table, .td-table-scroll, .pc-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Barres d'outils : champs et listes pleine largeur. */
    .toolbar { align-items: stretch; }
    .toolbar .field, .toolbar select, .toolbar input[type="search"], .toolbar input[type="text"] {
        max-width: 100%;
    }
    .toolbar select { width: 100%; }
    .toolbar .pc-range { flex-wrap: wrap; width: 100%; }
    .toolbar .pc-range input { flex: 1 1 5rem; min-width: 0; }

    .page-head, .wrap:not(.dashboard-shell) > .page-head { flex-direction: column; align-items: stretch; }
    .page-head .page-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
    .page-head .page-actions > * { flex: 1 1 auto; }

    /* Documents financiers (format A4) : feuille defilable dans son cadre. */
    #bilanWrap, #resultatWrap, #fluxWrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }

    /* Modales. */
    .gm, .gm.gm-lg { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); }
    .gm-body { max-height: calc(100vh - 9rem); }
    .gm-body .form-field { flex-basis: 100%; }
    .emp-form .form-field.emp-narrow { flex: 1 1 100%; }
    .gm-body { overflow-x: hidden; }
    .emp-form, .emp-set, .emp-form .form-row { min-width: 0; max-width: 100%; }
    .emp-form .form-field input, .emp-form .form-field select { width: 100%; }
    .gm-foot { flex-wrap: wrap; }
    .gm-foot > * { flex: 1 1 auto; }

    .emp-tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; }
    .emp-bar { align-items: stretch; }
    .a5-top input { width: 100%; }
}

@media (max-width: 767.98px) {
    /* Navigation : repliee derriere le bouton "menu". */
    .nav-burger {
        display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
        width: 40px; height: 40px; margin-left: auto; padding: 0 10px;
        background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .28); border-radius: 8px;
        cursor: pointer;
    }
    .nav-burger span { display: block; height: 2px; background: #fff; border-radius: 2px; }
    .topnav { display: none; }
    .topnav.nav-open { display: flex; flex-direction: column; flex-wrap: nowrap; max-height: 70vh; overflow-y: auto; }
    .topnav .nav-btn, .topnav .nav-dd { width: 100%; }
    .topnav .nav-btn { justify-content: flex-start; min-height: 44px; }

    /* Cibles tactiles confortables. */
    .btn-solid, .btn-soft, .ec-btn-apply, .ec-btn-manage, .ec-balance-btn, .bal-btn-reset, .bulkbar .b-act { min-height: 40px; }
    input[type="text"], input[type="search"], input[type="date"], input[type="number"], select { min-height: 40px; font-size: 16px; }

    .wrap { padding-left: .6rem; padding-right: .6rem; }
    .kpi-grid, .kpi-grid.cols-2, .kpi-grid.cols-3, .kpi-grid.cols-4 { grid-template-columns: 1fr 1fr; }
    .a5-btns { flex-direction: row; flex-wrap: wrap; flex: none; width: 100%; }
    .a5-btns > * { flex: 1 1 8rem; text-align: center; }
}

@media (max-width: 420px) {
    .kpi-grid, .kpi-grid.cols-2, .kpi-grid.cols-3, .kpi-grid.cols-4 { grid-template-columns: 1fr; }
    .brand em { display: none; }
}

/* Suppression d'un journal (modale globale, voir Scripts.php) */
.icon-btn.jr-delete:hover { color: var(--bad, #c0392b); }
.jr-del-alert { margin: 0 0 .8rem; padding: .6rem .8rem; border-radius: 8px; font-size: .86rem; line-height: 1.45;
    border: 1px solid var(--bad, #c0392b); color: var(--bad, #c0392b); background: rgba(192, 57, 43, .08); }
.jr-del-alert[hidden] { display: none; }
.btn-solid.jr-del-confirm { background: var(--bad, #c0392b); border-color: var(--bad, #c0392b); }

/* Modale "Declaration employeur — Fournisseur / tiers" (Employer-Tiers-Modal.php) : partagee entre pages. */
.emp-form { display: grid; gap: .9rem; }
.emp-note { margin: 0; font-size: .8rem; color: var(--muted); }
.emp-req { color: var(--neg); }
.emp-set { border: 1px solid var(--border); border-radius: 8px; padding: .4rem .9rem .9rem; margin: 0; min-width: 0; }
.emp-set legend { float: none; width: auto; padding: 0 .4rem; margin: 0; font-size: .85rem; font-weight: 700; color: var(--brand); }
.emp-form .form-field { min-width: 0; }
.emp-form .form-field.emp-narrow { flex: 0 0 200px; }
.emp-form select, .emp-form input { max-width: 100%; }
.emp-form .form-field small { display: block; font-size: .74rem; margin-top: .15rem; }
.emp-form .form-field small:empty { display: none; }
.emp-hint { color: var(--muted); }
.emp-err { color: var(--neg); font-weight: 600; }
.emp-form .is-invalid { border-color: var(--neg); box-shadow: 0 0 0 2px rgba(214, 69, 69, .15); }
.emp-ok { color: #1f9d55 !important; font-weight: 600; }
.emp-alert { margin: 0; padding: .5rem .7rem; border-left: 4px solid var(--neg); background: rgba(214, 69, 69, .08); color: var(--neg); font-size: .84rem; border-radius: 4px; }
.emp-context { padding: .5rem .7rem; border-left: 4px solid var(--brand); background: var(--brand-tint); color: var(--ink); font-size: .84rem; border-radius: 4px; }
.emp-context[hidden] { display: none; }

/* ===== Impression : regles communes a toutes les pages ===== */
.print-head { display: none; }
@page { margin: 12mm; }
@media print {
    .print-head {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        margin: 0 0 .6rem;
        padding-bottom: .35rem;
        border-bottom: 2px solid #1a2744;
        font-size: 10pt;
    }
    .print-head b { font-size: 14pt; }
    /* Pages that print their own header */
    body:has(.rp-print-header) .print-head,
    body:has(.ec-print-document) .print-head,
    body:has(.nef-sheet) .print-head,
    body:has(.is-etat) .print-head { display: none !important; }

    /* Messages, toasts and floating widgets never belong on paper */
    #ghoufaToasts, .toast, .toast-container, .modal, .modal-backdrop, .gm-backdrop, .gm, .page-back, .skip-link { display: none !important; }
    /* Content must flow over several pages */
    html, body, #app, #main, .page-content, .wrap { height: auto !important; overflow: visible !important; }
    tr, .kpi, .panel { break-inside: avoid; }
    thead { display: table-header-group; }
}

/* Boutons : finition (relief, survol, appui, focus, etat charge). Aucune taille modifiee ; voir la definition unique plus haut. */
.btn-solid, .btn-soft, .ec-btn-apply, .ec-btn-manage, .ec-balance-btn, .bal-btn-reset, .bulkbar .b-act {
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.btn-solid, .ec-btn-apply {
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0));
    box-shadow: 0 1px 2px rgba(29, 78, 216, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-soft, .ec-btn-manage, .ec-balance-btn, .bal-btn-reset, .bulkbar .b-act {
    box-shadow: var(--shadow-xs);
}
.btn-solid:not(:disabled):hover, .ec-btn-apply:not(:disabled):hover {
    box-shadow: 0 3px 8px rgba(29, 78, 216, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
    transform: translateY(-1px);
}
.btn-soft:not(:disabled):hover, .ec-btn-manage:hover, .ec-balance-btn:not(:disabled):hover, .bal-btn-reset:not(:disabled):hover, .bulkbar .b-act:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.btn-solid:not(:disabled):active, .btn-soft:not(:disabled):active, .ec-btn-apply:not(:disabled):active, .ec-btn-manage:active,
.ec-balance-btn:not(:disabled):active, .bal-btn-reset:not(:disabled):active, .bulkbar .b-act:active {
    transform: translateY(0) scale(.98);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15);
}
.btn-solid:focus-visible, .btn-soft:focus-visible, .ec-btn-apply:focus-visible, .ec-btn-manage:focus-visible,
.ec-balance-btn:focus-visible, .bal-btn-reset:focus-visible, .bulkbar .b-act:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}
.btn-solid:disabled, .btn-soft:disabled, .ec-btn-apply:disabled, .ec-balance-btn:disabled, .bal-btn-reset:disabled {
    box-shadow: none;
    filter: grayscale(.4);
}
/* Variante danger : <button class="btn-solid danger"> ou <button class="btn-soft danger"> */
.btn-solid.danger { background-color: var(--neg); border-color: #b91c1c; box-shadow: 0 1px 2px rgba(185, 28, 28, .35); }
.btn-solid.danger:not(:disabled):hover { background-color: #b91c1c; }
.btn-soft.danger { color: var(--neg); border-color: #f3b4b4; }
.btn-soft.danger:not(:disabled):hover { background: var(--neg-tint); border-color: var(--neg); color: #b91c1c; }
/* Etat charge : ajouter la classe is-loading pendant un appel serveur. */
.btn-solid.is-loading, .btn-soft.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-solid.is-loading svg, .btn-soft.is-loading svg { opacity: 0; }
.btn-solid.is-loading::after, .btn-soft.is-loading::after {
    content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid currentColor; border-color: var(--brand) transparent var(--brand) transparent;
    animation: btn-spin .7s linear infinite;
}
.btn-solid.is-loading::after { border-color: #fff transparent #fff transparent; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .btn-solid, .btn-soft, .ec-btn-apply, .ec-btn-manage, .ec-balance-btn, .bal-btn-reset, .bulkbar .b-act { transition: none; transform: none !important; }
    .btn-solid.is-loading::after, .btn-soft.is-loading::after { animation-duration: 1.6s; }
}
@media print { .btn-solid, .btn-soft { box-shadow: none; } }

/* Alignement des boutons : meme hauteur, meme ligne de base, memes ecarts partout. */
.btn-solid, .btn-soft, .ec-btn-apply, .ec-btn-manage, .ec-balance-btn, .bal-btn-reset, .bulkbar .b-act {
    box-sizing: border-box;
    height: 34px;
    min-height: 34px;
    margin: 0;
    vertical-align: middle;
    font-family: inherit;
}
.page-actions, .irpp-actions, .toolbar .actions, .form-panel .page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}
/* Barre de boutons a droite de la ligne (fin de formulaire, bas de tableau). */
.form-panel > .page-actions, .form-panel > .page-actions:last-child { justify-content: flex-end; margin-top: .6rem; }
/* Bouton place a cote de champs : s'aligne sur le bas des champs, pas sur leur etiquette. */
.ec-filter > .btn-solid, .ec-filter > .btn-soft, .ec-filter > .ec-btn-apply, .ec-filter > .ec-btn-manage,
.form-row > .btn-solid, .form-row > .btn-soft { align-self: flex-end; }
.toolbar > .btn-solid, .toolbar > .btn-soft { align-self: center; }
/* Dans une meme rangee, les boutons ont la meme largeur minimale pour un rendu regulier. */
.page-actions > .btn-solid, .page-actions > .btn-soft { min-width: 7.5rem; }
.btn-solid svg, .btn-soft svg, .ec-btn-apply svg, .ec-btn-manage svg { margin: 0; align-self: center; }
@media (max-width: 767px) {
    .btn-solid, .btn-soft, .ec-btn-apply, .ec-btn-manage, .ec-balance-btn, .bal-btn-reset, .bulkbar .b-act { height: 40px; min-height: 40px; }
    .page-actions > .btn-solid, .page-actions > .btn-soft { min-width: 0; }
}
